Lab Checkoff

Dependencies:   SDFileSystem TextLCD mbed-rtos mbed wave_player FATFileSystem

Committer:
doubster
Date:
Wed Nov 13 20:00:28 2013 +0000
Revision:
0:67dbd54e60d4
Lab Checkoff

Who changed what in which revision?

UserRevisionLine numberNew contents of line
doubster 0:67dbd54e60d4 1 /*----------------------------------------------------------------------------
doubster 0:67dbd54e60d4 2 * RL-ARM - RTX
doubster 0:67dbd54e60d4 3 *----------------------------------------------------------------------------
doubster 0:67dbd54e60d4 4 * Name: RT_TASK.C
doubster 0:67dbd54e60d4 5 * Purpose: Task functions and system start up.
doubster 0:67dbd54e60d4 6 * Rev.: V4.60
doubster 0:67dbd54e60d4 7 *----------------------------------------------------------------------------
doubster 0:67dbd54e60d4 8 *
doubster 0:67dbd54e60d4 9 * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
doubster 0:67dbd54e60d4 10 * All rights reserved.
doubster 0:67dbd54e60d4 11 * Redistribution and use in source and binary forms, with or without
doubster 0:67dbd54e60d4 12 * modification, are permitted provided that the following conditions are met:
doubster 0:67dbd54e60d4 13 * - Redistributions of source code must retain the above copyright
doubster 0:67dbd54e60d4 14 * notice, this list of conditions and the following disclaimer.
doubster 0:67dbd54e60d4 15 * - Redistributions in binary form must reproduce the above copyright
doubster 0:67dbd54e60d4 16 * notice, this list of conditions and the following disclaimer in the
doubster 0:67dbd54e60d4 17 * documentation and/or other materials provided with the distribution.
doubster 0:67dbd54e60d4 18 * - Neither the name of ARM nor the names of its contributors may be used
doubster 0:67dbd54e60d4 19 * to endorse or promote products derived from this software without
doubster 0:67dbd54e60d4 20 * specific prior written permission.
doubster 0:67dbd54e60d4 21 *
doubster 0:67dbd54e60d4 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
doubster 0:67dbd54e60d4 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
doubster 0:67dbd54e60d4 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
doubster 0:67dbd54e60d4 25 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
doubster 0:67dbd54e60d4 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
doubster 0:67dbd54e60d4 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
doubster 0:67dbd54e60d4 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
doubster 0:67dbd54e60d4 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
doubster 0:67dbd54e60d4 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
doubster 0:67dbd54e60d4 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
doubster 0:67dbd54e60d4 32 * POSSIBILITY OF SUCH DAMAGE.
doubster 0:67dbd54e60d4 33 *---------------------------------------------------------------------------*/
doubster 0:67dbd54e60d4 34
doubster 0:67dbd54e60d4 35 #include "rt_TypeDef.h"
doubster 0:67dbd54e60d4 36 #include "RTX_Config.h"
doubster 0:67dbd54e60d4 37 #include "rt_System.h"
doubster 0:67dbd54e60d4 38 #include "rt_Task.h"
doubster 0:67dbd54e60d4 39 #include "rt_List.h"
doubster 0:67dbd54e60d4 40 #include "rt_MemBox.h"
doubster 0:67dbd54e60d4 41 #include "rt_Robin.h"
doubster 0:67dbd54e60d4 42 #include "rt_HAL_CM.h"
doubster 0:67dbd54e60d4 43
doubster 0:67dbd54e60d4 44 /*----------------------------------------------------------------------------
doubster 0:67dbd54e60d4 45 * Global Variables
doubster 0:67dbd54e60d4 46 *---------------------------------------------------------------------------*/
doubster 0:67dbd54e60d4 47
doubster 0:67dbd54e60d4 48 /* Running and next task info. */
doubster 0:67dbd54e60d4 49 struct OS_TSK os_tsk;
doubster 0:67dbd54e60d4 50
doubster 0:67dbd54e60d4 51 /* Task Control Blocks of idle demon */
doubster 0:67dbd54e60d4 52 struct OS_TCB os_idle_TCB;
doubster 0:67dbd54e60d4 53
doubster 0:67dbd54e60d4 54
doubster 0:67dbd54e60d4 55 /*----------------------------------------------------------------------------
doubster 0:67dbd54e60d4 56 * Local Functions
doubster 0:67dbd54e60d4 57 *---------------------------------------------------------------------------*/
doubster 0:67dbd54e60d4 58
doubster 0:67dbd54e60d4 59 OS_TID rt_get_TID (void) {
doubster 0:67dbd54e60d4 60 U32 tid;
doubster 0:67dbd54e60d4 61
doubster 0:67dbd54e60d4 62 for (tid = 1; tid <= os_maxtaskrun; tid++) {
doubster 0:67dbd54e60d4 63 if (os_active_TCB[tid-1] == NULL) {
doubster 0:67dbd54e60d4 64 return ((OS_TID)tid);
doubster 0:67dbd54e60d4 65 }
doubster 0:67dbd54e60d4 66 }
doubster 0:67dbd54e60d4 67 return (0);
doubster 0:67dbd54e60d4 68 }
doubster 0:67dbd54e60d4 69
doubster 0:67dbd54e60d4 70 #if defined (__CC_ARM) && !defined (__MICROLIB)
doubster 0:67dbd54e60d4 71 /*--------------------------- __user_perthread_libspace ---------------------*/
doubster 0:67dbd54e60d4 72 extern void *__libspace_start;
doubster 0:67dbd54e60d4 73
doubster 0:67dbd54e60d4 74 void *__user_perthread_libspace (void) {
doubster 0:67dbd54e60d4 75 /* Provide a separate libspace for each task. */
doubster 0:67dbd54e60d4 76 if (os_tsk.run == NULL) {
doubster 0:67dbd54e60d4 77 /* RTX not running yet. */
doubster 0:67dbd54e60d4 78 return (&__libspace_start);
doubster 0:67dbd54e60d4 79 }
doubster 0:67dbd54e60d4 80 return (void *)(os_tsk.run->std_libspace);
doubster 0:67dbd54e60d4 81 }
doubster 0:67dbd54e60d4 82 #endif
doubster 0:67dbd54e60d4 83
doubster 0:67dbd54e60d4 84 /*--------------------------- rt_init_context -------------------------------*/
doubster 0:67dbd54e60d4 85
doubster 0:67dbd54e60d4 86 void rt_init_context (P_TCB p_TCB, U8 priority, FUNCP task_body) {
doubster 0:67dbd54e60d4 87 /* Initialize general part of the Task Control Block. */
doubster 0:67dbd54e60d4 88 p_TCB->cb_type = TCB;
doubster 0:67dbd54e60d4 89 p_TCB->state = READY;
doubster 0:67dbd54e60d4 90 p_TCB->prio = priority;
doubster 0:67dbd54e60d4 91 p_TCB->p_lnk = NULL;
doubster 0:67dbd54e60d4 92 p_TCB->p_rlnk = NULL;
doubster 0:67dbd54e60d4 93 p_TCB->p_dlnk = NULL;
doubster 0:67dbd54e60d4 94 p_TCB->p_blnk = NULL;
doubster 0:67dbd54e60d4 95 p_TCB->delta_time = 0;
doubster 0:67dbd54e60d4 96 p_TCB->interval_time = 0;
doubster 0:67dbd54e60d4 97 p_TCB->events = 0;
doubster 0:67dbd54e60d4 98 p_TCB->waits = 0;
doubster 0:67dbd54e60d4 99 p_TCB->stack_frame = 0;
doubster 0:67dbd54e60d4 100
doubster 0:67dbd54e60d4 101 rt_init_stack (p_TCB, task_body);
doubster 0:67dbd54e60d4 102 }
doubster 0:67dbd54e60d4 103
doubster 0:67dbd54e60d4 104
doubster 0:67dbd54e60d4 105 /*--------------------------- rt_switch_req ---------------------------------*/
doubster 0:67dbd54e60d4 106
doubster 0:67dbd54e60d4 107 void rt_switch_req (P_TCB p_new) {
doubster 0:67dbd54e60d4 108 /* Switch to next task (identified by "p_new"). */
doubster 0:67dbd54e60d4 109 os_tsk.new_tsk = p_new;
doubster 0:67dbd54e60d4 110 p_new->state = RUNNING;
doubster 0:67dbd54e60d4 111 DBG_TASK_SWITCH(p_new->task_id);
doubster 0:67dbd54e60d4 112 }
doubster 0:67dbd54e60d4 113
doubster 0:67dbd54e60d4 114
doubster 0:67dbd54e60d4 115 /*--------------------------- rt_dispatch -----------------------------------*/
doubster 0:67dbd54e60d4 116
doubster 0:67dbd54e60d4 117 void rt_dispatch (P_TCB next_TCB) {
doubster 0:67dbd54e60d4 118 /* Dispatch next task if any identified or dispatch highest ready task */
doubster 0:67dbd54e60d4 119 /* "next_TCB" identifies a task to run or has value NULL (=no next task) */
doubster 0:67dbd54e60d4 120 if (next_TCB == NULL) {
doubster 0:67dbd54e60d4 121 /* Running task was blocked: continue with highest ready task */
doubster 0:67dbd54e60d4 122 next_TCB = rt_get_first (&os_rdy);
doubster 0:67dbd54e60d4 123 rt_switch_req (next_TCB);
doubster 0:67dbd54e60d4 124 }
doubster 0:67dbd54e60d4 125 else {
doubster 0:67dbd54e60d4 126 /* Check which task continues */
doubster 0:67dbd54e60d4 127 if (next_TCB->prio > os_tsk.run->prio) {
doubster 0:67dbd54e60d4 128 /* preempt running task */
doubster 0:67dbd54e60d4 129 rt_put_rdy_first (os_tsk.run);
doubster 0:67dbd54e60d4 130 os_tsk.run->state = READY;
doubster 0:67dbd54e60d4 131 rt_switch_req (next_TCB);
doubster 0:67dbd54e60d4 132 }
doubster 0:67dbd54e60d4 133 else {
doubster 0:67dbd54e60d4 134 /* put next task into ready list, no task switch takes place */
doubster 0:67dbd54e60d4 135 next_TCB->state = READY;
doubster 0:67dbd54e60d4 136 rt_put_prio (&os_rdy, next_TCB);
doubster 0:67dbd54e60d4 137 }
doubster 0:67dbd54e60d4 138 }
doubster 0:67dbd54e60d4 139 }
doubster 0:67dbd54e60d4 140
doubster 0:67dbd54e60d4 141
doubster 0:67dbd54e60d4 142 /*--------------------------- rt_block --------------------------------------*/
doubster 0:67dbd54e60d4 143
doubster 0:67dbd54e60d4 144 void rt_block (U16 timeout, U8 block_state) {
doubster 0:67dbd54e60d4 145 /* Block running task and choose next ready task. */
doubster 0:67dbd54e60d4 146 /* "timeout" sets a time-out value or is 0xffff (=no time-out). */
doubster 0:67dbd54e60d4 147 /* "block_state" defines the appropriate task state */
doubster 0:67dbd54e60d4 148 P_TCB next_TCB;
doubster 0:67dbd54e60d4 149
doubster 0:67dbd54e60d4 150 if (timeout) {
doubster 0:67dbd54e60d4 151 if (timeout < 0xffff) {
doubster 0:67dbd54e60d4 152 rt_put_dly (os_tsk.run, timeout);
doubster 0:67dbd54e60d4 153 }
doubster 0:67dbd54e60d4 154 os_tsk.run->state = block_state;
doubster 0:67dbd54e60d4 155 next_TCB = rt_get_first (&os_rdy);
doubster 0:67dbd54e60d4 156 rt_switch_req (next_TCB);
doubster 0:67dbd54e60d4 157 }
doubster 0:67dbd54e60d4 158 }
doubster 0:67dbd54e60d4 159
doubster 0:67dbd54e60d4 160
doubster 0:67dbd54e60d4 161 /*--------------------------- rt_tsk_pass -----------------------------------*/
doubster 0:67dbd54e60d4 162
doubster 0:67dbd54e60d4 163 void rt_tsk_pass (void) {
doubster 0:67dbd54e60d4 164 /* Allow tasks of same priority level to run cooperatively.*/
doubster 0:67dbd54e60d4 165 P_TCB p_new;
doubster 0:67dbd54e60d4 166
doubster 0:67dbd54e60d4 167 p_new = rt_get_same_rdy_prio();
doubster 0:67dbd54e60d4 168 if (p_new != NULL) {
doubster 0:67dbd54e60d4 169 rt_put_prio ((P_XCB)&os_rdy, os_tsk.run);
doubster 0:67dbd54e60d4 170 os_tsk.run->state = READY;
doubster 0:67dbd54e60d4 171 rt_switch_req (p_new);
doubster 0:67dbd54e60d4 172 }
doubster 0:67dbd54e60d4 173 }
doubster 0:67dbd54e60d4 174
doubster 0:67dbd54e60d4 175
doubster 0:67dbd54e60d4 176 /*--------------------------- rt_tsk_self -----------------------------------*/
doubster 0:67dbd54e60d4 177
doubster 0:67dbd54e60d4 178 OS_TID rt_tsk_self (void) {
doubster 0:67dbd54e60d4 179 /* Return own task identifier value. */
doubster 0:67dbd54e60d4 180 if (os_tsk.run == NULL) {
doubster 0:67dbd54e60d4 181 return (0);
doubster 0:67dbd54e60d4 182 }
doubster 0:67dbd54e60d4 183 return (os_tsk.run->task_id);
doubster 0:67dbd54e60d4 184 }
doubster 0:67dbd54e60d4 185
doubster 0:67dbd54e60d4 186
doubster 0:67dbd54e60d4 187 /*--------------------------- rt_tsk_prio -----------------------------------*/
doubster 0:67dbd54e60d4 188
doubster 0:67dbd54e60d4 189 OS_RESULT rt_tsk_prio (OS_TID task_id, U8 new_prio) {
doubster 0:67dbd54e60d4 190 /* Change execution priority of a task to "new_prio". */
doubster 0:67dbd54e60d4 191 P_TCB p_task;
doubster 0:67dbd54e60d4 192
doubster 0:67dbd54e60d4 193 if (task_id == 0) {
doubster 0:67dbd54e60d4 194 /* Change execution priority of calling task. */
doubster 0:67dbd54e60d4 195 os_tsk.run->prio = new_prio;
doubster 0:67dbd54e60d4 196 run:if (rt_rdy_prio() > new_prio) {
doubster 0:67dbd54e60d4 197 rt_put_prio (&os_rdy, os_tsk.run);
doubster 0:67dbd54e60d4 198 os_tsk.run->state = READY;
doubster 0:67dbd54e60d4 199 rt_dispatch (NULL);
doubster 0:67dbd54e60d4 200 }
doubster 0:67dbd54e60d4 201 return (OS_R_OK);
doubster 0:67dbd54e60d4 202 }
doubster 0:67dbd54e60d4 203
doubster 0:67dbd54e60d4 204 /* Find the task in the "os_active_TCB" array. */
doubster 0:67dbd54e60d4 205 if (task_id > os_maxtaskrun || os_active_TCB[task_id-1] == NULL) {
doubster 0:67dbd54e60d4 206 /* Task with "task_id" not found or not started. */
doubster 0:67dbd54e60d4 207 return (OS_R_NOK);
doubster 0:67dbd54e60d4 208 }
doubster 0:67dbd54e60d4 209 p_task = os_active_TCB[task_id-1];
doubster 0:67dbd54e60d4 210 p_task->prio = new_prio;
doubster 0:67dbd54e60d4 211 if (p_task == os_tsk.run) {
doubster 0:67dbd54e60d4 212 goto run;
doubster 0:67dbd54e60d4 213 }
doubster 0:67dbd54e60d4 214 rt_resort_prio (p_task);
doubster 0:67dbd54e60d4 215 if (p_task->state == READY) {
doubster 0:67dbd54e60d4 216 /* Task enqueued in a ready list. */
doubster 0:67dbd54e60d4 217 p_task = rt_get_first (&os_rdy);
doubster 0:67dbd54e60d4 218 rt_dispatch (p_task);
doubster 0:67dbd54e60d4 219 }
doubster 0:67dbd54e60d4 220 return (OS_R_OK);
doubster 0:67dbd54e60d4 221 }
doubster 0:67dbd54e60d4 222
doubster 0:67dbd54e60d4 223 /*--------------------------- rt_tsk_delete ---------------------------------*/
doubster 0:67dbd54e60d4 224
doubster 0:67dbd54e60d4 225 OS_RESULT rt_tsk_delete (OS_TID task_id) {
doubster 0:67dbd54e60d4 226 /* Terminate the task identified with "task_id". */
doubster 0:67dbd54e60d4 227 P_TCB task_context;
doubster 0:67dbd54e60d4 228
doubster 0:67dbd54e60d4 229 if (task_id == 0 || task_id == os_tsk.run->task_id) {
doubster 0:67dbd54e60d4 230 /* Terminate itself. */
doubster 0:67dbd54e60d4 231 os_tsk.run->state = INACTIVE;
doubster 0:67dbd54e60d4 232 os_tsk.run->tsk_stack = rt_get_PSP ();
doubster 0:67dbd54e60d4 233 rt_stk_check ();
doubster 0:67dbd54e60d4 234 os_active_TCB[os_tsk.run->task_id-1] = NULL;
doubster 0:67dbd54e60d4 235
doubster 0:67dbd54e60d4 236 os_tsk.run->stack = NULL;
doubster 0:67dbd54e60d4 237 DBG_TASK_NOTIFY(os_tsk.run, __FALSE);
doubster 0:67dbd54e60d4 238 os_tsk.run = NULL;
doubster 0:67dbd54e60d4 239 rt_dispatch (NULL);
doubster 0:67dbd54e60d4 240 /* The program should never come to this point. */
doubster 0:67dbd54e60d4 241 }
doubster 0:67dbd54e60d4 242 else {
doubster 0:67dbd54e60d4 243 /* Find the task in the "os_active_TCB" array. */
doubster 0:67dbd54e60d4 244 if (task_id > os_maxtaskrun || os_active_TCB[task_id-1] == NULL) {
doubster 0:67dbd54e60d4 245 /* Task with "task_id" not found or not started. */
doubster 0:67dbd54e60d4 246 return (OS_R_NOK);
doubster 0:67dbd54e60d4 247 }
doubster 0:67dbd54e60d4 248 task_context = os_active_TCB[task_id-1];
doubster 0:67dbd54e60d4 249 rt_rmv_list (task_context);
doubster 0:67dbd54e60d4 250 rt_rmv_dly (task_context);
doubster 0:67dbd54e60d4 251 os_active_TCB[task_id-1] = NULL;
doubster 0:67dbd54e60d4 252
doubster 0:67dbd54e60d4 253 task_context->stack = NULL;
doubster 0:67dbd54e60d4 254 DBG_TASK_NOTIFY(task_context, __FALSE);
doubster 0:67dbd54e60d4 255 }
doubster 0:67dbd54e60d4 256 return (OS_R_OK);
doubster 0:67dbd54e60d4 257 }
doubster 0:67dbd54e60d4 258
doubster 0:67dbd54e60d4 259
doubster 0:67dbd54e60d4 260 /*--------------------------- rt_sys_init -----------------------------------*/
doubster 0:67dbd54e60d4 261
doubster 0:67dbd54e60d4 262 #ifdef __CMSIS_RTOS
doubster 0:67dbd54e60d4 263 void rt_sys_init (void) {
doubster 0:67dbd54e60d4 264 #else
doubster 0:67dbd54e60d4 265 void rt_sys_init (FUNCP first_task, U32 prio_stksz, void *stk) {
doubster 0:67dbd54e60d4 266 #endif
doubster 0:67dbd54e60d4 267 /* Initialize system and start up task declared with "first_task". */
doubster 0:67dbd54e60d4 268 U32 i;
doubster 0:67dbd54e60d4 269
doubster 0:67dbd54e60d4 270 DBG_INIT();
doubster 0:67dbd54e60d4 271
doubster 0:67dbd54e60d4 272 /* Initialize dynamic memory and task TCB pointers to NULL. */
doubster 0:67dbd54e60d4 273 for (i = 0; i < os_maxtaskrun; i++) {
doubster 0:67dbd54e60d4 274 os_active_TCB[i] = NULL;
doubster 0:67dbd54e60d4 275 }
doubster 0:67dbd54e60d4 276
doubster 0:67dbd54e60d4 277 /* Set up TCB of idle demon */
doubster 0:67dbd54e60d4 278 os_idle_TCB.task_id = 255;
doubster 0:67dbd54e60d4 279 os_idle_TCB.priv_stack = idle_task_stack_size;
doubster 0:67dbd54e60d4 280 os_idle_TCB.stack = idle_task_stack;
doubster 0:67dbd54e60d4 281 rt_init_context (&os_idle_TCB, 0, os_idle_demon);
doubster 0:67dbd54e60d4 282
doubster 0:67dbd54e60d4 283 /* Set up ready list: initially empty */
doubster 0:67dbd54e60d4 284 os_rdy.cb_type = HCB;
doubster 0:67dbd54e60d4 285 os_rdy.p_lnk = NULL;
doubster 0:67dbd54e60d4 286 /* Set up delay list: initially empty */
doubster 0:67dbd54e60d4 287 os_dly.cb_type = HCB;
doubster 0:67dbd54e60d4 288 os_dly.p_dlnk = NULL;
doubster 0:67dbd54e60d4 289 os_dly.p_blnk = NULL;
doubster 0:67dbd54e60d4 290 os_dly.delta_time = 0;
doubster 0:67dbd54e60d4 291
doubster 0:67dbd54e60d4 292 /* Fix SP and systemvariables to assume idle task is running */
doubster 0:67dbd54e60d4 293 /* Transform main program into idle task by assuming idle TCB */
doubster 0:67dbd54e60d4 294 #ifndef __CMSIS_RTOS
doubster 0:67dbd54e60d4 295 rt_set_PSP (os_idle_TCB.tsk_stack+32);
doubster 0:67dbd54e60d4 296 #endif
doubster 0:67dbd54e60d4 297 os_tsk.run = &os_idle_TCB;
doubster 0:67dbd54e60d4 298 os_tsk.run->state = RUNNING;
doubster 0:67dbd54e60d4 299
doubster 0:67dbd54e60d4 300 /* Initialize ps queue */
doubster 0:67dbd54e60d4 301 os_psq->first = 0;
doubster 0:67dbd54e60d4 302 os_psq->last = 0;
doubster 0:67dbd54e60d4 303 os_psq->size = os_fifo_size;
doubster 0:67dbd54e60d4 304
doubster 0:67dbd54e60d4 305 rt_init_robin ();
doubster 0:67dbd54e60d4 306
doubster 0:67dbd54e60d4 307 /* Intitialize SVC and PendSV */
doubster 0:67dbd54e60d4 308 rt_svc_init ();
doubster 0:67dbd54e60d4 309
doubster 0:67dbd54e60d4 310 #ifndef __CMSIS_RTOS
doubster 0:67dbd54e60d4 311 /* Intitialize and start system clock timer */
doubster 0:67dbd54e60d4 312 os_tick_irqn = os_tick_init ();
doubster 0:67dbd54e60d4 313 if (os_tick_irqn >= 0) {
doubster 0:67dbd54e60d4 314 OS_X_INIT(os_tick_irqn);
doubster 0:67dbd54e60d4 315 }
doubster 0:67dbd54e60d4 316
doubster 0:67dbd54e60d4 317 /* Start up first user task before entering the endless loop */
doubster 0:67dbd54e60d4 318 rt_tsk_create (first_task, prio_stksz, stk, NULL);
doubster 0:67dbd54e60d4 319 #endif
doubster 0:67dbd54e60d4 320 }
doubster 0:67dbd54e60d4 321
doubster 0:67dbd54e60d4 322
doubster 0:67dbd54e60d4 323 /*--------------------------- rt_sys_start ----------------------------------*/
doubster 0:67dbd54e60d4 324
doubster 0:67dbd54e60d4 325 #ifdef __CMSIS_RTOS
doubster 0:67dbd54e60d4 326 void rt_sys_start (void) {
doubster 0:67dbd54e60d4 327 /* Start system */
doubster 0:67dbd54e60d4 328
doubster 0:67dbd54e60d4 329 /* Intitialize and start system clock timer */
doubster 0:67dbd54e60d4 330 os_tick_irqn = os_tick_init ();
doubster 0:67dbd54e60d4 331 if (os_tick_irqn >= 0) {
doubster 0:67dbd54e60d4 332 OS_X_INIT(os_tick_irqn);
doubster 0:67dbd54e60d4 333 }
doubster 0:67dbd54e60d4 334 }
doubster 0:67dbd54e60d4 335 #endif
doubster 0:67dbd54e60d4 336
doubster 0:67dbd54e60d4 337 /*----------------------------------------------------------------------------
doubster 0:67dbd54e60d4 338 * end of file
doubster 0:67dbd54e60d4 339 *---------------------------------------------------------------------------*/
doubster 0:67dbd54e60d4 340