This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: serial line ISR problem -- again:(


Some points on your code:

1) I don't see how you are 'living without any DSR' based on your posted
code.
2) You're signalling a semaphore in the DSR to kick the thread to print 'c',
so this won't work unless you do as Eric suggests.
3) Why are you reading 8 times into 'ier' (you will end up with the scratch
register in 'ier')? To clear the pending modem interrupt, you only need to
read the modem status register (base + 6).
4) You should be looking at IIR to determine if there is a pending
interrupt. Try something like the following for isr() and dsr():

volatile cyg_uint8 iir;
volatile cyg_uint8 msr;

cyg_uint32 isr(cyg_vector_t vector, cyg_addrword_t data)
{
    /* do the work... */
    c++;

    /* Read interrupt ident. register on UART */
    HAL_READ_UINT8(COM_ADDR + 2, iir);
    /* Read modem status register on UART - will clear interrupt too */
    HAL_READ_UINT8(COM_ADDR + 6, msr);
    cyg_interrupt_acknowledge( vector );
    return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
}

void dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
    /* (iir == 0x00) -> modem interrupt, (msr & 0x88) -> DDCD=1, DCD=1 */
    if ((iir == 0x00) && (msr & 0x88)) {
        cyg_semaphore_post( &data_ready );
    }
}

Robert Cragie, Design Engineer
_______________________________________________________________
Jennic Ltd, Furnival Street, Sheffield, S1 4QT,  UK
http://www.jennic.com  Tel: +44 (0) 114 281 2655
_______________________________________________________________

> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com
> [mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Piotr
> Trojanek
> Sent: 09 September 2003 09:44
> To: ecos-discuss
> Subject: Re: [ECOS] serial line ISR problem -- again:(
>
>
> On Tue, Sep 09, 2003 at 09:46:39AM +0200, Eric Doenges wrote:
> > If you want your DSR to run, I believe you have to
> > return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
> > here. This may be your problem.
>
> no, I was trying to live without any DSR  -- incrementing 'voilatile int'
> in ISR and printing it in 'for(;;) printf(...)' thread. it doesnt work:(
> ISR doesn't run at all.
>
> --
> Piotr Trojanek
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>
>


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]