Here is an example I just lifted from the new Atmel demo (I didn't choose the macro names!)
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
This defines configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY to be in a form acceptable to the NVIC_SetPriority function.
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
This uses the configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY definition to set configMAX_SYSCALL_INTERRUPT_PRIORITY in a form acceptable to the NVIC directly (which is how the FreeRTOS port layer uses it internally).
In this example, an interrupt that uses the FreeRTOS API has to have its priority set using the NVIC_SetPriority() function to a value of 10 or higher (so 10, 11, 12, etc).
(I also didn't design the Cortex-M3 NVIC mash up!)
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.