+++ /dev/null
-/*\r
- * FreeRTOS Kernel V10.0.0\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software. If you wish to use our Amazon\r
- * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://www.FreeRTOS.org\r
- * http://aws.amazon.com/freertos\r
- *\r
- * 1 tab == 4 spaces!\r
- */\r
-\r
-/*-----------------------------------------------------------\r
- * Implementation of functions defined in portable.h for the ARM CM4F port.\r
- *----------------------------------------------------------*/\r
-\r
-/* Scheduler includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-\r
-/*\r
- * Start first task is a separate function so it can be tested in isolation.\r
- */\r
-void vPortStartFirstTask( void ) __attribute__ (( naked ));\r
-\r
-/*\r
- * Exception handlers.\r
- */\r
-void vPortSVCHandler( void ) __attribute__ (( naked ));\r
-void xPortPendSVHandler( void ) __attribute__ (( naked ));\r
-\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-void vPortStartFirstTask( void )\r
-{\r
- __asm volatile(\r
-#if defined(__SES_ARM)\r
- " ldr r0, =_vectors \n" /* Locate the stack using _vectors table. */\r
-#else\r
- " ldr r0, =__isr_vector \n" /* Locate the stack using __isr_vector table. */\r
-#endif\r
- " ldr r0, [r0] \n"\r
- " msr msp, r0 \n" /* Set the msp back to the start of the stack. */\r
- " cpsie i \n" /* Globally enable interrupts. */\r
- " cpsie f \n"\r
- " dsb \n"\r
- " isb \n"\r
-#ifdef SOFTDEVICE_PRESENT\r
- /* Block kernel interrupts only (PendSV) before calling SVC */\r
- " mov r0, %0 \n"\r
- " msr basepri, r0 \n"\r
-#endif\r
- " svc 0 \n" /* System call to start first task. */\r
- " \n"\r
- " .align 2 \n"\r
-#ifdef SOFTDEVICE_PRESENT\r
- ::"i"(configKERNEL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))\r
-#endif\r
- );\r
-}\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-void vPortSVCHandler( void )\r
-{\r
- __asm volatile (\r
- " ldr r3, =pxCurrentTCB \n" /* Restore the context. */\r
- " ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */\r
- " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */\r
- " ldmia r0!, {r4-r11, r14} \n" /* Pop the registers that are not automatically saved on exception entry and the critical nesting count. */\r
- " msr psp, r0 \n" /* Restore the task stack pointer. */\r
- " isb \n"\r
- " mov r0, #0 \n"\r
- " msr basepri, r0 \n"\r
- " bx r14 \n"\r
- " \n"\r
- " .align 2 \n"\r
- );\r
-}\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-void xPortPendSVHandler( void )\r
-{\r
- /* This is a naked function. */\r
-\r
- __asm volatile\r
- (\r
- " mrs r0, psp \n"\r
- " isb \n"\r
- " \n"\r
- " ldr r3, =pxCurrentTCB \n" /* Get the location of the current TCB. */\r
- " ldr r2, [r3] \n"\r
- " \n"\r
- " tst r14, #0x10 \n" /* Is the task using the FPU context? If so, push high vfp registers. */\r
- " it eq \n"\r
- " vstmdbeq r0!, {s16-s31} \n"\r
- " \n"\r
- " stmdb r0!, {r4-r11, r14} \n" /* Save the core registers. */\r
- " \n"\r
- " str r0, [r2] \n" /* Save the new top of stack into the first member of the TCB. */\r
- " \n"\r
- " stmdb sp!, {r3} \n"\r
- " mov r0, %0 \n"\r
- " msr basepri, r0 \n"\r
- " dsb \n"\r
- " isb \n"\r
- " bl vTaskSwitchContext \n"\r
- " mov r0, #0 \n"\r
- " msr basepri, r0 \n"\r
- " ldmia sp!, {r3} \n"\r
- " \n"\r
- " ldr r1, [r3] \n" /* The first item in pxCurrentTCB is the task top of stack. */\r
- " ldr r0, [r1] \n"\r
- " \n"\r
- " ldmia r0!, {r4-r11, r14} \n" /* Pop the core registers. */\r
- " \n"\r
- " tst r14, #0x10 \n" /* Is the task using the FPU context? If so, pop the high vfp registers too. */\r
- " it eq \n"\r
- " vldmiaeq r0!, {s16-s31} \n"\r
- " \n"\r
- " msr psp, r0 \n"\r
- " isb \n"\r
- " \n"\r
- " \n"\r
- " bx r14 \n"\r
- " \n"\r
- " .align 2 \n"\r
- ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))\r
- );\r
-}\r