Home News Features Examples Code FAQ License
AVR Webring
Prev Hub Join Rate Next
Application Programming Interface

Introduction

Below, find an overview of the methodes you can use in your code. This list is valid for Femto OS v0.86. Please have a look inside the file femtoos_core.h for a more elaborate discussion about the use. Methodes starting with 'gen' can be used from within a task, isr or code running in OS space. Methodes with the prefix 'task' should only be called from task, and may trigger a switch of context. Some methodes have a twin "onName" method, these are not seperately listed.

Methods related to task control.
genGetPriority Return the current priority of a given task.
genGetLastWakeTime Return the time the task was last woken.
genGetTaskname Get the flash address of the task name
genResume Resume the given task from suspension.
genSetPriority Set a new priority for the given task.
genSuspend Suspend a task, but do not invoke a context switch.
taskBlockSwitch Block or de-block task switching.
taskDelayFromNow Delay your task for the given number of ticks, starting from now.
taskDelayFromWake Delay your task for a number of ticks, starting at the last wake time.
taskFeedWatchdog Feed the watchdog in order to prevent barking.
taskKillWatchdog Switch off the watchdog facility for this task.
taskKillTask Stop (in error mode) one particular task.
taskSuspendMe Suspend this task and invoke a context switch.
taskRestart Restart one particular task.
taskSleep Put the current task to sleep and invoke a context switch.
taskSleepAll Put all tasks to sleep.
taskStackCheck Call to check how much free space is left on the task stack.
taskYield Manual context switch

Methods related to OS control.
genAddtoTickCount Add the given number of ticks to the tick counter.
genGetTickCount Get the tick counter.
genLogOs Binary oneliner about the os
genLogTask Binary oneliners about every task
genPassFlashString Auxiliary function to push a string on a pipe
genPipeInt16 Auxiliary function to push a Tint16 on a pipe
genReboot Reboot the system
genTraceInfo Custom trace facility, sends one byte over the traceline.
genTraceMarker Custom trace facility, sends a marker traceline.

Methods related to synchronization.
genQueuClear Clear the queu.
genQueuEmpty See if the queu is empty.
genQueuFull See if the queu is full.
genQueuPeek Look ahead what the next byte to read would be.
genQueuWrite Write a byte on the queu.
genQueuWriteable See how many bytes can be written to the queu.
genQueuRead Read a byte from the queu.
genQueuReadable See how many bytes can be read from the queu.
genWaitRelease Release all wait locks on this slot.
taskMutexRequestOnName Call this if you want to take possession of a mutex on name.
taskMutexReleaseOnName Release the lock on a mutex, by name
taskQueuWriteRequestOnName Call this if you want to take possession of a queu on name.
taskQueuReadRequestOnName Call this if you want to take possession of a queu on name.
taskQueuReleaseOnName Release the lock on a queu, by name
taskSyncRequest Try to obtain a lock on a queu , on a mutex or both.
taskSyncRelease Release a queu, on a mutex or both.
taskSyncReleaseOnName Release the lock on a queu or mutex, by name.
taskSyncWriteWriteRequestOnName Call this if you want to take possession of queu's, mutex or a mix.
taskSyncWriteReadRequestOnName Call this if you want to take possession of queu's, mutex or a mix.
taskSyncReadWriteRequestOnName Call this if you want to take possession of queu's, mutex or a mix.
taskSyncReadReadRequestOnName Call this if you want to take possession of queu's, mutex or a mix.
taskWaitForOtherTask Lock this task until n other tasks pass on the same slot.
taskWaitForTasks Lock this task until n other tasks pass on the same slot.

Methods related to interrupts.
isrBegin Start the isr, switch to the isr stack.
isrEndReturn Stop the isr, return to the place where the interrupt occured.
isrEndYield Stop the isr, yield as quickly as possible
isrEnter Start the isr by a context switch.
isrExit End the isr, switch to the OS.
isrStackCheck Call to check how much free space is left on the isr stack.
isrStartLoad Start measuring the time spend in an isr.
isrStopLoad Stop measuring the time spend in an isr.
genFireAllEvents Call this ot release all tasks waiting for an event.
genFireEvent Call this to fire an event.
taskDisableTickInterrupts Disable tick interrupts
taskDisableGlobalInterrupts Disable global interrupts, trace when needed
taskEnableTickInterrupts Enable tick interrupts
taskEnableGlobalInterrupts Enable global interrupts, trace when needed
taskEnterGlobalCritical Enter global critical section
taskExitGlobalCritical Exit global critical section
taskEnterTickCritical Enter tick critical section
taskExitTickCritical Exit tick critical section
taskWaitForEvent Call this to let the task wait for a specific event in the system.

Methods related to the file system.
taskFileAppendByte Add one byte to the file, starting at the beginning when full.
taskFileClear Clear the file by setting its size to zero, contents are unchanged.
taskFileClose Close the file system, so other tasks may obtain access.
taskFileDirectRead Direct read function on the file system.
taskFileDirectWrite Direct write function on the file system.
taskFileFormat Clean (fill with zero's) the whole diskspace.
taskFileGetSize Get the present size of a file.
taskFileOpen Open the file system for writing and/or reading.
taskFileReadBuffer Read severeal bytes from the file and push them to the buffer.
taskFileReadByte Get one byte from a file using a raw read.
taskFileReadPipe Read severeal bytes from the file and push them to the pipe.
taskFileSetSize Give the file a new size, contents are unchanged.
taskFileWriteBuffer Read several bytes from the buffer and put the on file.
taskFileWriteByte Write one byte to a file using a raw write.
taskFileWritePipe Read several bytes from the pipe and put the on file.

Preprocessor constants
defCurrentTaskName Litteral value to specify the current task.
defCurrentTaskNumber Value to specify the current task.
defFromFileEnd Litteral value to state to start at the end of a file.
defFromFileStart Litteral value to state to start at the beginning of a file.
defLockBlockInfinite Use in a synchronizing method to specify it may not timeout
defLockDoNotBlock Use in a synchronizing method to say it must return immideately
defMaxDelayTime The highest delay time you may use.
defReadOnly Litteral value to state to open the file system in read only mode.
defReadWrite Litteral value to state to open the file system in read/write mode.
defStackInitByte Value with which the stack is filled.
defUntilFileEnd Litteral value to state you want to run up to the end of a file.

Preprocessor functions
preEventNumberOf Returns the event number of an event with the name "EventName".
preFileDefined Use this function to see if a file is defined on a file name.
preFileNumberOf Returns the file number of a file with the name "FileName".
preMutexDefined Use to see if a mutex is defined on a slot name.
preQueuDefined Use to see if a queu is defined on a slot name.
preSlotDefined Use to see if a slot is in use.
preSlotNumberOf Returns the slot number of a slot with the name "SlotName".
preTaskDefined Use to see if a task is defined and included in the source
preTaskNumberOf Returns the task number of a task with the name "TaskName".
preWaitDefined Use this function to see if a wait is defined on a slot name.

Detailed descriptions

genGetPriority: Return the current priority of a given task.
Tuint08 genGetPriority(Tuint08 uiTaskNumber)
Tuint08 genGetPriorityOnName(Tlit TaskName)
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.

genGetLastWakeTime: Return the time the task was last woken.
Tuint16 genGetLastWakeTime(Tuint08 uiTaskNumber)
Tuint16 genGetLastWakeTimeOnName(Tlit TaskName)
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.

genGetTaskname: Get the flash address of the task name
Taddress genGetTaskname(Tuint08 uiTaskNumber)
Taddress genGetTasknameOnName(Tlit TaskName)
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().

genResume: Resume the given task from suspension.
void genResume(Tuint08 uiTaskNumber)
void genResumeOnName(Tlit TaskName)
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.

genSetPriority: Set a new priority for the given task.
void genSetPriority(Tuint08 uiTaskNumber, Tuint08 uiNewPriority)
void genSetPriorityOnName(Tlit TaskName,Tuint08 NewPriority)
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.

genSuspend: Suspend a task, but do not invoke a context switch.
void genSuspend(Tuint08 uiTaskNumber)
void genSuspendOnName(Tlit TaskName)
Call this method if you want to suspend a particular task. The state of that task is changed to suspended immediately. This call does not force a context switch, thus if you call it with the current running task number, the method still returns and will not be scheduled again only after a context switch. The call has no effect on terminated, sleeping or tasks that already suspended. It will not work on blocked tasks eighter, since at a resume there is no garantee that the task will be released when possible. You may call suspend on running tasks that hold slots, but the tasks that are waiting their release will not be released until this task is resumed, which may be indefinitely.

taskBlockSwitch: Block or de-block task switching.
void taskBlockSwitch(Tbool bBlock)
Call this to block of unblock context switching. The tick interrupts keep coming, and the tick counter keeps increasing and delayed task wakeup etcetera. Only thing is, there is no task switch, thus by using this method a low priority task can take (keep it temporarily) full processor time, and will behave like a top priority task.

taskDelayFromNow: Delay your task for the given number of ticks, starting from now.
void taskDelayFromNow(Tuint16 uiTicksToWait)
taskDelayFromNow delays your task for the given number of ticks. This value represents the minimum delay. Since the delay time is measured from the moment the delay call is issued, it cannot be used to obtain a reliable frequency.

taskDelayFromWake: Delay your task for a number of ticks, starting at the last wake time.
void taskDelayFromWake(Tuint16 uiTicksToWait)
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.

taskFeedWatchdog: Feed the watchdog in order to prevent barking.
void taskFeedWatchdog(void)
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.

taskKillWatchdog: Switch off the watchdog facility for this task.
void taskKillWatchdog(void)
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.

taskKillTask: Stop (in error mode) one particular task.
void taskKillTask(Tuint08 uiTaskNumber)
void taskKillTaskOnName(Tlit TaskName)
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 restarted, provided you compiled the necessary code in. See taskResart for more information.

taskSuspendMe: Suspend this task and invoke a context switch.
void taskSuspendMe(void)
If you need to suspend your task immediately call this method. 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. If you want a task in suspended mode, do not call this from an init routine, but from the beginning of the infinity loop.

taskRestart: Restart one particular task.
void taskRestart(Tuint08 uiTaskNumber)
void taskRestartOnName(Tlit TaskName)
Restart a task by recreating its context. Init or bark are NOT called again, these are for one time (harware) initialization. The context is cleared, locks are released, and the Loop 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 wich case this call does not return.

taskSleep: Put the current task to sleep and invoke a context switch.
void taskSleep(void)
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 restarted 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 lock on the file system. Femto OS does not keep track of this situation and the task will go to sleep, but will wake without the lock. Thus call sleep after you have completed file operations (i.e. after fileClose)

taskSleepAll: Put all tasks to sleep.
void taskSleepAll(void)
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, Femto OS waits until all file operations have come to an end, and puts the system to sleep directly after. Note that this may imply that tasks not using the FS at the moment of calling kept awake longer as you may expect. The current task should not make use of the FS at the moment off calling taskSleepAll, since it will be put to sleep immediately. See also the discussion on taskSleep(). The method returns when the sleep has taken place.

taskStackCheck: Call to check how much free space is left on the task stack.
Tuint08 taskStackCheck(Tuint08 uiExtraStackSafety)
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 marge 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 op the normal StackSafety parameter. Thus the larger the uiExtraStackSafety the quicker an (expected) error occurs.
     This function returns the amount of free (real) stackspace at the moment of calling, that would be left over, if an context save would happen right at this place, appart from the safety parameters, but the stack required for this call incluis. Thus, if it returns 0 you are living on the edge. This function also operates correctly if the stacklevel and uiExtraStackSafety together exceed the 255 byte limit.

taskYield: Manual context switch
void taskYield(void)
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.

genAddtoTickCount: Add the given number of ticks to the tick counter.
void genAddtoTickCount(Tuint16 uiSleepTime)
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.

genGetTickCount: Get the tick counter.
Tuint16 genGetTickCount(void)
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 ms we have a timer of approximately 65 secs.

genLogOs: Binary oneliner about the os
void genLogOs(void (*pipe)(Tchar))
Call this funcion to obtain information about the OS itself The information is piped through the given pipe method, which could be a write method on a queu, 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(1) the number indicating the number of bytes to be expected.

genLogTask: Binary oneliners about every task
void genLogTask(Tuint08 uiTaskNumber, void (*pipe)(Tchar))
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 queu, 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(1) RegUse(1) the number indicating the number of bytes to be expected.

genPassFlashString: Auxiliary function to push a string on a pipe
void genPassFlashString(Taddress pString, Tuint08 uiLength, Tchar cFilling, void (*pipe)(Tchar))
Inside genLogOs and genLogTask use is made of the function to pipe a string from flash. When uiLength == 0 this method continues and scans the string for a terminating null character. If uiLength > 0 the number of chars is exactly uiLength. If the real length of the string is shorter it is augmented with cFilling chars, otherwise the string is just truncated. The terminating null character is never copied. Note that this function when used externally uses excessive amount of stack so that is may be more efficient to just duplicate the code and inline it.

genPipeInt16: Auxiliary function to push a Tint16 on a pipe
void genPipeInt16(Tuint16 uiValue, void (*pipe)(Tchar))
Inside genLogOs and genLogTask use is made of the function to pipe a 16 bit number. It is available for the user also. Note that this function when used externally uses exessive amount of stack so that is may be more efficient to just duplicate the code and inline it.

genReboot: Reboot the system
void genReboot(void)
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.

genTraceInfo: Custom trace facility, sends one byte over the traceline.
void genTraceInfo(Tbyte bUser)
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.

genTraceMarker: Custom trace facility, sends a marker traceline.
void genTraceMarker()
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.

genQueuClear: Clear the queu.
void genQueuClear(Tuint08 uiSlot)
void genQueuClearOnName(Tlit SlotName)
Call this to clear the queu. The remaining bytes are not removed, but the read and write pionters are simply reset. Be carefull with clearingto queus 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.

genQueuEmpty: See if the queu is empty.
Tbool genQueuEmpty(Tuint08 uiSlot)
Tbool genQueuEmptyOnName(Tlit SlotName)
A quick method to see if the queu is empty. Interrupts are blocked only shortly inside.

genQueuFull: See if the queu is full.
Tbool genQueuFull(Tuint08 uiSlot)
Tbool genQueuFullOnName(Tlit SlotName)
A quick method to see if the queu is full. Interrupts are not blocked inside since the information is obtained in a single atomair read operation.

genQueuPeek: Look ahead what the next byte to read would be.
Tbyte genQueuPeek(Tuint08 uiSlot)
Tbyte genQueuPeekOnName(Tlit SlotName)
Instead of reading the byte from the queu, sometimes you want to know which byte is comming without removing that byte. Call this method to peek into the queu. If the queu is empty, it returns 0.

genQueuWrite: Write a byte on the queu.
void genQueuWrite(Tuint08 uiSlot, Tbyte bItem)
void genQueuWriteOnName(Tlit SlotName, Tbyte bItem)
Call this method if you want to write one byte to the queu. The execution takes place in task space, and may require some stackspace. Before you write a byte please first obtain a lock on the queu, 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 queu mechnism 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 queu may filled in the interrupt and read in a task. If you write on a full queu the new bytes are disposed and not placed on the queu.

genQueuWriteable: See how many bytes can be written to the queu.
Tuint08 genQueuWriteable(Tuint08 uiSlot)
Tuint08 genQueuWriteableOnName(Tlit SlotName)
This method return how may bytes can be read to the queu. This is really a temporarily value, but since you know which tasks read/write on the queu, you can judge how stable it is.

genQueuRead: Read a byte from the queu.
Tbyte genQueuRead(Tuint08 uiSlot)
Tbyte genQueuReadOnName(Tlit SlotName)
Call this method if you want to read one byte from the queu. The execution takes place in task space, and may require some stackspace. Before you write a byte please first obtain a lock on the queu, 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 queu mechnism 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 queu may filled in the interrupt and read in a task. If you read from an empty queu the returned value is 0.

genQueuReadable: See how many bytes can be read from the queu.
Tuint08 genQueuReadable(Tuint08 uiSlot)
Tuint08 genQueuReadableOnName(Tlit SlotName)
This method return how may bytes can be written to the queu. This is really a temporarily value, but since you know which tasks read/write on the queu, you can judge how stable it is.

genWaitRelease: Release all wait locks on this slot.
void genWaitRelease(Tuint08 uiSlot)
void genWaitReleaseOnName(Tlit SlotName)
Use this call to release a rendez vous started with taskWaitForTasks() or taskWaitForOtherTask(). All waiting tasks are released and return true when cfgUseTimeoutOnSync is activated. Note this method can be called from within an isr. On other speciality is that this call may also be performed from tasks not holding slots by themselfes.

taskMutexRequestOnName: Call this if you want to take possession of a mutex on name.
Tbool taskMutexRequestOnName(Tlit SlotName, Tuint16 uiTicksToWait)
Tbool taskMutexRequestOnName(Tlit SlotName)
Call this if you want to take possession of a mutex. Use the (literal) slotname. The task blocks until the mutex is available.
     You must specify a timeout, if cfgUseTimeoutOnSync is activated. You can spefify anything from 2 to defMaxDelayTime. If you need an infinite wait, specify defLockBlockInfinite, and if you want an immedieate return specify defLockDoNotBlock, to make your intensions clear. The method returns true or false, if cfgUseBoolReturns was activated. True means that the lock has been obtained, false means a timeout. If cfgUseBoolReturns was deactivated it may return any numerical value.

taskMutexReleaseOnName: Release the lock on a mutex, by name
void taskMutexReleaseOnName(Tlit SlotName)
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 queu.

taskQueuWriteRequestOnName: Call this if you want to take possession of a queu on name.
Tbool taskQueuWriteRequestOnName(Tlit SlotName, Tsint08 siFreeFilling, Tuint16 uiTicksToWait)
Tbool taskQueuWriteRequestOnName(Tlit SlotName, Tsint08 siFreeFilling)
Tbool taskQueuReadRequestOnName(Tlit SlotName, Tsint08 siFreeFilling, Tuint16 uiTicksToWait)
Tbool taskQueuReadRequestOnName(Tlit SlotName, Tsint08 siFreeFilling)
Call this if you want to take possession of a queu. Use the (literal) slotname. You must specify the number of bytes you want to read or write, which can be anything from 0 up to 127, boundaries included. The task blocks until the queu is available.
     You must specify a timeout, if cfgUseTimeoutOnSync is activated. You can spefify anything from 2 to defMaxDelayTime. If you need an infinite wait, specify defLockBlockInfinite, and if you want an immedieate return specify defLockDoNotBlock, to make your intensions clear. The method returns true or false, if cfgUseBoolReturns was activated. True means that the lock has been obtained, false means a timeout. If cfgUseBoolReturns was deactivated it may return any numerical value.

taskQueuReleaseOnName: Release the lock on a queu, by name
void taskQueuReleaseOnName(Tlit SlotName)
These macro make it possible to release a lock on a queu 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 queu.

taskSyncRequest: Try to obtain a lock on a queu , on a mutex or both.
Tbool taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait)
Tbool taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait)
Tbool taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling)
Tbool taskSyncRequest(Tuint08 uiSlotSlot, Tsint08 siFreeRightFilling)
The method taskSyncRequest is the general way to obtain a lock on a mutex or queu. It is even possible to obtain a simultaneos lock on two mutexes, two queus or a mutex and a queu. 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 indentical slots. (Would not make much sense eighter). For queu'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 avaiable for reading or writing. If you just want access to the queu, 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)
     The method returns true or false, if cfgUseBoolReturns was activated. True means that the lock has been obtained. You can specify a timeout, if cfgUseTimeoutOnSync is activated, in which case it may return false, indicating a timeout. If cfgUseBoolReturns was deactivated it may return any value.
     Slots must be configured as queu's in the config section. Queu always fill up the lowest slot numbers, thus 1..n where n is the maximum number of queu'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 queus and muytexes. If you do, make use of the predefined macro's for easy access to the method defined below.

taskSyncRelease: Release a queu, on a mutex or both.
void taskSyncRelease(Tuint08 uiSlotSlot)
After you have taken a queu, 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 releasy 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.

taskSyncReleaseOnName: Release the lock on a queu or mutex, by name.
void taskSyncReleaseOnName(Tlit SlotLeftName, Tlit SlotRightName)
These macro make it possible to release locks on the basis of the name. If other tasks had a lock on the queu the system checks all task with respect to their lockcondition. The first task that meets the requirement will be released. Scanning is done in task number order, not in priority order. 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 queu cannot be made.

taskSyncWriteWriteRequestOnName: Call this if you want to take possession of queu's, mutex or a mix.
taskSyncWriteReadRequestOnName: Call this if you want to take possession of queu's, mutex or a mix.
taskSyncReadWriteRequestOnName: Call this if you want to take possession of queu's, mutex or a mix.
taskSyncReadReadRequestOnName: Call this if you want to take possession of queu's, mutex or a mix.
Tbool taskSyncWriteWriteRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait)
Tbool taskSyncWriteWriteRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling)
Tbool taskSyncReadWriteRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait)
Tbool taskSyncReadWriteRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling)
Tbool taskSyncWriteReadRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait)
Tbool taskSyncWriteReadRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling)
Tbool taskSyncReadReadRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling, Tuint16 uiTicksToWait)
Tbool taskSyncReadReadRequestOnName(Tlit SlotLeftName, Tlit SlotRightName, Tsint08 siFreeLeftFilling, Tsint08 siFreeRightFilling)
Call this if you want to take possession of two queu's, mutexes or one queu and one mutex. Use the (literal) slotnames. You must specify the number of bytes you want to read or write for queus, which can be anything from 0 up to 127, boundaries included. For mutexes specify 0 for the freefilling. The task blocks until both resources are available.
     You must specify a timeout, if cfgUseTimeoutOnSync is activated. You can spefify anything from 2 to defMaxDelayTime. If you need an infinite wait, specify defLockBlockInfinite, and if you want an immedieate return specify defLockDoNotBlock, to make your intensions clear. The method returns true or false, if cfgUseBoolReturns was activated. True means that the lock has been obtained, false means a timeout. If cfgUseBoolReturns was deactivated it may return any numerical value.

taskWaitForOtherTask: Lock this task until n other tasks pass on the same slot.
Tbool taskWaitForOtherTask(Tuint08 uiSlot, Tuint16 uiTicksToWait)
Tbool taskWaitForOtherTask(Tuint08 uiSlot)
Tbool taskWaitForOtherTaskOnName(Tlit SlotName, Tuint16 uiTicksToWait)
Tbool taskWaitForOtherTaskOnName(Tlit SlotName)
Use this function to hold one or more tasks and let it wait for the given number of tasks to pass the same lock. In other words it is a rendezvous of N (uiNumberOfTasks) tasks. Make sure N is equal on all calls because as soon as the number of tasks is equal or lower a the value specified all are released. You can specify a timeout, if cfgUseTimeoutOnSync is activated. The function returns true if the rendez vous took place, false otherwise, if the cfgUseBoolReturns is activated. Otherwise the return value is undefined.

taskWaitForTasks: Lock this task until n other tasks pass on the same slot.
Tbool taskWaitForTasks(Tuint08 uiSlot, Tuint08 uiNumberOfTasks, Tuint16 uiTicksToWait)
Tbool taskWaitForTasks(Tuint08 uiSlot, Tuint08 uiNumberOfTasks)
Tbool taskWaitForTasksOnName(Tlit SlotName, Tuint08 uiNumberOfTasks, Tuint16 uiTicksToWait)
Tbool taskWaitForTasksOnName(Tlit SlotName, Tuint08 uiNumberOfTasks)
Use this function to hold one or more tasks and let it wait for the given number of tasks to pass the same lock. In other words it is a rendezvous of N (uiNumberOfTasks) tasks. Make sure N is equal on all calls because as soon as the number of tasks is equal or lower a the value specified all are released. You can specify a timeout, if cfgUseTimeoutOnSync is activated. The function returns true if the rendez vous took place, false otherwise, if the cfgUseBoolReturns is activated. Otherwise the return value is undefined.

isrBegin: Start the isr, switch to the isr stack.
isrBegin()
isrBegin() is used when you want the interrupt to be serviced as quickly as possible. No context is saved, so you are responsible for saving and restoring any registers you use, including the status register. You can however let GCC take care of this. Note that, if you use many registers, this may take more time than a context save. Andvantage is that you can interrupt the OS if you want, depending on the setting of cfgIntOsProtected. If you want to measure the time spend inside the interrupt you must manually call the irsStartLoad/isrStopLoad routines, and make sure you save the registers utilized inside as well.

isrEndReturn: Stop the isr, return to the place where the interrupt occured.
isrEndReturn()
isrEndReturn(): use this to return from a isr to the place the interrupt occured. It is your only option is you have no OS protection. Restore anything you corrupted, this is your own responsibility. The only thing the isrBegin() / isrReturn() pair takes care of is the stack switch. So inside the isr you have the ISR stack.

isrEndYield: Stop the isr, yield as quickly as possible
isrEndYield()
isrEndYield(): use this if you want a context switch directly after the handling of your interrupt. You are stil responsible for restoring any registers, so it only makes sense to use isrBegin() / isrYield() over isrEnter() / isrExit() if your response to the interrupt need to be very fast and does not require that many operations. Since this method calls taskYield() that method must be included too.

isrEnter: Start the isr by a context switch.
isrEnter()
Use isrEnter() to start an isr with a context switch. The current task is pushed to the context (so this is only available when the interrupts comes when a task is running, i.e. cfgIntOsProtected must be set) and, depening on the setting of cfgIntSwitchUsesOSstack work is continued on the OS or ISR stack. Always close the isr with isrExit(). If selected the time spend in the isr is measured automatically

isrExit: End the isr, switch to the OS.
isrExit()
Use isrEnter() to start an isr with a context switch. The current task is pushed to the context (so this is only available when the interrupts comes when a task is running, i.e. cfgIntOsProtected must be set) and, depening on the setting of cfgIntSwitchUsesOSstack work is continued on the OS or ISR stack. Always close the isr with isrExit().

isrStackCheck: Call to check how much free space is left on the isr stack.
Tuint08 isrStackCheck(Tuint08 uiExtraStackSafety)
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 marge you require at this place. Note that the total of present isr stacksize and uiExtraStackSafety should not exceed the 255 bytes. This function returns the amount of free (real) isr stackspace at the moment of calling, appart 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.

isrStartLoad: Start measuring the time spend in an isr.
void isrStartLoad(void)
IsrStartLoad measures the total time spend in interrupts. You only need to call it at the beginning of your interrupt service routine if you took onw responsibility of the context save, i.e. if you came at the place with isrBegin. It starts the stopwatch for measuring the time inside an isr. You can leave the call in you code when switching off cfgUseLoadMonitor, it will be replaced by an empty statement.

isrStopLoad: Stop measuring the time spend in an isr.
void isrStopLoad(void)
IsrStopLoad measures the total time spend in interrupts. You only need to call it at the end of your interrupt service routine if you took own responsibility of the context save, i.e. before you leave with isrEndYield() or isrEndReturn(). It stops the stopwatch for measuring the time inside an isr. You can leave the call in you code when switching off cfgUseLoadMonitor, it will be replaced by an empty statement.

genFireAllEvents: Call this ot release all tasks waiting for an event.
void genFireAllEvents(void)
When calling all events are fired at once, so all blocking tasks on events are released. The excution of this method takes place in a non interuptable realm.

genFireEvent: Call this to fire an event.
void genFireEvent(Tuint08 uiEvent)
This method is not an regular method but a define, to be as quick as possible. It is assumend to compiler is able to compile it into a single bit-write instruction (avr). If this is not possible, be sure you only call it when interrupts are disabled. GCC is able to compile this into an atomic instruction provided you supply a constant, or if you use the FireEventOnName() call. So you should not call it with a variable, or with a constant of other values, if interrupts are enabled. If you need to fire more events, call this function several times, once for each event.

taskDisableTickInterrupts: Disable tick interrupts
taskDisableTickInterrupts()
taskEnable/DisableTickInterrupts makes it possible to set/clear the tick interrupt flag. Don't call portEnable, but call taskEnable to make you code general. Note these calls cannot be nested, i.e. they are absolute and work instantly. If cfgCheckTrace is switched on, the call is traced. Never call Enable/Disable interrupts inside critical sections.

taskDisableGlobalInterrupts: Disable global interrupts, trace when needed
taskDisableGlobalInterrupts()
taskEnable/DisableGlobalInterrupts makes it possible to set/clear the global interrupt flag. Don't call portEnable, but call taskEnable to make you code general. Note these calls cannot be nested, i.e. they are absolute and work instantly. If cfgCheckTrace is switched on, the call is traced. Never call Enable/Disable interrupts inside critical sections.

taskEnableTickInterrupts: Enable tick interrupts
taskEnableTickInterrupts()
taskEnable/DisableTickInterrupts makes it possible to set/clear the tick interrupt flag. Don't call portEnable, but call taskEnable to make you code general. Note these calls cannot be nested, i.e. they are absolute and work instantly. If cfgCheckTrace is switched on, the call is traced. Never call Enable/Disable interrupts inside critical sections.

taskEnableGlobalInterrupts: Enable global interrupts, trace when needed
taskEnableGlobalInterrupts()
taskEnable/DisableGlobalInterrupts makes it possible to set/clear the global interrupt flag. Don't call portEnable, but call taskEnable to make you code general. Note these calls cannot be nested, i.e. they are absolute and work instantly. If cfgCheckTrace is switched on, the call is traced. Never call Enable/Disable interrupts inside critical sections.

taskEnterGlobalCritical: Enter global critical section
void taskEnterGlobalCritical(void)
Use taskEnter/ExitGlobalCritical if you need nested (de)activation of the global interrupts. Nesting is only active when cfgUseNestedCriticals is set, otherwise these calls are replaced by simple taskEnterGlobalCritical. Thus, in fact you can always use this call, and decide lateron on its functionality. It is the most general way. The same mechanism about interrupt tracking applies as with taskEnable/ DisableGlobalInterrupts.

taskExitGlobalCritical: Exit global critical section
void taskExitGlobalCritical(void)
Use taskEnter/ExitGlobalCritical if you need nested (de)activation of the global interrupts. Nesting is only active when cfgUseNestedCriticals is set, otherwise these calls are replaced by simple taskExitGlobalCritical. Thus, in fact you can always use this call, and decide lateron on its functionality. It is the most general way. The same mechanism about interrupt tracking applies as with taskEnable/ DisableGlobalInterrupts.

taskEnterTickCritical: Enter tick critical section
void taskEnterTickCritical(void)
Use taskEnter/ExitTickCritical if you need nested (de)activation of the tick interrupts. Nesting is only active when cfgUseNestedCriticals is set, otherwise these calls are replaced by simple taskEnterTickCritical. Thus, in fact you can always use this call, and decide lateron on its functionality. It is the most general way. The same mechanism about interrupt tracking applies as with taskEnable/ DisableTickInterrupts.

taskExitTickCritical: Exit tick critical section
void taskExitTickCritical(void)
Use taskEnter/ExitTickCritical if you need nested (de)activation of the tick interrupts. Nesting is only active when cfgUseNestedCriticals is set, otherwise these calls are replaced by simple taskExitTickCritical. Thus, in fact you can always use this call, and decide lateron on its functionality. It is the most general way. The same mechanism about interrupt tracking applies as with taskEnable/ DisableTickInterrupts.

taskWaitForEvent: Call this to let the task wait for a specific event in the system.
Tbool taskWaitForEvent(Tuint08 uiEvent, Tuint16 uiTicksToWait)
Tbool taskWaitForEvent(Tuint08 uiEvent)
Tbool taskWaitForEventOnName(Tlit EventName,TicksToWait)
Tbool taskWaitForEventOnName(Tlit EventName)
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 interuptable. Thus this can make you application very responsive, while not being bound to handle all matters inside an isr.

taskFileAppendByte: Add one byte to the file, starting at the beginning when full.
void taskFileAppendByte(Tuint08 uiFileNumber, Tbyte bItem)
void taskFileAppendByteOnName(Tlit FileName, Tbyte bItem)
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 exented. 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 filesize is set to zero first, then the byte is written and subsequently the size is set to one. Only use after taskFileOpen().

taskFileClear: Clear the file by setting its size to zero, contents are unchanged.
void taskFileClear(Tuint08 FileNumber)
void taskFileClearOnName(Tlit FileName)
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().

taskFileClose: Close the file system, so other tasks may obtain access.
void taskFileClose(void)
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 immideately release such blocked tasks, possibly starving the current task if it runs in lower priority.

taskFileDirectRead: Direct read function on the file system.
Tbyte taskFileDirectRead(Taddress pAddress)
Sometimes it is convineant 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.

taskFileDirectWrite: Direct write function on the file system.
void taskFileDirectWrite(Taddress pAddress, Tbyte bValue)
Sometimes it is convineant 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.

taskFileFormat: Clean (fill with zero's) the whole diskspace.
void taskFileFormat(void)
void taskFileFormatOnName(Tlit FileName)
If you need to clean the diskspace 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 filesystem before use, but you must be ensure file system integrety yourself before first use. Only use after taskFileOpen().

taskFileGetSize: Get the present size of a file.
Tuint08 taskFileGetSize(Tuint08 uiFileNumber)
Tuint08 taskFileGetSizeOnName(Tlit FileName)
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().

taskFileOpen: Open the file system for writing and/or reading.
Tbool taskFileOpen(Tbool bReadOnly, Tuint16 uiTicksToWait)
Tbool taskFileOpen(Tuint16 uiTicksToWait)
Tbool taskFileOpen(Tbool bReadOnly)
Tbool taskFileOpen(void)
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.

taskFileReadBuffer: Read severeal bytes from the file and push them to the buffer.
void taskFileReadBuffer(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
void taskFileReadBufferOnName(Tlit FileName, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
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 savely 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().

taskFileReadByte: Get one byte from a file using a raw read.
Tbyte taskFileReadByte(Tuint08 uiFileNumber, Tuint08 uiOffset)
Tbyte taskFileReadByteOnName(Tlit FileName, Tuint08 uiOffset)
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().

taskFileReadPipe: Read severeal bytes from the file and push them to the pipe.
void taskFileReadPipe(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, void (*pipe)(Tchar))
void taskFileReadPipeOnName(Tlit FileName, Tuint08 uiOffset, Tuint08 uiSize, void (*pipe)(Tchar))
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 savely 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().

taskFileSetSize: Give the file a new size, contents are unchanged.
void taskFileSetSize(Tuint08 uiFileNumber, Tuint08 uiSize)
void taskFileSetSizeOnName(Tlit FileName, Tuint08 uiSize)
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().

taskFileWriteBuffer: Read several bytes from the buffer and put the on file.
void taskFileWriteBuffer(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
void taskFileWriteBufferOnName(Tlit FileName, Tuint08 uiOffset, Tuint08 uiSize, Taddress pBuffer)
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().

taskFileWriteByte: Write one byte to a file using a raw write.
void taskFileWriteByte(Tuint08 uiFileNumber, Tuint08 uiOffset, Tbyte bItem)
void taskFileWriteByteOnName(Tlit FileName, Tuint08 uiOffset, Tbyte bItem)
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().

taskFileWritePipe: Read several bytes from the pipe and put the on file.
void taskFileWritePipe(Tuint08 uiFileNumber, Tuint08 uiOffset, Tuint08 uiSize, Tchar (*pipe)(void))
void taskFileWritePipeOnName(Tlit FileName, Tuint08 uiOffset, Tuint08 uiSize, Tchar (*pipe)(void))
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().

defCurrentTaskName: Litteral value to specify the current task.
#define defCurrentTaskName
In all (external) methodes accepting the TaskName parameter you can specify defCurrentTask to indicate you want to use it for the current task, if you do not know that name (for example when code is run from different tasks). Never use it as a number in your code Please be absolutely sure you are inside a real task. If you are inside an isr, inside init or bark routines, you are not in task space and the current task may not be what you expect. However, the system cannot warn you for this situation. Thus, only to be used inside code that was called from appLoop_XXX.

defCurrentTaskNumber: Value to specify the current task.
#define defCurrentTaskNumber
In all (external) methodes accepting the uiTaskNumber parameter you can specify defCurrentTaskNumber to indicate you want to use it for the current task, if you do not know that number (for example when code is run from different tasks). Please be absolutely sure you are inside a real task. If you are inside an isr, inside init or bark routines, you are not in task space and the current task may not be what you expect. However, the system cannot warn you for this situation. Thus, only to be used inside code that was called from appLoop_XXX.

defFromFileEnd: Litteral value to state to start at the end of a file.
#define defFromFileEnd
In most file operation calls you can specify an offset. Instead of using the real file length (which you must know or obtain), you may use this constant to start writing the new bytes at the end of the file. This constant is only available if cfgUseFileSystemMaintainFAT is activated.

defFromFileStart: Litteral value to state to start at the beginning of a file.
#define defFromFileStart
In most file operation calls you can specify an offset. Instead of using zero, you may always use this constant to make your intention clear that you want to start reading or writing from the file start.

defLockBlockInfinite: Use in a synchronizing method to specify it may not timeout
#define defLockBlockInfinite
Value you can use to indicate that a lock need not to timeout. Use this rather than supply 0 to make your intensions clear.

defLockDoNotBlock: Use in a synchronizing method to say it must return immideately
#define defLockDoNotBlock
Value you can use to indicate that a lock need timeout immideately, thus just check if you can obtain the lock, but do not wait for it. Use this rather than supply 1 to make your intensions clear.

defMaxDelayTime: The highest delay time you may use.
#define defMaxDelayTime
The highest delay time you may use. If your tick time is 1ms, and since we have a 16 bit tick counter, the maximum delay is about 65 seconds. In my opinion, this is long enough. If you want to delay tasks longer it is better to get a real time signal somewhere.

defReadOnly: Litteral value to state to open the file system in read only mode.
#define defReadOnly
If cfgUseFileSystemConcurrentRead is activated, it is required to specify if you want to open the file system in read only mode, or in read/write mode. Although, you can just use a boolean there, you may want to use this constant to make your intentions mode explicit.

defReadWrite: Litteral value to state to open the file system in read/write mode.
#define defReadWrite

defStackInitByte: Value with which the stack is filled.
#define defStackInitByte
For testing purposes you can fill the stack with other values that 0x00. This may be handy to see if you are not misusing a register. For the shortest code, leave it to 0x00, so the compiler can rely upon the .bss section cleaning. For a discussion how to use this setting see also cfgSysRegisterCheckByte. Also see the discussion at defStackClean.

defUntilFileEnd: Litteral value to state you want to run up to the end of a file.
#define defUntilFileEnd
In most file operation calls you can specify an size. Instead of using the real file length (which you must know or obtain), you may use this constant to keep reading bytes up to the end of the file. This constant is only available if cfgUseFileSystemMaintainFAT is activated.

preEventNumberOf: Returns the event number of an event with the name "EventName".
#define preEventNumberOf(EventName)
Using this function it is possible to use static names for the event instead of numbers. It returns the event number of an event with the compile time name "EventName". This function is implictly called in all 'OnName' variants of the API calls. Make sure you correctly spell the name, since that is not checked here (and will give rise to a compile time warning only) Preferably uses names instead of numbers in your code since the numbering depends an the inclusions and may differ at different compiles. Substitution of the numbers is done at compile time and does not require code. Cannot be used in preproccessor statements.

preFileDefined: Use this function to see if a file is defined on a file name.
#define preFileNumberOf(FileName)
Use this function to see if a file is defined on a file name. Can be used in preproccessor statements

preFileNumberOf: Returns the file number of a file with the name "FileName".
#define preFileNumberOf(FileName)
Using this function it is possible to use static names for the files instead of numbers. It returns the file number of a file with the compile time name "FileName". This function is implictly called in all 'OnName' variants of the API calls. Make sure you correctly spell the name, since that is not checked here (and will give rise to a compile time warning only). Preferably uses names instead of numbers in your code since the numbering depends an the inclusions and may differ at different compiles. Substitution of the numbers is done at compile time and does not require code. Cannot be used in preproccessor statements.

preMutexDefined: Use to see if a mutex is defined on a slot name.
#define preMutexDefined(SlotName)
Use this function to see if a mutex is defined on a slot name. Can be used in preproccessor statements

preQueuDefined: Use to see if a queu is defined on a slot name.
#define preQueuDefined(SlotName)
Use this function to see if a queu is defined on a slot name. Can be used in preproccessor statements

preSlotDefined: Use to see if a slot is in use.
#define preSlotDefined(SlotName)
Use this function to see if a slot is in use. Can be used in preproccessor statements

preSlotNumberOf: Returns the slot number of a slot with the name "SlotName".
#define preSlotNumberOf(SlotName)
Using this function it is possible to use static names for the slots instead of numbers. It returns the slot number of a slot with the compile time name "SlotName". This function is implictly called in all 'OnName' variants of the API calls. Make sure you correctly spell the name, since that is not checked here (and will give rise to a compile time warning only). Preferably uses names instead of numbers in your code since the numbering depends an the inclusions and may differ at different compiles. Substitution of the numbers is done at compile time and does not require code. Cannot be used in preproccessor statements.

preTaskDefined: Use to see if a task is defined and included in the source
#define preTaskDefined(TaskName)
Use this function to see if a task is defined and included in the source Can be used in preproccessor statements

preTaskNumberOf: Returns the task number of a task with the name "TaskName".
#define preTaskNumberOf(TaskName)
Using this function it is possible to use static names for the tasks instead of numbers. It returns the task number of a task with the compile time name "TaskName". This does not equak the task name that is embedded in the code, that may be different or even absent). This function is implictly called in all 'OnName' variants of the API calls. Make sure you correctly spell the name, since that is not checked here (and will give rise to a compile time warning only). Preferably uses names instead of numbers in your code since the numbering depends an the inclusions and may differ at different compiles. Substitution of the numbers is done at compile time and does not require code. Cannot be used in preproccessor statements.

preWaitDefined: Use this function to see if a wait is defined on a slot name.
#define preWaitDefined(SlotName)
Use this function to see if a wait is defined on a slot name. Can be used in preproccessor statements

Contact: info@femtoos.org