From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Edwards To: Warren Jasper Cc: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] semaphore bug?? Date: Tue, 14 Aug 2001 13:09:00 -0000 Message-id: <20010814151106.A13809@visi.com> References: <200108141921.PAA09282@lx10.tx.ncsu.edu> X-SW-Source: 2001-08/msg00490.html 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