femtoos_headers/femtoos_types.h

Go to the documentation of this file.
00001 /*
00002  * Femto OS v 0.91 - Copyright (C) 2008-2009 Ruud Vlaming
00003  *
00004  * This file is part of the Femto OS distribution.
00005  *
00006  * This program is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, version 3 of the License.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  * Please note that, due to the GPLv3 license, for application of this
00019  * work and/or combined work in embedded systems special obligations apply.
00020  * If these are not to you liking, please know the Femto OS is dual
00021  * licensed. A commercial license and support are available.
00022  * See http://www.femtoos.org/ for details.
00023  */
00024 
00025 #ifndef FEMTOOS_TYPES_H
00026 #define FEMTOOS_TYPES_H
00027 
00028 #include "femtoos_globals.h"
00029 #include "femtoos_constants.h"
00030 #include "femtoos_order.h"
00031 #include "femtoos_locals.h"
00032 
00033 
00034 typedef union
00035 { Tuint16 MaxSelect;
00036   struct
00037   { Tuint08 MaxTask;
00038     Tuint08 MaxStatus; };
00039 } Tselect;
00040 
00047 typedef union
00048 { Tuint16 Full;
00049   struct
00050   { Tuint08 LowByte;
00051     Tuint08 HighByte; };
00052 } Ttick;
00053 
00054 
00059 typedef union
00060 { Tuint16 Full;
00061   struct
00062   { Tuint08 LowByte;
00063     Tuint08 HighByte;
00064     Tuint08 SubByte; };
00065 } TextendedTick;
00066 
00067 
00068 #if (cfgUseEquidistantTicks == cfgTrue) && (cfgUseLowPowerSleep == cfgFalse) && (cfgCheckWatermarks == cfgFalse) && (cfgUseLoadMonitor == cfgFalse)
00069   #define Ttickcount Ttick
00070 #else
00071   #define Ttickcount TextendedTick
00072 #endif
00073 
00074 
00104 #if (cfgSysStackGrowthUp == cfgTrue)
00105 
00106   #if (cfgCheckTaskStack == cfgTrue) || (cfgCheckRegisters == cfgTrue) || (cfgCheckWatermarks == cfgTrue)
00107 
00108     typedef struct
00109     {
00110       #if (cfgUseSynchronization != cfgSyncNon) && (defUseBoolReturns == cfgTrue)
00111         Tuint08   uiReturn;
00112       #endif
00113       Taddress  pcStackLimit;
00114       Taddress  pcStackLevel;
00115       Taddress  pcStackOffset;
00116       Tuint08   uiStackTCheck;
00117       Tuint08   uiRegisterCheck;
00118       Tuint08   uiRegisterUse;
00119       Tuint08   r28;
00120       Tuint08   r29;
00121       Tuint08   r30;
00122       Tuint08   r31;
00123     } TtaskSave;
00124 
00125   #else
00126 
00127     typedef struct
00128     {
00129       #if (cfgUseSynchronization != cfgSyncNon) && (defUseBoolReturns == cfgTrue)
00130         Tuint08   uiReturn;
00131       #endif
00132       Taddress  pcStackLevel;
00133       Taddress  pcStackOffset;
00134       Tuint08   uiRegisterUse;
00135       Tuint08   r30;
00136       Tuint08   r31;
00137     } TtaskSave;
00138 
00139   #endif
00140 
00141 #else
00142 
00143   #if (cfgCheckTaskStack == cfgTrue) || (cfgCheckRegisters == cfgTrue) || (cfgCheckWatermarks == cfgTrue)
00144 
00145     typedef struct
00146     { Tuint08   r31;
00147       Tuint08   r30;
00148       Tuint08   r29;
00149       Tuint08   r28;
00150       Tuint08   uiRegisterUse;
00151       Tuint08   uiRegisterCheck;
00152       Tuint08   uiStackTCheck;
00153       Taddress  pcStackOffset;
00154       Taddress  pcStackLevel;
00155       Taddress  pcStackLimit;
00156       #if (cfgUseSynchronization != cfgSyncNon) && (defUseBoolReturns == cfgTrue)
00157         Tuint08   uiReturn;
00158       #endif
00159     } TtaskSave;
00160 
00161   #else
00162     typedef struct
00163     { Tuint08   r31;
00164       Tuint08   r30;
00165       Tuint08   uiRegisterUse;
00166       Taddress  pcStackOffset;
00167       Taddress  pcStackLevel;
00168       #if (cfgUseSynchronization != cfgSyncNon) && (defUseBoolReturns == cfgTrue)
00169         Tuint08   uiReturn;
00170       #endif
00171     } TtaskSave;
00172 
00173   #endif
00174 
00175 #endif
00176 
00177 
00187 #if (cfgSysReuseOsStack == cfgTrue)
00188   typedef union
00189   { Tchar StackOS[StackSizeOS];
00190     TtaskSave pxSave;
00191   } TosData;
00192 #else
00193   typedef struct
00194   { Tchar StackOS[StackSizeOS];
00195     TtaskSave pxSave;
00196   } TosData;
00197 #endif
00198 
00199 
00207 typedef struct
00208 { Tstack    pcStackLevel;
00209   Tuint08   uiTaskStatus;
00210   #if (defUseDelay == cfgTrue)
00211     Ttick   uxDelay;
00212   #endif
00213   #if (defUseTaskMonitor == cfgTrue)
00214     Tuint08 uiTaskMonitor;
00215   #endif
00216   #if (defUseTaskLevels == cfgTrue)
00217     Tuint08 uiTaskLevels;
00218   #endif
00219   #if (cfgUseEvents == cfgTrue)
00220     Tuint08 uiTaskEvents;
00221   #endif
00222   #if (cfgUseLoadMonitor == cfgTrue)
00223     Tuint16 uiLoadCollect;
00224     Tuint16 uiLoadTotal;
00225   #endif
00226   #if (cfgCheckWatermarks == cfgTrue)
00227     Tstack  uiStackMax;
00228     Tuint08 uiRegisterUse;
00229   #endif
00230 } TtaskControlBlock;
00231 
00232 typedef struct
00233 { Tstack    pcStackLevel;
00234   Tuint08   uiTaskStatus;
00235   #if (defUseDelay == cfgTrue)
00236     Ttick   uxDelay;
00237   #endif
00238   #if (defUseTaskMonitor == cfgTrue)
00239     Tuint08 uiTaskMonitor;
00240   #endif
00241   #if (defUseTaskLevels == cfgTrue)
00242     Tuint08 uiTaskLevels;
00243   #endif
00244   #if (cfgUseEvents == cfgTrue)
00245     Tuint08 uiTaskEvents;
00246   #endif
00247   #if (cfgUseLoadMonitor == cfgTrue)
00248     Tuint16 uiLoadCollect;
00249     Tuint16 uiLoadTotal;
00250   #endif
00251   #if (cfgCheckWatermarks == cfgTrue)
00252     Tstack  uiStackMax;
00253     Tuint08 uiRegisterUse;
00254   #endif
00255   #if (defUseQueus == cfgTrue)
00256     Tsint08 siQueuRightLock;
00257     #if (cfgUseSynchronization == cfgSyncDoubleBlock)
00258       Tsint08 siQueuLeftLock;
00259     #endif
00260   #endif
00261   /* This definition must be on the end, for the space is created by an variable sized array */
00262   #if (defUseTaskSlot == cfgTrue)
00263     Tuint08 uiTaskSlot;
00264   #endif
00265 } TtaskExtendedControlBlock;
00266 
00271 typedef void (*fpInitTask)(void);
00272 
00277 typedef void (*fpLoopTask)(void);
00278 
00283 typedef void (*fpBarkTask)(void);
00284 
00285 
00295 typedef struct
00296 {
00297   #if (defRegisterUseConstant == cfgFalse)
00298     const Tuint08   uiRegisterUse;
00299   #endif
00300   #if (defRegisterCheckConstant == cfgFalse)
00301     const Tuint08   uiRegisterCheck;
00302   #endif
00303   #if (defInitialStatusConstant == cfgFalse)
00304     const Tuint08   uiInitialStatus;
00305   #endif
00306   #if (defStackSizeConstant == cfgFalse) && ( (cfgCheckTaskStack == cfgTrue) || (cfgCheckWatermarks == cfgTrue) || (defStackClean == cfgTrue) )
00307     const Tstack    uiStackSize;
00308   #endif
00309   const Taddress    pcStackOffset;
00310   #if (defTimeSliceConstant == cfgFalse)
00311     const Tuint08   uiTimeSlice;
00312   #endif
00313   #if (cfgUseSynchronization != cfgSyncNon) && (defSlotDepthConstant == cfgFalse)
00314     const Tuint08 uiSlotDepth;
00315   #endif
00316   #if (cfgUseTasknames == cfgTrue)
00317     const Taddress  pTaskName;
00318   #endif
00319 } TtaskDefinitionBlock;
00320 
00321 
00322 #endif /* FEMTOOS_TYPES_H */

Generated on Fri Oct 16 00:05:21 2009 for FemtoOS by  doxygen 1.5.2