It depends on you hwo you design it.
I wrote a own interrupt function for a CAN device.
I used MicroC/OS-2 Event Flags to communicate between interrupt function and the normal program flow.
Interrupt Registration absolute normal
alt_irq_register(CAN_1_IRQ,
NULL,
local_my_avalon_can_advanced_isr);
ISR:
extern "C" // wegen ISR ...... // i use C++
{
static void local_my_avalon_can_advanced_isr
(
void * context, // Dummies - ignore
alt_u32 id // Dummies - ignore
)
{
..... // do something
OSFlagPost(CAN_local_CAN_Event, // event flag group
proc_os_can_flags, // flags according to the result of do something
OS_FLAG_SET,
&proc_u8_error);
}
Function that waits for CAN Stuff:
void class_can_system::my_avalon_can_handler
(
void
)
{
... /// do some init stuff
for(;;)
{
proc_os_can_flags = OSFlagPend(CAN_local_CAN_Event,
L_CAN_ALL_EVENT,
OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME,
L_WAIT_FOR_EVER,
&proc_u8_error);
switch(proc_u8_error)
{
case OS_NO_ERR:
// do normal flag handling
break;
case OS_ERR_PEND_ISR:
..... and other errors - do some error handling
}
}
}
regards
Karsten