Structuring Language: Activity Chart Implementation : Interrupt Service Routine Activities : ISR Categories

ISR Categories

The decision of which ISR category to use depends on the content of the functions it runs. According to the OSEK/OS specification, it is not allowed to call any OS API function from ISR category 1. For ISR categories 2 and 3, it is allowed to call some of the OS API functions only within the code section marked by EnterISR()/LeaveISR() calls.

The form of the generated code frame for an ISR depends on the.Structuring Language: Activity chart Implementation category and content. Some examples are shown below.

Example 1:
The code for an ISR category 1 or 2, named ISR0, containing Activities I01 and I02 without controller will be as follows:

ISR (ISR0)

{

cgActivity_I01();

cgActivity_I02();

}

 

 

 

Example 2:
The code for an ISR category 3 function named ISR0, containing Activities I01 and I02 without controller will be as follows:

ISR (ISR0)

{

EnterISR();

cgActivity_I01();

cgActivity_I02();

LeaveISR();

}

 

Example 3:
The code for an ISR category 3 function named ISR1, containing Activities I11 and I12 and a controller named CTRL1 will be as follows:

ISR (ISR1)

{

EnterISR();

do {

cgGlobalFlags &= ~BITSUPERSTEP_ISR1; MicroC 41

TASK/ISR Run Modes

cgActivity_I11();

cgActivity_I12();

cgActivity_CTRL1cnt1();

} while ( (cgGlobalFlags & BITSUPERSTEP_ISR1) != 0);

LeaveISR();

}