femtoos_source/femtoos_core.c File Reference

#include "femtoos_core.h"
#include "femtoos_shared.h"

Include dependency graph for femtoos_core.c:

Go to the source code of this file.

Defines

#define privDelayCalcFromNow(DT)   privDelayCalc(DT,true)
#define privDelayCalcFromWake(DT)   privDelayCalc(DT,false)

Functions

static void privDelayFromNowBody (Tuint16 uiTicksToWait) __attribute__((used)) defSysReduceProEpilogue
 Internal use only, not possible to call yourself from application code.
static void privDelayFromWakeBody (Tuint16 uiTicksToWait) __attribute__((used)) defSysReduceProEpilogue
 Internal use only, not possible to call yourself from application code.
static void privRecreateBody (Tuint08 uiTaskNumber) __attribute__((used)) defSysReduceProEpilogue
 Internal use only, not possible to call yourself from application code.
static void privRestartBody (Tuint08 uiRestartMode, Tuint16 uiTicksToWait) __attribute__((used)) defSysReduceProEpilogue
 Internal use only, not possible to call yourself from application code.
static void privYieldBody (void)
 Internal use only, not possible to call yourself from application code.
static void privCheckOsStackLevel (void)
static void privCheckOsStackRegion (void)
static void privCheckCapabilities (Tuint08 uiCallId, Tuint08 uiTaskCaps)
static TtaskControlBlockprivTcbList (Tuint08 uiTaskNumber)
static Tuint08 privTaskNumber (Tuint08 uiTaskNumber)
static Tuint08 privRegisterCount (Tuint08 uiRegisterUse)
static void privTaskInit (Tuint08 uiTaskNumber, Tuint08 uiInitControl)
static void privEnterOS (Tuint08 uiAction)
static void privIncrementTick (void)
static Tselect privSelectTask (Tuint08 uiFlipMask, Tuint08 uiLoopStart, Tuint08 uiLoopEnd)
static void privMakeTasksRunable (Tuint08 uiFlipMask, Tuint08 uiPriority, Tuint08 uiLoopStart, Tuint08 uiLoopEnd, Tbool bCheckSkip)
static Tuint08 privSwitchContext (void)
static void privEnterSleep (Tuint08 uiTickMinDelay)
static void privEnterIdle (void)
static void privEnterTask (void)
static void privWakeupFromDelay (Tuint08 uiTaskNumber, TtaskControlBlock *taskTCB)
static void privCopyLoad (void)
static void privTraceWatermarks (void)
static void privDelayCalc (Tuint16 uiDelayTime, Tbool bFromNow)
static void privCleanSlotStack (TtaskExtendedControlBlock *taskTCB)
static Tbool privOperateSlotStack (Tuint08 uiControlTaskNumber, Tuint08 uiSlotSlot)
static void privUnblockTask (Tuint08 uiControlTaskNumber)
static void privPutAllTasksToSleep (void)
static void privReleaseFileBlocks (void)
static Taddress privFileLocation (Tuint08 uiFileNumber, Tuint08 uiOffset)
static Tuint08 privFileSpace (Tuint08 uiFileNumber)
static void privPrepareFileClose (Tuint08 uiTaskNumber)
void privWakeupFromLowPower (void)
void privInitOs (Tuint08 uiErrorControl)
void isrStartLoad (void)
void isrStopLoad (void)
void privIsrExit (void)
 Internal use only, do not call it yourself from application code.
void privSubtickOverflow (void)
 Internal use only, do not call it yourself from application code.
void privTickYield (void)
 Internal use only, do not call it yourself from application code.
void main (void)
 Internal use only, do not call it yourself from application code.
void taskDelayFromNow (Tuint16 uiTicksToWait)
 Delay the task a number of ticks, starting from now.
void taskDelayFromWake (Tuint16 uiTicksToWait)
 Delay the task a number of ticks, starting at the last wake time.
void taskRecreate (Tuint08 uiTaskNumber)
 Recreate one particular task.
void taskRestart (Tuint08 uiRestartMode, Tuint16 uiTicksToWait)
 Restart the running task.
void taskYield (void)
 Manual context switch.
void taskSuspend (Tuint08 uiSuspendMode)
 Suspend this task and invoke a context switch.
void taskSleep (void)
 Put the current task to sleep and invoke a context switch.
void taskTerminate (Tuint08 uiTaskNumber)
 Stop (in error mode) one particular task.
void taskSleepAll (void)
 Put all tasks to sleep.
void privWaitForFsAccess (void)
 Internal use only, do not call it yourself from application code.
Tbool taskFileOpen (Tbool bReadOnly, Tuint16 uiTicksToWait)
void taskFileClose (void)
 Close the file system, so other tasks may obtain access.
Tbool taskWaitForEvent (Tuint08 uiEvent, Tuint16 uiTicksToWait)
Tuint16 taskStackCheck (Tuint08 uiExtraStackSafety)
 Call to check how much free space is left on the task stack.
Tuint16 isrStackCheck (Tuint08 uiExtraStackSafety)
 Call to check how much free space is left on the isr stack.
void privTerminateBody (Tuint08 uiTaskNumber)
void genReboot (void)
 Reboot the system.
void genAddtoTickCount (Tuint16 uiSleepTime)
 Add the given number of ticks to the tick counter.
Taddress genGetTaskname (Tuint08 uiTaskNumber)
 Get the flash address of the task name.
void genSuspend (Tuint08 uiTaskNumber)
 Suspend a task, but do not invoke a context switch.
void privSuspendBody (Tuint08 uiSuspendMode)
void genResume (Tuint08 uiTaskNumber)
 Resume the given task from suspension.
void privSleepBody (void)
void privSleepAllBody (void)
void taskDisableSwitchTask (void)
void taskEnableSwitchTask (void)
void genSetPriority (Tuint08 uiTaskNumber, Tuint08 uiNewPriority)
 Set a new priority for the given task.
Tuint08 genGetPriority (Tuint08 uiTaskNumber)
 Return the current priority of a given task.
Tuint16 genGetTickCount (void)
 Get the tick counter.
Tuint16 genGetLastWakeTime (Tuint08 uiTaskNumber)
 Return the time the task was last woken.
void taskFeedWatchdog (void)
 Feed the watchdog in order to prevent barking.
void taskKillWatchdog (void)
 Switch off the watchdog facility for this task.
static void genPipeInt16 (Tuint16 uiValue, void(*pipe)(Tchar))
static void genPassFlashString (Taddress pString, Tuint08 uiLength, Tchar cFilling, void(*pipe)(Tchar))
void genLogOs (void(*pipe)(Tchar))
 Binary one liner about the os.
void genLogTask (Tuint08 uiTaskNumber, void(*pipe)(Tchar))
 Binary one liners about every task.
void taskEnterGlobalCritical (void)
void taskExitGlobalCritical (void)
void taskEnterSwitchCritical (void)
void taskExitSwitchCritical (void)
void taskEnterTickCritical (void)
void taskExitTickCritical (void)
void genTraceByteInfo (Tbyte bUser)
void genTraceWordInfo (Tword wUser)
void genTraceMarker (void)
void privWaitForFsAccessBody (void)
void privFileOpenBody (Tbool bReadOnly, Tuint16 uiTicksToWait)
void privFileCloseBody (void)
static void privCheckFileSpecsWriting (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Tuint08 uiCallId)
static void privCheckFileSpecsReading (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Tuint08 uiCallId)
void taskFileSetSize (Tuint08 uiFileNumber, Tuint08 uiSize)
 Give the file a new size, contents are unchanged.
Tuint08 taskFileGetSize (Tuint08 uiFileNumber)
 Get the present size of a file.
void taskFileFormat (void)
 Clean (fill with zero's) the whole disk space.
Tbyte taskFileReadByte (Tuint08 uiFileNumber, Tuint08 uiOffset)
 Get one byte from a file using a raw read.
void taskFileWriteByte (Tuint08 uiFileNumber, Tuint08 uiOffset, Tbyte bItem)
 Write one byte to a file using a raw write.
void taskFileAppendByte (Tuint08 uiFileNumber, Tbyte bItem)
 Add one byte to the file, starting at the beginning when full.
void taskFileReadPipe (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, void(*pipe)(Tchar))
 Read several bytes from the file and push them to the pipe.
void taskFileReadBuffer (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
 Read several bytes from the file and push them to the buffer.
void taskFileWritePipe (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Tchar(*pipe)(void))
 Read several bytes from the pipe and put the on file.
void taskFileWriteBuffer (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
 Read several bytes from the buffer and put the on file.
void privWaitForEventBody (Tuint08 uiEventSet, Tuint16 uiTicksToWait)
void genFireEvent (Tuint08 uiEvent)
Tuint08 genCountEventBlocks (Tuint08 uiEventSet)
 Call to get the number of blocks on a combination of events.
void genFireEventSet (Tuint08 uiEventSet)
 Call this to release tasks waiting for an different events.


Define Documentation

#define privDelayCalcFromNow ( DT   )     privDelayCalc(DT,true)

Referenced by privDelayCalc(), privDelayFromNowBody(), privFileOpenBody(), privRestartBody(), privWaitForEventBody(), and privYieldBody().

#define privDelayCalcFromWake ( DT   )     privDelayCalc(DT,false)

Referenced by privDelayFromWakeBody().


Function Documentation

void genAddtoTickCount ( Tuint16  uiSleepTime  ) 

Add the given number of ticks to the tick counter.

With this function it is possible to add some value to the tick counter, which is shifted to the future. All missed appTick00() and appTick08() calls are NOT catched up. However an appTick16() call is performed should the tick counter roll over. This method is typically used in situations where the processor is put into a low power sleep.

Definition at line 4597 of file femtoos_core.c.

References appTick16(), callIdGenAddtoTickCount, defBaseDelayStateDelayed, defBaseDelayStateGetMask, defContextGetMask, defContextStateIsr, defNumberOfTasks, errNoInfo, errTaskStateNon, fatIllegalCallfromISR, privEnterSysCritical, privTcbList(), privTraceAPI, privWakeupFromDelay(), Tbool, Tuint08, Tuint16, uiOsStatus, TtaskControlBlock::uiTaskStatus, and uxTickCount.

Referenced by portSleep().

Here is the call graph for this function:

Here is the caller graph for this function:

Tuint08 genCountEventBlocks ( Tuint08  uiEventSet  ) 

Call to get the number of blocks on a combination of events.

You may want to postpone firing an event until one or more tasks are actually blocking on it. Call this to get the current number of tasks blocking on all the events given. If it is called in isr or interrupt protected environment the number is accurate. If not it is a lower bound, when the calling task is the only one capable of firing the particular event.

Definition at line 7355 of file femtoos_core.c.

References callIdGenCountEventBlocks, defEqualAuxiliaryRegisters, defTaskNumberEventBegin, defTaskNumberEventEnd, errCurrentTask, errTaskStateCurrent, fatIllegalEvent, privEnterGlobalCritical, privTcbList(), privTraceAPI, and Tuint08.

Referenced by appLoop_SupervisorTask().

Here is the call graph for this function:

Here is the caller graph for this function:

void genFireEvent ( Tuint08  uiEvent  ) 

Definition at line 7320 of file femtoos_core.c.

References callIdSystem, defEqualAuxiliaryRegisters, defNumberEventBegin, defNumberEventEnd, errCurrentTask, errTaskStateCurrent, fatIllegalEvent, privEnterGlobalCritical, privExitGlobalCritical, privTrace, and traceFireEvent.

Referenced by appLoop_SupervisorTask(), and appLoop_task0().

Here is the caller graph for this function:

void genFireEventSet ( Tuint08  uiEventSet  ) 

Call this to release tasks waiting for an different events.

Using this call you may fire any combination of events simultaneously. Note it is a real function call and is not compiled to one atomic instruction. Call genFireAllEvents() to release a blocking tasks at once. The execution of this method takes place in a non interruptible realm.

Merely firing events does not require the task to have event capabilities, it is even more efficient when the task does not include the capabilities. Waiting for an event however does.

Definition at line 7395 of file femtoos_core.c.

References callIdGenFireEventSet, defEqualAuxiliaryRegisters, portEventRegister, preBitClr1, privEnterGlobalCritical, privExitGlobalCritical, and privTraceAPI.

Tuint16 genGetLastWakeTime ( Tuint08  uiTaskNumber  ) 

Return the time the task was last woken.

When you want to know what the last time was a task was woken call this function. If it was last woken from a delay this time is always correct, otherwise activate the cfgUseCorrectWakeupTimes option. When activated, other wakeup events are recorded as well.

Definition at line 5177 of file femtoos_core.c.

References callIdGenGetLastWakeTime, defContextGetMask, defContextStateIsr, defCurrentTaskNumber, defNumberOfTasks, errCurrentTask, errNoInfo, errTaskStateCurrent, errTaskStateNon, fatIllegalCallfromISR, fatTaskIllegalTaskNumber, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, Tuint16, and uiOsStatus.

Here is the call graph for this function:

Tuint08 genGetPriority ( Tuint08  uiTaskNumber  ) 

Return the current priority of a given task.

Call this to retrieve the current priority of a task.Of course the information may be outdated the moment it is received. Returns a value between 0 and 7, boundary values included.

Definition at line 5111 of file femtoos_core.c.

References callIdGenGetPriority, defBasePrioGetMask, defBasePrioShift, defContextGetMask, defContextStateIsr, defCurrentTaskNumber, defNumberOfTasks, errCurrentTask, errNoInfo, errTaskStateCurrent, errTaskStateNon, fatIllegalCallfromISR, fatTaskIllegalTaskNumber, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, Tuint08, uiOsStatus, and TtaskControlBlock::uiTaskStatus.

Here is the call graph for this function:

Taddress genGetTaskname ( Tuint08  uiTaskNumber  ) 

Get the flash address of the task name.

Call this method to get the address of the task name of the given task Note that it returns an address in flash, so take appropriate measures read the data, for example read the bytes using portFlashReadByte().

Definition at line 4766 of file femtoos_core.c.

References callIdGenGetTaskname, defContextGetMask, defContextStateIsr, defCurrentTaskNumber, defNumberOfTasks, errCurrentTask, errNoInfo, errTaskStateCurrent, errTaskStateNon, fatIllegalCallfromISR, fatTaskIllegalTaskNumber, portFlashReadStruc, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTraceAPI, pxTDBlist, Taddress, and uiOsStatus.

Referenced by genLogTask().

Here is the call graph for this function:

Here is the caller graph for this function:

Tuint16 genGetTickCount ( void   ) 

Get the tick counter.

Returns the current value of the tick counter. The tick counter is a 16 bit value running from 0 to 0xFFFF. If the tick interrupts come every millisecond we have a timer of approximately 65 seconds.

Definition at line 5145 of file femtoos_core.c.

References callIdGenGetTickCount, defContextGetMask, defContextStateIsr, errNoInfo, errTaskStateNon, fatIllegalCallfromISR, privEnterSysCritical, privExitSysCritical, privTraceAPI, Tuint16, uiOsStatus, and uxTickCount.

Referenced by SendTickCount(), and SendUptime().

Here is the caller graph for this function:

void genLogOs ( void(*)(Tchar)  pipe  ) 

Binary one liner about the os.

Call this function to obtain information about the OS itself The information is piped through the given pipe method, which could be a write method on a queue, so there is no need for a separate buffer. The information is in binary form, of the following form: Id(1) StatusOs(1) LoadOs(2) LoadIdle(2) LoadIsr(2) StackOsMax(1) StackIsrMax(2) the number indicating the number of bytes to be expected.

Definition at line 5305 of file femtoos_core.c.

References callIdGenLogOs, defContextGetMask, defContextStateIsr, defResponseLogOs, errNoInfo, errTaskStateNon, fatIllegalCallfromISR, genPipeInt16(), privEnterSysCritical, privExitSysCritical, privTraceAPI, uiFsStatus, uiIdleLoadTotal, uiIsrLoadTotal, uiIsrStackMax, uiOsLoadTotal, uiOsStackMax, and uiOsStatus.

Referenced by SendProcessList().

Here is the call graph for this function:

Here is the caller graph for this function:

void genLogTask ( Tuint08  uiTaskNumber,
void(*)(Tchar)  pipe 
)

Binary one liners about every task.

Call this function to obtain information about the a task in the OS. The information is piped through the given pipe method, which could be a write method on a queue, so there is no need for a separate buffer. The information is in binary form, of the following form: Id(1) TaskNr(1) Status(1) LoadOs/0(2) Name(8) TaskMonitor(1) TaskLevels(1) SlotStack(4) StackMax(2) RegUse(1) the number indicating the number of bytes to be expected.

Definition at line 5378 of file femtoos_core.c.

References callIdGenLogTask, defContextGetMask, defContextStateIsr, defCurrentTaskNumber, defNumberOfTasks, defNumGlobWidth, defNumTickWidth, defResponseLogTask, defSlotDepthCollect, errCurrentTask, errNoInfo, errTaskStateCurrent, errTaskStateNon, fatIllegalCallfromISR, fatTaskIllegalTaskNumber, genGetTaskname(), genPassFlashString(), genPipeInt16(), portFlashReadStruc, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, pxTDBlist, Tuint08, uiOsStatus, TtaskExtendedControlBlock::uiTaskSlot, and TtaskExtendedControlBlock::uiTaskStatus.

Referenced by SendProcessList().

Here is the call graph for this function:

Here is the caller graph for this function:

static void genPassFlashString ( Taddress  pString,
Tuint08  uiLength,
Tchar  cFilling,
void(*)(Tchar)  pipe 
) [static]

Definition at line 5283 of file femtoos_core.c.

References callIdGenPassFlashString, portFlashReadByte, privTraceAPI, Tbool, Tuint08, and Tuint16.

Referenced by genLogTask(), and SendID().

Here is the caller graph for this function:

static void genPipeInt16 ( Tuint16  uiValue,
void(*)(Tchar)  pipe 
) [static]

Definition at line 5270 of file femtoos_core.c.

References Tuint08.

Referenced by genLogOs(), genLogTask(), SendTickCount(), and SendUptime().

Here is the caller graph for this function:

void genReboot ( void   ) 

Reboot the system.

This call reboots, but not necessarily resets, the system. The actual result depends on the contents of portReboot(), but on the my avr it simply calls reset, which does not imply a full hardware reset. The software is fully reset though, inclusive cleaning of all variables. As this function may be called from an interrupt it may be used to reactivate a dead system. An other use is a call in a shell. Normally however, there is not much need for such a function. This function should not return.

Definition at line 4582 of file femtoos_core.c.

References callIdGenReboot, portReboot(), privDisableGlobalInterrupts, and privTraceAPI.

Referenced by HandleReboot().

Here is the call graph for this function:

Here is the caller graph for this function:

void genResume ( Tuint08  uiTaskNumber  ) 

Resume the given task from suspension.

A suspended task can be resumed by this call. A task that is in an other state (running (go), terminated, sleeping) remain unchanged. So there is no harm in calling this method on such tasks.

Any standing suspend requests are cleared. So you can be certain that the task will not be suspend as a result of prior genSuspend() calls.

Definition at line 4900 of file femtoos_core.c.

References callIdGenResume, defBaseDelayStateDelayed, defBaseDelayStateGetMask, defBaseNoBlocksSetMask, defBaseNoBlocksTask, defBaseSharedSetMask, defBaseSharedTask, defBaseSuspendedGetMask, defBaseSuspendedTask, defContextGetMask, defContextStateIsr, defCurrentTaskNumber, defNumberOfTasks, defStackEmpty, defSusClear, defSusSetMask, errCurrentTask, errNoInfo, errTaskStateCurrent, errTaskStateNon, fatIllegalCallfromISR, fatTaskIllegalTaskNumber, TtaskControlBlock::pcStackLevel, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, uiOsStatus, TtaskControlBlock::uiTaskStatus, and uxTickCount.

Referenced by ExecuteShell().

Here is the call graph for this function:

Here is the caller graph for this function:

void genSetPriority ( Tuint08  uiTaskNumber,
Tuint08  uiNewPriority 
)

Set a new priority for the given task.

All task run in the initial priority. There are eight priorities running from 0 to 7, 0 being the lowest. The idle task runs in fictive priority -1, thus being the lowest of all. The priority can be raised or lowered at will.

Definition at line 5074 of file femtoos_core.c.

References callIdGenSetPriority, defBasePrioGetMask, defBasePrioSetMask, defBasePrioShift, defContextGetMask, defContextStateIsr, defCurrentTaskNumber, defNumberOfPriorities, defNumberOfTasks, errCurrentTask, errNoInfo, errTaskPriorityTooHigh, errTaskStateCurrent, errTaskStateNon, fatIllegalCallfromISR, fatTaskIllegalTaskNumber, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, uiOsStatus, and TtaskControlBlock::uiTaskStatus.

Referenced by HandlePriority().

Here is the call graph for this function:

Here is the caller graph for this function:

void genSuspend ( Tuint08  uiTaskNumber  ) 

Suspend a task, but do not invoke a context switch.

Call this method if you want to suspend a particular task. The state of that task is not changed to suspended immediately, bit this is viewed as a suspend request, to which the task may respond if he likes, by calling taskSuspend(defSuspendCheck). The reason the call does not have immediate effect is that the current state of the target task is unclear. It may be blocking or holding locks or have open files. Suspending such tasks may take down the whole system. If the task is restarted however the state is well defined (it may not hold locks of blocks) the request is always honored, independent of the parameter restart was called with.

The call does not force a context switch, thus if you call it with the current running task number the method returns.

The call has no effect on terminated or already suspended tasks. Sleeping tasks will receive the request and be suspended when they handle the call after the have waken.

When called upon shared tasks, the result depends on the state of the shared task. If it is currently scheduled for execution, if will be treated as a normal task. So if it runs into a taskSuspend(defSuspendCheck) it will be suspended immediate, and no other shared tasks are able to run again. If the shared task hits restart first, the task will be suspended in shared state, thus allowing the other shared states to run.

Definition at line 4801 of file femtoos_core.c.

References callIdGenSuspend, defBaseSharedGetMask, defBaseSharedTask, defBaseSleepingTask, defBaseSuspendedSetMask, defBaseSuspendedTask, defContextGetMask, defContextStateIsr, defCurrentTaskNumber, defNumberOfTasks, defSusRequest, defSusSetMask, errCurrentTask, errNoInfo, errTaskStateCurrent, errTaskStateNon, fatIllegalCallfromISR, fatTaskIllegalTaskNumber, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, uiOsStatus, and TtaskControlBlock::uiTaskStatus.

Referenced by ExecuteShell().

Here is the call graph for this function:

Here is the caller graph for this function:

void genTraceByteInfo ( Tbyte  bUser  ) 

Definition at line 5693 of file femtoos_core.c.

References privEnterSysCritical, privExitSysCritical, privTrace, and traceUserByteMessage.

void genTraceMarker ( void   ) 

Definition at line 5732 of file femtoos_core.c.

References privEnterSysCritical, privExitSysCritical, privTrace, and traceMarker.

void genTraceWordInfo ( Tword  wUser  ) 

Definition at line 5712 of file femtoos_core.c.

References privEnterSysCritical, privExitSysCritical, privTrace, Tbyte, and traceUserWordMessage.

Tuint16 isrStackCheck ( Tuint08  uiExtraStackSafety  ) 

Call to check how much free space is left on the isr stack.

With this function you call check the amount of free space in the isr stack. (a context switch never happens here). This function only works when cfgCheckIsrStack set to cfgTrue. Otherwise the function is still defined, but returns 0, so that it does need to be removed every time you switch the cfgCheckIsrStack setting. With the parameter uiExtraStackSafety you can supply how much extra space you require at this place. Note that the total of present isr stack size and uiExtraStackSafety should not exceed the 255 bytes. This function returns the amount of free (real) isr stack space at the moment of calling, apart from the safety parameters. Of course the 2 bytes as result of the call are extra.

This function does not operate when cfgIntSwitchUsesOSstack is set to true since in that case the isr makes use of the OS stack.

Definition at line 4381 of file femtoos_core.c.

References callIdSystem, errNoInfo, errTaskStateNon, fatIsrStackOverflowed, privGetStack, StackISR, StackSizeISR, Taddress, Tuint16, and uiIsrStackMax.

Referenced by devSigExternalInt().

Here is the caller graph for this function:

void isrStartLoad ( void   ) 

Definition at line 3920 of file femtoos_core.c.

References portReadTimer(), and uiIsrLoadTemp.

Here is the call graph for this function:

void isrStopLoad ( void   ) 

Definition at line 3935 of file femtoos_core.c.

References portReadTimer(), and uiIsrLoadTemp.

Here is the call graph for this function:

void main ( void   ) 

Internal use only, do not call it yourself from application code.

Starts the OS, changes the stack, and then starts the first task. http://www.mail-archive.com/avr-gcc-list@nongnu.org/msg03812.html Note: we could use defSysReduceMain but the difference is minimal, so for those who have the patch not installed we do not do so.

Definition at line 4013 of file femtoos_core.c.

References appBoot(), callIdSystem, defActionTaskStateSwitch, defInitContextRenew, defInitLockKeep, defInitProcessAll, defInitSharedPassive, defInitStatusCopyDont, defInitStatusPrioRenew, defNumberOfTasks, defOsStackMinimum, errNoInfo, errTaskStateNon, fatOsStackUnderMinimum, portFlashReadWord, portInit(), portSetupTimerInterrupt(), privEnterOS(), privShowReset, privTaskInit(), pxInitlist, StackSizeOS, and Tuint08.

Here is the call graph for this function:

static void privCheckCapabilities ( Tuint08  uiCallId,
Tuint08  uiTaskCaps 
) [static]

Definition at line 887 of file femtoos_core.c.

References defContextGetMask, defContextStateIsr, defOsTaskNumberShift, defTaskNumberGetMask, errInfoNumberShift, errInsufficientCapabilities, errOsStateAsIs, errTaskNumberShift, errTaskStateInfo, portFlashReadByte, Tuint08, uiCapabilities, and uiOsStatus.

Referenced by privDelayFromNowBody(), privDelayFromWakeBody(), privFileCloseBody(), privFileOpenBody(), privRestartBody(), privWaitForEventBody(), taskEnterGlobalCritical(), taskEnterSwitchCritical(), taskEnterTickCritical(), taskExitGlobalCritical(), taskExitSwitchCritical(), taskExitTickCritical(), taskFeedWatchdog(), taskFileAppendByte(), taskFileFormat(), taskFileGetSize(), taskFileReadBuffer(), taskFileReadByte(), taskFileReadPipe(), taskFileSetSize(), taskFileWriteBuffer(), taskFileWriteByte(), taskFileWritePipe(), and taskKillWatchdog().

Here is the caller graph for this function:

static void privCheckFileSpecsReading ( Tuint08  uiFileNumber,
Tuint08  uiOffset,
Tuint08  uiSize,
Tuint08  uiCallId 
) [static]

Definition at line 6800 of file femtoos_core.c.

References defCurrentTaskNumber, defFsNumberOfAllFiles, defFsReadClear, defFsReadGetMask, defFsWriteClear, defFsWriteGetMask, errCurrentTask, errFileClosedMode, errFileInvalidFileNumber, errFileOutOfRange, errTaskStateCurrent, portFSReadByte(), privFileSpace(), privTaskNumber(), privTcbList(), Taddress, Tuint08, and Tuint16.

Referenced by taskFileGetSize(), taskFileReadBuffer(), taskFileReadByte(), and taskFileReadPipe().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privCheckFileSpecsWriting ( Tuint08  uiFileNumber,
Tuint08  uiOffset,
Tuint08  uiSize,
Tuint08  uiCallId 
) [static]

Definition at line 6762 of file femtoos_core.c.

References defCurrentTaskNumber, defFsNumberOfAllFiles, defFsWriteClear, defFsWriteGetMask, errCurrentTask, errFileInvalidFileNumber, errFileOutOfRange, errFileWrongMode, errTaskStateCurrent, portFSReadByte(), privFileSpace(), privTaskNumber(), privTcbList(), Taddress, Tuint08, and Tuint16.

Referenced by taskFileAppendByte(), taskFileSetSize(), taskFileWriteBuffer(), taskFileWriteByte(), and taskFileWritePipe().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privCheckOsStackLevel ( void   )  [static]

Definition at line 826 of file femtoos_core.c.

References callIdSystem, errNoInfo, errTaskStateNon, fatOsStackOverflowed, privGetStack, TosData::StackOS, StackSizeOS, Taddress, Tuint16, uiOsStackMax, and xOS.

Referenced by privDelayCalc(), privOperateSlotStack(), privSelectTask(), and privUnblockTask().

Here is the caller graph for this function:

static void privCheckOsStackRegion ( void   )  [static]

Definition at line 857 of file femtoos_core.c.

References defStackInitByte, TosData::StackOS, StackSizeOS, Taddress, Tuint08, uiOsStackMax, and xOS.

Referenced by privIncrementTick().

Here is the caller graph for this function:

static void privCleanSlotStack ( TtaskExtendedControlBlock taskTCB  )  [static]

Definition at line 2612 of file femtoos_core.c.

References defSlotRightFree, and TtaskExtendedControlBlock::uiTaskSlot.

Referenced by privTaskInit().

Here is the caller graph for this function:

static void privCopyLoad ( void   )  [static]

Definition at line 2444 of file femtoos_core.c.

References defNumberOfTasks, privTcbList(), privTrace, Tbyte, traceLoadInfo, Tuint08, uiIdleLoadCollect, uiIdleLoadTotal, uiIsrLoadCollect, uiIsrLoadTotal, uiOsLoadCollect, and uiOsLoadTotal.

Referenced by privIncrementTick().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privDelayCalc ( Tuint16  uiDelayTime,
Tbool  bFromNow 
) [static]

Definition at line 2553 of file femtoos_core.c.

References callIdSystem, defBaseDelayStateDelayed, defBaseDelayStateSetMask, defCurrentTaskNumber, defNearWakeStatePresent, defNearWakeStateSetMask, errCurrentTask, errOsStateAsIs, errTaskDelayTooShort, errTaskStateCurrent, privCheckOsStackLevel(), privDelayCalcFromNow, privTaskNumber(), privTcbList(), Tuint16, uiOsStatus, TtaskControlBlock::uiTaskStatus, and uxTickCount.

Here is the call graph for this function:

void privDelayFromNowBody ( Tuint16  uiTicksToWait  )  [static]

Internal use only, not possible to call yourself from application code.

Use this function to delay your task for the given number of ticks. The delay time is measured from the point you call this function, which does not make it a very reliable clock.

Definition at line 4704 of file femtoos_core.c.

References callIdTaskDelayFromNow, cfgCapDelay, defActionTaskStateSwitch, defDelayTimeMax, defDelayTimeZero, errCurrentTask, errOsStateAsIs, errTaskDelayTooLong, errTaskStateCurrent, privCheckCapabilities(), privDelayCalcFromNow, privEnterOS(), privInitOsSwitch, and privTraceAPI.

Referenced by taskDelayFromNow().

Here is the call graph for this function:

Here is the caller graph for this function:

void privDelayFromWakeBody ( Tuint16  uiTicksToWait  )  [static]

Internal use only, not possible to call yourself from application code.

Use this function to delay your task for the given number of ticks. The delay time is measured from the point the task was last woken. This can be used to generate a fixed frequency, depending of the timing model and other parameters used. See the discussion at cfgUseEquidistantTicks and cfgUseCorrectWakeupTimes.

Definition at line 4735 of file femtoos_core.c.

References callIdTaskDelayFromWake, cfgCapDelay, defActionTaskStateSwitch, defDelayTimeMax, defDelayTimeZero, errCurrentTask, errOsStateAsIs, errTaskDelayTooLong, errTaskStateCurrent, privCheckCapabilities(), privDelayCalcFromWake, privEnterOS(), privInitOsSwitch, and privTraceAPI.

Referenced by taskDelayFromWake().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privEnterIdle ( void   )  [static]

Definition at line 2204 of file femtoos_core.c.

References appEnterIdle(), defContextSetMask, defContextStateIdle, OSstackInit, portIdle(), portJump, privDisableGlobalInterrupts, privEnableGlobalInterrupts, privSetStack, privTrace, TosData::StackOS, traceIdleStart, uiOsStatus, and xOS.

Here is the call graph for this function:

static void privEnterOS ( Tuint08  uiAction  )  [static]

Definition at line 1287 of file femtoos_core.c.

References defActionTaskStateSwitch, defAllEventsReset, defContextSetMask, defContextStateOs, defParaLockStateUnlock, defParaRetStateTrue, defTaskNumberEventBegin, defTaskNumberEventEnd, portEventRegister, privDisableGlobalInterrupts, privTcbList(), privTrace, privUnblockTask(), traceOsStart, Tuint08, and uiOsStatus.

Referenced by main(), privDelayFromNowBody(), privDelayFromWakeBody(), privFileCloseBody(), privFileOpenBody(), privIsrExit(), privRecreateBody(), privRestartBody(), privSleepAllBody(), privSleepBody(), privSuspendBody(), privTerminateBody(), privTickYield(), privWaitForEventBody(), and privWaitForFsAccessBody().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privEnterSleep ( Tuint08  uiTickMinDelay  )  [static]

Definition at line 2153 of file femtoos_core.c.

References appEnterSleep(), appExitSleep(), defContextSetMask, defContextStateSleep, defFsSleepRequestClear, defFsSleepRequestSetMask, OSstackInit, portJump, portSleep(), privDisableGlobalInterrupts, privSetStack, privTickYield(), privTrace, TosData::StackOS, traceSleepStart, uiFsStatus, uiOsStatus, and xOS.

Here is the call graph for this function:

static void privEnterTask ( void   )  [static]

Definition at line 2243 of file femtoos_core.c.

void privFileCloseBody ( void   ) 

Definition at line 6731 of file femtoos_core.c.

References callIdTaskFileClose, cfgCapFileSystem, defActionTaskStateSwitch, defCurrentTaskNumber, defFsReadClear, defFsReadGetMask, defFsWriteClear, defFsWriteGetMask, errCurrentTask, errFileClosedMode, errOsStateAsIs, errTaskStateCurrent, privCheckCapabilities(), privEnterOS(), privInitOsSwitch, privPrepareFileClose(), privTaskNumber(), privTcbList(), and privTraceAPI.

Referenced by taskFileClose().

Here is the call graph for this function:

Here is the caller graph for this function:

static Taddress privFileLocation ( Tuint08  uiFileNumber,
Tuint08  uiOffset 
) [static]

Definition at line 3516 of file femtoos_core.c.

References defFilePreSpaceFixed, defFsNumberOfAllFiles, defFsNumberOfPreFiles, defTotalPreFileSpace, FileSpaceStandard, portFlashReadByte, Taddress, Tuint08, Tuint16, and uiFileSpace.

Referenced by taskFileAppendByte(), taskFileReadBuffer(), taskFileReadByte(), taskFileReadPipe(), taskFileWriteBuffer(), taskFileWriteByte(), and taskFileWritePipe().

Here is the caller graph for this function:

void privFileOpenBody ( Tbool  bReadOnly,
Tuint16  uiTicksToWait 
)

Definition at line 6620 of file femtoos_core.c.

References callIdTaskFileOpen, cfgCapFileSystem, cfgCapTimeout, defActionTaskStateSwitch, defBaseDressGetMask, defBaseDressRead, defBaseDressRunable, defBaseDressSetMask, defBaseDressWrite, defBaseFileBlockedSetMask, defBaseFileBlockedTask, defCurrentTaskNumber, defDelayTimeMax, defFsReadActive, defFsReadBlockActive, defFsReadBlockSetMask, defFsReadClear, defFsReadGetMask, defFsReadSetMask, defFsWriteActive, defFsWriteBlockActive, defFsWriteBlockSetMask, defFsWriteClear, defFsWriteGetMask, defFsWriteSetMask, defLockBlockInfinite, errCurrentTask, errFileOpenMode, errIllegalDominantState, errOsStateAsIs, errTaskDelayTooLong, errTaskStateCurrent, privCheckCapabilities(), privDelayCalcFromNow, privEnterOS(), privInitOsSwitch, privReleaseFileBlocks(), privTaskNumber(), privTcbList(), privTraceAPI, uiFsStatus, and TtaskControlBlock::uiTaskStatus.

Referenced by taskFileOpen().

Here is the call graph for this function:

Here is the caller graph for this function:

static Tuint08 privFileSpace ( Tuint08  uiFileNumber  )  [static]

Definition at line 3554 of file femtoos_core.c.

References defFilePreSpaceFixed, defFsNumberOfPreFiles, FileSpaceStandard, portFlashReadByte, Tuint08, and uiFileSpace.

Referenced by privCheckFileSpecsReading(), privCheckFileSpecsWriting(), and taskFileAppendByte().

Here is the caller graph for this function:

static void privIncrementTick ( void   )  [static]

Definition at line 1701 of file femtoos_core.c.

References appTick00(), appTick08(), appTick16(), cfgNumMonitorDiv, cfgNumWatchdogDiv, cfgSysSubTicksPerFullTick, defBaseRunningTask, defDogBark, defDogDec, defDogGetMask, defDogSetMask, defNearWakeStatePresent, defNearWakeStateSetMask, defTaskNumberWatchdogBegin, defTaskNumberWatchdogEnd, privCheckOsStackRegion(), privCopyLoad(), privTcbList(), privTraceWatermarks(), Tuint08, uiOsStatus, and uxTickCount.

Here is the call graph for this function:

void privInitOs ( Tuint08  uiErrorControl  ) 

Definition at line 3777 of file femtoos_core.c.

References callIdSystem, defCheckStackGetMask, defCheckStackStateError, defContextGetMask, defContextStateOs, defContextStateSleep, defContextStateTask, defCurrentTaskNumber, defRetNon, defRetSetMask, errCurrentTask, errInfoNumberShift, errTaskIllegalRegisterUse, errTaskStackWillOverflow, errTaskStateCurrent, TtaskControlBlock::pcStackLevel, privEnableGlobalInterrupts, privTaskNumber(), privTcbList(), privWakeupFromLowPower(), TosData::pxSave, Tuint08, uiLastOsStatus, uiOsStatus, TtaskSave::uiRegisterUse, and xOS.

Here is the call graph for this function:

void privIsrExit ( void   ) 

Internal use only, do not call it yourself from application code.

Switches from isr stack to os stack and starts the OS.

Definition at line 3946 of file femtoos_core.c.

References defActionTaskStateSwitch, OSstackInit, privEnterOS(), privSetStack, TosData::StackOS, Tuint08, uiLastOsStatus, and xOS.

Here is the call graph for this function:

static void privMakeTasksRunable ( Tuint08  uiFlipMask,
Tuint08  uiPriority,
Tuint08  uiLoopStart,
Tuint08  uiLoopEnd,
Tbool  bCheckSkip 
) [static]

Definition at line 1848 of file femtoos_core.c.

References cfgTrue, cfgUseHierarchicalRoundRobin, defBaseDressRunable, defBaseDressSetMask, defBaseNoBlocksTask, defBasePrioGetMask, privTcbList(), Tuint08, and TtaskControlBlock::uiTaskStatus.

Referenced by privSwitchContext().

Here is the call graph for this function:

Here is the caller graph for this function:

static Tbool privOperateSlotStack ( Tuint08  uiControlTaskNumber,
Tuint08  uiSlotSlot 
) [static]

Definition at line 2638 of file femtoos_core.c.

References callIdSystem, defNumberMutexEnd, defNumberQueuBegin, defSlotLoopBlockBlocked, defSlotLoopBlockMask, defSlotOperateDecreaseAction, defSlotOperateDecreaseMask, defSlotOperateIncreaseAction, defSlotOperateIncreaseMask, defSlotOperateQMAbsent, defSlotOperateSearchFree, defSlotOperateSFreeMask, defSlotOperateSQMMask, defSlotRightFree, defTaskNumberGetMask, errInfoNumberShift, errOsStateForce, errSlotDecreaseFail, errSlotIncreaseFail, errTaskNumberShift, errTaskStateInfo, privCheckOsStackLevel(), privTcbList(), privTrace, Tbool, traceSlotLock, traceSlotUnlock, Tuint08, TtaskExtendedControlBlock::uiTaskSlot, and TtaskExtendedControlBlock::uiTaskStatus.

Here is the call graph for this function:

static void privPrepareFileClose ( Tuint08  uiTaskNumber  )  [static]

Definition at line 3577 of file femtoos_core.c.

References defCurrentTaskNumber, defFsFree, defFsFreeSetMask, defFsReadActive, defFsReadBlockActive, defFsReadBlockClear, defFsReadBlockGetMask, defFsReadBlockSetMask, defFsReadClear, defFsReadCountGetMask, defFsReadGetMask, defFsReadInc, defFsReadSetMask, defFsSetReleaseRequest, defFsTaskNumberShift, defFsWriteActive, defFsWriteBlockActive, defFsWriteBlockGetMask, defFsWriteClear, defFsWriteGetMask, defFsWriteNumberGetMask, defFsWriteSetMask, portFSWriteReady, privReleaseFileBlocks(), privTcbList(), privTrace, traceBurnLock, and uiFsStatus.

Referenced by privFileCloseBody(), and privTaskInit().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privPutAllTasksToSleep ( void   )  [static]

Definition at line 3374 of file femtoos_core.c.

References cfgTrue, cfgUseFileSystem, defBaseSleepingSetMask, defBaseSleepingTask, defBaseStopStateGetMask, defBaseStopStateGo, defFsReadClear, defFsReadGetMask, defFsWriteBlockClear, defFsWriteBlockGetMask, defFsWriteClear, defFsWriteGetMask, defNumberOfTasks, privTcbList(), Tuint08, uiFsStatus, and TtaskControlBlock::uiTaskStatus.

Referenced by privReleaseFileBlocks(), and privSleepAllBody().

Here is the call graph for this function:

Here is the caller graph for this function:

void privRecreateBody ( Tuint08  uiTaskNumber  )  [static]

Internal use only, not possible to call yourself from application code.

Body function for taskRecreate. See and use that function.

Definition at line 4485 of file femtoos_core.c.

References callIdTaskRecreate, callIdTaskTerminate, defActionTaskStateSwitch, defCurrentTaskNumber, defInitContextRenew, defInitLockRelease, defInitProcessAll, defInitSharedPassive, defInitStatusCopyDont, defInitStatusPrioRenew, defNumberOfTasks, errCurrentTask, errTaskStateCurrent, fatTaskIllegalTaskNumber, portFlashReadWord, privEnterOS(), privInitOsSwitch, privTaskInit(), privTaskNumber(), privTraceAPI, and pxInitlist.

Referenced by taskRecreate().

Here is the call graph for this function:

Here is the caller graph for this function:

static Tuint08 privRegisterCount ( Tuint08  uiRegisterUse  )  [static]

Definition at line 1016 of file femtoos_core.c.

References Tuint08.

Referenced by privTaskInit().

Here is the caller graph for this function:

static void privReleaseFileBlocks ( void   )  [static]

Definition at line 3416 of file femtoos_core.c.

References defBaseDressGetMask, defBaseDressRead, defBaseDressWrite, defBaseFileBlockedGetMask, defBaseFileBlockedTask, defFsBurnBlockClear, defFsBurnBlockSetMask, defFsReadBlockActive, defFsReadBlockClear, defFsReadBlockGetMask, defFsReadBlockSetMask, defFsReadInc, defFsSleepRequestActive, defFsSleepRequestGetMask, defFsTaskNumberShift, defFsWriteBlockActive, defFsWriteBlockClear, defFsWriteBlockGetMask, defFsWriteBlockSetMask, defFsWriteNumberSetMask, defParaLockStateKeep, defParaRetStateTrue, defTaskNumberFileSystemBegin, defTaskNumberFileSystemEnd, privPutAllTasksToSleep(), privTcbList(), privUnblockTask(), Tuint08, and uiFsStatus.

Referenced by privFileOpenBody(), and privPrepareFileClose().

Here is the call graph for this function:

Here is the caller graph for this function:

void privRestartBody ( Tuint08  uiRestartMode,
Tuint16  uiTicksToWait 
) [static]

Internal use only, not possible to call yourself from application code.

Body function for taskRestart. See and use that function.

Definition at line 4517 of file femtoos_core.c.

References callIdTaskRestart, cfgCapDelay, defActionTaskStateSwitch, defBaseDressGetMask, defBaseDressRunable, defBaseRestartGetMask, defBaseRestartSetMask, defCurrentTaskNumber, defDelayTimeMax, defDelayTimeZero, defFsReadClear, defFsReadGetMask, defFsWriteClear, defFsWriteGetMask, defInitContextRenew, defInitLockKeep, defInitProcessAll, defInitSharedPassive, defInitStatusCopyDo, defInitStatusPrioKeep, defTaskLevelsInit, errCurrentTask, errFileOpenMode, errIllegalDominantState, errInvalidRestartMode, errOsStateAsIs, errTaskDelayTooLong, errTaskNestingPresent, errTaskStateCurrent, privCheckCapabilities(), privDelayCalcFromNow, privEnterOS(), privInitOsSwitch, privTaskInit(), privTaskNumber(), privTcbList(), privTraceAPI, Tuint08, and TtaskControlBlock::uiTaskStatus.

Referenced by taskRestart().

Here is the call graph for this function:

Here is the caller graph for this function:

static Tselect privSelectTask ( Tuint08  uiFlipMask,
Tuint08  uiLoopStart,
Tuint08  uiLoopEnd 
) [static]

Definition at line 1816 of file femtoos_core.c.

References defBaseRunningTask, Tselect::MaxStatus, Tselect::MaxTask, privCheckOsStackLevel(), privTcbList(), and Tuint08.

Referenced by privSwitchContext().

Here is the call graph for this function:

Here is the caller graph for this function:

void privSleepAllBody ( void   ) 

Definition at line 5018 of file femtoos_core.c.

References callIdTaskSleepAll, defActionTaskStateSwitch, defFsSleepRequestActive, defFsSleepRequestSetMask, privEnterOS(), privInitOsSwitch, privPutAllTasksToSleep(), privTraceAPI, and uiFsStatus.

Referenced by taskSleepAll().

Here is the call graph for this function:

Here is the caller graph for this function:

void privSleepBody ( void   ) 

Definition at line 4976 of file femtoos_core.c.

References callIdTaskSleep, defActionTaskStateSwitch, defBaseSleepingSetMask, defBaseSleepingTask, defCurrentTaskNumber, defFsWriteActive, defFsWriteGetMask, defInitContextRenew, defInitLockKeep, defInitProcessSharedOnly, defInitSharedPassive, defInitStatusCopyDo, defInitStatusPrioKeep, defRestartRunning, errCurrentTask, errFileWrongMode, errOsStateAsIs, errTaskStateCurrent, privEnterOS(), privInitOsSwitch, privTaskInit(), privTaskNumber(), privTcbList(), privTraceAPI, Tuint08, and TtaskControlBlock::uiTaskStatus.

Referenced by taskSleep().

Here is the call graph for this function:

Here is the caller graph for this function:

void privSubtickOverflow ( void   ) 

Internal use only, do not call it yourself from application code.

Called from the interrupt which signals the overflow of the subtick timer. Calling this directly results in an error.

Definition at line 3972 of file femtoos_core.c.

References callIdSystem, errCurrentTask, errTaskStateCurrent, and fatTaskSubtickOverflow.

void privSuspendBody ( Tuint08  uiSuspendMode  ) 

Definition at line 4848 of file femtoos_core.c.

References callIdTaskSuspend, cfgTrue, defActionTaskStateSwitch, defBaseDressGetMask, defBaseDressRunable, defBaseSuspendedSetMask, defBaseSuspendedTask, defCurrentTaskNumber, defSusClear, defSusGetMask, defSuspendCheck, defSuspendCheckGetMask, defSuspendClear, defSuspendNow, defSuspendNowGetMask, defSusRequest, defSusSetMask, errCurrentTask, errIllegalDominantState, errInvalidSuspendMode, errOsStateAsIs, errTaskStateCurrent, includeGenSuspend, privEnterOS(), privInitOsSwitch, privTaskNumber(), privTcbList(), privTraceAPI, and TtaskControlBlock::uiTaskStatus.

Referenced by taskSuspend().

Here is the call graph for this function:

Here is the caller graph for this function:

static Tuint08 privSwitchContext ( void   )  [static]

Definition at line 1877 of file femtoos_core.c.

References cfgFalse, cfgSyncNon, cfgTrue, cfgUseFileSystem, cfgUseLowPowerOnDelay, cfgUseSynchronization, defAssignmentTask, defAssignmentWatchdog, defBaseDelayStateDelayed, defBaseDelayStateGetMask, defBaseDressDone, defBaseDressGetMask, defBaseDressRunable, defBaseDressSetMask, defBaseFileBlockedGetMask, defBaseFileBlockedTask, defBaseModeGetMask, defBaseModeSync, defBaseNoBlocksGetMask, defBaseNoBlocksTask, defBasePrioGetMask, defBaseRunningTask, defBaseSharedGetMask, defBaseSharedTask, defBaseStopStateGetMask, defBaseStopStateGo, defCurrentTaskNumber, defDenseSharedStack, defDogBark, defDogGetMask, defFsWriteBlockActive, defFsWriteBlockGetMask, defInitContextRenew, defInitLockKeep, defInitLockRelease, defInitProcessAll, defInitSharedActive, defInitSharedPassive, defInitStatusCopyDo, defInitStatusCopyDont, defInitStatusPrioKeep, defNumberOfTasks, defOsTaskNumberShift, defRestartRunning, defShareStateAbsent, defShareStateGetMask, defSleepMaximum, defSleepThreshold, defTaskNumberSetMask, defTaskNumberSharedBegin, defTaskNumberSharedEnd, defTaskNumberWatchdogBegin, defUseSharedStack, Tselect::MaxStatus, Tselect::MaxTask, portFlashReadWord, privMakeTasksRunable(), privSelectTask(), privTaskInit(), privTaskNumber(), privTcbList(), privTrace, pxBarklist, traceWatchdog, Tuint08, uiFsStatus, uiOsStatus, TtaskControlBlock::uiTaskStatus, and uxTickCount.

Here is the call graph for this function:

static void privTaskInit ( Tuint08  uiTaskNumber,
Tuint08  uiInitControl 
) [static]

Definition at line 1034 of file femtoos_core.c.

References defBaseBlockStateFree, defBaseBlockStateSetMask, defBaseDelayStateSetMask, defBaseDelayStateWake, defBaseDressDone, defBaseDressSetMask, defBaseModeSetMask, defBaseModeShared, defBaseRestartGetMask, defBaseRestartSetMask, defBaseStopStateGetMask, defBaseStopStateGo, defInitContextGetMask, defInitContextKeep, defInitContextRenew, defInitContextSetMask, defInitialPriorityGetMask, defInitialPrioritySetMask, defInitialSharePresent, defInitialStartGetMask, defInitialStartSetMask, defInitialStatusFixed, defInitLockGetMask, defInitLockRelease, defInitProcessGetMask, defInitProcessSharedOnly, defInitSharedActive, defInitSharedGetMask, defInitStatusCopyDo, defInitStatusCopyDont, defInitStatusCopyGetMask, defInitStatusCopySetMask, defInitStatusPrioGetMask, defInitStatusPrioKeep, defInitStatusPrioRenew, defNumberOfTasksWithSlot, defRegisterCount, defRestartDefault, defRestartSuspended, defShareStateAbsent, defShareStateRunning, defShareStateSetMask, defStackEmpty, defStackInitByte, defStackSizeFixed, defSusGetMask, defSusRequest, defTaskLevelsInit, defTaskMonitorInit, TtaskControlBlock::pcStackLevel, portFlashReadStruc, portFlashReadWord, portInitContext, privCleanSlotStack(), privPrepareFileClose(), privRegisterCount(), privTcbList(), privTrace, pxLooplist, pxTDBlist, Taddress, traceCreateContext, traceTaskInit, Tstack, Tuint08, Tuint16, uiOsStatus, and TtaskControlBlock::uiTaskStatus.

Referenced by main(), privRecreateBody(), privRestartBody(), privSleepBody(), privSwitchContext(), and privTerminateBody().

Here is the call graph for this function:

Here is the caller graph for this function:

static Tuint08 privTaskNumber ( Tuint08  uiTaskNumber  )  [static]

Definition at line 1006 of file femtoos_core.c.

References defCurrentTaskMask, defCurrentTaskNumber, defOsTaskNumberShift, defTaskNumberGetMask, and uiOsStatus.

Referenced by genGetLastWakeTime(), genGetPriority(), genGetTaskname(), genLogTask(), genResume(), genSetPriority(), genSuspend(), privCheckFileSpecsReading(), privCheckFileSpecsWriting(), privDelayCalc(), privFileCloseBody(), privFileOpenBody(), privInitOs(), privRecreateBody(), privRestartBody(), privSleepBody(), privSuspendBody(), privSwitchContext(), privTerminateBody(), privWaitForEventBody(), privWaitForFsAccessBody(), taskDisableSwitchTask(), taskEnableSwitchTask(), taskEnterGlobalCritical(), taskEnterSwitchCritical(), taskEnterTickCritical(), taskExitGlobalCritical(), taskExitSwitchCritical(), taskExitTickCritical(), taskFeedWatchdog(), taskFileFormat(), and taskKillWatchdog().

Here is the caller graph for this function:

static TtaskControlBlock* privTcbList ( Tuint08  uiTaskNumber  )  [static]

Definition at line 998 of file femtoos_core.c.

References portFlashReadWord, and pxTCBlist.

Referenced by genAddtoTickCount(), genCountEventBlocks(), genGetLastWakeTime(), genGetPriority(), genLogTask(), genResume(), genSetPriority(), genSuspend(), privCheckFileSpecsReading(), privCheckFileSpecsWriting(), privCopyLoad(), privDelayCalc(), privEnterOS(), privFileCloseBody(), privFileOpenBody(), privIncrementTick(), privInitOs(), privMakeTasksRunable(), privOperateSlotStack(), privPrepareFileClose(), privPutAllTasksToSleep(), privReleaseFileBlocks(), privRestartBody(), privSelectTask(), privSleepBody(), privSuspendBody(), privSwitchContext(), privTaskInit(), privTerminateBody(), privTraceWatermarks(), privUnblockTask(), privWaitForEventBody(), privWaitForFsAccessBody(), privWakeupFromLowPower(), taskDisableSwitchTask(), taskEnableSwitchTask(), taskEnterGlobalCritical(), taskEnterSwitchCritical(), taskEnterTickCritical(), taskExitGlobalCritical(), taskExitSwitchCritical(), taskExitTickCritical(), taskFeedWatchdog(), taskFileFormat(), and taskKillWatchdog().

Here is the caller graph for this function:

void privTerminateBody ( Tuint08  uiTaskNumber  ) 

Definition at line 4450 of file femtoos_core.c.

References callIdTaskTerminate, defActionTaskStateSwitch, defBaseTerminatedTask, defCurrentTaskNumber, defInitContextKeep, defInitLockRelease, defInitProcessAll, defInitSharedPassive, defInitStatusCopyDont, defInitStatusPrioKeep, defNumberOfTasks, errCurrentTask, errTaskStateCurrent, fatTaskIllegalTaskNumber, privEnterOS(), privInitOsSwitch, privTaskInit(), privTaskNumber(), privTcbList(), privTraceAPI, and TtaskControlBlock::uiTaskStatus.

Referenced by taskTerminate().

Here is the call graph for this function:

Here is the caller graph for this function:

void privTickYield ( void   ) 

Internal use only, do not call it yourself from application code.

Called from the timer interrupt or any place from inside the OS when a Yield is necessary.

Definition at line 3981 of file femtoos_core.c.

References defActionTaskStateSwitch, portResqueGlobalInterruptActive, portSaveContext(), privEnterOS(), privInitOsReturn, privTrace, traceTickInterrupt, Tuint08, and uiOsStatus.

Referenced by privEnterSleep().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privTraceWatermarks ( void   )  [static]

Definition at line 2510 of file femtoos_core.c.

References defNumberOfTasks, privTcbList(), privTrace, Tbyte, traceWatermarks, Tuint08, uiIsrStackMax, and uiOsStackMax.

Referenced by privIncrementTick().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privUnblockTask ( Tuint08  uiControlTaskNumber  )  [static]

Definition at line 2969 of file femtoos_core.c.

References defAllEventsReset, defBaseBlockStateFree, defBaseBlockStateSetMask, defBaseDelayStateSetMask, defBaseDelayStateWake, defBaseDressDone, defBaseDressGetMask, defBaseDressSetMask, defBaseDressSlot, defBaseModeAccess, defBaseModeGetMask, defBaseModeSetMask, defBaseModeSync, defBaseSleepingTask, defFsReadClear, defFsReadSetMask, defFsWriteClear, defFsWriteSetMask, defParaLockMask, defParaLockStateUnlock, defParaRetMask, defParaRetToRetShift, defRetSetMask, defSlotFree, defSlotRightFree, defSlotRightSetMask, privCheckOsStackLevel(), privTcbList(), privTrace, traceSlotUnlock, traceTaskRelease, TtaskExtendedControlBlock::uiTaskSlot, TtaskExtendedControlBlock::uiTaskStatus, and uxTickCount.

Referenced by privEnterOS(), privReleaseFileBlocks(), and privWakeupFromDelay().

Here is the call graph for this function:

Here is the caller graph for this function:

void privWaitForEventBody ( Tuint08  uiEventSet,
Tuint16  uiTicksToWait 
)

Definition at line 7278 of file femtoos_core.c.

References callIdTaskWaitForEvent, cfgCapEvent, cfgCapTimeout, defActionTaskStateSwitch, defBaseBlockStateBlocked, defBaseBlockStateSetMask, defBaseDressEvent, defBaseDressSetMask, defBaseModeSetMask, defBaseModeSync, defCurrentTaskNumber, defDelayTimeMax, defLockBlockInfinite, errCurrentTask, errOsStateAsIs, errTaskDelayTooLong, errTaskStateCurrent, privCheckCapabilities(), privDelayCalcFromNow, privEnterOS(), privInitOsSwitch, privTaskNumber(), privTcbList(), privTraceAPI, and TtaskControlBlock::uiTaskStatus.

Referenced by taskWaitForEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void privWaitForFsAccess ( void   ) 

Internal use only, do not call it yourself from application code.

Called to check if we can write a byte or if we must block.

Definition at line 4263 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privWaitForFsAccessBody().

Referenced by taskFileAppendByte(), taskFileFormat(), taskFileSetSize(), taskFileWriteBuffer(), taskFileWriteByte(), and taskFileWritePipe().

Here is the call graph for this function:

Here is the caller graph for this function:

void privWaitForFsAccessBody ( void   ) 

Definition at line 6582 of file femtoos_core.c.

References defActionTaskStateKeep, defActionTaskStateSwitch, defBaseDressGetMask, defBaseDressRunable, defBaseDressSetMask, defBaseDressWrite, defBaseFileBlockedSetMask, defBaseFileBlockedTask, defCurrentTaskNumber, defFsBurnBlockActive, defFsBurnBlockSetMask, portFSWriteReady, privEnterOS(), privInitOsSwitch, privTaskNumber(), privTcbList(), privTrace, traceBurnLock, uiFsStatus, and TtaskControlBlock::uiTaskStatus.

Referenced by privWaitForFsAccess().

Here is the call graph for this function:

Here is the caller graph for this function:

static void privWakeupFromDelay ( Tuint08  uiTaskNumber,
TtaskControlBlock taskTCB 
) [static]

Definition at line 2397 of file femtoos_core.c.

References defBaseBlockStateBlocked, defBaseBlockStateGetMask, defBaseDelayStateSetMask, defBaseDelayStateWake, defBaseDressGetMask, defBaseDressSlot, defBaseModeGetMask, defBaseModeSync, defParaLockStateUnlock, defParaRetStateFalse, privUnblockTask(), and TtaskControlBlock::uiTaskStatus.

Referenced by genAddtoTickCount().

Here is the call graph for this function:

Here is the caller graph for this function:

void privWakeupFromLowPower ( void   ) 

Definition at line 3723 of file femtoos_core.c.

References cfgTrue, defBaseDelayStateGetMask, defBaseDelayStateWake, defBaseModeAccess, defBaseModeSetMask, defBaseSleepingGetMask, defBaseSleepingTask, defBaseStopStateGo, defBaseStopStateSetMask, defNumberOfTasks, defStackEmpty, defSubTicksMax, defUseSharedStack, TtaskControlBlock::pcStackLevel, portReadAndResetTimer(), privTcbList(), Tuint08, TtaskControlBlock::uiTaskStatus, and uxTickCount.

Referenced by privInitOs().

Here is the call graph for this function:

Here is the caller graph for this function:

void privYieldBody ( void   )  [static]

Internal use only, not possible to call yourself from application code.

Body function for taskYield. See and use that function.

Definition at line 90 of file femtoos_core.c.

References privDelayCalcFromNow.

Referenced by taskYield().

Here is the caller graph for this function:

void taskDelayFromNow ( Tuint16  uiTicksToWait  ) 

Delay the task a number of ticks, starting from now.

In short the procedure is.

Definition at line 4113 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privDelayFromNowBody().

Referenced by appLoop_AutoStart(), appLoop_Display(), appLoop_DriveLamp(), appLoop_LEDtask0(), appLoop_LEDtask1(), appLoop_LEDtask2(), appLoop_LEDtask3(), appLoop_LEDtask4(), appLoop_LEDtask5(), appLoop_LEDtask6(), appLoop_LEDtask7(), appLoop_ReadSwitch(), appLoop_ReadTask(), appLoop_Reset(), appLoop_ResetTask(), appLoop_Select(), appLoop_Shell(), appLoop_Speed(), appLoop_SupervisorTask(), appLoop_Synchronize(), appLoop_T4Bus(), appLoop_WriteTask(), flashLED(), HandleReboot(), HandleRecreate(), HandOver(), LedBeacon(), LedFlash(), LedOff(), and LedOn().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskDelayFromWake ( Tuint16  uiTicksToWait  ) 

Delay the task a number of ticks, starting at the last wake time.

taskDelayFromWake delays your task for the given number of ticks. The delay time is measured from the moment of last wakeup. This is automatically correct when the tasks are only stopped by delays. If however you want it to be correct in case of suspended and locked tasks as well, set cfgUseCorrectWakeupTimes to true. It can be used to obtain a reliable frequency, within the limits of the system clock and demands of other tasks.

Definition at line 4124 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privDelayFromWakeBody().

Here is the call graph for this function:

void taskDisableSwitchTask ( void   ) 

Definition at line 5041 of file femtoos_core.c.

References callIdTaskDisableSwitchTask, defBaseDressRunable, defBaseDressSetMask, defCurrentTaskNumber, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, and TtaskControlBlock::uiTaskStatus.

Here is the call graph for this function:

void taskEnableSwitchTask ( void   ) 

Definition at line 5055 of file femtoos_core.c.

References callIdTaskEnableSwitchTask, defBaseDressDone, defBaseDressSetMask, defCurrentTaskNumber, privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, and TtaskControlBlock::uiTaskStatus.

Here is the call graph for this function:

void taskEnterGlobalCritical ( void   ) 

Definition at line 5496 of file femtoos_core.c.

References callIdTaskEnterGlobalCritical, cfgCapCritical, defCurrentTaskNumber, defGlobGetMask, defGlobInc, defGlobMax, errCurrentTask, errTaskNestingOverflowed, errTaskStateCurrent, privCheckCapabilities(), privDisableGlobalInterrupts, privTaskNumber(), privTcbList(), and privTraceAPI.

Referenced by ExeLedState(), and setLed().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskEnterSwitchCritical ( void   ) 

Definition at line 5558 of file femtoos_core.c.

References callIdTaskEnterSwitchCritical, cfgCapCritical, defBaseDressRunable, defBaseDressSetMask, defCurrentTaskNumber, defSwitchGetMask, defSwitchInc, defSwitchMax, errCurrentTask, errTaskNestingOverflowed, errTaskStateCurrent, privCheckCapabilities(), privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, and TtaskControlBlock::uiTaskStatus.

Referenced by invLed(), and setNumber().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskEnterTickCritical ( void   ) 

Definition at line 5627 of file femtoos_core.c.

References callIdTaskEnterTickCritical, cfgCapCritical, defCurrentTaskNumber, defTickGetMask, defTickInc, defTickMax, errCurrentTask, errTaskNestingOverflowed, errTaskStateCurrent, privCheckCapabilities(), privDisableTickInterrupts, privTaskNumber(), privTcbList(), and privTraceAPI.

Here is the call graph for this function:

void taskExitGlobalCritical ( void   ) 

Definition at line 5528 of file femtoos_core.c.

References callIdTaskExitGlobalCritical, cfgCapCritical, defCurrentTaskNumber, defGlobGetMask, defGlobInc, defGlobMin, errCurrentTask, errTaskNestingUnderflowed, errTaskStateCurrent, privCheckCapabilities(), privEnableGlobalInterrupts, privTaskNumber(), privTcbList(), and privTraceAPI.

Referenced by ExeLedState(), and setLed().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskExitSwitchCritical ( void   ) 

Definition at line 5593 of file femtoos_core.c.

References callIdTaskExitSwitchCritical, cfgCapCritical, defBaseDressDone, defBaseDressSetMask, defCurrentTaskNumber, defSwitchGetMask, defSwitchInc, defSwitchMin, errCurrentTask, errTaskNestingUnderflowed, errTaskStateCurrent, privCheckCapabilities(), privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, and TtaskControlBlock::uiTaskStatus.

Referenced by invLed(), and setNumber().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskExitTickCritical ( void   ) 

Definition at line 5660 of file femtoos_core.c.

References callIdTaskExitTickCritical, cfgCapCritical, defCurrentTaskNumber, defTickGetMask, defTickInc, defTickMin, errCurrentTask, errTaskNestingUnderflowed, errTaskStateCurrent, privCheckCapabilities(), privEnableTickInterrupts, privTaskNumber(), privTcbList(), and privTraceAPI.

Here is the call graph for this function:

void taskFeedWatchdog ( void   ) 

Feed the watchdog in order to prevent barking.

If you activated cfgUseTaskWatchdog and fed the watchdog at least once, it is on alert. Each task has its own watchdog. After a certain time (configurable with cfgNumWatchdogDiv) it starts barking, which means it calls your bark routine if specified and subsequently restarts the task, by re-intializing the context and calling your loop code. To prevent the watchdog from barking, call taskFeedWatchdog() regularly from you code. If you want to stop its activity call taskKillWatchdog(). Please note that every loop starts with de-activated watchdog, the watchdog is activated after the first taskFeedWatchdog(). If a task got stuck and is restarted, the watchdog is de-activated! Make sure you activate it early in your code.

Definition at line 5222 of file femtoos_core.c.

References callIdTaskFeedWatchdog, cfgCapWatchdog, defCurrentTaskNumber, defDogSetMask, defDogSleep, privCheckCapabilities(), privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), and privTraceAPI.

Referenced by appLoop_T4Bus().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskFileAppendByte ( Tuint08  uiFileNumber,
Tbyte  bItem 
)

Add one byte to the file, starting at the beginning when full.

The call taskFileAppendByte() adds one byte to the file in a size maintained manner (only available if cfgUseFileSystemMaintainFAT is activated). The byte is first written, and subsequently the file size is increased. In case of power failure in between, it is as if the file was never extended. If the file is full, the byte is written at the beginning, so that this call may be used to implement a ring buffer. In the latter case, the file size is set to zero first, then the byte is written and subsequently the size is set to one. Only use after taskFileOpen().

Definition at line 7006 of file femtoos_core.c.

References callIdTaskFileAppendByte, cfgCapFileSystem, portFSReadByte(), portFSWriteByte(), privCheckCapabilities(), privCheckFileSpecsWriting(), privEnterSysCritical, privExitSysCritical, privFileLocation(), privFileSpace(), privTraceAPI, privWaitForFsAccess(), Taddress, Tuint08, and Tuint16.

Referenced by appLoop_SupervisorTask().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskFileClose ( void   ) 

Close the file system, so other tasks may obtain access.

Every call taskFileOpen() must be closed with a call to taskFileClose(). This signals the Femto OS that you are ready read/writing. It is an error to call taskFileClose() if the file access has not been opened before. If other tasks are waiting to obtain file access, calling taskFileClose() may immediately release such blocked tasks, possibly starving the current task if it runs in lower priority.

Definition at line 4295 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privFileCloseBody().

Referenced by appLoop_SupervisorTask(), ExeLedLoad(), ExeLedSave(), HandleDump(), HandleRecall(), HandleStore(), and WorkerProcess().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskFileFormat ( void   ) 

Clean (fill with zero's) the whole disk space.

If you need to clean the dis kspace call taskFileFormat. The space used for files (and only that part) is filled with zero's. Since the FAT is situated at the start of this region, all files are set to length zero. If you set the size of these files to other values afterwards, you can be sure that file is filled with 0x00. There is no need to clean format the file system before use, but you must be ensure file system integrity yourself before first use. Only use after taskFileOpen().

Definition at line 6900 of file femtoos_core.c.

References callIdTaskFileFormat, cfgCapFileSystem, defCurrentTaskNumber, defFsWriteClear, defFsWriteGetMask, defTotalAllFileSpace, errCurrentTask, errFileWrongMode, errTaskStateCurrent, portFSWriteByte(), privCheckCapabilities(), privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), privTraceAPI, privWaitForFsAccess(), Taddress, and Tuint16.

Referenced by appLoop_SupervisorTask().

Here is the call graph for this function:

Here is the caller graph for this function:

Tuint08 taskFileGetSize ( Tuint08  uiFileNumber  ) 

Get the present size of a file.

If cfgUseFileSystemMaintainFAT is activated the size of each file is maintained by the Femto OS. Using the call you can obtain the size of the file. Only use after taskFileOpen().

Definition at line 6871 of file femtoos_core.c.

References callIdTaskFileGetSize, cfgCapFileSystem, portFSReadByte(), privCheckCapabilities(), privCheckFileSpecsReading(), privEnterSysCritical, privExitSysCritical, privTraceAPI, Taddress, Tuint08, and Tuint16.

Referenced by HandleRecall().

Here is the call graph for this function:

Here is the caller graph for this function:

Tbool taskFileOpen ( Tbool  bReadOnly,
Tuint16  uiTicksToWait 
)

Definition at line 4275 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privFileOpenBody().

Here is the call graph for this function:

void taskFileReadBuffer ( Tuint08  uiFileNumber,
Tuint08  uiOffset,
Tuint08  uiSize,
Taddress  pBuffer 
)

Read several bytes from the file and push them to the buffer.

Call this method to read one or more bytes (uiSize) from position uiOffset and write them in the buffer. You can use defFromFileStart for the uiOffset parameter. Furthermore, you can use (if cfgUseFileSystemMaintainFAT is activated) defUntilFileEnd for uiSize. Note that, depending on your design of course, you should not assume a file is present. If there was a power failure at writing, the file length may be set to zero. If the length of the file does not equal zero, you may safely assume writing has been competed, before any power interruption took place. It is an error to read beyond the file size. Only use after taskFileOpen().

Definition at line 7102 of file femtoos_core.c.

References callIdTaskFileReadBuffer, cfgCapFileSystem, defUntilFileEnd, portFSReadByte(), privCheckCapabilities(), privCheckFileSpecsReading(), privEnterSysCritical, privExitSysCritical, privFileLocation(), privTraceAPI, Taddress, Tuint08, and Tuint16.

Referenced by appLoop_SupervisorTask(), ExeLedLoad(), and WorkerProcess().

Here is the call graph for this function:

Here is the caller graph for this function:

Tbyte taskFileReadByte ( Tuint08  uiFileNumber,
Tuint08  uiOffset 
)

Get one byte from a file using a raw read.

Call taskFileReadByte() if you need one byte from a file on a random location. It is an error (but possible if checks are switched off) to read beyond the length of the file (if cfgUseFileSystemMaintainFAT is activated) or beyond the space boundary of the file. Only use after taskFileOpen().

Definition at line 6940 of file femtoos_core.c.

References callIdTaskFileReadByte, cfgCapFileSystem, portFSReadByte(), privCheckCapabilities(), privCheckFileSpecsReading(), privEnterSysCritical, privExitSysCritical, privFileLocation(), privTraceAPI, Taddress, and Tuint08.

Here is the call graph for this function:

void taskFileReadPipe ( Tuint08  uiFileNumber,
Tuint08  uiOffset,
Tuint08  uiSize,
void(*)(Tchar)  pipe 
)

Read several bytes from the file and push them to the pipe.

Call this method to read one or more bytes (uiSize) from position uiOffset and push them on the pipe. You can use defFromFileStart for the uiOffset parameter. Furthermore, you can use (if cfgUseFileSystemMaintainFAT is activated) defUntilFileEnd for uiSize. Note that, depending on your design of course, you should not assume a file is present. If there was a power failure at writing, the file length may be set to zero. If the length of the file does not equal zero, you may safely assume writing has been competed, before any power interruption took place. It is an error to read beyond the file size. Only use after taskFileOpen().

Definition at line 7060 of file femtoos_core.c.

References callIdTaskFileReadByte, callIdTaskFileReadPipe, cfgCapFileSystem, defUntilFileEnd, portFSReadByte(), privCheckCapabilities(), privCheckFileSpecsReading(), privEnterSysCritical, privExitSysCritical, privFileLocation(), privTraceAPI, Taddress, Tuint08, and Tuint16.

Referenced by HandleRecall().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskFileSetSize ( Tuint08  uiFileNumber,
Tuint08  uiSize 
)

Give the file a new size, contents are unchanged.

If cfgUseFileSystemMaintainFAT is activated the size of each file is maintained by the Femto OS. It is however possible to change the size using this call. If the file is extended in this way, the new bytes will not be cleaned. Using the raw access taskWriteByte() these may be filled or cleaned on beforehand. It is an error to increase the size beyond the space reserved for the file at compile time. Only use after taskFileOpen().

Definition at line 6837 of file femtoos_core.c.

References callIdTaskFileSetSize, cfgCapFileSystem, portFSWriteByte(), privCheckCapabilities(), privCheckFileSpecsWriting(), privEnterSysCritical, privExitSysCritical, privTraceAPI, privWaitForFsAccess(), Taddress, and Tuint16.

Here is the call graph for this function:

void taskFileWriteBuffer ( Tuint08  uiFileNumber,
Tuint08  uiOffset,
Tuint08  uiSize,
Taddress  pBuffer 
)

Read several bytes from the buffer and put the on file.

Call this method to read one or more bytes (uiSize) from the buffer and write them to the file, starting at the position uiOffset. You can use defFromFileStart or, if cfgUseFileSystemMaintainFAT is activated, defFromFileEnd for the uiOffset parameter. It is an error to write beyond the file space. Before any writing is done, the size of the file is set to zero. After the writing has been completed, the new size is written to the FAT (when present). The procedure is to ensure file system integrity at power failure. Only use after taskFileOpen().

Definition at line 7211 of file femtoos_core.c.

References callIdTaskFileWriteBuffer, cfgCapFileSystem, defFromFileEnd, portFSReadByte(), portFSWriteByte(), privCheckCapabilities(), privCheckFileSpecsWriting(), privEnterSysCritical, privExitSysCritical, privFileLocation(), privTraceAPI, privWaitForFsAccess(), Taddress, Tuint08, and Tuint16.

Referenced by ExeLedSave(), and WorkerProcess().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskFileWriteByte ( Tuint08  uiFileNumber,
Tuint08  uiOffset,
Tbyte  bItem 
)

Write one byte to a file using a raw write.

Call taskFileWriteByte() if you need to write one byte to a file on a random location. The write is raw in the sense that the fileSize is not maintained. You may write bytes beyond the file length, but not beyond the space boundary. For example, you may write, zero's to a file first and afterwards set its length to the desired value. Only use after taskFileOpen().

Definition at line 6971 of file femtoos_core.c.

References callIdTaskFileWriteByte, cfgCapFileSystem, portFSWriteByte(), privCheckCapabilities(), privCheckFileSpecsWriting(), privEnterSysCritical, privExitSysCritical, privFileLocation(), privTraceAPI, privWaitForFsAccess(), and Taddress.

Here is the call graph for this function:

void taskFileWritePipe ( Tuint08  uiFileNumber,
Tuint08  uiOffset,
Tuint08  uiSize,
Tchar(*)(void)  pipe 
)

Read several bytes from the pipe and put the on file.

Call this method to read one or more bytes (uiSize) from the pipe and write them to the file, starting at the position uiOffset. You can use defFromFileStart or, if cfgUseFileSystemMaintainFAT is activated, defFromFileEnd for the uiOffset parameter. It is an error to write beyond the file space. Before any writing is done, the size of the file is set to zero. After the writing has been completed, the new size is written to the FAT (when present). The procedure is to ensure file system integrity at power failure. Only use after taskFileOpen().

Definition at line 7146 of file femtoos_core.c.

References callIdTaskFileWritePipe, cfgCapFileSystem, defFromFileEnd, portFSReadByte(), portFSWriteByte(), privCheckCapabilities(), privCheckFileSpecsWriting(), privEnterSysCritical, privExitSysCritical, privFileLocation(), privTraceAPI, privWaitForFsAccess(), Taddress, Tuint08, and Tuint16.

Referenced by HandleStore().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskKillWatchdog ( void   ) 

Switch off the watchdog facility for this task.

See also taskFeedWatchdog(). A watchdog once activated must or be fed or be killed in order to keep it quit. You can call taskKillWatchdog on a already dead watchdog.

Definition at line 5244 of file femtoos_core.c.

References callIdTaskKillWatchdog, cfgCapWatchdog, defCurrentTaskNumber, defDogDead, defDogSetMask, privCheckCapabilities(), privEnterSysCritical, privExitSysCritical, privTaskNumber(), privTcbList(), and privTraceAPI.

Here is the call graph for this function:

void taskRecreate ( Tuint08  uiTaskNumber  ) 

Recreate one particular task.

Recreate a task by recreating its context. appInit() if present is called again, for (hardware) (re)initialization. The context is cleared, locks are released, and the appLoop() is called, as if the task is new. Your (private) static variables are not cleaned or changed. The task may be terminated, running or in whatever state. You may even call it on you own task, in which case this call does not return.

Definition at line 4135 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privRecreateBody().

Referenced by HandleRecreate().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskRestart ( Tuint08  uiRestartMode,
Tuint16  uiTicksToWait 
)

Restart the running task.

Restart the task currently running. If present the watchdog is killed and the context is cleared. Subsequently appLoop() is called. appInit() is not called again, this is for one time (hardware) initialization. Watermarks are not cleared. Locks are not released and the priority is kept. Holding a lock at the moment of this call is an error. You can supply a delay, which means that the task is restarted not earlier as the given delay. This call does not return. Your (private) static variables are not cleaned or changed.

Definition at line 4146 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privRestartBody().

Referenced by appLoop_LEDtask0(), appLoop_LEDtask1(), appLoop_LEDtask2(), appLoop_LEDtask3(), appLoop_LEDtask4(), appLoop_LEDtask5(), appLoop_LEDtask6(), appLoop_LEDtask7(), and wait().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskSleep ( void   ) 

Put the current task to sleep and invoke a context switch.

Call this if you want to put the current task into low power sleep. A sleeping task is not rescheduled for operation, and cannot be woken by the user anymore (it can be recreated though). If all tasks are in sleep state, or some delays are sufficiently long, the device may go to low power sleep, see the options for details. Note that there is no call to put an other specific task to sleep. The method returns when the sleep has taken place. Never call sleep when you have a write lock on the file system, and it is unwise to call it when you hold a read lock (since it will prevent other tasks from writing). Thus call sleep after you have completed file operations (i.e. after fileClose)

It is possible to put yourself to sleep in the dominant mode. Although the dominant mode is remembered and revived after the sleep, during sleep other tasks will be activated, which may, request for a dominant mode themselves. This may lead to an unclear situation at wake up.

Shared tasks can be put to sleep with this call, but after sleep the call does not return, but the task is restarted in the running mode instead. During sleep of the task, other shared tasks are rescheduled, when present. Because this call works as a restart for shared tasks you are not allowed to call it with any locks.

Definition at line 4183 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privSleepBody().

Here is the call graph for this function:

void taskSleepAll ( void   ) 

Put all tasks to sleep.

Call this is you want give the OS the possibility to go to low power sleep directly. It puts all tasks into low power sleep, which should normally trigger the sleep mode. If any task is using the file system, or is blocking to get access, Femto OS waits until all file write operations have come to an end, and puts the system to sleep directly after. Tasks not using the FS at the moment of calling are put so sleep immediately. The current task may make use of the FS and is treated like other tasks. Thus if the task is in read only mode it will sleep directly; if the task is in read/write mode it will do so at taskFileClose(). See also the discussion on taskSleep(). The method returns when the sleep has taken place.

Definition at line 4204 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privSleepAllBody().

Here is the call graph for this function:

Tuint16 taskStackCheck ( Tuint08  uiExtraStackSafety  ) 

Call to check how much free space is left on the task stack.

With this function you can check on any place in your code what would happen if a context switch was made here. This function only works when cfgCheckTaskStack set to cfgTrue. Otherwise the function is still defined, but returns 0, so that it does need to be removed every time you switch the cfgCheckTaskStack setting. With the parameter uiExtraStackSafety you can supply how much extra space you require at this place. Use this to compensate for extra stack in calls in which you cannot place this function. The uiExtraStackSafety comes onto the normal StackSafety parameter. Thus the larger the uiExtraStackSafety the quicker an (expected) error occurs.

This function returns the amount of free (real) stack space at the moment of calling, that would be left over, if an context save would happen right at this place, apart from the safety parameters, but the stack required for this call included. Thus, if it returns 0 you are living on the edge. This function also operates correctly if the stack level and uiExtraStackSafety together exceed the 255 byte limit.

Definition at line 4319 of file femtoos_core.c.

References callIdSystem, errCurrentTask, errTaskStateCurrent, fatTaskStackOverflowed, privGetStack, TosData::pxSave, Taddress, Tuint16, and xOS.

void taskSuspend ( Tuint08  uiSuspendMode  ) 

Suspend this task and invoke a context switch.

If you need to suspend your task immediately call this method with the parameter defSuspendNow. If you want to handle a suspend request from genSuspend(), call with defSuspendCheck. The suspended state is directly applied, a context switch is performed. This method only returns is an other task (or isr) calls genResume on your task.

Do not use this at places where you may hold resources, such are files, or locks. Although possible, other tasks may be effectively blocked as well. Or know what you are doing. It is an error to call it in the dominant mode, since it will render the switch protection of that mode useless.

Definition at line 4172 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privSuspendBody().

Referenced by appLoop_LEDtask0(), appLoop_LEDtask1(), appLoop_LEDtask2(), and appLoop_LEDtask3().

Here is the call graph for this function:

Here is the caller graph for this function:

void taskTerminate ( Tuint08  uiTaskNumber  ) 

Stop (in error mode) one particular task.

Call this function if you want to stop a task permanently. The task is terminated and cannot be revived by resume or so. In case you have some checking activated, and the system detects an error, the task is brought to the same state. A terminated task can be recreated, provided you compiled the necessary code in. See taskCreate() for more information.

Definition at line 4193 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privTerminateBody().

Referenced by ExecuteShell().

Here is the call graph for this function:

Here is the caller graph for this function:

Tbool taskWaitForEvent ( Tuint08  uiEvent,
Tuint16  uiTicksToWait 
)

Definition at line 4306 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privWaitForEventBody().

Here is the call graph for this function:

void taskYield ( void   ) 

Manual context switch.

Call this function inside your code when you want to force a context switch. Note it makes no real sense to call it if you are the task with the highest priority for it will immediately return. Mostly you use this call as some kind of cooperative escape from part of your code where interrupts are disabled.

Definition at line 4161 of file femtoos_core.c.

References portJump, portResqueGlobalInterruptState, portSaveContext(), and privYieldBody().

Referenced by portYieldISR().

Here is the call graph for this function:

Here is the caller graph for this function:


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