femtoos_headers/femtoos_constants.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_CONSTANTS_H
00026 #define FEMTOOS_CONSTANTS_H
00027 
00028 /* Definition of constants needed in you configuration file
00029  * Most of these constants are tightly coupled to the constants
00030  * defined in locals and cannot be altered. */
00031 
00037 #define cfgFalse               0x0100U
00038 #define cfgTrue                0x0101U
00039 
00043 #define cfgUndefined           0x0108U
00044 #define cfgOverrideNon         0xFF01U
00045 #define cfgShared              0x8000U
00046 
00050 #define cfgGlobSet             0x0201U
00051 #define cfgGlobClear           0x0200U
00052 #define cfgTickSet             0x0210U
00053 #define cfgTickClear           0x0200U
00054 
00058 #define cfgExclude             0x0800U
00059 #define cfgStartSuspended      0x0900U
00060 #define cfgStartSleeping       0x0940U
00061 #define cfgStartRunning        0x09C0U
00062 
00066 #define cfgUseAsWait           0x0A01U
00067 #define cfgUseAsMutex          0x0A02U
00068 #define cfgUseAsQueu           0x0A03U
00069 #define cfgUseAsNon            0x0A04U
00070 
00074 #define cfgSyncSingleSlot      0x0C01U
00075 #define cfgSyncSingleBlock     0x0C02U
00076 #define cfgSyncDoubleBlock     0x0C03U
00077 #define cfgSyncNon             0x0C04U
00078 
00082 #define cfgKeep                0x0102U
00083 #define cfgOverride            0x0103U
00084 #define cfgReplace             0x0104U
00085 
00089 #define cfgNaked               0x0B02U
00090 #define cfgBikini              0x0B03U
00091 #define cfgComplete            0x0B04U
00092 
00099 #define cfgCapNon              0x0D00
00100 #define cfgCapWatchdog         0x0D01
00101 #define cfgCapEvent            0x0D02
00102 #define cfgCapCritical         0x0D04
00103 #define cfgCapSynchronization  0x0D08
00104 #define cfgCapFileSystem       0x0D10
00105 #define cfgCapDelay            0x0D20
00106 #define cfgCapTimeout          0x0D60
00107 #define cfgCapAll              0x0D7F
00108 
00109 
00113 #define registersNon           0x00    /*  ........  */
00114 #define r00r01r02r03           0x01    /*  .......x  */
00115 #define r04r05r06r07           0x02    /*  ......x.  */
00116 #define r08r09r10r11           0x04    /*  .....x..  */
00117 #define r12r13r14r15           0x08    /*  ....x...  */
00118 #define r16r17r18r19           0x10    /*  ...x....  */
00119 #define r20r21r22r23           0x20    /*  ..x.....  */
00120 #define r24r25r26r27           0x40    /*  .x......  */
00121 #define r28r29r30r31           0x80    /*  x.......  */
00122 #define r00_upto_r07           0x03    /*  ......xx  */
00123 #define r08_upto_r15           0x0C    /*  ....xx..  */
00124 #define r16_upto_r23           0x30    /*  ..xx....  */
00125 #define r24_upto_r31           0xC0    /*  xx......  */
00126 #define r00_upto_r15           0x0F    /*  ....xxxx  */
00127 #define r16_upto_r31           0xF0    /*  xxxx....  */
00128 #define registersAll           0xFF    /*  xxxxxxxx  */
00129 
00135 #if defined(defExtOptimized)
00136   #define defSysOptimized (defExtOptimized)
00137 #else
00138   #define defSysOptimized (cfgSysOptimized)
00139 #endif
00140 
00146 #if defined(defExtGCCstartup)
00147   #define defSysGCCstartup (defExtGCCstartup)
00148 #else
00149   #define defSysGCCstartup (cfgSysGCCstartup)
00150 #endif
00151 
00157 #if defined(defExtZeroPageStack)
00158   #define defSysZeroPageStack (defExtZeroPageStack)
00159 #else
00160   #define defSysZeroPageStack (cfgSysZeroPageStack)
00161 #endif
00162 
00163 
00169 #include "femtoos_device.h"
00170 
00171 #if !defined(__ASSEMBLER__)
00172 
00173 #undef  _SFR_IO8
00174 #undef  _SFR_MEM8
00175 #define _SFR_IO8(arg)  (arg)
00176 #define _SFR_MEM8(arg) (arg)
00177 
00178 #if (devTIMSK < 0x40)
00179   #define defTIMSKinIO          cfgTrue
00180 #else
00181   #define defTIMSKinIO          cfgFalse
00182 #endif
00183 
00184 #if (devAuxSysReg < 0x20)
00185   #define defAuxSysRegLowIO     cfgTrue
00186 #else
00187   #define defAuxSysRegLowIO     cfgFalse
00188 #endif
00189 
00190 #if (devAuxEventReg < 0x20)
00191   #define defAuxEventRegLowIO   cfgTrue
00192 #else
00193   #define defAuxEventRegLowIO   cfgFalse
00194 #endif
00195 
00196 #undef  _SFR_IO8
00197 #undef  _SFR_MEM8
00198 #define _SFR_IO8(arg)  ( _MMIO_BYTE((arg) + 0x20) )
00199 #define _SFR_MEM8(arg) ( _MMIO_BYTE(arg) )
00200 
00201 #endif
00202 
00208 #if (devFLASHsize > 0x10000UL)
00209   #define defThreeByteAddress          cfgTrue
00210   #define defThreeByteStackAdd         1
00211   #define defAddressSize               3
00212 #else
00213   #define defThreeByteAddress          cfgFalse
00214   #define defThreeByteStackAdd         0
00215   #define defAddressSize               2
00216 #endif
00217 
00218 #include "config_application.h"
00219 
00220 /* Any derived constants needed to be checked are to be inserted here. */
00221 
00222 /* Just to regulate the return value */
00223 #define defUseBoolReturns cfgUseTimeout
00224 
00230 #if (cfgUseSynchronization != cfgSyncNon) && (defUseBoolReturns == cfgTrue)
00231   #define defTaskSaveSizeSync 1
00232 #else
00233   #define defTaskSaveSizeSync 0
00234 #endif
00235 
00236 #if (cfgCheckTaskStack == cfgTrue) || (cfgCheckRegisters == cfgTrue) || (cfgCheckWatermarks == cfgTrue)
00237   #define defTaskSaveSizeBase 13
00238 #else
00239   #define defTaskSaveSizeBase 7
00240 #endif
00241 
00242 #define defTaskSaveSize (defTaskSaveSizeBase + defTaskSaveSizeSync)
00243 
00249 #define defTaskStackMinimum            (2*defAddressSize)
00250 
00254 #define defTaskStackGround             (defAddressSize + 1)
00255 
00256 
00257 #include "femtoos_check.h"
00258 
00268 #if defined(defExtReduceProEpilogue)
00269 
00270   #if (defExtReduceProEpilogue == cfgNaked)
00271     #define defSysReduceProEpilogue __attribute__ (( naked ))
00272     #define defSysReduceMain        __attribute__ (( naked ))
00273   #elif (defExtReduceProEpilogue == cfgBikini)
00274     #define defSysReduceProEpilogue  __attribute__ (( OS_task ))
00275     #define defSysReduceMain         __attribute__ (( OS_main ))
00276   #elif (defExtReduceProEpilogue == cfgComplete)
00277     #define defSysReduceProEpilogue
00278     #define defSysReduceMain
00279   #else
00280     #error "undefined option for external parameter defExtReduceProEpilogue"
00281   #endif
00282 
00283 #else
00284 
00285   #if (cfgSysReduceProEpilogue == cfgNaked)
00286     #define defSysReduceProEpilogue __attribute__ (( naked ))
00287   #elif (cfgSysReduceProEpilogue == cfgBikini)
00288     #define defSysReduceProEpilogue  __attribute__ (( OS_task ))
00289   #else
00290     #define defSysReduceProEpilogue
00291   #endif
00292 
00293 #endif
00294 
00299 #define defSysWrapperEpilogue __attribute__ ( ( naked , noinline) )
00300 
00301 #endif /* FEMTOOS_CONSTANTS_H */

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