ql_freertos_config.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <stdint.h>
  2. #include "kernel_config.h"
  3. #include "quec_proj_config.h"
  4. //#include "FreeRTOS.h"
  5. //#include <stddef.h>
  6. #ifdef CONFIG_TRUSTZONE_SUPPORT
  7. // <o>Interrupt controller unique priorities
  8. // <i> The number of unique priorities that can be specified in the ARM Generic Interrupt Controller (GIC).
  9. // <i> Default: 32
  10. #define configUNIQUE_INTERRUPT_PRIORITIES 16
  11. // <o>Maximum API call interrupt priority
  12. // <i> Interrupts assigned a priority at or below this priority can call interrupt safe FreeRTOS API function, and will nest.
  13. // <i> Interrupts assigned a priority above this priority will not be effected by RTOS critical sections, and will nest,
  14. // <i> but cannot call any FreeRTOS API functions.
  15. // <i> Default: 32
  16. #define configMAX_API_CALL_INTERRUPT_PRIORITY 16
  17. #else
  18. #define configUNIQUE_INTERRUPT_PRIORITIES 32
  19. #define configMAX_API_CALL_INTERRUPT_PRIORITY 32
  20. #endif
  21. /* The number of bits to shift for an interrupt priority is dependent on the
  22. number of bits implemented by the interrupt controller. */
  23. #if configUNIQUE_INTERRUPT_PRIORITIES == 16
  24. #define portPRIORITY_SHIFT 4
  25. #define portMAX_BINARY_POINT_VALUE 3
  26. #elif configUNIQUE_INTERRUPT_PRIORITIES == 32
  27. #define portPRIORITY_SHIFT 3
  28. #define portMAX_BINARY_POINT_VALUE 2
  29. #elif configUNIQUE_INTERRUPT_PRIORITIES == 64
  30. #define portPRIORITY_SHIFT 2
  31. #define portMAX_BINARY_POINT_VALUE 1
  32. #elif configUNIQUE_INTERRUPT_PRIORITIES == 128
  33. #define portPRIORITY_SHIFT 1
  34. #define portMAX_BINARY_POINT_VALUE 0
  35. #elif configUNIQUE_INTERRUPT_PRIORITIES == 256
  36. #define portPRIORITY_SHIFT 0
  37. #define portMAX_BINARY_POINT_VALUE 0
  38. #else
  39. #error Invalid configUNIQUE_INTERRUPT_PRIORITIES setting. configUNIQUE_INTERRUPT_PRIORITIES must be set to the number of unique priorities implemented by the target hardware
  40. #endif
  41. #ifndef configUNIQUE_INTERRUPT_PRIORITIES
  42. #error configUNIQUE_INTERRUPT_PRIORITIES must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html
  43. #endif
  44. #ifndef configMAX_API_CALL_INTERRUPT_PRIORITY
  45. #error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html
  46. #endif
  47. #if configMAX_API_CALL_INTERRUPT_PRIORITY == 0
  48. #error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0
  49. #endif
  50. #if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES
  51. #error configMAX_API_CALL_INTERRUPT_PRIORITY must be less than or equal to configUNIQUE_INTERRUPT_PRIORITIES as the lower the numeric priority value the higher the logical interrupt priority
  52. #endif
  53. /* In case security extensions are implemented. */
  54. #if configMAX_API_CALL_INTERRUPT_PRIORITY <= ( configUNIQUE_INTERRUPT_PRIORITIES / 2 )
  55. #error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 )
  56. #endif
  57. unsigned char ql_port_priority_shift = portPRIORITY_SHIFT;
  58. unsigned char ql_port_max_binary_point_value = portMAX_BINARY_POINT_VALUE;
  59. unsigned char ql_unique_interrupt_priorities = configUNIQUE_INTERRUPT_PRIORITIES;
  60. unsigned char ql_max_api_call_interrupt_priority = configMAX_API_CALL_INTERRUPT_PRIORITY;