port.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. /*
  2. * FreeRTOS Kernel V10.4.6
  3. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * SPDX-License-Identifier: MIT
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  8. * this software and associated documentation files (the "Software"), to deal in
  9. * the Software without restriction, including without limitation the rights to
  10. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  11. * the Software, and to permit persons to whom the Software is furnished to do so,
  12. * subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in all
  15. * copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. *
  24. * https://www.FreeRTOS.org
  25. * https://github.com/FreeRTOS
  26. *
  27. */
  28. /* Standard includes. */
  29. #include <stdlib.h>
  30. /* Scheduler includes. */
  31. #include "FreeRTOS.h"
  32. #include "task.h"
  33. #ifndef configINTERRUPT_CONTROLLER_BASE_ADDRESS
  34. #error configINTERRUPT_CONTROLLER_BASE_ADDRESS must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html
  35. #endif
  36. #ifndef configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET
  37. #error configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html
  38. #endif
  39. #ifndef configUNIQUE_INTERRUPT_PRIORITIES
  40. #error configUNIQUE_INTERRUPT_PRIORITIES must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html
  41. #endif
  42. #ifndef configSETUP_TICK_INTERRUPT
  43. #error configSETUP_TICK_INTERRUPT() must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html
  44. #endif /* configSETUP_TICK_INTERRUPT */
  45. #ifndef configMAX_API_CALL_INTERRUPT_PRIORITY
  46. #error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html
  47. #endif
  48. #if configMAX_API_CALL_INTERRUPT_PRIORITY == 0
  49. #error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0
  50. #endif
  51. #if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES
  52. #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
  53. #endif
  54. #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
  55. /* Check the configuration. */
  56. #if( configMAX_PRIORITIES > 32 )
  57. #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
  58. #endif
  59. #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
  60. /* In case security extensions are implemented. */
  61. #if configMAX_API_CALL_INTERRUPT_PRIORITY <= ( configUNIQUE_INTERRUPT_PRIORITIES / 2 )
  62. #error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 )
  63. #endif
  64. #ifndef configCLEAR_TICK_INTERRUPT
  65. #define configCLEAR_TICK_INTERRUPT()
  66. #endif
  67. /* The number of bits to shift for an interrupt priority is dependent on the
  68. number of bits implemented by the interrupt controller. */
  69. #if configUNIQUE_INTERRUPT_PRIORITIES == 16
  70. #define portPRIORITY_SHIFT 4
  71. #define portMAX_BINARY_POINT_VALUE 3
  72. #elif configUNIQUE_INTERRUPT_PRIORITIES == 32
  73. #define portPRIORITY_SHIFT 3
  74. #define portMAX_BINARY_POINT_VALUE 2
  75. #elif configUNIQUE_INTERRUPT_PRIORITIES == 64
  76. #define portPRIORITY_SHIFT 2
  77. #define portMAX_BINARY_POINT_VALUE 1
  78. #elif configUNIQUE_INTERRUPT_PRIORITIES == 128
  79. #define portPRIORITY_SHIFT 1
  80. #define portMAX_BINARY_POINT_VALUE 0
  81. #elif configUNIQUE_INTERRUPT_PRIORITIES == 256
  82. #define portPRIORITY_SHIFT 0
  83. #define portMAX_BINARY_POINT_VALUE 0
  84. #else
  85. #error Invalid configUNIQUE_INTERRUPT_PRIORITIES setting. configUNIQUE_INTERRUPT_PRIORITIES must be set to the number of unique priorities implemented by the target hardware
  86. #endif
  87. /* A critical section is exited when the critical section nesting count reaches
  88. this value. */
  89. #define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
  90. /* In all GICs 255 can be written to the priority mask register to unmask all
  91. (but the lowest) interrupt priority. */
  92. #define portUNMASK_VALUE ( 0xFFUL )
  93. /* Tasks are not created with a floating point context, but can be given a
  94. floating point context after they have been created. A variable is stored as
  95. part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task
  96. does not have an FPU context, or any other value if the task does have an FPU
  97. context. */
  98. #define portNO_FLOATING_POINT_CONTEXT ( ( StackType_t ) 0 )
  99. /* Interrupt controller access addresses. */
  100. #define portICCPMR_PRIORITY_MASK_OFFSET ( 0x04 )
  101. #define portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET ( 0x0C )
  102. #define portICCEOIR_END_OF_INTERRUPT_OFFSET ( 0x10 )
  103. #define portICCBPR_BINARY_POINT_OFFSET ( 0x08 )
  104. #define portICCRPR_RUNNING_PRIORITY_OFFSET ( 0x14 )
  105. #define portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET )
  106. #define portICCPMR_PRIORITY_MASK_REGISTER ( *( ( volatile uint32_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET ) ) )
  107. #define portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET )
  108. #define portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCEOIR_END_OF_INTERRUPT_OFFSET )
  109. #define portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET )
  110. #define portICCBPR_BINARY_POINT_REGISTER ( *( ( const volatile uint32_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET ) ) )
  111. #define portICCRPR_RUNNING_PRIORITY_REGISTER ( *( ( const volatile uint32_t * ) ( portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET ) ) )
  112. /* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary
  113. point is zero. */
  114. #define portBINARY_POINT_BITS ( ( uint8_t ) 0x03 )
  115. /* Constants required to setup the initial task context. */
  116. #define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
  117. #define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 )
  118. #define portTHUMB_MODE_ADDRESS ( 0x01UL )
  119. /* Masks all bits in the APSR other than the mode bits. */
  120. #define portAPSR_MODE_BITS_MASK ( 0x1F )
  121. /* The value of the mode bits in the APSR when the CPU is executing in user
  122. mode. */
  123. #define portAPSR_USER_MODE ( 0x10 )
  124. /* Macro to unmask all interrupt priorities. */
  125. #define portCLEAR_INTERRUPT_MASK() \
  126. { \
  127. __disable_irq(); \
  128. portICCPMR_PRIORITY_MASK_REGISTER = portUNMASK_VALUE; \
  129. __asm( "DSB \n" \
  130. "ISB \n" ); \
  131. __enable_irq(); \
  132. }
  133. /*-----------------------------------------------------------*/
  134. /*
  135. * Starts the first task executing. This function is necessarily written in
  136. * assembly code so is implemented in portASM.s.
  137. */
  138. extern void vPortRestoreTaskContext( void );
  139. /*
  140. * Used to catch tasks that attempt to return from their implementing function.
  141. */
  142. static void prvTaskExitError( void );
  143. /*-----------------------------------------------------------*/
  144. /* A variable is used to keep track of the critical section nesting. This
  145. variable has to be stored as part of the task context and must be initialised to
  146. a non zero value to ensure interrupts don't inadvertently become unmasked before
  147. the scheduler starts. As it is stored as part of the task context it will
  148. automatically be set to 0 when the first task is started. */
  149. volatile uint32_t ulCriticalNesting = 9999UL;
  150. /* Used to pass constants into the ASM code. The address at which variables are
  151. placed is the constant value so indirect loads in the asm code are not
  152. required. */
  153. uint32_t ulICCIAR __attribute__( ( at( portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS ) ) );
  154. uint32_t ulICCEOIR __attribute__( ( at( portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS ) ) );
  155. uint32_t ulICCPMR __attribute__( ( at( portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS ) ) );
  156. uint32_t ulAsmAPIPriorityMask __attribute__( ( at( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) ) );
  157. /* Saved as part of the task context. If ulPortTaskHasFPUContext is non-zero then
  158. a floating point context must be saved and restored for the task. */
  159. uint32_t ulPortTaskHasFPUContext = pdFALSE;
  160. /* Set to 1 to pend a context switch from an ISR. */
  161. uint32_t ulPortYieldRequired = pdFALSE;
  162. /* Counts the interrupt nesting depth. A context switch is only performed if
  163. if the nesting depth is 0. */
  164. uint32_t ulPortInterruptNesting = 0UL;
  165. /*-----------------------------------------------------------*/
  166. /*
  167. * See header file for description.
  168. */
  169. StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
  170. {
  171. /* Setup the initial stack of the task. The stack is set exactly as
  172. expected by the portRESTORE_CONTEXT() macro.
  173. The fist real value on the stack is the status register, which is set for
  174. system mode, with interrupts enabled. A few NULLs are added first to ensure
  175. GDB does not try decoding a non-existent return address. */
  176. *pxTopOfStack = NULL;
  177. pxTopOfStack--;
  178. *pxTopOfStack = NULL;
  179. pxTopOfStack--;
  180. *pxTopOfStack = NULL;
  181. pxTopOfStack--;
  182. *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;
  183. if( ( ( uint32_t ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL )
  184. {
  185. /* The task will start in THUMB mode. */
  186. *pxTopOfStack |= portTHUMB_MODE_BIT;
  187. }
  188. pxTopOfStack--;
  189. /* Next the return address, which in this case is the start of the task. */
  190. *pxTopOfStack = ( StackType_t ) pxCode;
  191. pxTopOfStack--;
  192. /* Next all the registers other than the stack pointer. */
  193. *pxTopOfStack = ( StackType_t ) prvTaskExitError; /* R14 */
  194. pxTopOfStack--;
  195. *pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
  196. pxTopOfStack--;
  197. *pxTopOfStack = ( StackType_t ) 0x11111111; /* R11 */
  198. pxTopOfStack--;
  199. *pxTopOfStack = ( StackType_t ) 0x10101010; /* R10 */
  200. pxTopOfStack--;
  201. *pxTopOfStack = ( StackType_t ) 0x09090909; /* R9 */
  202. pxTopOfStack--;
  203. *pxTopOfStack = ( StackType_t ) 0x08080808; /* R8 */
  204. pxTopOfStack--;
  205. *pxTopOfStack = ( StackType_t ) 0x07070707; /* R7 */
  206. pxTopOfStack--;
  207. *pxTopOfStack = ( StackType_t ) 0x06060606; /* R6 */
  208. pxTopOfStack--;
  209. *pxTopOfStack = ( StackType_t ) 0x05050505; /* R5 */
  210. pxTopOfStack--;
  211. *pxTopOfStack = ( StackType_t ) 0x04040404; /* R4 */
  212. pxTopOfStack--;
  213. *pxTopOfStack = ( StackType_t ) 0x03030303; /* R3 */
  214. pxTopOfStack--;
  215. *pxTopOfStack = ( StackType_t ) 0x02020202; /* R2 */
  216. pxTopOfStack--;
  217. *pxTopOfStack = ( StackType_t ) 0x01010101; /* R1 */
  218. pxTopOfStack--;
  219. *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
  220. pxTopOfStack--;
  221. /* The task will start with a critical nesting count of 0 as interrupts are
  222. enabled. */
  223. *pxTopOfStack = portNO_CRITICAL_NESTING;
  224. pxTopOfStack--;
  225. /* The task will start without a floating point context. A task that uses
  226. the floating point hardware must call vPortTaskUsesFPU() before executing
  227. any floating point instructions. */
  228. *pxTopOfStack = portNO_FLOATING_POINT_CONTEXT;
  229. return pxTopOfStack;
  230. }
  231. /*-----------------------------------------------------------*/
  232. static void prvTaskExitError( void )
  233. {
  234. /* A function that implements a task must not exit or attempt to return to
  235. its caller as there is nothing to return to. If a task wants to exit it
  236. should instead call vTaskDelete( NULL ).
  237. Artificially force an assert() to be triggered if configASSERT() is
  238. defined, then stop here so application writers can catch the error. */
  239. configASSERT( ulPortInterruptNesting == ~0UL );
  240. portDISABLE_INTERRUPTS();
  241. for( ;; );
  242. }
  243. /*-----------------------------------------------------------*/
  244. BaseType_t xPortStartScheduler( void )
  245. {
  246. uint32_t ulAPSR;
  247. /* Only continue if the CPU is not in User mode. The CPU must be in a
  248. Privileged mode for the scheduler to start. */
  249. __asm( "MRS ulAPSR, APSR" );
  250. ulAPSR &= portAPSR_MODE_BITS_MASK;
  251. configASSERT( ulAPSR != portAPSR_USER_MODE );
  252. if( ulAPSR != portAPSR_USER_MODE )
  253. {
  254. /* Only continue if the binary point value is set to its lowest possible
  255. setting. See the comments in vPortValidateInterruptPriority() below for
  256. more information. */
  257. configASSERT( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE );
  258. if( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE )
  259. {
  260. /* Start the timer that generates the tick ISR. */
  261. configSETUP_TICK_INTERRUPT();
  262. __enable_irq();
  263. vPortRestoreTaskContext();
  264. }
  265. }
  266. /* Will only get here if vTaskStartScheduler() was called with the CPU in
  267. a non-privileged mode or the binary point register was not set to its lowest
  268. possible value. */
  269. return 0;
  270. }
  271. /*-----------------------------------------------------------*/
  272. void vPortEndScheduler( void )
  273. {
  274. /* Not implemented in ports where there is nothing to return to.
  275. Artificially force an assert. */
  276. configASSERT( ulCriticalNesting == 1000UL );
  277. }
  278. /*-----------------------------------------------------------*/
  279. void vPortEnterCritical( void )
  280. {
  281. /* Disable interrupts as per portDISABLE_INTERRUPTS(); */
  282. ulPortSetInterruptMask();
  283. /* Now interrupts are disabled ulCriticalNesting can be accessed
  284. directly. Increment ulCriticalNesting to keep a count of how many times
  285. portENTER_CRITICAL() has been called. */
  286. ulCriticalNesting++;
  287. /* This is not the interrupt safe version of the enter critical function so
  288. assert() if it is being called from an interrupt context. Only API
  289. functions that end in "FromISR" can be used in an interrupt. Only assert if
  290. the critical nesting count is 1 to protect against recursive calls if the
  291. assert function also uses a critical section. */
  292. if( ulCriticalNesting == 1 )
  293. {
  294. configASSERT( ulPortInterruptNesting == 0 );
  295. }
  296. }
  297. /*-----------------------------------------------------------*/
  298. void vPortExitCritical( void )
  299. {
  300. if( ulCriticalNesting > portNO_CRITICAL_NESTING )
  301. {
  302. /* Decrement the nesting count as the critical section is being
  303. exited. */
  304. ulCriticalNesting--;
  305. /* If the nesting level has reached zero then all interrupt
  306. priorities must be re-enabled. */
  307. if( ulCriticalNesting == portNO_CRITICAL_NESTING )
  308. {
  309. /* Critical nesting has reached zero so all interrupt priorities
  310. should be unmasked. */
  311. portCLEAR_INTERRUPT_MASK();
  312. }
  313. }
  314. }
  315. /*-----------------------------------------------------------*/
  316. void FreeRTOS_Tick_Handler( void )
  317. {
  318. /* Set interrupt mask before altering scheduler structures. The tick
  319. handler runs at the lowest priority, so interrupts cannot already be masked,
  320. so there is no need to save and restore the current mask value. */
  321. __disable_irq();
  322. portICCPMR_PRIORITY_MASK_REGISTER = ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT );
  323. __asm( "DSB \n"
  324. "ISB \n" );
  325. __enable_irq();
  326. /* Increment the RTOS tick. */
  327. if( xTaskIncrementTick() != pdFALSE )
  328. {
  329. ulPortYieldRequired = pdTRUE;
  330. }
  331. /* Ensure all interrupt priorities are active again. */
  332. portCLEAR_INTERRUPT_MASK();
  333. configCLEAR_TICK_INTERRUPT();
  334. }
  335. /*-----------------------------------------------------------*/
  336. void vPortTaskUsesFPU( void )
  337. {
  338. uint32_t ulInitialFPSCR = 0;
  339. /* A task is registering the fact that it needs an FPU context. Set the
  340. FPU flag (which is saved as part of the task context). */
  341. ulPortTaskHasFPUContext = pdTRUE;
  342. /* Initialise the floating point status register. */
  343. __asm( "FMXR FPSCR, ulInitialFPSCR" );
  344. }
  345. /*-----------------------------------------------------------*/
  346. void vPortClearInterruptMask( uint32_t ulNewMaskValue )
  347. {
  348. if( ulNewMaskValue == pdFALSE )
  349. {
  350. portCLEAR_INTERRUPT_MASK();
  351. }
  352. }
  353. /*-----------------------------------------------------------*/
  354. uint32_t ulPortSetInterruptMask( void )
  355. {
  356. uint32_t ulReturn;
  357. __disable_irq();
  358. if( portICCPMR_PRIORITY_MASK_REGISTER == ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) )
  359. {
  360. /* Interrupts were already masked. */
  361. ulReturn = pdTRUE;
  362. }
  363. else
  364. {
  365. ulReturn = pdFALSE;
  366. portICCPMR_PRIORITY_MASK_REGISTER = ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT );
  367. __asm( "DSB \n"
  368. "ISB \n" );
  369. }
  370. __enable_irq();
  371. return ulReturn;
  372. }
  373. /*-----------------------------------------------------------*/
  374. #if( configASSERT_DEFINED == 1 )
  375. void vPortValidateInterruptPriority( void )
  376. {
  377. /* The following assertion will fail if a service routine (ISR) for
  378. an interrupt that has been assigned a priority above
  379. configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API
  380. function. ISR safe FreeRTOS API functions must *only* be called
  381. from interrupts that have been assigned a priority at or below
  382. configMAX_SYSCALL_INTERRUPT_PRIORITY.
  383. Numerically low interrupt priority numbers represent logically high
  384. interrupt priorities, therefore the priority of the interrupt must
  385. be set to a value equal to or numerically *higher* than
  386. configMAX_SYSCALL_INTERRUPT_PRIORITY.
  387. FreeRTOS maintains separate thread and ISR API functions to ensure
  388. interrupt entry is as fast and simple as possible.
  389. The following links provide detailed information:
  390. https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
  391. https://www.FreeRTOS.org/FAQHelp.html */
  392. configASSERT( portICCRPR_RUNNING_PRIORITY_REGISTER >= ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) );
  393. /* Priority grouping: The interrupt controller (GIC) allows the bits
  394. that define each interrupt's priority to be split between bits that
  395. define the interrupt's pre-emption priority bits and bits that define
  396. the interrupt's sub-priority. For simplicity all bits must be defined
  397. to be pre-emption priority bits. The following assertion will fail if
  398. this is not the case (if some bits represent a sub-priority).
  399. The priority grouping is configured by the GIC's binary point register
  400. (ICCBPR). Writting 0 to ICCBPR will ensure it is set to its lowest
  401. possible value (which may be above 0). */
  402. configASSERT( portICCBPR_BINARY_POINT_REGISTER <= portMAX_BINARY_POINT_VALUE );
  403. }
  404. #endif /* configASSERT_DEFINED */