[ECOS] semaphore bug??

Grant Edwards grante@visi.com
Tue Aug 14 13:09:00 GMT 2001


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



More information about the Ecos-discuss mailing list