This is the mail archive of the ecos-discuss@sourceware.org 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]

why is it wrong to call cyg_semaphore_post() in ISR???


Hallo all,

I am new to eCos(and also to embedded). The eCos documentation says that ISR should not involve any kernel calls.But I want to know why cyg_semaphore_post() is not allowed in ISR(Interrupt service routine). It doesnt block. and i tried to use it though documentation says we shouldnt. It worked for me with the following code.

cyg_uint32 timer_isr(cyg_vector_t vector,cyg_addrword_t data)
{
 led_toggle();                    //Toggle the LED

isr_counter++; //32 bit ISR counter

cyg_interrupt_acknowledge( vector ); //acknowledge the Interrupt to the processor

cyg_semaphore_post( &intr_occured ); //give the semaphore,so that task waiting for it wakes up

return( CYG_ISR_HANDLED ); // Inform the kernel that ISR is handled
}


I wonder why in eCos,a semaphore cannot be posted in ISR. In VxWorks we can give a semaphore in ISR. Can anybody give me a pointer to documentation or an explanation for this.

Thank you in advance

monica


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


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