TNeoKernel
v1.03
|
PIC32 port implementation details
The context switch is implemented using the core software 0 interrupt. It should be configured to use the lowest priority in the system:
The interrupt priority level used by the context switch interrupt should not be configured to use shadow register sets.
src/arch/pic32/tn_arch_pic32_int_vec1.S
must be included in the main project itself, in order to dispatch vector1 (core software interrupt 0) correctly. Do note that if we include this file in the TNeoKernel library project, it doesn't work for vector, unfortunately._DefaultInterrupt
when it's time to switch context.For detailed information about interrupts in TNeoKernel, refer to the page Interrupts.
PIC32 port supports nested interrupts. The kernel provides C-language macros for calling C-language interrupt service routines, which can use either MIPS32 or MIPS16e mode. Both software and shadow register interrupt context saving is supported. Usage is as follows:
Alternatively, you can define your ISR in a standard way, like this:
Then, context is saved on the task's stack instead of interrupt stack (and takes therefore much more RAM), but you save about 20 cycles for each interrupt. See the page Interrupts for details.