1 |
/* |
---|
2 |
FreeRTOS V5.4.1 - Copyright (C) 2009 Real Time Engineers Ltd. |
---|
3 |
|
---|
4 |
This file is part of the FreeRTOS distribution. |
---|
5 |
|
---|
6 |
FreeRTOS is free software; you can redistribute it and/or modify it under |
---|
7 |
the terms of the GNU General Public License (version 2) as published by the |
---|
8 |
Free Software Foundation and modified by the FreeRTOS exception. |
---|
9 |
**NOTE** The exception to the GPL is included to allow you to distribute a |
---|
10 |
combined work that includes FreeRTOS without being obliged to provide the |
---|
11 |
source code for proprietary components outside of the FreeRTOS kernel. |
---|
12 |
Alternative commercial license and support terms are also available upon |
---|
13 |
request. See the licensing section of http://www.FreeRTOS.org for full |
---|
14 |
license details. |
---|
15 |
|
---|
16 |
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT |
---|
17 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
18 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
19 |
more details. |
---|
20 |
|
---|
21 |
You should have received a copy of the GNU General Public License along |
---|
22 |
with FreeRTOS; if not, write to the Free Software Foundation, Inc., 59 |
---|
23 |
Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
---|
24 |
|
---|
25 |
|
---|
26 |
*************************************************************************** |
---|
27 |
* * |
---|
28 |
* Looking for a quick start? Then check out the FreeRTOS eBook! * |
---|
29 |
* See http://www.FreeRTOS.org/Documentation for details * |
---|
30 |
* * |
---|
31 |
*************************************************************************** |
---|
32 |
|
---|
33 |
1 tab == 4 spaces! |
---|
34 |
|
---|
35 |
Please ensure to read the configuration and relevant port sections of the |
---|
36 |
online documentation. |
---|
37 |
|
---|
38 |
http://www.FreeRTOS.org - Documentation, latest information, license and |
---|
39 |
contact details. |
---|
40 |
|
---|
41 |
http://www.SafeRTOS.com - A version that is certified for use in safety |
---|
42 |
critical systems. |
---|
43 |
|
---|
44 |
http://www.OpenRTOS.com - Commercial support, development, porting, |
---|
45 |
licensing and training services. |
---|
46 |
*/ |
---|
47 |
|
---|
48 |
#include "FreeRTOSConfig.h" |
---|
49 |
#include "portasm.h" |
---|
50 |
|
---|
51 |
|
---|
52 |
.CODE |
---|
53 |
|
---|
54 |
/* |
---|
55 |
* The RTOS tick ISR. |
---|
56 |
* |
---|
57 |
* If the cooperative scheduler is in use this simply increments the tick |
---|
58 |
* count. |
---|
59 |
* |
---|
60 |
* If the preemptive scheduler is in use a context switch can also occur. |
---|
61 |
*/ |
---|
62 |
_vTickISR: |
---|
63 |
portSAVE_CONTEXT |
---|
64 |
|
---|
65 |
call #_vTaskIncrementTick |
---|
66 |
|
---|
67 |
#if configUSE_PREEMPTION == 1 |
---|
68 |
call #_vTaskSwitchContext |
---|
69 |
#endif |
---|
70 |
|
---|
71 |
portRESTORE_CONTEXT |
---|
72 |
/*-----------------------------------------------------------*/ |
---|
73 |
|
---|
74 |
|
---|
75 |
/* |
---|
76 |
* Manual context switch called by the portYIELD() macro. |
---|
77 |
*/ |
---|
78 |
_vPortYield:: |
---|
79 |
|
---|
80 |
/* Mimic an interrupt by pushing the SR. */ |
---|
81 |
push SR |
---|
82 |
|
---|
83 |
/* Now the SR is stacked we can disable interrupts. */ |
---|
84 |
dint |
---|
85 |
|
---|
86 |
/* Save the context of the current task. */ |
---|
87 |
portSAVE_CONTEXT |
---|
88 |
|
---|
89 |
/* Switch to the highest priority task that is ready to run. */ |
---|
90 |
call #_vTaskSwitchContext |
---|
91 |
|
---|
92 |
/* Restore the context of the new task. */ |
---|
93 |
portRESTORE_CONTEXT |
---|
94 |
/*-----------------------------------------------------------*/ |
---|
95 |
|
---|
96 |
|
---|
97 |
/* |
---|
98 |
* Start off the scheduler by initialising the RTOS tick timer, then restoring |
---|
99 |
* the context of the first task. |
---|
100 |
*/ |
---|
101 |
_xPortStartScheduler:: |
---|
102 |
|
---|
103 |
/* Setup the hardware to generate the tick. Interrupts are disabled |
---|
104 |
when this function is called. */ |
---|
105 |
call #_prvSetupTimerInterrupt |
---|
106 |
|
---|
107 |
/* Restore the context of the first task that is going to run. */ |
---|
108 |
portRESTORE_CONTEXT |
---|
109 |
/*-----------------------------------------------------------*/ |
---|
110 |
|
---|
111 |
|
---|
112 |
/* Place the tick ISR in the correct vector. */ |
---|
113 |
.VECTORS |
---|
114 |
|
---|
115 |
.KEEP |
---|
116 |
|
---|
117 |
ORG TIMERA0_VECTOR |
---|
118 |
DW _vTickISR |
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 |
END |
---|
123 |
|
---|