]> git.sur5r.net Git - freertos/blob - FreeRTOS/Source/portable/IAR/78K0R/portasm.s26
Update version number ready for next release.
[freertos] / FreeRTOS / Source / portable / IAR / 78K0R / portasm.s26
1 ;/*\r
2 ; * FreeRTOS Kernel V10.2.1\r
3 ; * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4 ; *\r
5 ; * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6 ; * this software and associated documentation files (the "Software"), to deal in\r
7 ; * the Software without restriction, including without limitation the rights to\r
8 ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9 ; * the Software, and to permit persons to whom the Software is furnished to do so,\r
10 ; * subject to the following conditions:\r
11 ; *\r
12 ; * The above copyright notice and this permission notice shall be included in all\r
13 ; * copies or substantial portions of the Software.\r
14 ; *\r
15 ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16 ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17 ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18 ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19 ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20 ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21 ; *\r
22 ; * http://www.FreeRTOS.org\r
23 ; * http://aws.amazon.com/freertos\r
24 ; *\r
25 ; * 1 tab == 4 spaces!\r
26 ; */\r
27 \r
28 #include "ISR_Support.h"\r
29 ;------------------------------------------------------------------------------\r
30 \r
31 #if __CORE__ != __78K0R__\r
32         #error "This file is only for 78K0R Devices"\r
33 #endif\r
34 \r
35 #define CS                    0xFFFFC\r
36 #define ES                    0xFFFFD\r
37 \r
38 ; Functions implemented in this file\r
39 ;------------------------------------------------------------------------------\r
40         PUBLIC    vPortYield\r
41         PUBLIC    vPortStart\r
42 \r
43 ; Functions used by scheduler\r
44 ;------------------------------------------------------------------------------\r
45         EXTERN    vTaskSwitchContext\r
46         EXTERN    xTaskIncrementTick\r
47 \r
48 ; Tick ISR Prototype\r
49 ;------------------------------------------------------------------------------\r
50 ;       EXTERN    ?CL78K0R_V2_L00\r
51 \r
52         PUBWEAK   `??MD_INTTM05??INTVEC 68`\r
53         PUBLIC    MD_INTTM05\r
54 \r
55 MD_INTTM05    SYMBOL "MD_INTTM05"\r
56 `??MD_INTTM05??INTVEC 68` SYMBOL "??INTVEC 68", MD_INTTM05\r
57 \r
58 \r
59 \r
60 ;------------------------------------------------------------------------------\r
61 ;   Yield to another task.  Implemented as a software interrupt.  The return\r
62 ;   address and PSW will have been saved to the stack automatically before\r
63 ;   this code runs.\r
64 ;\r
65 ;   Input:  NONE\r
66 ;\r
67 ;   Call:   CALL    vPortYield\r
68 ;\r
69 ;   Output: NONE\r
70 ;\r
71 ;------------------------------------------------------------------------------\r
72     RSEG CODE:CODE\r
73 vPortYield:\r
74         portSAVE_CONTEXT                        ; Save the context of the current task.\r
75         call      vTaskSwitchContext    ; Call the scheduler to select the next task.\r
76         portRESTORE_CONTEXT                     ; Restore the context of the next task to run.\r
77         retb\r
78 \r
79 \r
80 ;------------------------------------------------------------------------------\r
81 ;   Restore the context of the first task that is going to run.\r
82 ;\r
83 ;   Input:  NONE\r
84 ;\r
85 ;   Call:   CALL    vPortStart\r
86 ;\r
87 ;   Output: NONE\r
88 ;\r
89 ;------------------------------------------------------------------------------\r
90     RSEG CODE:CODE\r
91 vPortStart:\r
92         portRESTORE_CONTEXT                 ; Restore the context of whichever task the ...\r
93         reti                                            ; An interrupt stack frame is used so the task\r
94                                     ; is started using a RETI instruction.\r
95 \r
96 ;------------------------------------------------------------------------------\r
97 ;   Perform the necessary steps of the Tick Count Increment and Task Switch\r
98 ;   depending on the chosen kernel configuration\r
99 ;\r
100 ;   Input:  NONE\r
101 ;\r
102 ;   Call:   ISR\r
103 ;\r
104 ;   Output: NONE\r
105 ;\r
106 ;------------------------------------------------------------------------------\r
107 \r
108 MD_INTTM05:\r
109 \r
110         portSAVE_CONTEXT                        ; Save the context of the current task.\r
111         call      xTaskIncrementTick    ; Call the timer tick function.\r
112 #if configUSE_PREEMPTION == 1\r
113         call      vTaskSwitchContext    ; Call the scheduler to select the next task.\r
114 #endif\r
115         portRESTORE_CONTEXT                     ; Restore the context of the next task to run.\r
116         reti\r
117 \r
118 \r
119 \r
120 ;       REQUIRE ?CL78K0R_V2_L00\r
121         COMMON INTVEC:CODE:ROOT(1)      ; Set ISR location to the Interrupt vector table.\r
122         ORG 68\r
123 `??MD_INTTM05??INTVEC 68`:\r
124         DW MD_INTTM05\r
125 \r
126         COMMON INTVEC:CODE:ROOT(1)      ; Set ISR location to the Interrupt vector table.\r
127         ORG 126\r
128 `??vPortYield??INTVEC 126`:\r
129         DW vPortYield\r
130 \r
131                                                                         ; Set value for the usCriticalNesting.\r
132         RSEG NEAR_ID:CONST:SORT:NOROOT(1)\r
133 `?<Initializer for usCriticalNesting>`:\r
134         DW 10\r
135 \r
136 ;#endif\r
137 \r
138       END