scheduler.c

Go to the documentation of this file.
00001 /*This file is prepared for Doxygen automatic documentation generation.*/
00017 
00018 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
00019  *
00020  * Redistribution and use in source and binary forms, with or without
00021  * modification, are permitted provided that the following conditions are met:
00022  *
00023  * 1. Redistributions of source code must retain the above copyright notice,
00024  * this list of conditions and the following disclaimer.
00025  *
00026  * 2. Redistributions in binary form must reproduce the above copyright notice,
00027  * this list of conditions and the following disclaimer in the documentation
00028  * and/or other materials provided with the distribution.
00029  *
00030  * 3. The name of Atmel may not be used to endorse or promote products derived
00031  * from this software without specific prior written permission.
00032  *
00033  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00034  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00035  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
00036  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00037  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00038  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00039  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00040  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00041  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00042  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00043  */
00044 
00046 #define _SCHEDULER_C_
00047 #include "config.h"                         // system definition 
00048 #include "conf/conf_scheduler.h"            // Configuration for the scheduler
00049 #include "scheduler.h"                      // scheduler definition 
00050 
00051 
00054 #if SCHEDULER_TYPE != SCHEDULER_FREE
00056 bit   scheduler_tick_flag;
00057 #endif
00058 
00059 #ifdef TOKEN_MODE
00065 Uchar token;
00066 #endif
00067 
00077 void scheduler_init (void)
00078 {
00079    #ifdef Scheduler_time_init
00080       Scheduler_time_init();
00081    #endif
00082    #ifdef TOKEN_MODE
00083       token =  TOKEN_FREE;
00084    #endif
00085    #ifdef Scheduler_task_1_init
00086       Scheduler_task_1_init();  
00087       Scheduler_call_next_init();
00088    #endif
00089    #ifdef Scheduler_task_2_init
00090       Scheduler_task_2_init();  
00091       Scheduler_call_next_init();
00092    #endif
00093    #ifdef Scheduler_task_3_init
00094       Scheduler_task_3_init();  
00095       Scheduler_call_next_init();
00096    #endif
00097    #ifdef Scheduler_task_4_init
00098       Scheduler_task_4_init();  
00099       Scheduler_call_next_init();
00100    #endif
00101    #ifdef Scheduler_task_5_init
00102       Scheduler_task_5_init();  
00103       Scheduler_call_next_init();
00104    #endif
00105    #ifdef Scheduler_task_6_init
00106       Scheduler_task_6_init();  
00107       Scheduler_call_next_init();
00108    #endif
00109    #ifdef Scheduler_task_7_init
00110       Scheduler_task_7_init();  
00111       Scheduler_call_next_init();
00112    #endif
00113    #ifdef Scheduler_task_8_init
00114       Scheduler_task_8_init();  
00115       Scheduler_call_next_init();
00116    #endif
00117    #ifdef Scheduler_task_9_init
00118       Scheduler_task_9_init();  
00119       Scheduler_call_next_init();
00120    #endif
00121    #ifdef Scheduler_task_10_init
00122       Scheduler_task_10_init();
00123       Scheduler_call_next_init();
00124    #endif
00125    #ifdef Scheduler_task_11_init
00126       Scheduler_task_11_init();
00127       Scheduler_call_next_init();
00128    #endif
00129    Scheduler_reset_tick_flag();
00130 }
00131 
00138 void scheduler_tasks (void)
00139 {
00140    // To avoid uncalled segment warning if the empty function is not used
00141    scheduler_empty_fct();
00142 
00143    for(;;)
00144    {
00145       Scheduler_new_schedule();
00146       #ifdef Scheduler_task_1
00147          Scheduler_task_1();
00148          Scheduler_call_next_task();
00149       #endif
00150       #ifdef Scheduler_task_2
00151          Scheduler_task_2();
00152          Scheduler_call_next_task();
00153       #endif
00154       #ifdef Scheduler_task_3
00155          Scheduler_task_3();
00156          Scheduler_call_next_task();
00157       #endif
00158       #ifdef Scheduler_task_4
00159          Scheduler_task_4();
00160          Scheduler_call_next_task();
00161       #endif
00162       #ifdef Scheduler_task_5
00163          Scheduler_task_5();
00164          Scheduler_call_next_task();
00165       #endif
00166       #ifdef Scheduler_task_6
00167          Scheduler_task_6();
00168          Scheduler_call_next_task();
00169       #endif
00170       #ifdef Scheduler_task_7
00171          Scheduler_task_7();
00172          Scheduler_call_next_task();
00173       #endif
00174       #ifdef Scheduler_task_8
00175          Scheduler_task_8();
00176          Scheduler_call_next_task();
00177       #endif
00178       #ifdef Scheduler_task_9
00179          Scheduler_task_9();
00180          Scheduler_call_next_task();
00181       #endif
00182       #ifdef Scheduler_task_10
00183          Scheduler_task_10();
00184          Scheduler_call_next_task();
00185       #endif
00186       #ifdef Scheduler_task_11
00187          Scheduler_task_11();
00188          Scheduler_call_next_task();
00189       #endif
00190    }
00191 }
00192 
00199 void scheduler (void)
00200 {
00201    scheduler_init();
00202    scheduler_tasks();
00203 }
00204 
00205 
00213 void scheduler_empty_fct (void)
00214 {
00215 }
00216 

Generated on Mon Sep 14 13:24:11 2009 for ATMEL by  doxygen 1.5.3