Daniel Peter
/
RtosTest
Embed:
(wiki syntax)
Show/hide line numbers
scmRTOS_defs.h
00001 //****************************************************************************** 00002 //* 00003 //* FULLNAME: Single-Chip Microcontroller Real-Time Operating System 00004 //* 00005 //* NICKNAME: scmRTOS 00006 //* 00007 //* PURPOSE: Macros And Common Definitions 00008 //* 00009 //* Version: 3.10 00010 //* 00011 //* $Revision: 256 $ 00012 //* $Date:: 2010-01-22 #$ 00013 //* 00014 //* Copyright (c) 2003-2010, Harry E. Zhurov 00015 //* 00016 //* Permission is hereby granted, free of charge, to any person 00017 //* obtaining a copy of this software and associated documentation 00018 //* files (the "Software"), to deal in the Software without restriction, 00019 //* including without limitation the rights to use, copy, modify, merge, 00020 //* publish, distribute, sublicense, and/or sell copies of the Software, 00021 //* and to permit persons to whom the Software is furnished to do so, 00022 //* subject to the following conditions: 00023 //* 00024 //* The above copyright notice and this permission notice shall be included 00025 //* in all copies or substantial portions of the Software. 00026 //* 00027 //* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00028 //* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00029 //* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00030 //* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00031 //* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00032 //* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH 00033 //* THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00034 //* 00035 //* ================================================================= 00036 //* See http://scmrtos.sourceforge.net for documentation, latest 00037 //* information, license and contact details. 00038 //* ================================================================= 00039 //* 00040 //****************************************************************************** 00041 00042 #ifndef scmRTOS_DEFS_H 00043 #define scmRTOS_DEFS_H 00044 00045 #include <commdefs.h> 00046 00047 //------------------------------------------------------------------------------ 00048 00049 //----------------------------------------------------------------------------- 00050 // 00051 // 00052 /// Macro for Channel Type definition 00053 // 00054 // 00055 #define DefineChannel(Name, Capacity) \ 00056 class Name : public OS::TChannel \ 00057 { \ 00058 public: \ 00059 Name() : OS::TChannel(buf, sizeof(buf)) { } \ 00060 \ 00061 private: \ 00062 byte buf[Capacity]; \ 00063 \ 00064 } 00065 //----------------------------------------------------------------------------- 00066 // 00067 // Check CONFIG Macro Definitions 00068 // 00069 // 00070 00071 //----------------- scmRTOS_SYSTIMER_NEST_INTS_ENABLE ------------------------- 00072 #ifndef scmRTOS_SYSTIMER_NEST_INTS_ENABLE 00073 #error "Error: Config macro scmRTOS_SYSTIMER_NEST_INTS_ENABLE must be defined!" 00074 #endif 00075 00076 #if (scmRTOS_SYSTIMER_NEST_INTS_ENABLE < 0) || (scmRTOS_SYSTIMER_NEST_INTS_ENABLE > 1) 00077 #error "Error: scmRTOS_SYSTIMER_NEST_INTS_ENABLE must have values 0 or 1 only!" 00078 #endif 00079 00080 //----------------- scmRTOS_SYSTEM_TICKS_ENABLE ------------------------------- 00081 #ifndef scmRTOS_SYSTEM_TICKS_ENABLE 00082 #error "Error: Config macro scmRTOS_SYSTEM_TICKS_ENABLE must be defined!" 00083 #endif 00084 00085 #if (scmRTOS_SYSTEM_TICKS_ENABLE < 0) || (scmRTOS_SYSTEM_TICKS_ENABLE > 1) 00086 #error "Error: scmRTOS_SYSTEM_TICKS_ENABLE must have values 0 or 1 only!" 00087 #endif 00088 00089 00090 //----------------- scmRTOS_SYSTIMER_HOOK_ENABLE ------------------------------ 00091 #ifndef scmRTOS_SYSTIMER_HOOK_ENABLE 00092 #error "Error: Config macro scmRTOS_SYSTIMER_HOOK_ENABLE must be defined!" 00093 #endif 00094 00095 #if (scmRTOS_SYSTIMER_HOOK_ENABLE < 0) || (scmRTOS_SYSTIMER_HOOK_ENABLE > 1) 00096 #error "Error: scmRTOS_SYSTIMER_HOOK_ENABLE must have values 0 or 1 only!" 00097 #endif 00098 00099 //-------------- scmRTOS_CONTEXT_SWITCH_USER_HOOK_ENABLE ---------------------- 00100 #ifndef scmRTOS_CONTEXT_SWITCH_USER_HOOK_ENABLE 00101 #error "Error: Config macro scmRTOS_CONTEXT_SWITCH_USER_HOOK_ENABLE must be defined!" 00102 #endif 00103 00104 #if (scmRTOS_CONTEXT_SWITCH_USER_HOOK_ENABLE < 0) || (scmRTOS_CONTEXT_SWITCH_USER_HOOK_ENABLE > 1) 00105 #error "Error: scmRTOS_CONTEXT_SWITCH_USER_HOOK_ENABLE must have values 0 or 1 only!" 00106 #endif 00107 00108 //----------------- scmRTOS_IDLE_HOOK_ENABLE ---------------------------------- 00109 #ifndef scmRTOS_IDLE_HOOK_ENABLE 00110 #error "Error: Config macro scmRTOS_IDLE_HOOK_ENABLE must be defined!" 00111 #endif 00112 00113 #if (scmRTOS_IDLE_HOOK_ENABLE < 0) || (scmRTOS_IDLE_HOOK_ENABLE > 1) 00114 #error "Error: scmRTOS_IDLE_HOOK_ENABLE must have values 0 or 1 only!" 00115 #endif 00116 00117 //----------------- scmRTOS_CONTEXT_SWITCH_SCHEME ----------------------------- 00118 #ifndef scmRTOS_CONTEXT_SWITCH_SCHEME 00119 #error "Error: Config macro scmRTOS_CONTEXT_SWITCH_SCHEME must be defined!" 00120 #endif 00121 00122 #if (scmRTOS_CONTEXT_SWITCH_SCHEME < 0) || (scmRTOS_CONTEXT_SWITCH_SCHEME > 1) 00123 #error "Error: scmRTOS_CONTEXT_SWITCH_SCHEME must have values 0 or 1 only!" 00124 #endif 00125 00126 00127 //----------------- scmRTOS_PRIORITY_ORDER ------------------------------------ 00128 #ifndef scmRTOS_PRIORITY_ORDER 00129 #error "Error: Config macro scmRTOS_PRIORITY_ORDER must be defined!" 00130 #endif 00131 00132 #if (scmRTOS_PRIORITY_ORDER < 0) || (scmRTOS_PRIORITY_ORDER > 1) 00133 #error "Error: scmRTOS_PRIORITY_ORDER must have values 0 or 1 only!" 00134 #endif 00135 00136 //----------------- User Hooks inlining ------------------------------------ 00137 #ifndef INLINE_SYS_TIMER_HOOK 00138 #define INLINE_SYS_TIMER_HOOK 00139 #endif 00140 00141 #ifndef INLINE_CONTEXT_SWITCH_HOOK 00142 #define INLINE_CONTEXT_SWITCH_HOOK 00143 #endif 00144 00145 00146 //----------------------------------------------------------------------------- 00147 // 00148 /// Priority and process map type definitions 00149 // 00150 // 00151 namespace OS 00152 { 00153 #if scmRTOS_PROCESS_COUNT < 8 00154 typedef byte TProcessMap; 00155 #elif scmRTOS_PROCESS_COUNT < 16 00156 typedef word TProcessMap; 00157 #else 00158 typedef dword TProcessMap; 00159 #endif 00160 //------------------------------------------------------ 00161 #if scmRTOS_PRIORITY_ORDER == 0 00162 enum TPriority { 00163 #if scmRTOS_PROCESS_COUNT > 0 00164 pr0, 00165 #endif 00166 #if scmRTOS_PROCESS_COUNT > 1 00167 pr1, 00168 #endif 00169 #if scmRTOS_PROCESS_COUNT > 2 00170 pr2, 00171 #endif 00172 #if scmRTOS_PROCESS_COUNT > 3 00173 pr3, 00174 #endif 00175 #if scmRTOS_PROCESS_COUNT > 4 00176 pr4, 00177 #endif 00178 #if scmRTOS_PROCESS_COUNT > 5 00179 pr5, 00180 #endif 00181 #if scmRTOS_PROCESS_COUNT > 6 00182 pr6, 00183 #endif 00184 #if scmRTOS_PROCESS_COUNT > 7 00185 pr7, 00186 #endif 00187 #if scmRTOS_PROCESS_COUNT > 8 00188 pr8, 00189 #endif 00190 #if scmRTOS_PROCESS_COUNT > 9 00191 pr9, 00192 #endif 00193 #if scmRTOS_PROCESS_COUNT > 10 00194 pr10, 00195 #endif 00196 #if scmRTOS_PROCESS_COUNT > 11 00197 pr11, 00198 #endif 00199 #if scmRTOS_PROCESS_COUNT > 12 00200 pr12, 00201 #endif 00202 #if scmRTOS_PROCESS_COUNT > 13 00203 pr13, 00204 #endif 00205 #if scmRTOS_PROCESS_COUNT > 14 00206 pr14, 00207 #endif 00208 #if scmRTOS_PROCESS_COUNT > 15 00209 pr15, 00210 #endif 00211 #if scmRTOS_PROCESS_COUNT > 16 00212 pr16, 00213 #endif 00214 #if scmRTOS_PROCESS_COUNT > 17 00215 pr17, 00216 #endif 00217 #if scmRTOS_PROCESS_COUNT > 18 00218 pr18, 00219 #endif 00220 #if scmRTOS_PROCESS_COUNT > 19 00221 pr19, 00222 #endif 00223 #if scmRTOS_PROCESS_COUNT > 20 00224 pr20, 00225 #endif 00226 #if scmRTOS_PROCESS_COUNT > 21 00227 pr21, 00228 #endif 00229 #if scmRTOS_PROCESS_COUNT > 22 00230 pr22, 00231 #endif 00232 #if scmRTOS_PROCESS_COUNT > 23 00233 pr23, 00234 #endif 00235 #if scmRTOS_PROCESS_COUNT > 24 00236 pr24, 00237 #endif 00238 #if scmRTOS_PROCESS_COUNT > 25 00239 pr25, 00240 #endif 00241 #if scmRTOS_PROCESS_COUNT > 26 00242 pr26, 00243 #endif 00244 #if scmRTOS_PROCESS_COUNT > 27 00245 pr27, 00246 #endif 00247 #if scmRTOS_PROCESS_COUNT > 28 00248 pr28, 00249 #endif 00250 #if scmRTOS_PROCESS_COUNT > 29 00251 pr29, 00252 #endif 00253 #if scmRTOS_PROCESS_COUNT > 30 00254 pr30, 00255 #endif 00256 #if (scmRTOS_PROCESS_COUNT > 31) || (scmRTOS_PROCESS_COUNT < 1) 00257 #error "Invalid Process Count specification! Must be from 1 to 31." 00258 #endif 00259 prIDLE 00260 }; 00261 #else // scmRTOS_PRIORITY_ORDER == 1 00262 enum TPriority { 00263 prIDLE, 00264 #if scmRTOS_PROCESS_COUNT > 30 00265 pr30, 00266 #endif 00267 #if scmRTOS_PROCESS_COUNT > 29 00268 pr29, 00269 #endif 00270 #if scmRTOS_PROCESS_COUNT > 28 00271 pr28, 00272 #endif 00273 #if scmRTOS_PROCESS_COUNT > 27 00274 pr27, 00275 #endif 00276 #if scmRTOS_PROCESS_COUNT > 26 00277 pr26, 00278 #endif 00279 #if scmRTOS_PROCESS_COUNT > 25 00280 pr25, 00281 #endif 00282 #if scmRTOS_PROCESS_COUNT > 24 00283 pr24, 00284 #endif 00285 #if scmRTOS_PROCESS_COUNT > 23 00286 pr23, 00287 #endif 00288 #if scmRTOS_PROCESS_COUNT > 22 00289 pr22, 00290 #endif 00291 #if scmRTOS_PROCESS_COUNT > 21 00292 pr21, 00293 #endif 00294 #if scmRTOS_PROCESS_COUNT > 20 00295 pr20, 00296 #endif 00297 #if scmRTOS_PROCESS_COUNT > 19 00298 pr19, 00299 #endif 00300 #if scmRTOS_PROCESS_COUNT > 18 00301 pr18, 00302 #endif 00303 #if scmRTOS_PROCESS_COUNT > 17 00304 pr17, 00305 #endif 00306 #if scmRTOS_PROCESS_COUNT > 16 00307 pr16, 00308 #endif 00309 #if scmRTOS_PROCESS_COUNT > 15 00310 pr15, 00311 #endif 00312 #if scmRTOS_PROCESS_COUNT > 14 00313 pr14, 00314 #endif 00315 #if scmRTOS_PROCESS_COUNT > 13 00316 pr13, 00317 #endif 00318 #if scmRTOS_PROCESS_COUNT > 12 00319 pr12, 00320 #endif 00321 #if scmRTOS_PROCESS_COUNT > 11 00322 pr11, 00323 #endif 00324 #if scmRTOS_PROCESS_COUNT > 10 00325 pr10, 00326 #endif 00327 #if scmRTOS_PROCESS_COUNT > 9 00328 pr9, 00329 #endif 00330 #if scmRTOS_PROCESS_COUNT > 8 00331 pr8, 00332 #endif 00333 #if scmRTOS_PROCESS_COUNT > 7 00334 pr7, 00335 #endif 00336 #if scmRTOS_PROCESS_COUNT > 6 00337 pr6, 00338 #endif 00339 #if scmRTOS_PROCESS_COUNT > 5 00340 pr5, 00341 #endif 00342 #if scmRTOS_PROCESS_COUNT > 4 00343 pr4, 00344 #endif 00345 #if scmRTOS_PROCESS_COUNT > 3 00346 pr3, 00347 #endif 00348 #if scmRTOS_PROCESS_COUNT > 2 00349 pr2, 00350 #endif 00351 #if scmRTOS_PROCESS_COUNT > 1 00352 pr1, 00353 #endif 00354 #if scmRTOS_PROCESS_COUNT > 0 00355 pr0 00356 #endif 00357 #if (scmRTOS_PROCESS_COUNT > 31) || (scmRTOS_PROCESS_COUNT < 1) 00358 #error "Invalid Process Count specification! Must be from 1 to 31." 00359 #endif 00360 }; 00361 #endif //scmRTOS_PRIORITY_ORDER 00362 } 00363 //----------------------------------------------------------------------------- 00364 // 00365 // Process's constructor inlining control: default behaviour 00366 // 00367 #ifndef INLINE_PROCESS_CTOR 00368 #define INLINE_PROCESS_CTOR 00369 #endif 00370 00371 00372 //----------------------------------------------------------------------------- 00373 00374 #endif // scmRTOS_DEFS_H
Generated on Tue Jul 12 2022 21:14:46 by 1.7.2