port.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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. /*-----------------------------------------------------------
  29. * Implementation of functions defined in portable.h for the RXv3 DPFPU port.
  30. *----------------------------------------------------------*/
  31. #warning Testing for DFPU support in this port is not yet complete
  32. /* Scheduler includes. */
  33. #include "FreeRTOS.h"
  34. #include "task.h"
  35. /* Library includes. */
  36. #include "string.h"
  37. /* Hardware specifics. */
  38. #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
  39. #include "platform.h"
  40. #else /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */
  41. #include "iodefine.h"
  42. #endif /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */
  43. /*-----------------------------------------------------------*/
  44. /* Tasks should start with interrupts enabled and in Supervisor mode, therefore
  45. * PSW is set with U and I set, and PM and IPL clear. */
  46. #define portINITIAL_PSW ( ( StackType_t ) 0x00030000 )
  47. #define portINITIAL_FPSW ( ( StackType_t ) 0x00000100 )
  48. #define portINITIAL_DPSW ( ( StackType_t ) 0x00000100 )
  49. #define portINITIAL_DCMR ( ( StackType_t ) 0x00000000 )
  50. #define portINITIAL_DECNT ( ( StackType_t ) 0x00000001 )
  51. /* Tasks are not created with a DPFPU context, but can be given a DPFPU context
  52. * after they have been created. A variable is stored as part of the tasks context
  53. * that holds portNO_DPFPU_CONTEXT if the task does not have a DPFPU context, or
  54. * any other value if the task does have a DPFPU context. */
  55. #define portNO_DPFPU_CONTEXT ( ( StackType_t ) 0 )
  56. #define portHAS_DPFPU_CONTEXT ( ( StackType_t ) 1 )
  57. /* The space on the stack required to hold the DPFPU data registers. This is 16
  58. * 64-bit registers. */
  59. #define portDPFPU_DATA_REGISTER_WORDS ( 16 * 2 )
  60. /*-----------------------------------------------------------*/
  61. /*
  62. * Function to start the first task executing - written in asm code as direct
  63. * access to registers is required.
  64. */
  65. static void prvStartFirstTask( void );
  66. /*
  67. * Software interrupt handler. Performs the actual context switch (saving and
  68. * restoring of registers). Written in asm code as direct register access is
  69. * required.
  70. */
  71. __interrupt void vSoftwareInterruptISR( void );
  72. /*
  73. * The tick ISR handler. The peripheral used is configured by the application
  74. * via a hook/callback function.
  75. */
  76. __interrupt void vTickISR( void );
  77. /*-----------------------------------------------------------*/
  78. /* Saved as part of the task context. If ulPortTaskHasDPFPUContext is non-zero
  79. * then a DPFPU context must be saved and restored for the task. */
  80. #if ( configUSE_TASK_DPFPU_SUPPORT == 1 )
  81. StackType_t ulPortTaskHasDPFPUContext = portNO_DPFPU_CONTEXT;
  82. #endif /* configUSE_TASK_DPFPU_SUPPORT */
  83. /* This is accessed by the inline assembler functions so is file scope for
  84. * convenience. */
  85. extern void * pxCurrentTCB;
  86. extern void vTaskSwitchContext( void );
  87. /*-----------------------------------------------------------*/
  88. /*
  89. * See header file for description.
  90. */
  91. StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
  92. TaskFunction_t pxCode,
  93. void * pvParameters )
  94. {
  95. /* R0 is not included as it is the stack pointer. */
  96. *pxTopOfStack = 0x00;
  97. pxTopOfStack--;
  98. *pxTopOfStack = portINITIAL_PSW;
  99. pxTopOfStack--;
  100. *pxTopOfStack = ( StackType_t ) pxCode;
  101. /* When debugging it can be useful if every register is set to a known
  102. * value. Otherwise code space can be saved by just setting the registers
  103. * that need to be set. */
  104. #ifdef USE_FULL_REGISTER_INITIALISATION
  105. {
  106. pxTopOfStack--;
  107. *pxTopOfStack = 0xffffffff; /* r15. */
  108. pxTopOfStack--;
  109. *pxTopOfStack = 0xeeeeeeee;
  110. pxTopOfStack--;
  111. *pxTopOfStack = 0xdddddddd;
  112. pxTopOfStack--;
  113. *pxTopOfStack = 0xcccccccc;
  114. pxTopOfStack--;
  115. *pxTopOfStack = 0xbbbbbbbb;
  116. pxTopOfStack--;
  117. *pxTopOfStack = 0xaaaaaaaa;
  118. pxTopOfStack--;
  119. *pxTopOfStack = 0x99999999;
  120. pxTopOfStack--;
  121. *pxTopOfStack = 0x88888888;
  122. pxTopOfStack--;
  123. *pxTopOfStack = 0x77777777;
  124. pxTopOfStack--;
  125. *pxTopOfStack = 0x66666666;
  126. pxTopOfStack--;
  127. *pxTopOfStack = 0x55555555;
  128. pxTopOfStack--;
  129. *pxTopOfStack = 0x44444444;
  130. pxTopOfStack--;
  131. *pxTopOfStack = 0x33333333;
  132. pxTopOfStack--;
  133. *pxTopOfStack = 0x22222222;
  134. pxTopOfStack--;
  135. }
  136. #else /* ifdef USE_FULL_REGISTER_INITIALISATION */
  137. {
  138. pxTopOfStack -= 15;
  139. }
  140. #endif /* ifdef USE_FULL_REGISTER_INITIALISATION */
  141. *pxTopOfStack = ( StackType_t ) pvParameters; /* R1 */
  142. pxTopOfStack--;
  143. *pxTopOfStack = portINITIAL_FPSW;
  144. pxTopOfStack--;
  145. *pxTopOfStack = 0x11111111; /* Accumulator 1. */
  146. pxTopOfStack--;
  147. *pxTopOfStack = 0x22222222; /* Accumulator 1. */
  148. pxTopOfStack--;
  149. *pxTopOfStack = 0x33333333; /* Accumulator 1. */
  150. pxTopOfStack--;
  151. *pxTopOfStack = 0x44444444; /* Accumulator 0. */
  152. pxTopOfStack--;
  153. *pxTopOfStack = 0x55555555; /* Accumulator 0. */
  154. pxTopOfStack--;
  155. *pxTopOfStack = 0x66666666; /* Accumulator 0. */
  156. #if ( configUSE_TASK_DPFPU_SUPPORT == 1 )
  157. {
  158. /* The task will start without a DPFPU context. A task that
  159. * uses the DPFPU hardware must call vPortTaskUsesDPFPU() before
  160. * executing any floating point instructions. */
  161. pxTopOfStack--;
  162. *pxTopOfStack = portNO_DPFPU_CONTEXT;
  163. }
  164. #elif ( configUSE_TASK_DPFPU_SUPPORT == 2 )
  165. {
  166. /* The task will start with a DPFPU context. Leave enough
  167. * space for the registers - and ensure they are initialised if desired. */
  168. #ifdef USE_FULL_REGISTER_INITIALISATION
  169. {
  170. pxTopOfStack -= 2;
  171. *(double *)pxTopOfStack = 1515.1515; /* DR15. */
  172. pxTopOfStack -= 2;
  173. *(double *)pxTopOfStack = 1414.1414; /* DR14. */
  174. pxTopOfStack -= 2;
  175. *(double *)pxTopOfStack = 1313.1313; /* DR13. */
  176. pxTopOfStack -= 2;
  177. *(double *)pxTopOfStack = 1212.1212; /* DR12. */
  178. pxTopOfStack -= 2;
  179. *(double *)pxTopOfStack = 1111.1111; /* DR11. */
  180. pxTopOfStack -= 2;
  181. *(double *)pxTopOfStack = 1010.1010; /* DR10. */
  182. pxTopOfStack -= 2;
  183. *(double *)pxTopOfStack = 909.0909; /* DR9. */
  184. pxTopOfStack -= 2;
  185. *(double *)pxTopOfStack = 808.0808; /* DR8. */
  186. pxTopOfStack -= 2;
  187. *(double *)pxTopOfStack = 707.0707; /* DR7. */
  188. pxTopOfStack -= 2;
  189. *(double *)pxTopOfStack = 606.0606; /* DR6. */
  190. pxTopOfStack -= 2;
  191. *(double *)pxTopOfStack = 505.0505; /* DR5. */
  192. pxTopOfStack -= 2;
  193. *(double *)pxTopOfStack = 404.0404; /* DR4. */
  194. pxTopOfStack -= 2;
  195. *(double *)pxTopOfStack = 303.0303; /* DR3. */
  196. pxTopOfStack -= 2;
  197. *(double *)pxTopOfStack = 202.0202; /* DR2. */
  198. pxTopOfStack -= 2;
  199. *(double *)pxTopOfStack = 101.0101; /* DR1. */
  200. pxTopOfStack -= 2;
  201. *(double *)pxTopOfStack = 9876.54321;/* DR0. */
  202. }
  203. #else /* ifdef USE_FULL_REGISTER_INITIALISATION */
  204. {
  205. pxTopOfStack -= portDPFPU_DATA_REGISTER_WORDS;
  206. memset( pxTopOfStack, 0x00, portDPFPU_DATA_REGISTER_WORDS * sizeof( StackType_t ) );
  207. }
  208. #endif /* ifdef USE_FULL_REGISTER_INITIALISATION */
  209. pxTopOfStack--;
  210. *pxTopOfStack = portINITIAL_DECNT; /* DECNT. */
  211. pxTopOfStack--;
  212. *pxTopOfStack = portINITIAL_DCMR; /* DCMR. */
  213. pxTopOfStack--;
  214. *pxTopOfStack = portINITIAL_DPSW; /* DPSW. */
  215. }
  216. #elif ( configUSE_TASK_DPFPU_SUPPORT == 0 )
  217. {
  218. /* Omit DPFPU support. */
  219. }
  220. #else /* if ( configUSE_TASK_DPFPU_SUPPORT == 1 ) */
  221. {
  222. #error Invalid configUSE_TASK_DPFPU_SUPPORT setting - configUSE_TASK_DPFPU_SUPPORT must be set to 0, 1, 2, or left undefined.
  223. }
  224. #endif /* if ( configUSE_TASK_DPFPU_SUPPORT == 1 ) */
  225. return pxTopOfStack;
  226. }
  227. /*-----------------------------------------------------------*/
  228. #if ( configUSE_TASK_DPFPU_SUPPORT == 1 )
  229. void vPortTaskUsesDPFPU( void )
  230. {
  231. /* A task is registering the fact that it needs a DPFPU context. Set the
  232. * DPFPU flag (which is saved as part of the task context). */
  233. ulPortTaskHasDPFPUContext = portHAS_DPFPU_CONTEXT;
  234. }
  235. #endif /* configUSE_TASK_DPFPU_SUPPORT */
  236. /*-----------------------------------------------------------*/
  237. BaseType_t xPortStartScheduler( void )
  238. {
  239. extern void vApplicationSetupTimerInterrupt( void );
  240. /* Use pxCurrentTCB just so it does not get optimised away. */
  241. if( pxCurrentTCB != NULL )
  242. {
  243. /* Call an application function to set up the timer that will generate the
  244. * tick interrupt. This way the application can decide which peripheral to
  245. * use. A demo application is provided to show a suitable example. */
  246. vApplicationSetupTimerInterrupt();
  247. /* Enable the software interrupt. */
  248. _IEN( _ICU_SWINT ) = 1;
  249. /* Ensure the software interrupt is clear. */
  250. _IR( _ICU_SWINT ) = 0;
  251. /* Ensure the software interrupt is set to the kernel priority. */
  252. _IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY;
  253. /* Start the first task. */
  254. prvStartFirstTask();
  255. }
  256. /* Should not get here. */
  257. return pdFAIL;
  258. }
  259. /*-----------------------------------------------------------*/
  260. void vPortEndScheduler( void )
  261. {
  262. /* Not implemented in ports where there is nothing to return to.
  263. * Artificially force an assert. */
  264. configASSERT( pxCurrentTCB == NULL );
  265. /* The following line is just to prevent the symbol getting optimised away. */
  266. ( void ) vTaskSwitchContext();
  267. }
  268. /*-----------------------------------------------------------*/
  269. static void prvStartFirstTask( void )
  270. {
  271. __asm volatile
  272. (
  273. /* When starting the scheduler there is nothing that needs moving to the
  274. * interrupt stack because the function is not called from an interrupt.
  275. * Just ensure the current stack is the user stack. */
  276. "SETPSW U \n"\
  277. /* Obtain the location of the stack associated with which ever task
  278. * pxCurrentTCB is currently pointing to. */
  279. "MOV.L #_pxCurrentTCB, R15 \n"\
  280. "MOV.L [R15], R15 \n"\
  281. "MOV.L [R15], R0 \n"\
  282. /* Restore the registers from the stack of the task pointed to by
  283. * pxCurrentTCB. */
  284. #if ( configUSE_TASK_DPFPU_SUPPORT == 1 )
  285. /* The restored ulPortTaskHasDPFPUContext is to be zero here.
  286. * So, it is never necessary to restore the DPFPU context here. */
  287. "POP R15 \n"\
  288. "MOV.L #_ulPortTaskHasDPFPUContext, R14 \n"\
  289. "MOV.L R15, [R14] \n"\
  290. #elif ( configUSE_TASK_DPFPU_SUPPORT == 2 )
  291. /* Restore the DPFPU context. */
  292. "DPOPM.L DPSW-DECNT \n"\
  293. "DPOPM.D DR0-DR15 \n"\
  294. #endif /* if ( configUSE_TASK_DPFPU_SUPPORT == 1 ) */
  295. "POP R15 \n"\
  296. /* Accumulator low 32 bits. */
  297. "MVTACLO R15, A0 \n"\
  298. "POP R15 \n"\
  299. /* Accumulator high 32 bits. */
  300. "MVTACHI R15, A0 \n"\
  301. "POP R15 \n"\
  302. /* Accumulator guard. */
  303. "MVTACGU R15, A0 \n"\
  304. "POP R15 \n"\
  305. /* Accumulator low 32 bits. */
  306. "MVTACLO R15, A1 \n"\
  307. "POP R15 \n"\
  308. /* Accumulator high 32 bits. */
  309. "MVTACHI R15, A1 \n"\
  310. "POP R15 \n"\
  311. /* Accumulator guard. */
  312. "MVTACGU R15, A1 \n"\
  313. "POP R15 \n"\
  314. /* Floating point status word. */
  315. "MVTC R15, FPSW \n"\
  316. /* R1 to R15 - R0 is not included as it is the SP. */
  317. "POPM R1-R15 \n"\
  318. /* This pops the remaining registers. */
  319. "RTE \n"\
  320. "NOP \n"\
  321. "NOP \n"
  322. );
  323. }
  324. /*-----------------------------------------------------------*/
  325. #pragma vector = VECT( ICU, SWINT )
  326. __interrupt void vSoftwareInterruptISR( void )
  327. {
  328. __asm volatile
  329. (
  330. /* Re-enable interrupts. */
  331. "SETPSW I \n"\
  332. /* Move the data that was automatically pushed onto the interrupt stack when
  333. * the interrupt occurred from the interrupt stack to the user stack.
  334. *
  335. * R15 is saved before it is clobbered. */
  336. "PUSH.L R15 \n"\
  337. /* Read the user stack pointer. */
  338. "MVFC USP, R15 \n"\
  339. /* Move the address down to the data being moved. */
  340. "SUB #12, R15 \n"\
  341. "MVTC R15, USP \n"\
  342. /* Copy the data across, R15, then PC, then PSW. */
  343. "MOV.L [ R0 ], [ R15 ] \n"\
  344. "MOV.L 4[ R0 ], 4[ R15 ] \n"\
  345. "MOV.L 8[ R0 ], 8[ R15 ] \n"\
  346. /* Move the interrupt stack pointer to its new correct position. */
  347. "ADD #12, R0 \n"\
  348. /* All the rest of the registers are saved directly to the user stack. */
  349. "SETPSW U \n"\
  350. /* Save the rest of the general registers (R15 has been saved already). */
  351. "PUSHM R1-R14 \n"\
  352. /* Save the FPSW and accumulators. */
  353. "MVFC FPSW, R15 \n"\
  354. "PUSH.L R15 \n"\
  355. "MVFACGU #0, A1, R15 \n"\
  356. "PUSH.L R15 \n"\
  357. "MVFACHI #0, A1, R15 \n"\
  358. "PUSH.L R15 \n"\
  359. "MVFACLO #0, A1, R15 \n" /* Low order word. */ \
  360. "PUSH.L R15 \n"\
  361. "MVFACGU #0, A0, R15 \n"\
  362. "PUSH.L R15 \n"\
  363. "MVFACHI #0, A0, R15 \n"\
  364. "PUSH.L R15 \n"\
  365. "MVFACLO #0, A0, R15 \n" /* Low order word. */ \
  366. "PUSH.L R15 \n"\
  367. #if ( configUSE_TASK_DPFPU_SUPPORT == 1 )
  368. /* Does the task have a DPFPU context that needs saving? If
  369. * ulPortTaskHasDPFPUContext is 0 then no. */
  370. "MOV.L #_ulPortTaskHasDPFPUContext, R15 \n"\
  371. "MOV.L [R15], R15 \n"\
  372. "CMP #0, R15 \n"\
  373. /* Save the DPFPU context, if any. */
  374. "BEQ.B __lab1 \n"\
  375. "DPUSHM.D DR0-DR15 \n"\
  376. "DPUSHM.L DPSW-DECNT \n"\
  377. "__lab1: \n"\
  378. /* Save ulPortTaskHasDPFPUContext itself. */
  379. "PUSH.L R15 \n"\
  380. #elif ( configUSE_TASK_DPFPU_SUPPORT == 2 )
  381. /* Save the DPFPU context, always. */
  382. "DPUSHM.D DR0-DR15 \n"\
  383. "DPUSHM.L DPSW-DECNT \n"\
  384. #endif /* if ( configUSE_TASK_DPFPU_SUPPORT == 1 ) */
  385. /* Save the stack pointer to the TCB. */
  386. "MOV.L #_pxCurrentTCB, R15 \n"\
  387. "MOV.L [ R15 ], R15 \n"\
  388. "MOV.L R0, [ R15 ] \n"\
  389. /* Ensure the interrupt mask is set to the syscall priority while the kernel
  390. * structures are being accessed. */
  391. "MVTIPL %0 \n"\
  392. /* Select the next task to run. */
  393. "BSR.A _vTaskSwitchContext \n"\
  394. /* Reset the interrupt mask as no more data structure access is required. */
  395. "MVTIPL %1 \n"\
  396. /* Load the stack pointer of the task that is now selected as the Running
  397. * state task from its TCB. */
  398. "MOV.L #_pxCurrentTCB,R15 \n"\
  399. "MOV.L [ R15 ], R15 \n"\
  400. "MOV.L [ R15 ], R0 \n"\
  401. /* Restore the context of the new task. The PSW (Program Status Word) and
  402. * PC will be popped by the RTE instruction. */
  403. #if ( configUSE_TASK_DPFPU_SUPPORT == 1 )
  404. /* Is there a DPFPU context to restore? If the restored
  405. * ulPortTaskHasDPFPUContext is zero then no. */
  406. "POP R15 \n"\
  407. "MOV.L #_ulPortTaskHasDPFPUContext, R14 \n"\
  408. "MOV.L R15, [R14] \n"\
  409. "CMP #0, R15 \n"\
  410. /* Restore the DPFPU context, if any. */
  411. "BEQ.B __lab2 \n"\
  412. "DPOPM.L DPSW-DECNT \n"\
  413. "DPOPM.D DR0-DR15 \n"\
  414. "__lab2: \n"\
  415. #elif ( configUSE_TASK_DPFPU_SUPPORT == 2 )
  416. /* Restore the DPFPU context, always. */
  417. "DPOPM.L DPSW-DECNT \n"\
  418. "DPOPM.D DR0-DR15 \n"\
  419. #endif /* if( configUSE_TASK_DPFPU_SUPPORT == 1 ) */
  420. "POP R15 \n"\
  421. /* Accumulator low 32 bits. */
  422. "MVTACLO R15, A0 \n"\
  423. "POP R15 \n"\
  424. /* Accumulator high 32 bits. */
  425. "MVTACHI R15, A0 \n"\
  426. "POP R15 \n"\
  427. /* Accumulator guard. */
  428. "MVTACGU R15, A0 \n"\
  429. "POP R15 \n"\
  430. /* Accumulator low 32 bits. */
  431. "MVTACLO R15, A1 \n"\
  432. "POP R15 \n"\
  433. /* Accumulator high 32 bits. */
  434. "MVTACHI R15, A1 \n"\
  435. "POP R15 \n"\
  436. /* Accumulator guard. */
  437. "MVTACGU R15, A1 \n"\
  438. "POP R15 \n"\
  439. "MVTC R15, FPSW \n"\
  440. "POPM R1-R15 \n"\
  441. "RTE \n"\
  442. "NOP \n"\
  443. "NOP "
  444. portCDT_NO_PARSE( :: ) "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ), "i" ( configKERNEL_INTERRUPT_PRIORITY )
  445. );
  446. }
  447. /*-----------------------------------------------------------*/
  448. #pragma vector = _VECT( configTICK_VECTOR )
  449. __interrupt void vTickISR( void )
  450. {
  451. /* Re-enable interrupts. */
  452. __enable_interrupt();
  453. /* Increment the tick, and perform any processing the new tick value
  454. * necessitates. Ensure IPL is at the max syscall value first. */
  455. __set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY );
  456. {
  457. if( xTaskIncrementTick() != pdFALSE )
  458. {
  459. taskYIELD();
  460. }
  461. }
  462. __set_interrupt_level( configKERNEL_INTERRUPT_PRIORITY );
  463. }
  464. /*-----------------------------------------------------------*/