lpc_isr.h File Reference

Interrupt Service Routine (ISR) functions. More...

#include "LPC17xx.h"
Include dependency graph for lpc_isr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  intr_priorities_t {
  IP_above_freertos = 1, IP_SYSCALL = 2, IP_KERNEL = 31, IP_default = 20,
  IP_high = IP_SYSCALL + 1, IP_low = IP_default + 1, IP_eint = IP_default - 9, IP_ssp = IP_default - 6,
  IP_can = IP_default - 5, IP_i2c = IP_default - 2, IP_uart = IP_default - 1, IP_watchdog = IP_default,
  IP_timers = IP_default, IP_pwm1 = IP_default, IP_pll = IP_default, IP_spi = IP_default,
  IP_rtc = IP_default, IP_adc = IP_default, IP_bod = IP_default, IP_usb = IP_default,
  IP_dma = IP_default, IP_i2s = IP_default, IP_enet = IP_default, IP_mcpwm = IP_default,
  IP_qei = IP_default, IP_RIT = IP_default, IP_pll1 = IP_default, IP_usbact = IP_default,
  IP_canact = IP_default
}
 

Functions

void isr_register (IRQn_Type num, void(*isr_func_ptr)(void))
 

Detailed Description

Interrupt Service Routine (ISR) functions.

Enumeration Type Documentation

Interrupt Priorities (pre-configured by low_level_init.cpp) 0 - Highest 31 - Lowest

Interrupts used in this project must NOT use higher priority than IP_SYSCALL, so if IP_SYSCALL is set to 5, then interrupt priority must be higher number than 5 in order to set it to lower priority.

FromISR() FreeRTOS API cannot be called from interrupts that have higher priority than IP_SYSCALL, which means that:

  • YOUR ISR must have numerically equal to or HIGHER value than IP_SYSCALL

The interrupts that use higher priority than IP_SYSCALL MUST NOT USE FREERTOS API. These higher priority interrupts (even higher than FreeRTOS kernel) can be used to specify "super" priority above everything else in the system.

Enumerator
IP_above_freertos 

FreeRTOS Interrupt Priorities Be careful changing these because interrupt priorities set below must fall in between these two priorities.

IP_SYSCALL 
IP_KERNEL 
IP_default 

Interrupt Priorities These are used at to set default priorities before main() is called. All interrupts use default priority unless otherwise stated in this enum.

If you don't want interrupts to nest, set them to the same priority as IP_DEFAULTDefault priority of most interrupts, set arbitarily betweeen syscall and kernel

IP_high 

Higher than default, but lower than syscall

IP_low 

Lower than default

IP_eint 

Port0 and Port2 interrupt

IP_ssp 

SSP can be super fast, so needs higher priority

IP_can 

CAN can be fast, so use higher priority than other communication BUSes

IP_i2c 

I2C set to higher priority than UART

IP_uart 

UART set to higher priority than default

IP_watchdog 
IP_timers 
IP_pwm1 
IP_pll 
IP_spi 
IP_rtc 
IP_adc 
IP_bod 
IP_usb 
IP_dma 
IP_i2s 
IP_enet 
IP_mcpwm 
IP_qei 
IP_RIT 
IP_pll1 
IP_usbact 
IP_canact 

Function Documentation

void isr_register ( IRQn_Type  num,
void(*)(void)  isr_func_ptr 
)

Register a callback function for an interrupt.

There are two ways to register an interrupt, one is to define the exact "IRQHandler" as the one defined at startup.cpp, so something like this: C++ (*.cpp) file: extern "C" void UART0_IRQHandler() {} C (*.c) file: void UART0_IRQHandler() { }

The second method is just to call this function and register your function as an ISR:

Parameters
[in]numThe IRQ number;
See also
IRQn_Type. Only IRQ 0-N can be registered.
Parameters
[in]isr_func_ptrvoid function name.
Note
This function is implemented at startup.cpp since that contains the interrupt vector.

This function allows the user to register a function for the interrupt service routine. Registration of an IRQ is not necessary if the weak ISR has been over-riden.