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]

Re: semaphore bug??


On Tue, Aug 14, 2001 at 03:21:05PM -0400, Warren Jasper wrote:
> 
> I have written an application that blocks on a semaphore.  When
> an interrupt is generated, the semaphore is released, and the
> program **should** continue.  Here is a snippit:
> 
> /* synchronization semaphore */
> static  cyg_sem_t dma_store_done_sem;
> 
> // I then initialize the semaphore to 0 and register the isr ...
> 
> static cyg_uint32 dma_store_done_isr(cyg_vector_t vector, cyg_addrword_t data, cyg_addrword_t *regs)
> {
>   CYG_WORD32 dspctl;
> 
>   //diag_printf("Entered dma_store_done_isr.  vector = %d Releasing semaphore.\n", vector);
>   cyg_interrupt_acknowledge(vector);
>   /* put the DMA into reset  */
>   HAL_READ_UINT32_MCB(DSPCTL, dspctl);
>   dspctl |= ResetDMA;
>   HAL_WRITE_UINT32_MCB(DSPCTL, dspctl);
>   cyg_semaphore_post(&dma_store_done_sem);

I don't think you can post to a semaphore from an ISR.  You'll
have to run a DSR and do it there.  There's a table in the eCos
Reference Manual (Device Driver Interface to the Kernel) that
shows what functions may be called from an ISR.  About the only
thing you can do is ack/mask/unmask interrupts and run a DSR.

-- 
Grant Edwards
grante@visi.com


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