00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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