BSP_OS_TickISR

Description

BSP_OS_TickISR() is the interrupt service routine (ISR) associated with the tick interrupt and this function can be written either in assembly language or C depending on the toolchain being used (see also Chapter 9, “Interrupt Management”).

Files

os.h/bsp_os_a.asm or bsp_os.c

Prototype

void  BSP_OS_TickISR (void)

Arguments

None

Returned Values

None

Required Configuration

None

Callers

Tick interrupt.

Notes/Warnings

None

Example Usage

The code below indicates how to write BSP_OS_TickISR() if all interrupts vector to a common location, and the interrupt handler simply calls BSP_OS_TickISR(). As indicated, this code can be written completely in C and can be placed in bsp_os.c of the board support package (BSP) and be reused by applications using the same BSP.

          void  BSP_OS_TickISR (void)
          {
              Clear the tick interrupt;
              OSTimeTick();
          }

The pseudo code below shows how to write BSP_OS_TickISR() if each interrupt directly vectors to its own interrupt handler. The code, in this case, would be written in assembly language and placed either in bsp_os_a.asm of the board support package.

          void  BSP_OS_TickISR (void)
          {
              Save all the CPU registers onto the current task's stack;
              if (OSIntNestingCtr == 0) {
                  OSTCBCurPtr->StkPtr = SP;
              }
              OSIntEnter();
              Clear the tick interrupt;
              OSTimeTick();
              OSIntExit();
              Restore the CPU registers from the stack;
              Return from interrupt;
          }