femtoos_headers/femtoos_core.h File Reference

#include "femtoos_port.h"

Include dependency graph for femtoos_core.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define privInitOsReturn()   privInitOs()
#define privInitOsSwitch()   privInitOs()
#define genSuspendOnName(TaskName)   genSuspend(preTaskNumberOf(TaskName))
#define genResumeOnName(TaskName)   genResume(preTaskNumberOf(TaskName))
#define genSetPriorityOnName(TaskName, NewPriority)   genSetPriority(preTaskNumberOf(TaskName),NewPriority)
#define genGetPriorityOnName(TaskName)   genGetPriority(preTaskNumberOf(TaskName))
#define genGetLastWakeTimeOnName(TaskName)   genGetLastWakeTime(preTaskNumberOf(TaskName))
#define genGetTasknameOnName(TaskName)   genGetTaskname(preTaskNumberOf(TaskName))
#define taskTerminateOnName(TaskName)   taskTerminate(preTaskNumberOf(TaskName))
#define taskRecreateOnName(TaskName)   taskRecreate(preTaskNumberOf(TaskName))
#define genTraceByteInfo(bUser)   do {} while(false)
 Custom trace facility, sends one byte over the traceline.
#define genTraceWordInfo(bUser)   do {} while(false)
 Custom trace facility, sends one byte over the traceline.
#define genTraceMarker()
 Custom trace facility, sends a marker traceline.
#define taskWaitForTasksOnName(SlotName, NumberOfTasks)   taskWaitForTasks(preSlotNumberOf(SlotName),NumberOfTasks)
#define taskWaitForOtherTask(Slot)   taskWaitForTasks(Slot,2)
#define taskWaitForOtherTaskOnName(SlotName)   taskWaitForTasks(preSlotNumberOf(SlotName),2)
#define genWaitReleaseOnName(SlotName)   genWaitRelease(preSlotNumberOf(SlotName))
#define taskQueuWriteRequestOnName(SlotName, FreeFilling)   taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(-(FreeFilling)))
 Try to obtain a lock on a queue for n bytes or on a mutex on a give name.
#define taskQueuReadRequestOnName(SlotName, FreeFilling)   taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(FreeFilling))
#define taskMutexRequestOnName(SlotName)   taskSyncRequest(PassIfSlotIsMutex(preSlotNumberOf(SlotName)),0)
#define taskQueuReleaseOnName(SlotName)   taskSyncRelease(PassIfSlotIsQueu(preSlotNumberOf(SlotName)))
 Release the lock on a queue, by name.
#define taskMutexReleaseOnName(SlotName)   taskSyncRelease(PassIfSlotIsMutex(preSlotNumberOf(SlotName)))
 Release the lock on a mutex, by name.
#define genQueuWriteOnName(SlotName, bItem)   genQueuWrite(preSlotNumberOf(SlotName),bItem)
#define genQueuReadOnName(SlotName)   genQueuRead(preSlotNumberOf(SlotName))
#define genQueuClearOnName(SlotName)   genQueuClear(preSlotNumberOf(SlotName))
#define genQueuPeekOnName(SlotName)   genQueuPeek(preSlotNumberOf(SlotName))
#define genQueuReadableOnName(SlotName)   genQueuReadable(preSlotNumberOf(SlotName))
#define genQueuWriteableOnName(SlotName)   genQueuWriteable(preSlotNumberOf(SlotName))
#define genQueuFullOnName(SlotName)   genQueuFull(preSlotNumberOf(SlotName))
#define genQueuEmptyOnName(SlotName)   genQueuEmpty(preSlotNumberOf(SlotName))
#define taskFileSetSizeOnName(FileName, Size)   taskFileSetSize(preFileNumberOf(FileName),Size)
#define taskFileClear(FileNumber)   taskFileSetSize(FileNumber,0)
 Clear the file by setting its size to zero, contents are unchanged.
#define taskFileClearOnName(FileName)   taskFileSetSize(preFileNumberOf(FileName),0)
#define taskFileGetSizeOnName(FileName)   taskFileSize(preFileNumberOf(FileName))
#define taskFileReadByteOnName(FileName, Offset)   taskFileReadByte(preFileNumberOf(FileName),Offset)
#define taskFileWriteByteOnName(FileName, Offset, Item)   taskFileWriteByte(preFileNumberOf(FileName),Offset,Item)
#define taskFileAppendByteOnName(FileName, Item)   taskFileAppendByte(preFileNumberOf(FileName),Item)
#define taskFileReadOnName(FileName, Offset, Size, pipe)   taskFileRead(preFileNumberOf(FileName),Offset,Size,pipe)
#define taskFileWriteOnName(FileName, Offset, Size, pipe)   taskFileWrite(preFileNumberOf(FileName),Offset,Size,pipe)
#define taskFileReadBufferOnName(FileName, Offset, Size, Buffer)   taskFileReadBuffer(preFileNumberOf(FileName),Offset,Size,Buffer)
#define taskFileWriteBufferOnName(FileName, Offset, Size, Buffer)   taskFileWriteBuffer(preFileNumberOf(FileName),Offset,Size,Buffer)
#define taskFileDirectRead(Address)   portFSReadByte(Address)
 Direct read function on the file system.
#define taskFileDirectWrite(Address, Value)   portFSWriteByte(Address,Value)
 Direct write function on the file system.
#define taskWaitForEventSetOnNames1(Event0)   taskWaitForEventSet(preEventLocationOf(Event0))
#define taskWaitForEventSetOnNames2(Event0, Event1)   taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1))
#define taskWaitForEventSetOnNames3(Event0, Event1, Event2)   taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))
#define taskWaitForEventSetOnNames4(Event0, Event1, Event2, Event3)   taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))
#define taskWaitForEventSetOnNames5(Event0, Event1, Event2, Event3, Event4)   taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))
#define taskWaitForEventSetOnNames6(Event0, Event1, Event2, Event3, Event4, Event5)   taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))
#define taskWaitForEventSetOnNames7(Event0, Event1, Event2, Event3, Event4, Event5, Event6)   taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))
#define taskWaitForAllEvents()   taskWaitForEventSet(defAllEvents)
#define genFireEventSetOnNames2(Event0, Event1)   genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1))
#define genFireEventSetOnNames3(Event0, Event1, Event2)   genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))
#define genFireEventSetOnNames4(Event0, Event1, Event2, Event3)   genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))
#define genFireEventSetOnNames5(Event0, Event1, Event2, Event3, Event4)   genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))
#define genFireEventSetOnNames6(Event0, Event1, Event2, Event3, Event4, Event5)   genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))
#define genFireEventSetOnNames7(Event0, Event1, Event2, Event3, Event4, Event5, Event6)   genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))
#define genFireAllEvents()   genFireEventSet(defAllEvents)
#define genCountEventBlocksOnNames2(Event0, Event1)   genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1))
#define genCountEventBlocksOnNames3(Event0, Event1, Event2)   genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))
#define genCountEventBlocksOnNames4(Event0, Event1, Event2, Event3)   genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))
#define genCountEventBlocksOnNames5(Event0, Event1, Event2, Event3, Event4)   genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))
#define genCountEventBlocksOnNames6(Event0, Event1, Event2, Event3, Event4, Event5)   genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))
#define genCountEventBlocksOnNames7(Event0, Event1, Event2, Event3, Event4, Event5, Event6)   genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))
#define genCountEventBlocksOnAll()   genCountEventBlocks(defAllEvents)

Functions

void privInitOs (void) __attribute__((noinline))
 Internal use only, do not call it yourself from application code.
void privIsrExit (void) defSysReduceProEpilogue
 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) defSysReduceProEpilogue
 Internal use only, do not call it yourself from application code.
void privWaitForFsAccess (void) defSysWrapperEpilogue
 Internal use only, do not call it yourself from application code.
void main (void) defSysReduceProEpilogue
 Internal use only, do not call it yourself from application code.
void taskYield (void) defSysWrapperEpilogue
 Manual context switch.
void taskDelayFromNow (Tuint16 uiTicksToWait) defSysWrapperEpilogue
 Delay the task a number of ticks, starting from now.
void taskDelayFromWake (Tuint16 uiTicksToWait) defSysWrapperEpilogue
 Delay the task a number of ticks, starting at the last wake time.
void genSuspend (Tuint08 uiTaskNumber)
 Suspend a task, but do not invoke a context switch.
void taskSuspend (Tuint08 uiSuspendMode) defSysWrapperEpilogue
 Suspend this task and invoke a context switch.
void genResume (Tuint08 uiTaskNumber)
 Resume the given task from suspension.
void taskSleep (void) defSysWrapperEpilogue
 Put the current task to sleep and invoke a context switch.
void taskSleepAll (void) defSysWrapperEpilogue
 Put all tasks to sleep.
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.
void genAddtoTickCount (Tuint16 uiSleepTime)
 Add the given number of ticks to 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.
Taddress genGetTaskname (Tuint08 uiTaskNumber)
 Get the flash address of the task name.
void taskTerminate (Tuint08 uiTaskNumber) defSysWrapperEpilogue
 Stop (in error mode) one particular task.
void taskRecreate (Tuint08 uiTaskNumber) defSysWrapperEpilogue
 Recreate one particular task.
void taskRestart (Tuint08 uiRestartMode, Tuint16 uiTicksToWait) defSysWrapperEpilogue __attribute__((noreturn))
 Restart the running task.
void genReboot (void) __attribute__((noreturn))
 Reboot the system.
void genLogTask (Tuint08 uiTaskNumber, void(*pipe)(Tchar))
 Binary one liners about every task.
void genLogOs (void(*pipe)(Tchar))
 Binary one liner about the os.
void taskWaitForTasks (Tuint08 uiSlot, Tuint08 uiNumberOfTasks) defSysWrapperEpilogue
void genWaitRelease (Tuint08 uiSlot)
 Release all wait locks on this slot.
void taskSyncRequest (Tuint08 uiSlotSlot, Tsint08 siFreeRightFilling) defSysWrapperEpilogue
 Try to obtain a lock on a queue , on a mutex or both.
void taskSyncRelease (Tuint08 uiSlotSlot) defSysWrapperEpilogue
 Release a queue, on a mutex or both.
void genQueuWrite (Tuint08 uiSlot, Tbyte bItem)
 Write a byte on the queue.
Tbyte genQueuRead (Tuint08 uiSlot)
 Read a byte from the queue.
void genQueuClear (Tuint08 uiSlot)
 Clear the queue.
Tbyte genQueuPeek (Tuint08 uiSlot)
 Look ahead what the next byte to read would be.
Tuint08 genQueuReadable (Tuint08 uiSlot)
 See how many bytes can be read from the queue.
Tuint08 genQueuWriteable (Tuint08 uiSlot)
 See how many bytes can be written to the queue.
Tbool genQueuFull (Tuint08 uiSlot)
 See if the queue is full.
Tbool genQueuEmpty (Tuint08 uiSlot)
 See if the queue is empty.
void taskFileOpen (void) defSysWrapperEpilogue
 Open the file system for writing and/or reading.
void taskFileClose (void) defSysWrapperEpilogue
 Close the file system, so other tasks may obtain access.
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 taskFileWritePipe (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Tchar(*pipe)(void))
 Read several bytes from the pipe and put the on file.
void taskFileReadBuffer (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
 Read several bytes from the file and push them to the buffer.
void taskFileWriteBuffer (Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
 Read several bytes from the buffer and put the on file.
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 taskWaitForEvent (Tuint08 uiEventSet) defSysWrapperEpilogue
 Call this to let the task wait for a specific event in the system.
void genFireEventSet (Tuint08 uiEventSet)
 Call this to release tasks waiting for an different events.
Tuint08 genCountEventBlocks (Tuint08 uiEventSet)
 Call to get the number of blocks on a combination of events.


Define Documentation

 
#define genCountEventBlocksOnAll (  )     genCountEventBlocks(defAllEvents)

Definition at line 1609 of file femtoos_core.h.

#define genCountEventBlocksOnNames2 ( Event0,
Event1   )     genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1))

Definition at line 1603 of file femtoos_core.h.

#define genCountEventBlocksOnNames3 ( Event0,
Event1,
Event2   )     genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))

Definition at line 1604 of file femtoos_core.h.

#define genCountEventBlocksOnNames4 ( Event0,
Event1,
Event2,
Event3   )     genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))

Definition at line 1605 of file femtoos_core.h.

#define genCountEventBlocksOnNames5 ( Event0,
Event1,
Event2,
Event3,
Event4   )     genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))

Definition at line 1606 of file femtoos_core.h.

#define genCountEventBlocksOnNames6 ( Event0,
Event1,
Event2,
Event3,
Event4,
Event5   )     genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))

Definition at line 1607 of file femtoos_core.h.

#define genCountEventBlocksOnNames7 ( Event0,
Event1,
Event2,
Event3,
Event4,
Event5,
Event6   )     genCountEventBlocks(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))

Definition at line 1608 of file femtoos_core.h.

 
#define genFireAllEvents (  )     genFireEventSet(defAllEvents)

Definition at line 1590 of file femtoos_core.h.

#define genFireEventSetOnNames2 ( Event0,
Event1   )     genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1))

Definition at line 1584 of file femtoos_core.h.

#define genFireEventSetOnNames3 ( Event0,
Event1,
Event2   )     genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))

Definition at line 1585 of file femtoos_core.h.

#define genFireEventSetOnNames4 ( Event0,
Event1,
Event2,
Event3   )     genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))

Definition at line 1586 of file femtoos_core.h.

#define genFireEventSetOnNames5 ( Event0,
Event1,
Event2,
Event3,
Event4   )     genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))

Definition at line 1587 of file femtoos_core.h.

#define genFireEventSetOnNames6 ( Event0,
Event1,
Event2,
Event3,
Event4,
Event5   )     genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))

Definition at line 1588 of file femtoos_core.h.

#define genFireEventSetOnNames7 ( Event0,
Event1,
Event2,
Event3,
Event4,
Event5,
Event6   )     genFireEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))

Definition at line 1589 of file femtoos_core.h.

#define genGetLastWakeTimeOnName ( TaskName   )     genGetLastWakeTime(preTaskNumberOf(TaskName))

Definition at line 331 of file femtoos_core.h.

#define genGetPriorityOnName ( TaskName   )     genGetPriority(preTaskNumberOf(TaskName))

Definition at line 300 of file femtoos_core.h.

#define genGetTasknameOnName ( TaskName   )     genGetTaskname(preTaskNumberOf(TaskName))

Definition at line 367 of file femtoos_core.h.

#define genQueuClearOnName ( SlotName   )     genQueuClear(preSlotNumberOf(SlotName))

Definition at line 781 of file femtoos_core.h.

Referenced by appLoop_ResetTask(), and clearQueus().

#define genQueuEmptyOnName ( SlotName   )     genQueuEmpty(preSlotNumberOf(SlotName))

Definition at line 829 of file femtoos_core.h.

Referenced by startCommunication().

#define genQueuFullOnName ( SlotName   )     genQueuFull(preSlotNumberOf(SlotName))

Definition at line 820 of file femtoos_core.h.

#define genQueuPeekOnName ( SlotName   )     genQueuPeek(preSlotNumberOf(SlotName))

Definition at line 791 of file femtoos_core.h.

#define genQueuReadableOnName ( SlotName   )     genQueuReadable(preSlotNumberOf(SlotName))

Definition at line 801 of file femtoos_core.h.

Referenced by startWrite().

#define genQueuReadOnName ( SlotName   )     genQueuRead(preSlotNumberOf(SlotName))

Definition at line 769 of file femtoos_core.h.

Referenced by appLoop_ReadTask(), ExeLedCycle(), ExeLedState(), getSingleValue(), HandleDump(), HandleStore(), ReadQueuPipe(), and startWrite().

#define genQueuWriteableOnName ( SlotName   )     genQueuWriteable(preSlotNumberOf(SlotName))

Definition at line 811 of file femtoos_core.h.

#define genQueuWriteOnName ( SlotName,
bItem   )     genQueuWrite(preSlotNumberOf(SlotName),bItem)

Definition at line 752 of file femtoos_core.h.

Referenced by appLoop_WriteTask(), HandleDump(), HandleRecall(), SendID(), SendSingleResponse(), SendTickCount(), SendUptime(), startRead(), and WriteQueuPipe().

#define genResumeOnName ( TaskName   )     genResume(preTaskNumberOf(TaskName))

Definition at line 234 of file femtoos_core.h.

Referenced by devSigExternalInt().

#define genSetPriorityOnName ( TaskName,
NewPriority   )     genSetPriority(preTaskNumberOf(TaskName),NewPriority)

Definition at line 290 of file femtoos_core.h.

#define genSuspendOnName ( TaskName   )     genSuspend(preTaskNumberOf(TaskName))

Definition at line 203 of file femtoos_core.h.

Referenced by devSigExternalInt().

#define genTraceByteInfo ( bUser   )     do {} while(false)

Custom trace facility, sends one byte over the traceline.

You can make use of the trace facility yourself by using this routine. It puts out one payload byte after the eventUserByteMessage trace message. If cfgCheckTrace == cfgFalse it is replaced by an empty statement. Include with

Definition at line 484 of file femtoos_core.h.

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

#define genTraceMarker ( void   ) 

Custom trace facility, sends a marker traceline.

You can make use of the trace facility yourself by using this routine. Use the marker to start tracing a some later point. In the trace program you can specify how many markers must have passed before the tracing starts. If cfgCheckTrace == cfgFalse it is replaced by an empty statement.

Definition at line 510 of file femtoos_core.h.

Referenced by appLoop_SupervisorTask().

#define genTraceWordInfo ( bUser   )     do {} while(false)

Custom trace facility, sends one byte over the traceline.

You can make use of the trace facility yourself by using this routine. It puts out one payload byte after the eventUserByteMessage trace message. If cfgCheckTrace == cfgFalse it is replaced by an empty statement. Include with

Definition at line 497 of file femtoos_core.h.

#define genWaitReleaseOnName ( SlotName   )     genWaitRelease(preSlotNumberOf(SlotName))

Definition at line 559 of file femtoos_core.h.

 
#define privInitOsReturn (  )     privInitOs()

Definition at line 95 of file femtoos_core.h.

Referenced by privTickYield().

 
#define privInitOsSwitch (  )     privInitOs()

Definition at line 96 of file femtoos_core.h.

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

#define taskFileAppendByteOnName ( FileName,
Item   )     taskFileAppendByte(preFileNumberOf(FileName),Item)

Definition at line 957 of file femtoos_core.h.

#define taskFileClear ( FileNumber   )     taskFileSetSize(FileNumber,0)

Clear the file by setting its size to zero, 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 to zero using this call. Setting the size to zero does not really remove the file (the bytes stay present), Only use after taskFileOpen().

Definition at line 894 of file femtoos_core.h.

Referenced by appLoop_SupervisorTask().

#define taskFileClearOnName ( FileName   )     taskFileSetSize(preFileNumberOf(FileName),0)

Definition at line 895 of file femtoos_core.h.

#define taskFileDirectRead ( Address   )     portFSReadByte(Address)

Direct read function on the file system.

Sometimes it is convenient to have direct access to the file system. Instead of using the portFSReadByte, use this macro instead. It returns the value at the given address on the file system. Make sure you only call this if you are certain you have read access. For normal file operations use taskFileReadByte() or taskFileReadBuffer() instead.

Definition at line 1021 of file femtoos_core.h.

#define taskFileDirectWrite ( Address,
Value   )     portFSWriteByte(Address,Value)

Direct write function on the file system.

Sometimes it is convenient to have direct access to the file system. Instead of using the portFSWriteByte, use this macro instead. It stores the value at the given address on the file system. Make sure you only call this if you are certain you have write access. For normal file operations use taskFileWriteByte() or taskFileWriteBuffer() instead.

Definition at line 1031 of file femtoos_core.h.

#define taskFileGetSizeOnName ( FileName   )     taskFileSize(preFileNumberOf(FileName))

Definition at line 905 of file femtoos_core.h.

#define taskFileReadBufferOnName ( FileName,
Offset,
Size,
Buffer   )     taskFileReadBuffer(preFileNumberOf(FileName),Offset,Size,Buffer)

Definition at line 998 of file femtoos_core.h.

Referenced by appLoop_SupervisorTask().

#define taskFileReadByteOnName ( FileName,
Offset   )     taskFileReadByte(preFileNumberOf(FileName),Offset)

Definition at line 931 of file femtoos_core.h.

Referenced by appLoop_SupervisorTask(), and WorkerProcess().

#define taskFileReadOnName ( FileName,
Offset,
Size,
pipe   )     taskFileRead(preFileNumberOf(FileName),Offset,Size,pipe)

Definition at line 971 of file femtoos_core.h.

#define taskFileSetSizeOnName ( FileName,
Size   )     taskFileSetSize(preFileNumberOf(FileName),Size)

Definition at line 884 of file femtoos_core.h.

Referenced by appLoop_SupervisorTask().

#define taskFileWriteBufferOnName ( FileName,
Offset,
Size,
Buffer   )     taskFileWriteBuffer(preFileNumberOf(FileName),Offset,Size,Buffer)

Definition at line 1011 of file femtoos_core.h.

Referenced by appLoop_SupervisorTask().

#define taskFileWriteByteOnName ( FileName,
Offset,
Item   )     taskFileWriteByte(preFileNumberOf(FileName),Offset,Item)

Definition at line 943 of file femtoos_core.h.

Referenced by appLoop_SupervisorTask(), and WorkerProcess().

#define taskFileWriteOnName ( FileName,
Offset,
Size,
pipe   )     taskFileWrite(preFileNumberOf(FileName),Offset,Size,pipe)

Definition at line 984 of file femtoos_core.h.

#define taskMutexReleaseOnName ( SlotName   )     taskSyncRelease(PassIfSlotIsMutex(preSlotNumberOf(SlotName)))

Release the lock on a mutex, by name.

These macro make it possible to release a lock on a mutex on the basis of the name. It performs the same action as taskSyncRelease() but an extra check is included if the slot indeed holds a queue.

Definition at line 734 of file femtoos_core.h.

#define taskMutexRequestOnName ( SlotName   )     taskSyncRequest(PassIfSlotIsMutex(preSlotNumberOf(SlotName)),0)

Definition at line 699 of file femtoos_core.h.

#define taskQueuReadRequestOnName ( SlotName,
FreeFilling   )     taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(FreeFilling))

Definition at line 698 of file femtoos_core.h.

Referenced by appLoop_ReadTask(), appLoop_ResetTask(), ExeLedCycle(), ExeLedState(), getSingleValue(), HandleDump(), HandleStore(), and startWrite().

#define taskQueuReleaseOnName ( SlotName   )     taskSyncRelease(PassIfSlotIsQueu(preSlotNumberOf(SlotName)))

Release the lock on a queue, by name.

These macro make it possible to release a lock on a queue on the basis of the name. It performs the same action as taskSyncRelease() but an extra check is included if the slot indeed holds a queue.

Definition at line 725 of file femtoos_core.h.

Referenced by appLoop_ReadTask(), appLoop_ResetTask(), appLoop_WriteTask(), clearQueus(), ExeLedCycle(), ExeLedState(), getSingleValue(), HandleDump(), HandleRecall(), HandleStore(), SendID(), SendProcessList(), SendSingleResponse(), SendTickCount(), SendUptime(), startRead(), and startWrite().

#define taskQueuWriteRequestOnName ( SlotName,
FreeFilling   )     taskSyncRequest(PassIfSlotIsQueu(preSlotNumberOf(SlotName)),(-(FreeFilling)))

Try to obtain a lock on a queue for n bytes or on a mutex on a give name.

These macro define the different ways that locks on queues and mutexes can be defined. At the same time they clarify the reading and writing of queue's. See more at taskSyncRequest(). The macros containing the type of slot contain code which check the type of the slot, if cfgCheckMethodUse is activated. So preferable use these. When making use of double slots the distinction between mutex and queue cannot be made.

Definition at line 697 of file femtoos_core.h.

Referenced by appLoop_WriteTask(), clearQueus(), HandleDump(), HandleRecall(), SendID(), SendProcessList(), SendSingleResponse(), SendTickCount(), SendUptime(), and startRead().

#define taskRecreateOnName ( TaskName   )     taskRecreate(preTaskNumberOf(TaskName))

Definition at line 392 of file femtoos_core.h.

#define taskTerminateOnName ( TaskName   )     taskTerminate(preTaskNumberOf(TaskName))

Definition at line 379 of file femtoos_core.h.

 
#define taskWaitForAllEvents (  )     taskWaitForEventSet(defAllEvents)

Definition at line 1568 of file femtoos_core.h.

#define taskWaitForEventSetOnNames1 ( Event0   )     taskWaitForEventSet(preEventLocationOf(Event0))

Definition at line 1561 of file femtoos_core.h.

#define taskWaitForEventSetOnNames2 ( Event0,
Event1   )     taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1))

Definition at line 1562 of file femtoos_core.h.

#define taskWaitForEventSetOnNames3 ( Event0,
Event1,
Event2   )     taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2))

Definition at line 1563 of file femtoos_core.h.

#define taskWaitForEventSetOnNames4 ( Event0,
Event1,
Event2,
Event3   )     taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3))

Definition at line 1564 of file femtoos_core.h.

#define taskWaitForEventSetOnNames5 ( Event0,
Event1,
Event2,
Event3,
Event4   )     taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4))

Definition at line 1565 of file femtoos_core.h.

#define taskWaitForEventSetOnNames6 ( Event0,
Event1,
Event2,
Event3,
Event4,
Event5   )     taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5))

Definition at line 1566 of file femtoos_core.h.

#define taskWaitForEventSetOnNames7 ( Event0,
Event1,
Event2,
Event3,
Event4,
Event5,
Event6   )     taskWaitForEventSet(preEventLocationOf(Event0)|preEventLocationOf(Event1)|preEventLocationOf(Event2)|preEventLocationOf(Event3)|preEventLocationOf(Event4)|preEventLocationOf(Event5)|preEventLocationOf(Event6))

Definition at line 1567 of file femtoos_core.h.

#define taskWaitForOtherTask ( Slot   )     taskWaitForTasks(Slot,2)

Definition at line 544 of file femtoos_core.h.

#define taskWaitForOtherTaskOnName ( SlotName   )     taskWaitForTasks(preSlotNumberOf(SlotName),2)

Definition at line 545 of file femtoos_core.h.

#define taskWaitForTasksOnName ( SlotName,
NumberOfTasks   )     taskWaitForTasks(preSlotNumberOf(SlotName),NumberOfTasks)

Definition at line 543 of file femtoos_core.h.

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


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 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:

void genQueuClear ( Tuint08  uiSlot  ) 

Clear the queue.

Call this to clear the queue. The remaining bytes are not removed, but the read and write pointers are simply reset. Be careful with clearing queues with write blocks on it, for those tasks may block indefinitely (if no timeout has been specified), even if cleaning means that room has become available to write some bytes.

Tbool genQueuEmpty ( Tuint08  uiSlot  ) 

See if the queue is empty.

A quick method to see if the queue is empty. Interrupts are blocked only shortly inside.

Tbool genQueuFull ( Tuint08  uiSlot  ) 

See if the queue is full.

A quick method to see if the queue is full. Interrupts are not blocked inside since the information is obtained in a single atomic read operation.

Tbyte genQueuPeek ( Tuint08  uiSlot  ) 

Look ahead what the next byte to read would be.

Instead of reading the byte from the queue, sometimes you want to know which byte is coming without removing that byte. Call this method to peek into the queue. If the queue is empty, it returns 0.

Tbyte genQueuRead ( Tuint08  uiSlot  ) 

Read a byte from the queue.

Call this method if you want to read one byte from the queue. The execution takes place in task space, and may require some stack space. Before you write a byte please first obtain a lock on the queue, or be sure you are the only one writing/reading (in an isr you cannot obtain a lock). The read/write methods are tick/interrupt protected. Thus it is possible to use the queue mechanism without the request/release methods, if you take care of locking and counting of the bytes yourself. This is particularly handy when working with interrupts A queue may filled in the interrupt and read in a task. If you read from an empty queue the returned value is 0.

Tuint08 genQueuReadable ( Tuint08  uiSlot  ) 

See how many bytes can be read from the queue.

This method return how may bytes can be written to the queue. This is really a temporarily value, but since you know which tasks read/write on the queue, you can judge how stable it is.

void genQueuWrite ( Tuint08  uiSlot,
Tbyte  bItem 
)

Write a byte on the queue.

Call this method if you want to write one byte to the queue. The execution takes place in task space, and may require some stackspace. Before you write a byte please first obtain a lock on the queue, or be sure you are the only one writing/reading (in an isr you cannot obtain a lock). The read/write methods are tick/interrupt protected. Thus it is possible to use the queue mechanism without the request/release methods, if you take care of locking and counting of the bytes yourself. This is particularly handy when working with interrupts A queue may filled in the interrupt and read in a task. If you write on a full queue the new bytes are disposed and not placed on the queue.

Tuint08 genQueuWriteable ( Tuint08  uiSlot  ) 

See how many bytes can be written to the queue.

This method return how may bytes can be read to the queue. This is really a temporarily value, but since you know which tasks read/write on the queue, you can judge how stable it is.

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 genWaitRelease ( Tuint08  uiSlot  ) 

Release all wait locks on this slot.

Use this call to release a rendezvous started with taskWaitForTasks() or taskWaitForOtherTask(). All waiting tasks are released and return true when cfgUseTimeout is activated. Note this method can be called from within an isr. On other specialty is that this call may also be performed from tasks not holding slots by themselves.

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 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:

void privInitOs ( void   ) 

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

This method is called directly after a context switch and takes care internal administrative procedures.

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:

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 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:

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 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 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:

void taskFileOpen ( void   ) 

Open the file system for writing and/or reading.

Before you can read or write a file you must request access to the file system. If you need to read only, you can specify so, thereby allowing other tasks read access to the file system too. If read only is false (or absent) you have private access to the file system, for reading and writing. As with other synchronization primitives you may specify a timeout.

The function returns true when access has been granted. If you need to use the portReadByte() or portWriteByte() directly, call taskFileOpen() first and then make your calls. Note that, due to the nature of eeprom, fileOpen() works as access protection for the whole file system, and not per file. So you may make use of several files simultaneously within the realm of taskFileOpen() - taskFileClose(). taskFileOpen() calls may not be nested.

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

Here is the caller 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 taskSyncRelease ( Tuint08  uiSlotSlot  ) 

Release a queue, on a mutex or both.

After you have taken a queue, mutex or both, you must release them with this call, to unblock other tasks. There is no obligation to release slots which are taken simultaneously in the same manner, but it is allowed. Also, you may use this function to release more than one slot, even if they where not taken simultaneously. This may be used to influence the way other tasks are deblocked. For clarity however, it is best to release in the same manner as the slots where locked.

void taskSyncRequest ( Tuint08  uiSlotSlot,
Tsint08  siFreeRightFilling 
)

Try to obtain a lock on a queue , on a mutex or both.

The method taskSyncRequest is the general way to obtain a lock on a mutex or queue. It is even possible to obtain a simultaneous lock on two mutexes, two queues or a mutex and a queue. Simultaneous locks hold the task blocked until both resources are free. The uiSlotSlot, may contain one slot as parameter (the least significant nibble) or two slots, one in the low nibble and one in the high nibble. Only a slot in the high nibble is not allowed, even as two identical slots. (Would not make much sense either). For queue's you must specify if , and how many bytes are to be read (>0) or written (<0), maximally 127 bytes.

The request blocks until the requested number of bytes is available for reading or writing. If you just want access to the queue, supply 0. For mutexes, supply zero for the free filling parameter (in practice it is ignored, but gives an error if method checking is activated)

You can specify a timeout, if cfgUseTimeout is activated, in which case it may return false, indicating a timeout. It returns true if the lock was obtained.

Slots must be configured as queue's in the config section. queue always fill up the lowest slot numbers, thus 1..n where n is the maximum number of queue's. The mutexes are numbered n+1 ... n+m, where m is the number of mutexes. But, it is easier to make use of named queues and muytexes. If you do, make use of the predefined macro's for easy access to the method defined below.

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:

void taskWaitForEvent ( Tuint08  uiEventSet  ) 

Call this to let the task wait for a specific event in the system.

This function is used as a lightweight alternative to synchronization to slots. There are 8 predefined events ready to use. If you call this function on one or more of those events, the task blocks until all of these events have fired. Events are typically fired one at the time, so the task is reactivated when the last event has fired. Firing event is possible from within an isr, even if the OS is set interruptible. Thus this can make you application very responsive, while not being bound to handle all matters inside an isr. Any task being able to wait for events must have the CapEvent capability.

Referenced by WorkerProcess().

Here is the caller graph for this function:

void taskWaitForTasks ( Tuint08  uiSlot,
Tuint08  uiNumberOfTasks 
)

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:29 2009 for FemtoOS by  doxygen 1.5.2