the difference between an embOS interrupt and a zero latency interrupt

the difference between an embOS interrupt and a zero latency interrupt is the interrupt priority level and the usage of OS_EnterInterrupt()/OS_LeaveInterrupt() or OS_EnterNestableInterrupt()/OS_LeaveNestableInterrupt().

Example of an embOS interrupt function:

void OS_COM_IsrHandler(void) {
  int Dummy;
  OS_EnterNestableInterrupt();
  Dummy = US_RHR;     
  // Call embOS API functions here
  OS_LeaveNestableInterrupt();
}

void Uart_Init(void) {
  OS_ARM_InstallISRHandler(ISR_ID_USART, (OS_ISR_HANDLER*) OS_COM_IsrHandler);
  OS_ARM_ISRSetPrio(140); // Set prio > 128
  OS_ARM_EnableISR(ISR_ID_USART);
}

Example of a zero latency interrupt function:

void OS_COM_IsrHandler(void) {
  int Dummy;
  Dummy = US_RHR;     
  // Never call embOS API functions here
}

void Uart_Init(void) {
  OS_ARM_InstallISRHandler(ISR_ID_USART, (OS_ISR_HANDLER*) OS_COM_IsrHandler);
  OS_ARM_ISRSetPrio(120); // Set prio < 128
  OS_ARM_EnableISR(ISR_ID_USART);
}

 

你可能感兴趣的:(interrupt)