2 * FreeRTOS SMP Kernel V202110.00
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 * https://www.FreeRTOS.org
23 * https://github.com/FreeRTOS
27 #include "FreeRTOSConfig.h"
30 IMPORT xTaskIncrementTick
31 IMPORT vTaskSwitchContext
32 IMPORT vPortSetupTimerInterrupt
36 EXPORT xPortStartScheduler
43 * If the cooperative scheduler is in use this simply increments the tick
46 * If the preemptive scheduler is in use a context switch can also occur.
51 call #xTaskIncrementTick
54 call #vTaskSwitchContext
58 /*-----------------------------------------------------------*/
62 * Manual context switch called by the portYIELD() macro.
66 /* Mimic an interrupt by pushing the SR. */
69 /* Now the SR is stacked we can disable interrupts. */
72 /* Save the context of the current task. */
75 /* Switch to the highest priority task that is ready to run. */
76 call #vTaskSwitchContext
78 /* Restore the context of the new task. */
80 /*-----------------------------------------------------------*/
84 * Start off the scheduler by initialising the RTOS tick timer, then restoring
85 * the context of the first task.
89 /* Setup the hardware to generate the tick. Interrupts are disabled
90 when this function is called. */
91 call #vPortSetupTimerInterrupt
93 /* Restore the context of the first task that is going to run. */
95 /*-----------------------------------------------------------*/
98 /* Install vTickISR as the timer A0 interrupt. */
100 ORG 0xFFE0 + TIMERA0_VECTOR
102 _vTickISR_: DC16 vTickISR