Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/rtos/rt_System.c@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file rt_System.c |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #include "rt_TypeDef.h" |
Pawel Zarembski |
0:01f31e923fe2 | 23 | #include "RTX_Config.h" |
Pawel Zarembski |
0:01f31e923fe2 | 24 | #include "rt_Task.h" |
Pawel Zarembski |
0:01f31e923fe2 | 25 | #include "rt_System.h" |
Pawel Zarembski |
0:01f31e923fe2 | 26 | #include "rt_Event.h" |
Pawel Zarembski |
0:01f31e923fe2 | 27 | #include "rt_List.h" |
Pawel Zarembski |
0:01f31e923fe2 | 28 | #include "rt_Mailbox.h" |
Pawel Zarembski |
0:01f31e923fe2 | 29 | #include "rt_Semaphore.h" |
Pawel Zarembski |
0:01f31e923fe2 | 30 | #include "rt_Time.h" |
Pawel Zarembski |
0:01f31e923fe2 | 31 | #include "rt_Timer.h" |
Pawel Zarembski |
0:01f31e923fe2 | 32 | #include "rt_Robin.h" |
Pawel Zarembski |
0:01f31e923fe2 | 33 | #include "rt_HAL_CM.h" |
Pawel Zarembski |
0:01f31e923fe2 | 34 | |
Pawel Zarembski |
0:01f31e923fe2 | 35 | /*---------------------------------------------------------------------------- |
Pawel Zarembski |
0:01f31e923fe2 | 36 | * Global Variables |
Pawel Zarembski |
0:01f31e923fe2 | 37 | *---------------------------------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 38 | |
Pawel Zarembski |
0:01f31e923fe2 | 39 | int os_tick_irqn; |
Pawel Zarembski |
0:01f31e923fe2 | 40 | |
Pawel Zarembski |
0:01f31e923fe2 | 41 | /*---------------------------------------------------------------------------- |
Pawel Zarembski |
0:01f31e923fe2 | 42 | * Local Variables |
Pawel Zarembski |
0:01f31e923fe2 | 43 | *---------------------------------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 44 | |
Pawel Zarembski |
0:01f31e923fe2 | 45 | static volatile BIT os_lock; |
Pawel Zarembski |
0:01f31e923fe2 | 46 | static volatile BIT os_psh_flag; |
Pawel Zarembski |
0:01f31e923fe2 | 47 | static U8 pend_flags; |
Pawel Zarembski |
0:01f31e923fe2 | 48 | |
Pawel Zarembski |
0:01f31e923fe2 | 49 | /*---------------------------------------------------------------------------- |
Pawel Zarembski |
0:01f31e923fe2 | 50 | * Global Functions |
Pawel Zarembski |
0:01f31e923fe2 | 51 | *---------------------------------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 52 | |
Pawel Zarembski |
0:01f31e923fe2 | 53 | __asm void $$RTX$$version (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 54 | /* Export a version number symbol for a version control. */ |
Pawel Zarembski |
0:01f31e923fe2 | 55 | |
Pawel Zarembski |
0:01f31e923fe2 | 56 | EXPORT __RL_RTX_VER |
Pawel Zarembski |
0:01f31e923fe2 | 57 | |
Pawel Zarembski |
0:01f31e923fe2 | 58 | __RL_RTX_VER EQU 0x470 |
Pawel Zarembski |
0:01f31e923fe2 | 59 | } |
Pawel Zarembski |
0:01f31e923fe2 | 60 | |
Pawel Zarembski |
0:01f31e923fe2 | 61 | |
Pawel Zarembski |
0:01f31e923fe2 | 62 | /*--------------------------- rt_suspend ------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 63 | |
Pawel Zarembski |
0:01f31e923fe2 | 64 | U32 rt_suspend (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 65 | /* Suspend OS scheduler */ |
Pawel Zarembski |
0:01f31e923fe2 | 66 | U32 delta = 0xFFFF; |
Pawel Zarembski |
0:01f31e923fe2 | 67 | |
Pawel Zarembski |
0:01f31e923fe2 | 68 | rt_tsk_lock(); |
Pawel Zarembski |
0:01f31e923fe2 | 69 | |
Pawel Zarembski |
0:01f31e923fe2 | 70 | if (os_dly.p_dlnk) { |
Pawel Zarembski |
0:01f31e923fe2 | 71 | delta = os_dly.delta_time; |
Pawel Zarembski |
0:01f31e923fe2 | 72 | } |
Pawel Zarembski |
0:01f31e923fe2 | 73 | if (os_tmr.next) { |
Pawel Zarembski |
0:01f31e923fe2 | 74 | if (os_tmr.tcnt < delta) delta = os_tmr.tcnt; |
Pawel Zarembski |
0:01f31e923fe2 | 75 | } |
Pawel Zarembski |
0:01f31e923fe2 | 76 | |
Pawel Zarembski |
0:01f31e923fe2 | 77 | return (delta); |
Pawel Zarembski |
0:01f31e923fe2 | 78 | } |
Pawel Zarembski |
0:01f31e923fe2 | 79 | |
Pawel Zarembski |
0:01f31e923fe2 | 80 | |
Pawel Zarembski |
0:01f31e923fe2 | 81 | /*--------------------------- rt_resume -------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 82 | |
Pawel Zarembski |
0:01f31e923fe2 | 83 | void rt_resume (U32 sleep_time) { |
Pawel Zarembski |
0:01f31e923fe2 | 84 | /* Resume OS scheduler after suspend */ |
Pawel Zarembski |
0:01f31e923fe2 | 85 | P_TCB next; |
Pawel Zarembski |
0:01f31e923fe2 | 86 | U32 delta; |
Pawel Zarembski |
0:01f31e923fe2 | 87 | |
Pawel Zarembski |
0:01f31e923fe2 | 88 | os_tsk.run->state = READY; |
Pawel Zarembski |
0:01f31e923fe2 | 89 | rt_put_rdy_first (os_tsk.run); |
Pawel Zarembski |
0:01f31e923fe2 | 90 | |
Pawel Zarembski |
0:01f31e923fe2 | 91 | os_robin.task = NULL; |
Pawel Zarembski |
0:01f31e923fe2 | 92 | |
Pawel Zarembski |
0:01f31e923fe2 | 93 | /* Update delays. */ |
Pawel Zarembski |
0:01f31e923fe2 | 94 | if (os_dly.p_dlnk) { |
Pawel Zarembski |
0:01f31e923fe2 | 95 | delta = sleep_time; |
Pawel Zarembski |
0:01f31e923fe2 | 96 | if (delta >= os_dly.delta_time) { |
Pawel Zarembski |
0:01f31e923fe2 | 97 | delta -= os_dly.delta_time; |
Pawel Zarembski |
0:01f31e923fe2 | 98 | os_time += os_dly.delta_time; |
Pawel Zarembski |
0:01f31e923fe2 | 99 | os_dly.delta_time = 1; |
Pawel Zarembski |
0:01f31e923fe2 | 100 | while (os_dly.p_dlnk) { |
Pawel Zarembski |
0:01f31e923fe2 | 101 | rt_dec_dly(); |
Pawel Zarembski |
0:01f31e923fe2 | 102 | if (delta == 0) break; |
Pawel Zarembski |
0:01f31e923fe2 | 103 | delta--; |
Pawel Zarembski |
0:01f31e923fe2 | 104 | os_time++; |
Pawel Zarembski |
0:01f31e923fe2 | 105 | } |
Pawel Zarembski |
0:01f31e923fe2 | 106 | } else { |
Pawel Zarembski |
0:01f31e923fe2 | 107 | os_time += delta; |
Pawel Zarembski |
0:01f31e923fe2 | 108 | os_dly.delta_time -= delta; |
Pawel Zarembski |
0:01f31e923fe2 | 109 | } |
Pawel Zarembski |
0:01f31e923fe2 | 110 | } else { |
Pawel Zarembski |
0:01f31e923fe2 | 111 | os_time += sleep_time; |
Pawel Zarembski |
0:01f31e923fe2 | 112 | } |
Pawel Zarembski |
0:01f31e923fe2 | 113 | |
Pawel Zarembski |
0:01f31e923fe2 | 114 | /* Check the user timers. */ |
Pawel Zarembski |
0:01f31e923fe2 | 115 | if (os_tmr.next) { |
Pawel Zarembski |
0:01f31e923fe2 | 116 | delta = sleep_time; |
Pawel Zarembski |
0:01f31e923fe2 | 117 | if (delta >= os_tmr.tcnt) { |
Pawel Zarembski |
0:01f31e923fe2 | 118 | delta -= os_tmr.tcnt; |
Pawel Zarembski |
0:01f31e923fe2 | 119 | os_tmr.tcnt = 1; |
Pawel Zarembski |
0:01f31e923fe2 | 120 | while (os_tmr.next) { |
Pawel Zarembski |
0:01f31e923fe2 | 121 | rt_tmr_tick(); |
Pawel Zarembski |
0:01f31e923fe2 | 122 | if (delta == 0) break; |
Pawel Zarembski |
0:01f31e923fe2 | 123 | delta--; |
Pawel Zarembski |
0:01f31e923fe2 | 124 | } |
Pawel Zarembski |
0:01f31e923fe2 | 125 | } else { |
Pawel Zarembski |
0:01f31e923fe2 | 126 | os_tmr.tcnt -= delta; |
Pawel Zarembski |
0:01f31e923fe2 | 127 | } |
Pawel Zarembski |
0:01f31e923fe2 | 128 | } |
Pawel Zarembski |
0:01f31e923fe2 | 129 | |
Pawel Zarembski |
0:01f31e923fe2 | 130 | /* Switch back to highest ready task */ |
Pawel Zarembski |
0:01f31e923fe2 | 131 | next = rt_get_first (&os_rdy); |
Pawel Zarembski |
0:01f31e923fe2 | 132 | rt_switch_req (next); |
Pawel Zarembski |
0:01f31e923fe2 | 133 | |
Pawel Zarembski |
0:01f31e923fe2 | 134 | rt_tsk_unlock(); |
Pawel Zarembski |
0:01f31e923fe2 | 135 | } |
Pawel Zarembski |
0:01f31e923fe2 | 136 | |
Pawel Zarembski |
0:01f31e923fe2 | 137 | |
Pawel Zarembski |
0:01f31e923fe2 | 138 | /*--------------------------- rt_tsk_lock -----------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 139 | |
Pawel Zarembski |
0:01f31e923fe2 | 140 | void rt_tsk_lock (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 141 | /* Prevent task switching by locking out scheduler */ |
Pawel Zarembski |
0:01f31e923fe2 | 142 | if (os_tick_irqn < 0) { |
Pawel Zarembski |
0:01f31e923fe2 | 143 | OS_LOCK(); |
Pawel Zarembski |
0:01f31e923fe2 | 144 | os_lock = __TRUE; |
Pawel Zarembski |
0:01f31e923fe2 | 145 | OS_UNPEND (&pend_flags); |
Pawel Zarembski |
0:01f31e923fe2 | 146 | } else { |
Pawel Zarembski |
0:01f31e923fe2 | 147 | OS_X_LOCK(os_tick_irqn); |
Pawel Zarembski |
0:01f31e923fe2 | 148 | os_lock = __TRUE; |
Pawel Zarembski |
0:01f31e923fe2 | 149 | OS_X_UNPEND (&pend_flags); |
Pawel Zarembski |
0:01f31e923fe2 | 150 | } |
Pawel Zarembski |
0:01f31e923fe2 | 151 | } |
Pawel Zarembski |
0:01f31e923fe2 | 152 | |
Pawel Zarembski |
0:01f31e923fe2 | 153 | |
Pawel Zarembski |
0:01f31e923fe2 | 154 | /*--------------------------- rt_tsk_unlock ---------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 155 | |
Pawel Zarembski |
0:01f31e923fe2 | 156 | void rt_tsk_unlock (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 157 | /* Unlock scheduler and re-enable task switching */ |
Pawel Zarembski |
0:01f31e923fe2 | 158 | if (os_tick_irqn < 0) { |
Pawel Zarembski |
0:01f31e923fe2 | 159 | OS_UNLOCK(); |
Pawel Zarembski |
0:01f31e923fe2 | 160 | os_lock = __FALSE; |
Pawel Zarembski |
0:01f31e923fe2 | 161 | OS_PEND (pend_flags, os_psh_flag); |
Pawel Zarembski |
0:01f31e923fe2 | 162 | os_psh_flag = __FALSE; |
Pawel Zarembski |
0:01f31e923fe2 | 163 | } else { |
Pawel Zarembski |
0:01f31e923fe2 | 164 | OS_X_UNLOCK(os_tick_irqn); |
Pawel Zarembski |
0:01f31e923fe2 | 165 | os_lock = __FALSE; |
Pawel Zarembski |
0:01f31e923fe2 | 166 | OS_X_PEND (pend_flags, os_psh_flag); |
Pawel Zarembski |
0:01f31e923fe2 | 167 | os_psh_flag = __FALSE; |
Pawel Zarembski |
0:01f31e923fe2 | 168 | } |
Pawel Zarembski |
0:01f31e923fe2 | 169 | } |
Pawel Zarembski |
0:01f31e923fe2 | 170 | |
Pawel Zarembski |
0:01f31e923fe2 | 171 | |
Pawel Zarembski |
0:01f31e923fe2 | 172 | /*--------------------------- rt_psh_req ------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 173 | |
Pawel Zarembski |
0:01f31e923fe2 | 174 | void rt_psh_req (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 175 | /* Initiate a post service handling request if required. */ |
Pawel Zarembski |
0:01f31e923fe2 | 176 | if (os_lock == __FALSE) { |
Pawel Zarembski |
0:01f31e923fe2 | 177 | OS_PEND_IRQ (); |
Pawel Zarembski |
0:01f31e923fe2 | 178 | } |
Pawel Zarembski |
0:01f31e923fe2 | 179 | else { |
Pawel Zarembski |
0:01f31e923fe2 | 180 | os_psh_flag = __TRUE; |
Pawel Zarembski |
0:01f31e923fe2 | 181 | } |
Pawel Zarembski |
0:01f31e923fe2 | 182 | } |
Pawel Zarembski |
0:01f31e923fe2 | 183 | |
Pawel Zarembski |
0:01f31e923fe2 | 184 | |
Pawel Zarembski |
0:01f31e923fe2 | 185 | /*--------------------------- rt_pop_req ------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 186 | |
Pawel Zarembski |
0:01f31e923fe2 | 187 | void rt_pop_req (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 188 | /* Process an ISR post service requests. */ |
Pawel Zarembski |
0:01f31e923fe2 | 189 | struct OS_XCB *p_CB; |
Pawel Zarembski |
0:01f31e923fe2 | 190 | P_TCB next; |
Pawel Zarembski |
0:01f31e923fe2 | 191 | U32 idx; |
Pawel Zarembski |
0:01f31e923fe2 | 192 | |
Pawel Zarembski |
0:01f31e923fe2 | 193 | os_tsk.run->state = READY; |
Pawel Zarembski |
0:01f31e923fe2 | 194 | rt_put_rdy_first (os_tsk.run); |
Pawel Zarembski |
0:01f31e923fe2 | 195 | |
Pawel Zarembski |
0:01f31e923fe2 | 196 | idx = os_psq->last; |
Pawel Zarembski |
0:01f31e923fe2 | 197 | while (os_psq->count) { |
Pawel Zarembski |
0:01f31e923fe2 | 198 | p_CB = os_psq->q[idx].id; |
Pawel Zarembski |
0:01f31e923fe2 | 199 | if (p_CB->cb_type == TCB) { |
Pawel Zarembski |
0:01f31e923fe2 | 200 | /* Is of TCB type */ |
Pawel Zarembski |
0:01f31e923fe2 | 201 | rt_evt_psh ((P_TCB)p_CB, (U16)os_psq->q[idx].arg); |
Pawel Zarembski |
0:01f31e923fe2 | 202 | } |
Pawel Zarembski |
0:01f31e923fe2 | 203 | else if (p_CB->cb_type == MCB) { |
Pawel Zarembski |
0:01f31e923fe2 | 204 | /* Is of MCB type */ |
Pawel Zarembski |
0:01f31e923fe2 | 205 | rt_mbx_psh ((P_MCB)p_CB, (void *)os_psq->q[idx].arg); |
Pawel Zarembski |
0:01f31e923fe2 | 206 | } |
Pawel Zarembski |
0:01f31e923fe2 | 207 | else { |
Pawel Zarembski |
0:01f31e923fe2 | 208 | /* Must be of SCB type */ |
Pawel Zarembski |
0:01f31e923fe2 | 209 | rt_sem_psh ((P_SCB)p_CB); |
Pawel Zarembski |
0:01f31e923fe2 | 210 | } |
Pawel Zarembski |
0:01f31e923fe2 | 211 | if (++idx == os_psq->size) idx = 0; |
Pawel Zarembski |
0:01f31e923fe2 | 212 | rt_dec (&os_psq->count); |
Pawel Zarembski |
0:01f31e923fe2 | 213 | } |
Pawel Zarembski |
0:01f31e923fe2 | 214 | os_psq->last = idx; |
Pawel Zarembski |
0:01f31e923fe2 | 215 | |
Pawel Zarembski |
0:01f31e923fe2 | 216 | next = rt_get_first (&os_rdy); |
Pawel Zarembski |
0:01f31e923fe2 | 217 | rt_switch_req (next); |
Pawel Zarembski |
0:01f31e923fe2 | 218 | } |
Pawel Zarembski |
0:01f31e923fe2 | 219 | |
Pawel Zarembski |
0:01f31e923fe2 | 220 | |
Pawel Zarembski |
0:01f31e923fe2 | 221 | /*--------------------------- os_tick_init ----------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 222 | |
Pawel Zarembski |
0:01f31e923fe2 | 223 | __weak int os_tick_init (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 224 | /* Initialize SysTick timer as system tick timer. */ |
Pawel Zarembski |
0:01f31e923fe2 | 225 | rt_systick_init (); |
Pawel Zarembski |
0:01f31e923fe2 | 226 | return (-1); /* Return IRQ number of SysTick timer */ |
Pawel Zarembski |
0:01f31e923fe2 | 227 | } |
Pawel Zarembski |
0:01f31e923fe2 | 228 | |
Pawel Zarembski |
0:01f31e923fe2 | 229 | |
Pawel Zarembski |
0:01f31e923fe2 | 230 | /*--------------------------- os_tick_irqack --------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 231 | |
Pawel Zarembski |
0:01f31e923fe2 | 232 | __weak void os_tick_irqack (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 233 | /* Acknowledge timer interrupt. */ |
Pawel Zarembski |
0:01f31e923fe2 | 234 | } |
Pawel Zarembski |
0:01f31e923fe2 | 235 | |
Pawel Zarembski |
0:01f31e923fe2 | 236 | |
Pawel Zarembski |
0:01f31e923fe2 | 237 | /*--------------------------- rt_systick ------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 238 | |
Pawel Zarembski |
0:01f31e923fe2 | 239 | void rt_systick (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 240 | /* Check for system clock update, suspend running task. */ |
Pawel Zarembski |
0:01f31e923fe2 | 241 | P_TCB next; |
Pawel Zarembski |
0:01f31e923fe2 | 242 | |
Pawel Zarembski |
0:01f31e923fe2 | 243 | os_tsk.run->state = READY; |
Pawel Zarembski |
0:01f31e923fe2 | 244 | rt_put_rdy_first (os_tsk.run); |
Pawel Zarembski |
0:01f31e923fe2 | 245 | |
Pawel Zarembski |
0:01f31e923fe2 | 246 | /* Check Round Robin timeout. */ |
Pawel Zarembski |
0:01f31e923fe2 | 247 | rt_chk_robin (); |
Pawel Zarembski |
0:01f31e923fe2 | 248 | |
Pawel Zarembski |
0:01f31e923fe2 | 249 | /* Update delays. */ |
Pawel Zarembski |
0:01f31e923fe2 | 250 | os_time++; |
Pawel Zarembski |
0:01f31e923fe2 | 251 | rt_dec_dly (); |
Pawel Zarembski |
0:01f31e923fe2 | 252 | |
Pawel Zarembski |
0:01f31e923fe2 | 253 | /* Check the user timers. */ |
Pawel Zarembski |
0:01f31e923fe2 | 254 | rt_tmr_tick (); |
Pawel Zarembski |
0:01f31e923fe2 | 255 | |
Pawel Zarembski |
0:01f31e923fe2 | 256 | /* Switch back to highest ready task */ |
Pawel Zarembski |
0:01f31e923fe2 | 257 | next = rt_get_first (&os_rdy); |
Pawel Zarembski |
0:01f31e923fe2 | 258 | rt_switch_req (next); |
Pawel Zarembski |
0:01f31e923fe2 | 259 | } |
Pawel Zarembski |
0:01f31e923fe2 | 260 | |
Pawel Zarembski |
0:01f31e923fe2 | 261 | /*--------------------------- rt_stk_check ----------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 262 | |
Pawel Zarembski |
0:01f31e923fe2 | 263 | __weak void rt_stk_check (void) { |
Pawel Zarembski |
0:01f31e923fe2 | 264 | /* Check for stack overflow. */ |
Pawel Zarembski |
0:01f31e923fe2 | 265 | if ((os_tsk.run->tsk_stack < (U32)os_tsk.run->stack) || |
Pawel Zarembski |
0:01f31e923fe2 | 266 | (os_tsk.run->stack[0] != MAGIC_WORD)) { |
Pawel Zarembski |
0:01f31e923fe2 | 267 | os_error (OS_ERR_STK_OVF); |
Pawel Zarembski |
0:01f31e923fe2 | 268 | } |
Pawel Zarembski |
0:01f31e923fe2 | 269 | } |
Pawel Zarembski |
0:01f31e923fe2 | 270 | |
Pawel Zarembski |
0:01f31e923fe2 | 271 | /*---------------------------------------------------------------------------- |
Pawel Zarembski |
0:01f31e923fe2 | 272 | * end of file |
Pawel Zarembski |
0:01f31e923fe2 | 273 | *---------------------------------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 274 |