femtoos_headers/femtoos_core.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 2that, 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_CORE_H
00026 #define FEMTOOS_CORE_H
00027 
00028 #include   "femtoos_port.h"
00029 
00030 /* DISCUSSION:
00031  * Several methods are defined through preprocessor definitions only. This
00032  * applies for the isrXXX methods, depending on the use they are coupled to
00033  * portXXX or privXXX methods. You cannot, in general make regular functions of
00034  * these methods, due to balanced stack depth.
00035  */
00036 
00037 
00087 #if (defCheckReportingError == cfgTrue)
00088   void privInitOs(Tuint08 uiErrorControl) __attribute__ (( noinline ));
00089   #define errOsStateForce        0x40
00090   #define errOsStateAsIs         0x00
00091   #define privInitOsReturn()     privInitOs(errOsStateForce)
00092   #define privInitOsSwitch()     privInitOs(errOsStateAsIs)
00093 #else
00094   void privInitOs(void) __attribute__ (( noinline ));
00095   #define privInitOsReturn()     privInitOs()
00096   #define privInitOsSwitch()     privInitOs()
00097 #endif
00098 
00099 
00105 void privIsrExit(void) defSysReduceProEpilogue;
00106 
00113 void privSubtickOverflow(void);
00114 
00121 void privTickYield(void) defSysReduceProEpilogue;
00122 
00128 void privWaitForFsAccess(void) defSysWrapperEpilogue;
00129 
00138 void main(void) defSysReduceProEpilogue;
00139 
00148 void taskYield(void) defSysWrapperEpilogue;
00149 
00158 void taskDelayFromNow(Tuint16 uiTicksToWait) defSysWrapperEpilogue;
00159 
00171 void taskDelayFromWake(Tuint16 uiTicksToWait) defSysWrapperEpilogue;
00172 
00202 void genSuspend(Tuint08 uiTaskNumber);
00203 #define genSuspendOnName(TaskName) genSuspend(preTaskNumberOf(TaskName))
00204 
00221 void taskSuspend(Tuint08 uiSuspendMode) defSysWrapperEpilogue;
00222 
00233 void genResume(Tuint08 uiTaskNumber);
00234 #define genResumeOnName(TaskName) genResume(preTaskNumberOf(TaskName))
00235 
00263 void taskSleep(void) defSysWrapperEpilogue;
00264 
00280 void taskSleepAll(void) defSysWrapperEpilogue;
00281 
00289 void genSetPriority(Tuint08 uiTaskNumber, Tuint08 uiNewPriority);
00290 #define genSetPriorityOnName(TaskName,NewPriority) genSetPriority(preTaskNumberOf(TaskName),NewPriority)
00291 
00299 Tuint08 genGetPriority(Tuint08 uiTaskNumber);
00300 #define genGetPriorityOnName(TaskName) genGetPriority(preTaskNumberOf(TaskName))
00301 
00309 Tuint16 genGetTickCount(void);
00310 
00320 void genAddtoTickCount(Tuint16 uiSleepTime);
00321 
00330 Tuint16 genGetLastWakeTime(Tuint08 uiTaskNumber);
00331 #define genGetLastWakeTimeOnName(TaskName) genGetLastWakeTime(preTaskNumberOf(TaskName))
00332 
00348 void taskFeedWatchdog(void);
00349 
00357 void taskKillWatchdog(void);
00358 
00366 Taddress genGetTaskname(Tuint08 uiTaskNumber);
00367 #define genGetTasknameOnName(TaskName) genGetTaskname(preTaskNumberOf(TaskName))
00368 
00378 void taskTerminate(Tuint08 uiTaskNumber) defSysWrapperEpilogue;
00379 #define taskTerminateOnName(TaskName) taskTerminate(preTaskNumberOf(TaskName))
00380 
00391 void taskRecreate(Tuint08 uiTaskNumber) defSysWrapperEpilogue;
00392 #define taskRecreateOnName(TaskName) taskRecreate(preTaskNumberOf(TaskName))
00393 
00406 void taskRestart(Tuint08 uiRestartMode, Tuint16 uiTicksToWait) defSysWrapperEpilogue __attribute__ ( ( noreturn ) );
00407 
00420 void genReboot(void) __attribute__ ( ( noreturn ) );
00421 
00432 void genLogTask(Tuint08 uiTaskNumber, void (*pipe)(Tchar));
00433 
00444 void genLogOs(void (*pipe)(Tchar));
00445 
00446 #if (includeGenPipeInt16 == cfgTrue)
00447 
00455 void genPipeInt16(Tuint16 uiValue, void (*pipe)(Tchar));
00456 #endif
00457 
00458 #if (includeGenPassFlashString == cfgTrue)
00459 
00471 void genPassFlashString(Taddress pString, Tuint08 uiLength, Tchar cFilling, void (*pipe)(Tchar));
00472 #endif
00473 
00481 #if (cfgCheckTrace == cfgTrue)
00482   void genTraceByteInfo(Tbyte bUser);
00483 #else
00484   #define genTraceByteInfo(bUser)  do {} while(false)
00485 #endif
00486 
00494 #if (cfgCheckTrace == cfgTrue)
00495   void genTraceWordInfo(Tword wUser);
00496 #else
00497   #define genTraceWordInfo(bUser)  do {} while(false)
00498 #endif
00499 
00507 #if (cfgCheckTrace == cfgTrue)
00508  void  genTraceMarker(void);
00509 #else
00510   #define genTraceMarker()
00511 #endif
00512 
00513 
00514 #if (cfgUseTimeout == cfgTrue)
00515 
00527   Tbool taskWaitForTasks(Tuint08 uiSlot, Tuint08 uiNumberOfTasks, Tuint16 uiTicksToWait) defSysWrapperEpilogue;
00528   #define taskWaitForTasksOnName(SlotName,NumberOfTasks,TicksToWait) taskWaitForTasks(preSlotNumberOf(SlotName),NumberOfTasks,TicksToWait)
00529 
00539   #define taskWaitForOtherTask(Slot,TicksToWait)                     taskWaitForTasks(Slot,2,TicksToWait)
00540   #define taskWaitForOtherTaskOnName(SlotName,TicksToWait)           taskWaitForTasks(preSlotNumberOf(SlotName),2,TicksToWait)
00541 #else
00542   void taskWaitForTasks(Tuint08 uiSlot, Tuint08 uiNumberOfTasks) defSysWrapperEpilogue;
00543   #define taskWaitForTasksOnName(SlotName,NumberOfTasks) taskWaitForTasks(preSlotNumberOf(SlotName),NumberOfTasks)
00544   #define taskWaitForOtherTask(Slot)                     taskWaitForTasks(Slot,2)
00545   #define taskWaitForOtherTaskOnName(SlotName)           taskWaitForTasks(preSlotNumberOf(SlotName),2)
00546 #endif
00547 
00548 
00558 void  genWaitRelease(Tuint08 uiSlot);
00559 #define  genWaitReleaseOnName(SlotName) genWaitRelease(preSlotNumberOf(SlotName))
00560 
00589 #if (cfgUseTimeout == cfgTrue)
00590   #if (cfgUseSynchronization == cfgSyncDoubleBlock)
00591     Tbool taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait) defSysWrapperEpilogue;
00592   #else
00593     Tbool taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait) defSysWrapperEpilogue;
00594   #endif
00595 #else
00596   #if (cfgUseSynchronization == cfgSyncDoubleBlock)
00597     void taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling) defSysWrapperEpilogue;
00598   #else
00599     void taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeRightFilling) defSysWrapperEpilogue;
00600   #endif
00601 #endif
00602 
00603 
00615 void taskSyncRelease(Tuint08 uiSlotSlot) defSysWrapperEpilogue;
00616 
00617 
00628 #if (cfgUseTimeout == cfgTrue)
00629   #if (cfgUseSynchronization == cfgSyncDoubleBlock)
00630 
00647     #define taskSyncWriteWriteRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling,TicksToWait) taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(-(FreeLeftFilling)),(-(FreeRightFilling)),TicksToWait)
00648     #define taskSyncWriteReadRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling,TicksToWait)  taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(-(FreeLeftFilling)),(FreeRightFilling),TicksToWait)
00649     #define taskSyncReadWriteRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling,TicksToWait)  taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(FreeLeftFilling),(-(FreeRightFilling)),TicksToWait)
00650     #define taskSyncReadReadRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling,TicksToWait)   taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(FreeLeftFilling),(FreeRightFilling),TicksToWait)
00651 
00666     #define taskQueuWriteRequestOnName(SlotName,FreeFilling,TicksToWait)                                             taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),0,(-(FreeFilling)),TicksToWait)
00667     #define taskQueuReadRequestOnName(SlotName,FreeFilling,TicksToWait)                                              taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),0,(FreeFilling),TicksToWait)
00668 
00681     #define taskMutexRequestOnName(SlotName,TicksToWait)                                                             taskSyncRequest(PassIfSlotIsMutex(preSlotNumberOf(SlotName)),0,0,TicksToWait)
00682   #else
00683     #define taskQueuWriteRequestOnName(SlotName,FreeFilling,TicksToWait)                                             taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(-(FreeFilling)),TicksToWait)
00684     #define taskQueuReadRequestOnName(SlotName,FreeFilling,TicksToWait)                                              taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(FreeFilling),TicksToWait)
00685     #define taskMutexRequestOnName(SlotName,TicksToWait)                                                             taskSyncRequest(PassIfSlotIsMutex(preSlotNumberOf(SlotName)),0,TicksToWait)
00686   #endif
00687 #else
00688   #if (cfgUseSynchronization == cfgSyncDoubleBlock)
00689     #define taskSyncWriteWriteRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling)             taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(-(FreeLeftFilling)),(-(FreeRightFilling)))
00690     #define taskSyncWriteReadRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling)              taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(-(FreeLeftFilling)),(FreeRightFilling))
00691     #define taskSyncReadWriteRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling)              taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(FreeLeftFilling),(-(FreeRightFilling)))
00692     #define taskSyncReadReadRequestOnName(SlotLeftName,SlotRightName,FreeLeftFilling,FreeRightFilling)               taskSyncRequest((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))),(FreeLeftFilling),(FreeRightFilling))
00693     #define taskQueuWriteRequestOnName(SlotName,FreeFilling)                                                         taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),0,(-(FreeFilling)))
00694     #define taskQueuReadRequestOnName(SlotName,FreeFilling)                                                          taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),0,(FreeFilling))
00695     #define taskMutexRequestOnName(SlotName)                                                                         taskSyncRequest(PassIfSlotIsMutex(preSlotNumberOf(SlotName)),0,0)
00696   #else
00697     #define taskQueuWriteRequestOnName(SlotName,FreeFilling)                                                         taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(-(FreeFilling)))
00698     #define taskQueuReadRequestOnName(SlotName,FreeFilling)                                                          taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(FreeFilling))
00699     #define taskMutexRequestOnName(SlotName)                                                                         taskSyncRequest(PassIfSlotIsMutex(preSlotNumberOf(SlotName)),0)
00700   #endif
00701 #endif
00702 
00714 #if (cfgUseSynchronization == cfgSyncDoubleBlock)
00715   #define taskSyncReleaseOnName(SlotLeftName,SlotRightName)   taskSyncRelease((((preSlotNumberOf(SlotLeftName))<<4)|((preSlotNumberOf(SlotRightName)))))
00716 #endif
00717 
00725 #define taskQueuReleaseOnName(SlotName)                       taskSyncRelease(PassIfSlotIsQueu(preSlotNumberOf(SlotName)))
00726 
00734 #define taskMutexReleaseOnName(SlotName)                      taskSyncRelease(PassIfSlotIsMutex(preSlotNumberOf(SlotName)))
00735 
00751 void genQueuWrite(Tuint08 uiSlot, Tbyte bItem);
00752 #define genQueuWriteOnName(SlotName,bItem) genQueuWrite(preSlotNumberOf(SlotName),bItem)
00753 
00768 Tbyte genQueuRead(Tuint08 uiSlot);
00769 #define genQueuReadOnName(SlotName) genQueuRead(preSlotNumberOf(SlotName))
00770 
00780 void genQueuClear(Tuint08 uiSlot);
00781 #define genQueuClearOnName(SlotName) genQueuClear(preSlotNumberOf(SlotName))
00782 
00790 Tbyte genQueuPeek(Tuint08 uiSlot);
00791 #define genQueuPeekOnName(SlotName) genQueuPeek(preSlotNumberOf(SlotName))
00792 
00800 Tuint08 genQueuReadable(Tuint08 uiSlot);
00801 #define genQueuReadableOnName(SlotName) genQueuReadable(preSlotNumberOf(SlotName))
00802 
00810 Tuint08 genQueuWriteable(Tuint08 uiSlot);
00811 #define genQueuWriteableOnName(SlotName) genQueuWriteable(preSlotNumberOf(SlotName))
00812 
00819 Tbool genQueuFull(Tuint08 uiSlot);
00820 #define genQueuFullOnName(SlotName) genQueuFull(preSlotNumberOf(SlotName))
00821 
00828 Tbool genQueuEmpty(Tuint08 uiSlot);
00829 #define genQueuEmptyOnName(SlotName) genQueuEmpty(preSlotNumberOf(SlotName))
00830 
00848 #if (cfgUseTimeout == cfgTrue)
00849   #if (cfgUseFileSystemConcurrentRead == cfgTrue)
00850     Tbool taskFileOpen(Tbool bReadOnly, Tuint16 uiTicksToWait) defSysWrapperEpilogue;
00851   #else
00852     Tbool taskFileOpen(Tuint16 uiTicksToWait) defSysWrapperEpilogue;
00853   #endif
00854 #else
00855   #if (cfgUseFileSystemConcurrentRead == cfgTrue)
00856     void taskFileOpen(Tbool bReadOnly) defSysWrapperEpilogue;
00857   #else
00858     void taskFileOpen(void) defSysWrapperEpilogue;
00859   #endif
00860 #endif
00861 
00871 void taskFileClose(void) defSysWrapperEpilogue;
00872 
00883 void taskFileSetSize(Tuint08 uiFileNumber, Tuint08 uiSize);
00884 #define taskFileSetSizeOnName(FileName,Size)  taskFileSetSize(preFileNumberOf(FileName),Size)
00885 
00894 #define taskFileClear(FileNumber)             taskFileSetSize(FileNumber,0)
00895 #define taskFileClearOnName(FileName)         taskFileSetSize(preFileNumberOf(FileName),0)
00896 
00904 Tuint08 taskFileGetSize(Tuint08 uiFileNumber);
00905 #define taskFileGetSizeOnName(FileName) taskFileSize(preFileNumberOf(FileName))
00906 
00919 void taskFileFormat(void);
00920 
00930 Tbyte taskFileReadByte(Tuint08 uiFileNumber, Tuint08 uiOffset);
00931 #define taskFileReadByteOnName(FileName,Offset) taskFileReadByte(preFileNumberOf(FileName),Offset)
00932 
00942 void taskFileWriteByte(Tuint08 uiFileNumber, Tuint08 uiOffset, Tbyte bItem);
00943 #define taskFileWriteByteOnName(FileName,Offset,Item) taskFileWriteByte(preFileNumberOf(FileName),Offset,Item)
00944 
00956 void taskFileAppendByte(Tuint08 uiFileNumber, Tbyte bItem);
00957 #define taskFileAppendByteOnName(FileName,Item) taskFileAppendByte(preFileNumberOf(FileName),Item)
00958 
00970 void taskFileReadPipe(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, void (*pipe)(Tchar));
00971 #define taskFileReadOnName(FileName,Offset,Size,pipe) taskFileRead(preFileNumberOf(FileName),Offset,Size,pipe)
00972 
00983 void taskFileWritePipe(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Tchar (*pipe)(void));
00984 #define taskFileWriteOnName(FileName,Offset,Size,pipe) taskFileWrite(preFileNumberOf(FileName),Offset,Size,pipe)
00985 
00997 void taskFileReadBuffer(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer);
00998 #define taskFileReadBufferOnName(FileName,Offset,Size,Buffer)  taskFileReadBuffer(preFileNumberOf(FileName),Offset,Size,Buffer)
00999 
01010 void taskFileWriteBuffer(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer);
01011 #define taskFileWriteBufferOnName(FileName,Offset,Size,Buffer)  taskFileWriteBuffer(preFileNumberOf(FileName),Offset,Size,Buffer)
01012 
01021 #define taskFileDirectRead(Address) portFSReadByte(Address)
01022 
01031 #define taskFileDirectWrite(Address, Value) portFSWriteByte(Address,Value)
01032 
01033 
01034 #if (includeTaskProtectGlobalInterrupts == cfgTrue) || ((includeTaskProtectGlobalCritical == cfgTrue) && (cfgUseNestedCriticals == cfgFalse) )
01035 
01036   #if (cfgCheckTrace == cfgTrue)
01037 
01046     #define taskEnableGlobalInterrupts()     do { portTrace(traceAPIcallBase | callIdTaskEnableGlobalInterrupts); portEnableGlobalInterrupts(); } while(false)
01047 
01048 
01058     #define taskDisableGlobalInterrupts()    do { portDisableGlobalInterrupts(); portTrace(traceAPIcallBase | callIdTaskDisableGlobalInterrupts); } while(false)
01059 
01060   #else
01061 
01065     #define taskEnableGlobalInterrupts()     portEnableGlobalInterrupts()
01066 
01070     #define taskDisableGlobalInterrupts()    portDisableGlobalInterrupts()
01071 
01072   #endif
01073 
01074 #endif
01075 
01076 
01077 #if (includeTaskProtectGlobalCritical == cfgTrue)
01078 
01079   #if (cfgUseNestedCriticals == cfgTrue)
01080 
01092     void taskEnterGlobalCritical(void);
01093 
01105     void taskExitGlobalCritical(void);
01106 
01107   #else
01108 
01112     #define taskEnterGlobalCritical()        taskDisableGlobalInterrupts()
01113 
01117     #define taskExitGlobalCritical()         taskEnableGlobalInterrupts()
01118 
01119   #endif
01120 
01121 #endif
01122 
01123 
01124 
01125 #if (includeTaskProtectSwitchTasks == cfgTrue) || ((includeTaskProtectSwitchCritical == cfgTrue) && (cfgUseNestedCriticals == cfgFalse) )
01126 
01140   void taskEnableSwitchTask(void);
01141 
01187   void taskDisableSwitchTask(void);
01188 
01189 #endif
01190 
01191 
01192 #if (includeTaskProtectSwitchCritical == cfgTrue)
01193 
01194   #if (cfgUseNestedCriticals == cfgTrue)
01195 
01215     void taskEnterSwitchCritical(void);
01216 
01231     void taskExitSwitchCritical(void);
01232 
01233   #else
01234 
01238     #define taskEnterSwitchCritical()          taskDisableSwitchTask()
01239 
01243     #define taskExitSwitchCritical()           taskEnableSwitchTask()
01244 
01245   #endif
01246 
01247 #endif
01248 
01249 
01250 #if (cfgIntTickTrack == cfgTrue) && ((includeTaskProtectTickInterrupts == cfgTrue) || ((includeTaskProtectTickCritical == cfgTrue) && (cfgUseNestedCriticals == cfgFalse) ))
01251 
01252   #if (cfgCheckTrace == cfgTrue)
01253 
01262     #if (cfgIntGlobalOnly == cfgTrue)
01263       #define taskEnableTickInterrupts()     do { portTrace(traceAPIcallBase | callIdTaskEnableGlobalInterrupts); portEnableGlobalInterrupts(); } while(false)
01264     #else
01265       #define taskEnableTickInterrupts()     do { portTrace(traceAPIcallBase | callIdTaskEnableTickInterrupts); portEnableTickInterrupts(); } while(false)
01266     #endif
01267 
01268 
01278     #if (cfgIntGlobalOnly == cfgTrue)
01279       #define taskDisableTickInterrupts()    do { portDisableGlobalInterrupts(); portTrace(traceAPIcallBase | callIdTaskDisableGlobalInterrupts); } while(false)
01280     #else
01281       #define taskDisableTickInterrupts()    do { portDisableTickInterrupts(); portTrace(traceAPIcallBase | callIdTaskDisableTickInterrupts); } while(false)
01282     #endif
01283 
01284   #else
01285 
01289     #if (cfgIntGlobalOnly == cfgTrue)
01290       #define taskEnableTickInterrupts()     portEnableGlobalInterrupts()
01291     #else
01292       #define taskEnableTickInterrupts()     portEnableTickInterrupts()
01293     #endif
01294 
01298     #if (cfgIntGlobalOnly == cfgTrue)
01299       #define taskDisableTickInterrupts()    portDisableGlobalInterrupts()
01300     #else
01301       #define taskDisableTickInterrupts()    portDisableTickInterrupts()
01302     #endif
01303 
01304   #endif
01305 
01306 #endif
01307 
01308 
01309 
01310 #if (cfgIntTickTrack == cfgTrue) && (includeTaskProtectTickCritical == cfgTrue)
01311 
01312   #if (cfgUseNestedCriticals == cfgTrue)
01313 
01314     #if (cfgIntGlobalOnly == cfgTrue)
01315       #define taskEnterTickCritical()      taskEnterGlobalCritical()
01316       void taskEnterGlobalCritical(void);
01317     #else
01318 
01329       void taskEnterTickCritical(void);
01330     #endif
01331 
01332     #if (cfgIntGlobalOnly == cfgTrue)
01333       #define taskExitTickCritical()       taskExitGlobalCritical()
01334       void taskExitGlobalCritical(void);
01335     #else
01336 
01347       void taskExitTickCritical(void);
01348     #endif
01349 
01350   #else
01351 
01355     #define taskEnterTickCritical()        taskDisableTickInterrupts()
01356 
01360     #define taskExitTickCritical()         taskEnableTickInterrupts()
01361 
01362   #endif
01363 
01364 #endif
01365 
01366 
01367 
01368 #if (cfgIntUserDefined == cfgTrue)
01369   #if (cfgIntOsProtected == cfgTrue) && (cfgUseLowPowerSleep == cfgFalse) && (cfgIntTickTrack == cfgFalse)
01370     #if (includeIsrEnter == cfgTrue) && (cfgUseLoadMonitor == cfgTrue)
01371 
01381       #define isrEnter()                   \
01382         portResqueGlobalInterruptActive(); \
01383         portSaveContext();                 \
01384         privInitOsReturn();                \
01385         isrStartLoad();                    \
01386         portEnterISR()
01387     #elif (includeIsrEnter == cfgTrue)
01388       #define isrEnter()                   \
01389         portResqueGlobalInterruptActive(); \
01390         portSaveContext();                 \
01391         privInitOsReturn();                \
01392         portEnterISR()
01393     #endif
01394 
01395     #if (includeIsrExit == cfgTrue) && (cfgUseLoadMonitor == cfgTrue)
01396 
01405       #define isrExit()         \
01406         isrStopLoad();          \
01407         privIsrExit()
01408     #elif (includeIsrExit == cfgTrue)
01409       #define isrExit()         privIsrExit()
01410     #endif
01411 
01412   #endif
01413 
01414 
01415   #if (includeIsrBegin == cfgTrue)
01416 
01430     #define isrBegin()         portBeginISR()
01431   #endif
01432 
01433   #if (includeIsrEndReturn == cfgTrue)
01434 
01442     #define isrEndReturn()     portReturnISR()
01443   #endif
01444 
01445   #if (cfgIntOsProtected == cfgTrue) && (includeIsrEndYield == cfgTrue) && (includeTaskYield == cfgTrue) && (cfgUseLowPowerSleep == cfgFalse)
01446 
01455     #define isrEndYield()      portYieldISR()
01456   #endif
01457 
01458 #endif
01459 
01480 Tuint16 taskStackCheck(Tuint08 uiExtraStackSafety);
01481 
01499 Tuint16 isrStackCheck(Tuint08 uiExtraStackSafety);
01500 
01501 
01502 #if (cfgIntUserDefined == cfgTrue)
01503   #if ((cfgUseLoadMonitor == cfgTrue) && ((includeIsrEnter == cfgTrue) || (includeIsrStartLoad == cfgTrue)))
01504 
01513     void isrStartLoad(void);
01514   #else
01515     #define isrStartLoad()
01516   #endif
01517 #endif
01518 
01519 #if (cfgIntUserDefined == cfgTrue)
01520   #if ((cfgUseLoadMonitor == cfgTrue) && ((includeIsrExit == cfgTrue) || (includeIsrStopLoad == cfgTrue)))
01521 
01530     void isrStopLoad(void);
01531   #else
01532     #define isrStopLoad()
01533   #endif
01534 #endif
01535 
01549 #if (cfgUseTimeout == cfgTrue)
01550   Tbool taskWaitForEvent(Tuint08 uiEventSet, Tuint16 uiTicksToWait) defSysWrapperEpilogue;
01551   #define taskWaitForEventSetOnNames1(Event0,TicksToWait)                                           taskWaitForEventSet(preEventLocationOf(Event0),TicksToWait)
01552   #define taskWaitForEventSetOnNames2(Event0,Event1,TicksToWait)                                    taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1),TicksToWait)
01553   #define taskWaitForEventSetOnNames3(Event0,Event1,Event2,TicksToWait)                             taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2),TicksToWait)
01554   #define taskWaitForEventSetOnNames4(Event0,Event1,Event2,Event3,TicksToWait)                      taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3),TicksToWait)
01555   #define taskWaitForEventSetOnNames5(Event0,Event1,Event2,Event3,Event4,TicksToWait)               taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4),TicksToWait)
01556   #define taskWaitForEventSetOnNames6(Event0,Event1,Event2,Event3,Event4,Event5,TicksToWait)        taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5),TicksToWait)
01557   #define taskWaitForEventSetOnNames7(Event0,Event1,Event2,Event3,Event4,Event5,Event6,TicksToWait) taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6),TicksToWait)
01558   #define taskWaitForAllEvents(TicksToWait)                                                         taskWaitForEventSet(defAllEvents,TicksToWait)
01559 #else
01560   void taskWaitForEvent(Tuint08 uiEventSet) defSysWrapperEpilogue;
01561   #define taskWaitForEventSetOnNames1(Event0)                                           taskWaitForEventSet(preEventLocationOf(Event0))
01562   #define taskWaitForEventSetOnNames2(Event0,Event1)                                    taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1))
01563   #define taskWaitForEventSetOnNames3(Event0,Event1,Event2)                             taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))
01564   #define taskWaitForEventSetOnNames4(Event0,Event1,Event2,Event3)                      taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))
01565   #define taskWaitForEventSetOnNames5(Event0,Event1,Event2,Event3,Event4)               taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))
01566   #define taskWaitForEventSetOnNames6(Event0,Event1,Event2,Event3,Event4,Event5)        taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))
01567   #define taskWaitForEventSetOnNames7(Event0,Event1,Event2,Event3,Event4,Event5,Event6) taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))
01568   #define taskWaitForAllEvents()                                                        taskWaitForEventSet(defAllEvents)
01569 #endif
01570 
01583 void genFireEventSet(Tuint08 uiEventSet);
01584 #define genFireEventSetOnNames2(Event0,Event1)                                    genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1))
01585 #define genFireEventSetOnNames3(Event0,Event1,Event2)                             genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))
01586 #define genFireEventSetOnNames4(Event0,Event1,Event2,Event3)                      genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))
01587 #define genFireEventSetOnNames5(Event0,Event1,Event2,Event3,Event4)               genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))
01588 #define genFireEventSetOnNames6(Event0,Event1,Event2,Event3,Event4,Event5)        genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))
01589 #define genFireEventSetOnNames7(Event0,Event1,Event2,Event3,Event4,Event5,Event6) genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))
01590 #define genFireAllEvents()                                                        genFireEventSet(defAllEvents)
01591 
01602 Tuint08 genCountEventBlocks(Tuint08 uiEventSet);
01603 #define genCountEventBlocksOnNames2(Event0,Event1)                                    genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1))
01604 #define genCountEventBlocksOnNames3(Event0,Event1,Event2)                             genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))
01605 #define genCountEventBlocksOnNames4(Event0,Event1,Event2,Event3)                      genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))
01606 #define genCountEventBlocksOnNames5(Event0,Event1,Event2,Event3,Event4)               genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))
01607 #define genCountEventBlocksOnNames6(Event0,Event1,Event2,Event3,Event4,Event5)        genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))
01608 #define genCountEventBlocksOnNames7(Event0,Event1,Event2,Event3,Event4,Event5,Event6) genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))
01609 #define genCountEventBlocksOnAll()                                                    genCountEventBlocks(defAllEvents)
01610 
01611 
01612 #if (cfgUseEvents == cfgTrue)
01613   /* Internal base definition for firing an event. */
01614   #define privFireEvent(Event)             portEventRegister |= (1 << (Event))
01615 
01616   #if (includeIsrFireEvent == cfgTrue)
01617 
01645     #define isrFireEvent(Event)              privFireEvent(CheckEventNumber(Event))
01646     #define isrFireEventOnName(EventName)    isrFireEvent(preEventNumberOf(EventName))
01647   #endif
01648 
01649 
01650   #if (includeGenFireEvent == cfgTrue)
01651     #if (defEventRegisterAtomicOperation == cfgTrue) && (cfgCheckTrace == cfgFalse) && (cfgUseEventsOnVariables == cfgFalse)
01652       #define genFireEvent(Event)            privFireEvent(CheckEventNumber(Event))
01653     #else
01654 
01677       void genFireEvent(Tuint08 uiEvent);
01678     #endif
01679     #define genFireEventOnName(EventName)    genFireEvent(preEventNumberOf(EventName))
01680   #endif
01681 
01682 #endif
01683 
01684 #endif /* FEMTOOS_CORE_H */
01685 

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