]> git.sur5r.net Git - freertos/blob - FreeRTOS/Source/portable/IAR/ARM_CA9/port.c
c2209629c21f81367c4747a8055b1b018fda97fc
[freertos] / FreeRTOS / Source / portable / IAR / ARM_CA9 / port.c
1 /*\r
2     FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     This file is part of the FreeRTOS distribution.\r
8 \r
9     FreeRTOS is free software; you can redistribute it and/or modify it under\r
10     the terms of the GNU General Public License (version 2) as published by the\r
11     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
12 \r
13     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
14     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
15     >>!   obliged to provide the source code for proprietary components     !<<\r
16     >>!   outside of the FreeRTOS kernel.                                   !<<\r
17 \r
18     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
19     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
20     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
21     link: http://www.freertos.org/a00114.html\r
22 \r
23     1 tab == 4 spaces!\r
24 \r
25     ***************************************************************************\r
26      *                                                                       *\r
27      *    Having a problem?  Start by reading the FAQ "My application does   *\r
28      *    not run, what could be wrong?".  Have you defined configASSERT()?  *\r
29      *                                                                       *\r
30      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
31      *                                                                       *\r
32     ***************************************************************************\r
33 \r
34     ***************************************************************************\r
35      *                                                                       *\r
36      *    FreeRTOS provides completely free yet professionally developed,    *\r
37      *    robust, strictly quality controlled, supported, and cross          *\r
38      *    platform software that is more than just the market leader, it     *\r
39      *    is the industry's de facto standard.                               *\r
40      *                                                                       *\r
41      *    Help yourself get started quickly while simultaneously helping     *\r
42      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
43      *    tutorial book, reference manual, or both:                          *\r
44      *    http://www.FreeRTOS.org/Documentation                              *\r
45      *                                                                       *\r
46     ***************************************************************************\r
47 \r
48     ***************************************************************************\r
49      *                                                                       *\r
50      *   Investing in training allows your team to be as productive as       *\r
51      *   possible as early as possible, lowering your overall development    *\r
52      *   cost, and enabling you to bring a more robust product to market     *\r
53      *   earlier than would otherwise be possible.  Richard Barry is both    *\r
54      *   the architect and key author of FreeRTOS, and so also the world's   *\r
55      *   leading authority on what is the world's most popular real time     *\r
56      *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
57      *   from Richard ensures your team will gain directly from his in-depth *\r
58      *   product knowledge and years of usage experience.  Contact Real Time *\r
59      *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
60      *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
61      *                                                                       *\r
62     ***************************************************************************\r
63 \r
64     ***************************************************************************\r
65      *                                                                       *\r
66      *    You are receiving this top quality software for free.  Please play *\r
67      *    fair and reciprocate by reporting any suspected issues and         *\r
68      *    participating in the community forum:                              *\r
69      *    http://www.FreeRTOS.org/support                                    *\r
70      *                                                                       *\r
71      *    Thank you!                                                         *\r
72      *                                                                       *\r
73     ***************************************************************************\r
74 \r
75     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
76     license and Real Time Engineers Ltd. contact details.\r
77 \r
78     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
79     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
80     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
81 \r
82     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
83     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
84 \r
85     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
86     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
87     licenses offer ticketed support, indemnification and commercial middleware.\r
88 \r
89     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
90     engineered and independently SIL3 certified version for use in safety and\r
91     mission critical applications that require provable dependability.\r
92 \r
93     1 tab == 4 spaces!\r
94 */\r
95 \r
96 /* Standard includes. */\r
97 #include <stdlib.h>\r
98 \r
99 /* IAR includes. */\r
100 #include <intrinsics.h>\r
101 \r
102 /* Scheduler includes. */\r
103 #include "FreeRTOS.h"\r
104 #include "task.h"\r
105 \r
106 #ifndef configINTERRUPT_CONTROLLER_BASE_ADDRESS\r
107         #error configINTERRUPT_CONTROLLER_BASE_ADDRESS must be defined.  See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html\r
108 #endif\r
109 \r
110 #ifndef configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET\r
111         #error configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET must be defined.  See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html\r
112 #endif\r
113 \r
114 #ifndef configUNIQUE_INTERRUPT_PRIORITIES\r
115         #error configUNIQUE_INTERRUPT_PRIORITIES must be defined.  See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html\r
116 #endif\r
117 \r
118 #ifndef configSETUP_TICK_INTERRUPT\r
119         #error configSETUP_TICK_INTERRUPT() must be defined.  See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html\r
120 #endif /* configSETUP_TICK_INTERRUPT */\r
121 \r
122 #ifndef configMAX_API_CALL_INTERRUPT_PRIORITY\r
123         #error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined.  See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html\r
124 #endif\r
125 \r
126 #if configMAX_API_CALL_INTERRUPT_PRIORITY == 0\r
127         #error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0\r
128 #endif\r
129 \r
130 #if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES\r
131         #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\r
132 #endif\r
133 \r
134 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1\r
135         /* Check the configuration. */\r
136         #if( configMAX_PRIORITIES > 32 )\r
137                 #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.\r
138         #endif\r
139 #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */\r
140 \r
141 /* In case security extensions are implemented. */\r
142 #if configMAX_API_CALL_INTERRUPT_PRIORITY <= ( configUNIQUE_INTERRUPT_PRIORITIES / 2 )\r
143         #error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 )\r
144 #endif\r
145 \r
146 #ifndef configCLEAR_TICK_INTERRUPT\r
147         #define configCLEAR_TICK_INTERRUPT()\r
148 #endif\r
149 \r
150 /* A critical section is exited when the critical section nesting count reaches\r
151 this value. */\r
152 #define portNO_CRITICAL_NESTING                 ( ( uint32_t ) 0 )\r
153 \r
154 /* In all GICs 255 can be written to the priority mask register to unmask all\r
155 (but the lowest) interrupt priority. */\r
156 #define portUNMASK_VALUE                                ( 0xFFUL )\r
157 \r
158 /* Tasks are not created with a floating point context, but can be given a\r
159 floating point context after they have been created.  A variable is stored as\r
160 part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task\r
161 does not have an FPU context, or any other value if the task does have an FPU\r
162 context. */\r
163 #define portNO_FLOATING_POINT_CONTEXT   ( ( StackType_t ) 0 )\r
164 \r
165 /* Constants required to setup the initial task context. */\r
166 #define portINITIAL_SPSR                                ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */\r
167 #define portTHUMB_MODE_BIT                              ( ( StackType_t ) 0x20 )\r
168 #define portTHUMB_MODE_ADDRESS                  ( 0x01UL )\r
169 \r
170 /* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary\r
171 point is zero. */\r
172 #define portBINARY_POINT_BITS                   ( ( uint8_t ) 0x03 )\r
173 \r
174 /* Masks all bits in the APSR other than the mode bits. */\r
175 #define portAPSR_MODE_BITS_MASK                 ( 0x1F )\r
176 \r
177 /* The value of the mode bits in the APSR when the CPU is executing in user\r
178 mode. */\r
179 #define portAPSR_USER_MODE                              ( 0x10 )\r
180 \r
181 /* Macro to unmask all interrupt priorities. */\r
182 #define portCLEAR_INTERRUPT_MASK()                                                                                      \\r
183 {                                                                                                                                                       \\r
184         __disable_irq();                                                                                                                \\r
185         portICCPMR_PRIORITY_MASK_REGISTER = portUNMASK_VALUE;                                   \\r
186         __asm(  "DSB            \n"                                                                                                     \\r
187                         "ISB            \n" );                                                                                          \\r
188         __enable_irq();                                                                                                                 \\r
189 }\r
190 \r
191 /*-----------------------------------------------------------*/\r
192 \r
193 /*\r
194  * Starts the first task executing.  This function is necessarily written in\r
195  * assembly code so is implemented in portASM.s.\r
196  */\r
197 extern void vPortRestoreTaskContext( void );\r
198 \r
199 /*\r
200  * Used to catch tasks that attempt to return from their implementing function.\r
201  */\r
202 static void prvTaskExitError( void );\r
203 \r
204 /*-----------------------------------------------------------*/\r
205 \r
206 /* A variable is used to keep track of the critical section nesting.  This\r
207 variable has to be stored as part of the task context and must be initialised to\r
208 a non zero value to ensure interrupts don't inadvertently become unmasked before\r
209 the scheduler starts.  As it is stored as part of the task context it will\r
210 automatically be set to 0 when the first task is started. */\r
211 volatile uint32_t ulCriticalNesting = 9999UL;\r
212 \r
213 /* Saved as part of the task context.  If ulPortTaskHasFPUContext is non-zero\r
214 then a floating point context must be saved and restored for the task. */\r
215 uint32_t ulPortTaskHasFPUContext = pdFALSE;\r
216 \r
217 /* Set to 1 to pend a context switch from an ISR. */\r
218 uint32_t ulPortYieldRequired = pdFALSE;\r
219 \r
220 /* Counts the interrupt nesting depth.  A context switch is only performed if\r
221 if the nesting depth is 0. */\r
222 uint32_t ulPortInterruptNesting = 0UL;\r
223 \r
224 \r
225 /*-----------------------------------------------------------*/\r
226 \r
227 /*\r
228  * See header file for description.\r
229  */\r
230 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )\r
231 {\r
232         /* Setup the initial stack of the task.  The stack is set exactly as\r
233         expected by the portRESTORE_CONTEXT() macro.\r
234 \r
235         The fist real value on the stack is the status register, which is set for\r
236         system mode, with interrupts enabled.  A few NULLs are added first to ensure\r
237         GDB does not try decoding a non-existent return address. */\r
238         *pxTopOfStack = NULL;\r
239         pxTopOfStack--;\r
240         *pxTopOfStack = NULL;\r
241         pxTopOfStack--;\r
242         *pxTopOfStack = NULL;\r
243         pxTopOfStack--;\r
244         *pxTopOfStack = ( StackType_t ) portINITIAL_SPSR;\r
245 \r
246         if( ( ( uint32_t ) pxCode & portTHUMB_MODE_ADDRESS ) != 0x00UL )\r
247         {\r
248                 /* The task will start in THUMB mode. */\r
249                 *pxTopOfStack |= portTHUMB_MODE_BIT;\r
250         }\r
251 \r
252         pxTopOfStack--;\r
253 \r
254         /* Next the return address, which in this case is the start of the task. */\r
255         *pxTopOfStack = ( StackType_t ) pxCode;\r
256         pxTopOfStack--;\r
257 \r
258         /* Next all the registers other than the stack pointer. */\r
259         *pxTopOfStack = ( StackType_t ) prvTaskExitError;       /* R14 */\r
260         pxTopOfStack--;\r
261         *pxTopOfStack = ( StackType_t ) 0x12121212;     /* R12 */\r
262         pxTopOfStack--;\r
263         *pxTopOfStack = ( StackType_t ) 0x11111111;     /* R11 */\r
264         pxTopOfStack--;\r
265         *pxTopOfStack = ( StackType_t ) 0x10101010;     /* R10 */\r
266         pxTopOfStack--;\r
267         *pxTopOfStack = ( StackType_t ) 0x09090909;     /* R9 */\r
268         pxTopOfStack--;\r
269         *pxTopOfStack = ( StackType_t ) 0x08080808;     /* R8 */\r
270         pxTopOfStack--;\r
271         *pxTopOfStack = ( StackType_t ) 0x07070707;     /* R7 */\r
272         pxTopOfStack--;\r
273         *pxTopOfStack = ( StackType_t ) 0x06060606;     /* R6 */\r
274         pxTopOfStack--;\r
275         *pxTopOfStack = ( StackType_t ) 0x05050505;     /* R5 */\r
276         pxTopOfStack--;\r
277         *pxTopOfStack = ( StackType_t ) 0x04040404;     /* R4 */\r
278         pxTopOfStack--;\r
279         *pxTopOfStack = ( StackType_t ) 0x03030303;     /* R3 */\r
280         pxTopOfStack--;\r
281         *pxTopOfStack = ( StackType_t ) 0x02020202;     /* R2 */\r
282         pxTopOfStack--;\r
283         *pxTopOfStack = ( StackType_t ) 0x01010101;     /* R1 */\r
284         pxTopOfStack--;\r
285         *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */\r
286         pxTopOfStack--;\r
287 \r
288         /* The task will start with a critical nesting count of 0 as interrupts are\r
289         enabled. */\r
290         *pxTopOfStack = portNO_CRITICAL_NESTING;\r
291         pxTopOfStack--;\r
292 \r
293         /* The task will start without a floating point context.  A task that uses\r
294         the floating point hardware must call vPortTaskUsesFPU() before executing\r
295         any floating point instructions. */\r
296         *pxTopOfStack = portNO_FLOATING_POINT_CONTEXT;\r
297 \r
298         return pxTopOfStack;\r
299 }\r
300 /*-----------------------------------------------------------*/\r
301 \r
302 static void prvTaskExitError( void )\r
303 {\r
304         /* A function that implements a task must not exit or attempt to return to\r
305         its caller as there is nothing to return to.  If a task wants to exit it\r
306         should instead call vTaskDelete( NULL ).\r
307 \r
308         Artificially force an assert() to be triggered if configASSERT() is\r
309         defined, then stop here so application writers can catch the error. */\r
310         configASSERT( ulPortInterruptNesting == ~0UL );\r
311         portDISABLE_INTERRUPTS();\r
312         for( ;; );\r
313 }\r
314 /*-----------------------------------------------------------*/\r
315 \r
316 BaseType_t xPortStartScheduler( void )\r
317 {\r
318 uint32_t ulAPSR;\r
319 \r
320         /* Only continue if the CPU is not in User mode.  The CPU must be in a\r
321         Privileged mode for the scheduler to start. */\r
322         __asm volatile ( "MRS %0, APSR" : "=r" ( ulAPSR ) );\r
323         ulAPSR &= portAPSR_MODE_BITS_MASK;\r
324         configASSERT( ulAPSR != portAPSR_USER_MODE );\r
325 \r
326         if( ulAPSR != portAPSR_USER_MODE )\r
327         {\r
328                 /* Only continue if the binary point value is set to its lowest possible\r
329                 setting.  See the comments in vPortValidateInterruptPriority() below for\r
330                 more information. */\r
331                 configASSERT( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE );\r
332 \r
333                 if( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE )\r
334                 {\r
335                         /* Start the timer that generates the tick ISR. */\r
336                         configSETUP_TICK_INTERRUPT();\r
337 \r
338                         __enable_irq();\r
339                         vPortRestoreTaskContext();\r
340                 }\r
341         }\r
342 \r
343         /* Will only get here if xTaskStartScheduler() was called with the CPU in\r
344         a non-privileged mode or the binary point register was not set to its lowest\r
345         possible value. */\r
346         return 0;\r
347 }\r
348 /*-----------------------------------------------------------*/\r
349 \r
350 void vPortEndScheduler( void )\r
351 {\r
352         /* Not implemented in ports where there is nothing to return to.\r
353         Artificially force an assert. */\r
354         configASSERT( ulCriticalNesting == 1000UL );\r
355 }\r
356 /*-----------------------------------------------------------*/\r
357 \r
358 void vPortEnterCritical( void )\r
359 {\r
360         /* Disable interrupts as per portDISABLE_INTERRUPTS();  */\r
361         ulPortSetInterruptMask();\r
362 \r
363         /* Now interrupts are disabled ulCriticalNesting can be accessed\r
364         directly.  Increment ulCriticalNesting to keep a count of how many times\r
365         portENTER_CRITICAL() has been called. */\r
366         ulCriticalNesting++;\r
367         \r
368         /* This is not the interrupt safe version of the enter critical function so\r
369         assert() if it is being called from an interrupt context.  Only API \r
370         functions that end in "FromISR" can be used in an interrupt.  Only assert if\r
371         the critical nesting count is 1 to protect against recursive calls if the\r
372         assert function also uses a critical section. */\r
373         if( ulCriticalNesting == 1 )\r
374         {\r
375                 configASSERT( ulPortInterruptNesting == 0 );\r
376         }\r
377 }\r
378 /*-----------------------------------------------------------*/\r
379 \r
380 void vPortExitCritical( void )\r
381 {\r
382         if( ulCriticalNesting > portNO_CRITICAL_NESTING )\r
383         {\r
384                 /* Decrement the nesting count as the critical section is being\r
385                 exited. */\r
386                 ulCriticalNesting--;\r
387 \r
388                 /* If the nesting level has reached zero then all interrupt\r
389                 priorities must be re-enabled. */\r
390                 if( ulCriticalNesting == portNO_CRITICAL_NESTING )\r
391                 {\r
392                         /* Critical nesting has reached zero so all interrupt priorities\r
393                         should be unmasked. */\r
394                         portCLEAR_INTERRUPT_MASK();\r
395                 }\r
396         }\r
397 }\r
398 /*-----------------------------------------------------------*/\r
399 \r
400 void FreeRTOS_Tick_Handler( void )\r
401 {\r
402         /* Set interrupt mask before altering scheduler structures.   The tick\r
403         handler runs at the lowest priority, so interrupts cannot already be masked,\r
404         so there is no need to save and restore the current mask value. */\r
405         __disable_irq();\r
406         portICCPMR_PRIORITY_MASK_REGISTER = ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT );\r
407         __asm(  "DSB            \n"\r
408                         "ISB            \n" );\r
409         __enable_irq();\r
410 \r
411         /* Increment the RTOS tick. */\r
412         if( xTaskIncrementTick() != pdFALSE )\r
413         {\r
414                 ulPortYieldRequired = pdTRUE;\r
415         }\r
416 \r
417         /* Ensure all interrupt priorities are active again. */\r
418         portCLEAR_INTERRUPT_MASK();\r
419         configCLEAR_TICK_INTERRUPT();\r
420 }\r
421 /*-----------------------------------------------------------*/\r
422 \r
423 void vPortTaskUsesFPU( void )\r
424 {\r
425 uint32_t ulInitialFPSCR = 0;\r
426 \r
427         /* A task is registering the fact that it needs an FPU context.  Set the\r
428         FPU flag (which is saved as part of the task context). */\r
429         ulPortTaskHasFPUContext = pdTRUE;\r
430 \r
431         /* Initialise the floating point status register. */\r
432         __asm( "FMXR    FPSCR, %0" :: "r" (ulInitialFPSCR) );\r
433 }\r
434 /*-----------------------------------------------------------*/\r
435 \r
436 void vPortClearInterruptMask( uint32_t ulNewMaskValue )\r
437 {\r
438         if( ulNewMaskValue == pdFALSE )\r
439         {\r
440                 portCLEAR_INTERRUPT_MASK();\r
441         }\r
442 }\r
443 /*-----------------------------------------------------------*/\r
444 \r
445 uint32_t ulPortSetInterruptMask( void )\r
446 {\r
447 uint32_t ulReturn;\r
448 \r
449         __disable_irq();\r
450         if( portICCPMR_PRIORITY_MASK_REGISTER == ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) )\r
451         {\r
452                 /* Interrupts were already masked. */\r
453                 ulReturn = pdTRUE;\r
454         }\r
455         else\r
456         {\r
457                 ulReturn = pdFALSE;\r
458                 portICCPMR_PRIORITY_MASK_REGISTER = ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT );\r
459                 __asm(  "DSB            \n"\r
460                                 "ISB            \n" );\r
461         }\r
462         __enable_irq();\r
463 \r
464         return ulReturn;\r
465 }\r
466 /*-----------------------------------------------------------*/\r
467 \r
468 #if( configASSERT_DEFINED == 1 )\r
469 \r
470         void vPortValidateInterruptPriority( void )\r
471         {\r
472                 /* The following assertion will fail if a service routine (ISR) for\r
473                 an interrupt that has been assigned a priority above\r
474                 configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API\r
475                 function.  ISR safe FreeRTOS API functions must *only* be called\r
476                 from interrupts that have been assigned a priority at or below\r
477                 configMAX_SYSCALL_INTERRUPT_PRIORITY.\r
478 \r
479                 Numerically low interrupt priority numbers represent logically high\r
480                 interrupt priorities, therefore the priority of the interrupt must\r
481                 be set to a value equal to or numerically *higher* than\r
482                 configMAX_SYSCALL_INTERRUPT_PRIORITY.\r
483 \r
484                 FreeRTOS maintains separate thread and ISR API functions to ensure\r
485                 interrupt entry is as fast and simple as possible.\r
486 \r
487                 The following links provide detailed information:\r
488                 http://www.freertos.org/RTOS-Cortex-M3-M4.html\r
489                 http://www.freertos.org/FAQHelp.html */\r
490                 configASSERT( portICCRPR_RUNNING_PRIORITY_REGISTER >= ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) );\r
491 \r
492                 /* Priority grouping:  The interrupt controller (GIC) allows the bits\r
493                 that define each interrupt's priority to be split between bits that\r
494                 define the interrupt's pre-emption priority bits and bits that define\r
495                 the interrupt's sub-priority.  For simplicity all bits must be defined\r
496                 to be pre-emption priority bits.  The following assertion will fail if\r
497                 this is not the case (if some bits represent a sub-priority).\r
498 \r
499                 The priority grouping is configured by the GIC's binary point register\r
500                 (ICCBPR).  Writting 0 to ICCBPR will ensure it is set to its lowest\r
501                 possible value (which may be above 0). */\r
502                 configASSERT( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE );\r
503         }\r
504 \r
505 #endif /* configASSERT_DEFINED */\r
506 \r
507 \r