femtoos_headers/femtoos_port.h File Reference

#include "femtoos_globals.h"
#include "femtoos_constants.h"

Include dependency graph for femtoos_port.h:

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

Go to the source code of this file.

Defines

#define portFlashReadByte(byteType, byteVar)   ((byteType) pgm_read_byte(&(byteVar)))
 Operation to read one byte (8 bit) from flash, and perform the appropriate type cast.
#define portFlashReadWord(wordType, wordVar)   ((wordType) pgm_read_word(&(wordVar)))
 Operation to read one word (16bit) from flash, and perform the appropriate type cast.
#define portFlashReadStruc(strucType, strucPointer, strucFieldType, strucField)   ((strucFieldType) pgm_read_word(&(((strucType *)pgm_read_word(&strucPointer))->strucField)))
 Operation to read one field from a structure in flash, and perform the appropriate type cast.
#define portInitCPUStatusRegister   0x00
 Specify how the status register must be filled upon first start of the task, but do not include the setting of interrupts here, i.e.
#define portBarrier()   asm volatile ( "" ::: "memory" )
 Specify the operation that makes gcc flush all its cached variables.
#define portNop()   asm volatile ( "nop" :: )
 Specify the no operations instruction of your hardware.
#define portEnableGlobalInterrupts()   asm volatile ( "sei" ::: "memory" )
 Specify the instruction to set the global interrupt.
#define portDisableGlobalInterrupts()   asm volatile ( "cli" ::: "memory" )
 Specify the instruction to clear the global interrupt.
#define portResqueGlobalInterruptState()
 This call is used as preamble for all context switching functions to store the state of the global interrupt as soon as possible.
#define portResqueGlobalInterruptActive()   asm volatile ( "seh " :: )
 We call this instead of portResqueGlobalInterruptState to store the global interrupt state on places where we are sure the global interrupts where enabled shortly before, but are already disabled now.
#define portFSWriteReady()   ((devEECR & (1 << devEEPE)) == 0)
 Specify the instructions that determine if the file system is ready for writing.
#define portGetFullStack(field)
 Specify the instructions to obtain the stack pointer.
#define portGetReducedStack(field)
 Specify the instructions to obtain the reduced stack pointer.
#define portSetFullStack(field)
 Specify the instructions to initialize the stack pointer.
#define portSetReducedStack(field)   asm volatile ( "out __SP_L__, %A0 " : : "r" (field) : "memory")
 Specify the instructions to set the low byte of the stack pointer.
#define portSwapNibbles(field)   asm volatile("swap %0" : "=r" (field) : "0" (field));
 Specify the instructions to swap to nibbles in a byte.
#define defJUMP   "rjmp"
 Specify the hardware dependent jump and call instruction.
#define defCALL   "rcall"
#define portJump(destination)   asm volatile ( defJUMP " " #destination :: )
#define portEventRegister   devAuxEventReg
 Define the event register.
#define defEventRegisterAtomicOperation   defAuxEventRegLowIO
 Here you can specify if the portEventRegister can be written and read in an atomic operation.
#define defEqualAuxiliaryRegisters   preEqualMacros(devAuxSysReg,devAuxEventReg)
#define defTimerPrescaleBits   (DefPrescaler(cfgSysSubTickDivider))
 Most hardware make use of some kind of prescaling to feed the timer clocks.
#define defWatchDogPrescaleBits   0x04
 The (device) watchdog can usually be set to different different wait times and is (should be) driven by an independent low power clock.
#define defSleepRealPeriod   256
#define portInitContext(TaskStart, StackTop, RegisterUse, InterruptStart)   privInitContext(TaskStart,StackTop,RegisterUse,InterruptStart)
 Define portInitContext as privInitContext to make use of the in Femto Os defined privInitContext.

Functions

void portReboot (void) __attribute__((naked
 Specify the instructions to reboot your hardware.
void portFSWriteByte (Taddress pAddress, Tbyte bValue)
 Within this call you must save a byte on the file system at the given address.
Tbyte portFSReadByte (Taddress pAddress)
 Return the content of the given location in the file system.
void portEnterGlobalInterrupts (void) __attribute__((naked
 Specify the functions that the system (femtoos.c) and not your application code (!) must use to enter global critical regions.
void portExitGlobalInterrupts (void) __attribute__((naked
 Specify the functions that the system (femtoos.c) and not your application code (!) must use to exit global critical regions.
void portEnterTickInterrupts (void) __attribute__((naked
 Specify the functions that the system (femtoos.c) and not your application code (!) must use to enter tick critical regions.
void portExitTickInterrupts (void) __attribute__((naked
 Specify the functions that the system (femtoos.c) and not your application code (!) must use to exit tick critical regions.
void portDisableTickInterrupts (void) __attribute__((naked
 Define code to switch off the interrupts of the tick counter.
void portEnableTickInterrupts (void) __attribute__((naked
 Define code to switch on the interrupts of the tick counter.
void portInit (void)
 Specify all code needed to startup your system.
void portTrace (Tuint08 uiEvent)
 The femto OS is capable of tracing its own and your functions.
void portIdle (void) __attribute__((noreturn
 The Femto OS has no special idle tasks.
void portSleep (Tuint08 uiTickBlockMinDelay)
 Besides the possibility to put the device in a power save mode during idle, the OS supports a low power sleep mode which can be entered for a longer period.
void portShowError (Tuint08 uiMessage, Tuint08 uiCallId, Tuint08 uiInfoTask)
 As long as you are developing, it is useful to keep track of errors that occur (in embedded devices we expect no errors during normal operation) Every error encountered is reported through a call to portShowError.
void portShowReset (void)
 The startup code of the Femto OS contains a special call to show a reset took place, this is portShowReset().
void portEnterISR (void) __attribute__((naked
 Specify a function that switches the stack from task to isr.
void portBeginISR (void) __attribute__((naked
 Specify a function that switches the stack from os/task to isr.
void portReturnISR (void) __attribute__((naked
 Specify a function that switches the stack from isr to os/task.
void portYieldISR (void) __attribute__((naked
 Specify a function that switches the stack from isr to os/task.
void portSaveContext (void) __attribute__((naked
 Specify a function that saves all relevant registers and the status register on the stack, and subsequently performs a stack change from task to os.
void portRestoreContext (void) __attribute__((naked
 Specify a function that restores all relevant registers and the status register from the stack.
void portSetupTimerInterrupt (void)
 Specify a function that sets up your hardware so that tick interupts can take place.
Tuint08 portReadTimer (void)
 Specify a function that returns the number of subticks passed from the subtick timer.
Tbool portCheckTimer (void)
 Specify a function that returns true if the timer interrupt is due but has not yet been executed, and false otherwise.
Tuint08 portReadAndResetTimer (Tuint08 uiSubTickInterrupt)
 Specify a function that returns the number of subticks passed from the subtick timer, and simultaneously resets the timer with a new interrupt time.
void devSigTimerCompare (void) __attribute__((signal
 Interrupt routine called when the tick interrupt takes place.
void devSigTimerOverflow (void) __attribute__((signal
 Interrupt routine called when the subtick timer overflows.

Variables

void noreturn
void noinline
void noinline
void noinline
void noinline
void noinline
void noinline
void naked
void noinline
void used
void noinline
void used
void noinline
void used
void noinline
void used
void noinline
void used
void noinline
void used
void naked
void used
void externally_visible
void naked
void used
void externally_visible


Define Documentation

#define defCALL   "rcall"

Definition at line 288 of file femtoos_port.h.

Referenced by portSleep().

#define defEqualAuxiliaryRegisters   preEqualMacros(devAuxSysReg,devAuxEventReg)

Definition at line 313 of file femtoos_port.h.

Referenced by genCountEventBlocks(), genFireEvent(), and genFireEventSet().

#define defEventRegisterAtomicOperation   defAuxEventRegLowIO

Here you can specify if the portEventRegister can be written and read in an atomic operation.

And if the auxiliary system storage coincides with the registers used for events.

Definition at line 312 of file femtoos_port.h.

#define defJUMP   "rjmp"

Specify the hardware dependent jump and call instruction.

Make sure this instruction always works and does not depend on the distance that must be jumped.

Definition at line 287 of file femtoos_port.h.

#define defSleepRealPeriod   256

Definition at line 402 of file femtoos_port.h.

#define defTimerPrescaleBits   (DefPrescaler(cfgSysSubTickDivider))

Most hardware make use of some kind of prescaling to feed the timer clocks.

We decided not to explicitly do the tick interrupt frequency math in our code, since it will be not general enough anyway. Instead, you can couple the prescale values to the constant which contains the bits that must be set in the prescale register. This coupling is done per device in the device.asm file.

Definition at line 362 of file femtoos_port.h.

Referenced by portSetupTimerInterrupt().

#define defWatchDogPrescaleBits   0x04

The (device) watchdog can usually be set to different different wait times and is (should be) driven by an independent low power clock.

The table below translates the requested waittime into the correct settings for the watchdog prescaler.

Definition at line 401 of file femtoos_port.h.

 
#define portBarrier (  )     asm volatile ( "" ::: "memory" )

Specify the operation that makes gcc flush all its cached variables.

This is needed to make sure the optimizer does not move calls over this barrier. calls this function, it is for your own purposes.

Definition at line 108 of file femtoos_port.h.

 
#define portDisableGlobalInterrupts (  )     asm volatile ( "cli" ::: "memory" )

Specify the instruction to clear the global interrupt.

All calls from the Femtoos.c regarding clearing the state of the global interrupt make use off this function, but that does not hold true for other assembler parts of the OS. The memory clobber ensures uncaching of variables and prevent dislocation.

Definition at line 132 of file femtoos_port.h.

 
#define portEnableGlobalInterrupts (  )     asm volatile ( "sei" ::: "memory" )

Specify the instruction to set the global interrupt.

All calls from the Femtoos.c regarding setting the state of the global interrupt make use off this function, but that does not hold true for other assembler parts of the OS. The memory clobber ensures uncaching of variables and prevent dislocation.

Definition at line 123 of file femtoos_port.h.

#define portEventRegister   devAuxEventReg

Define the event register.

This should be a register that can preferable be read and written one atomic operation (see below) For the AVR the general purpose registers are appropiate. Writing is done using atomic bitset and bitclear operations. If such a register is not available, use a normal register, and make sure you only set events in interrupt protected environments, by using isrFireEvent() or genFireEvent() on the appropiate places. Reading inside the OS is already protected.

Definition at line 305 of file femtoos_port.h.

Referenced by genFireEventSet(), and privEnterOS().

#define portFlashReadByte ( byteType,
byteVar   )     ((byteType) pgm_read_byte(&(byteVar)))

Operation to read one byte (8 bit) from flash, and perform the appropriate type cast.

All flash read operations make use of portFlashReadByte, portFlashReadWord or portFlashReadStruc

Definition at line 47 of file femtoos_port.h.

Referenced by appLoop_Display(), genPassFlashString(), privCheckCapabilities(), privFileLocation(), and privFileSpace().

#define portFlashReadStruc ( strucType,
strucPointer,
strucFieldType,
strucField   )     ((strucFieldType) pgm_read_word(&(((strucType *)pgm_read_word(&strucPointer))->strucField)))

Operation to read one field from a structure in flash, and perform the appropriate type cast.

All flash read operations make use of portFlashReadByte, portFlashReadWord or portFlashReadStruc

Definition at line 63 of file femtoos_port.h.

Referenced by genGetTaskname(), genLogTask(), and privTaskInit().

#define portFlashReadWord ( wordType,
wordVar   )     ((wordType) pgm_read_word(&(wordVar)))

Operation to read one word (16bit) from flash, and perform the appropriate type cast.

All flash read operations make use of portFlashReadByte, portFlashReadWord or portFlashReadStruc

Definition at line 55 of file femtoos_port.h.

Referenced by main(), privRecreateBody(), privSwitchContext(), privTaskInit(), and privTcbList().

 
#define portFSWriteReady (  )     ((devEECR & (1 << devEEPE)) == 0)

Specify the instructions that determine if the file system is ready for writing.

Femto OS assumes, if this call returns true, the files system remains ready until a write action is initiated by the Femto OS itself. In other words, the system is not capable of discovering other situations which may prevent a successful write. There situations are, for example, but not limited to, writing to flash or raw calls to portFSWriteByte.

Definition at line 210 of file femtoos_port.h.

Referenced by privPrepareFileClose(), and privWaitForFsAccessBody().

#define portGetFullStack ( field   ) 

Value:

asm volatile ( "in %A0,__SP_L__     \n\t" \
                 "in %B0,__SP_H__   " :"=r" (field) : )
Specify the instructions to obtain the stack pointer.

If you have a SP_H field, you must use it here, otherwise this routine may equal portGetReducedStack.

Definition at line 239 of file femtoos_port.h.

#define portGetReducedStack ( field   ) 

Value:

asm volatile ( "in %A0,__SP_L__     \n\t" \
                 "ldi %B0, 0x00   " :"=r" (field) : )
Specify the instructions to obtain the reduced stack pointer.

Note this is not shorter as the code above since we must supply a valid 16 bit number.

Definition at line 249 of file femtoos_port.h.

#define portInitContext ( TaskStart,
StackTop,
RegisterUse,
InterruptStart   )     privInitContext(TaskStart,StackTop,RegisterUse,InterruptStart)

Define portInitContext as privInitContext to make use of the in Femto Os defined privInitContext.

This can then be inlined. You can also define your own portInitContext just remove this define (true -> false), and supply the appropriate method inside port.c

Definition at line 560 of file femtoos_port.h.

Referenced by privTaskInit().

#define portInitCPUStatusRegister   0x00

Specify how the status register must be filled upon first start of the task, but do not include the setting of interrupts here, i.e.

leave them disabled, and do not make use of any predefined interrupt storage locations (see below), they will be cleared. Since the status will usually be of not great importance at startup, the null byte should be adequate.

Definition at line 72 of file femtoos_port.h.

#define portJump ( destination   )     asm volatile ( defJUMP " " #destination :: )

Definition at line 294 of file femtoos_port.h.

Referenced by portYieldISR(), privEnterIdle(), privEnterSleep(), privWaitForFsAccess(), taskDelayFromNow(), taskDelayFromWake(), taskFileClose(), taskFileOpen(), taskRecreate(), taskRestart(), taskSleep(), taskSleepAll(), taskSuspend(), taskTerminate(), taskWaitForEvent(), and taskYield().

 
#define portNop (  )     asm volatile ( "nop" :: )

Specify the no operations instruction of your hardware.

Note that Femto OS does not explicitly calls this function, it is for your own purposes.

Definition at line 114 of file femtoos_port.h.

Referenced by appTickSleep().

 
#define portResqueGlobalInterruptActive (  )     asm volatile ( "seh " :: )

We call this instead of portResqueGlobalInterruptState to store the global interrupt state on places where we are sure the global interrupts where enabled shortly before, but are already disabled now.

The only thing to do it to store that situation, i.e. signal that we come from a place with interrupts activated. For this purpose we can use the auxiliary register bit (save) of sacrifice the status of the H bit (daring). The AuxRegBit is per default zero.

Definition at line 190 of file femtoos_port.h.

Referenced by privTickYield().

 
#define portResqueGlobalInterruptState (  ) 

Value:

asm volatile ( "clh           \n\t"      /* Clear H bit  */   \
                   "brid 67f      \n\t"                           \
                   "cli           \n\t"      /* Clean I bit  */   \
                   "seh           \n\t"      /* Set H bit    */   \
                   "67:         " ::                              \
                   [_Hb_]       "i" (preBitSet1(0x00,SREG_H)) )
This call is used as preamble for all context switching functions to store the state of the global interrupt as soon as possible.

Subsequently the global interrupts are disabled. If we make use of an AuxReg we copy the original of I value to the ARB of the AuxReg, otherwise we copy it to the H bit. We may assume the ARB bit being zero upon entry (it is cleared in the restore context).

Definition at line 163 of file femtoos_port.h.

Referenced by privWaitForFsAccess(), taskDelayFromNow(), taskDelayFromWake(), taskFileClose(), taskFileOpen(), taskRecreate(), taskRestart(), taskSleep(), taskSleepAll(), taskSuspend(), taskTerminate(), taskWaitForEvent(), and taskYield().

#define portSetFullStack ( field   ) 

Value:

asm volatile ( "out __SP_L__, %A0     \n\t" \
                 "out __SP_H__, %B0 " : : "r" (field) : "memory" )
Specify the instructions to initialize the stack pointer.

If you have a SP_H field, you must use it here, otherwise this routine may equal portSetReducedStack.

Definition at line 259 of file femtoos_port.h.

#define portSetReducedStack ( field   )     asm volatile ( "out __SP_L__, %A0 " : : "r" (field) : "memory")

Specify the instructions to set the low byte of the stack pointer.

Setting the high byte is not needed since we know it will be zero.

Definition at line 268 of file femtoos_port.h.

#define portSwapNibbles ( field   )     asm volatile("swap %0" : "=r" (field) : "0" (field));

Specify the instructions to swap to nibbles in a byte.

Some architectures have special instructions for this purpose. Otherwise use: (field = (((field >> 4) & 0x0F) | ((field << 4) & 0xF0)))

Definition at line 277 of file femtoos_port.h.


Function Documentation

void devSigTimerCompare ( void   ) 

Interrupt routine called when the tick interrupt takes place.

Implement a jump to privTickYield

Referenced by portIdle().

Here is the caller graph for this function:

void devSigTimerOverflow ( void   ) 

Interrupt routine called when the subtick timer overflows.

This is an error situation. Implement a jump to privSubtickOverflow

void portBeginISR ( void   ) 

Specify a function that switches the stack from os/task to isr.

For implementation details see inside port.c. This method is called by isrBegin() to start executing your interrupt service without any special arrangements. Note this function should never inline due to stack manipulation operations.

Tbool portCheckTimer ( void   ) 

Specify a function that returns true if the timer interrupt is due but has not yet been executed, and false otherwise.

If is, the method must also clear the flag so that this interrupt is not executed any more. Femto OS only calls this method with tick interrupts disabled.

Definition at line 564 of file femtoos_port.c.

References preBitIsSet, preBitSet1, and Tbool.

void portDisableTickInterrupts ( void   ) 

Define code to switch off the interrupts of the tick counter.

Do not call it directly from application code. This code is called from taskDisableTickInterrupts() and taskEnterTickCritical(). Calls may be nested, but since the bookkeeping is done by the OS, there is no need for any of that. Make sure other bits of the register (containing other timer control bits) are not affected by proper global interrupt protection.

void portEnableTickInterrupts ( void   ) 

Define code to switch on the interrupts of the tick counter.

Do not call it directly from application code. This code is called from taskEnableTickInterrupts() and taskExitTickCritical(). Calls may be nested, but since the bookkeeping is done by the OS, there is no need for any of that. Make sure other bits of the register (containing other timer control bits) are not affected by proper global interrupt protection.

void portEnterGlobalInterrupts ( void   ) 

Specify the functions that the system (femtoos.c) and not your application code (!) must use to enter global critical regions.

This code does not need to be nestable, since the OS does not nest such calls. We explictly forbid inlining since this may lead to funny results when the gcc optimizer is at work. Furthermore, it generates more code too.

void portEnterISR ( void   ) 

Specify a function that switches the stack from task to isr.

For implementation details see inside port.c. This method is called by isrEnter() to start executing your interrupt service routine after a context switch is made. Note this function should never inline due to stack manipulation operations.

Definition at line 1161 of file femtoos_port.c.

References defContextStateIsr, and uiOsStatus.

void portEnterTickInterrupts ( void   ) 

Specify the functions that the system (femtoos.c) and not your application code (!) must use to enter tick critical regions.

This code does not need to be nestable, since the OS does not nest such calls. We explicitly forbid inlining since this may lead to funny results when the gcc optimizer is at work. Furthermore, it generates more code too.

void portExitGlobalInterrupts ( void   ) 

Specify the functions that the system (femtoos.c) and not your application code (!) must use to exit global critical regions.

This code does not need to be nestable, since the OS does not nest such calls. We explicitly forbid inlining since this may lead to funny results when the gcc optimizer is at work. Furthermore, it generates more code too.

void portExitTickInterrupts ( void   ) 

Specify the functions that the system (femtoos.c) and not your application code (!) must use to exit tick critical regions.

This code does not need to be nestable, since the OS does not nest such calls. We explicitly forbid inlining since this may lead to funny results when the gcc optimizer is at work. Furthermore, it generates more code too.

Tbyte portFSReadByte ( Taddress  pAddress  ) 

Return the content of the given location in the file system.

If needed, invert the byte before returning the value.

Definition at line 800 of file femtoos_port.c.

References Tuint08.

Referenced by HandleDump(), privCheckFileSpecsReading(), privCheckFileSpecsWriting(), taskFileAppendByte(), taskFileGetSize(), taskFileReadBuffer(), taskFileReadByte(), taskFileReadPipe(), taskFileWriteBuffer(), and taskFileWritePipe().

Here is the caller graph for this function:

void portFSWriteByte ( Taddress  pAddress,
Tbyte  bValue 
)

Within this call you must save a byte on the file system at the given address.

At a file format the Femto FS writes zero's to all valid file locations. Due to the nature of the eeprom, it may be beneficial to invert the byte so that actually 0xFF is stored instead of 0xFF. If you do so, make sure you invert the byte at reading as well. Femto OS assumes this method is the only one writing bytes to the file system and that no other tasks call this method apart from the one that have been granted write access.

Definition at line 745 of file femtoos_port.c.

References preBitClr1, and preBitSet3.

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

Here is the caller graph for this function:

void portIdle ( void   ) 

The Femto OS has no special idle tasks.

The idle task is simply a place where the processor must stay until the next tick interrupts occurs. Thus every time the OS goes idle this method is called, and the OS does not expect the method to return. You may implement it as an infinite loop, or some (timer interruptible) power save mode.

Referenced by privEnterIdle().

Here is the caller graph for this function:

void portInit ( void   ) 

Specify all code needed to startup your system.

This may include setting the clock frequency, of disabling a watchdog. Do not setup the stack, Femto OS takes care of that.

Referenced by main().

Here is the caller graph for this function:

Tuint08 portReadAndResetTimer ( Tuint08  uiSubTickInterrupt  ) 

Specify a function that returns the number of subticks passed from the subtick timer, and simultaneously resets the timer with a new interrupt time.

Femto OS only calls this method with tick interrupts disabled.

Definition at line 581 of file femtoos_port.c.

References cfgSysSubTicksPerFullTick, preBitSet1, privDisableGlobalInterrupts, privEnableGlobalInterrupts, and Tuint08.

Referenced by privWakeupFromLowPower().

Here is the caller graph for this function:

Tuint08 portReadTimer ( void   ) 

Specify a function that returns the number of subticks passed from the subtick timer.

If there has been an unhandled tick interrupt the value must not be reset. Femto OS only calls this method with tick interrupts disabled.

Definition at line 540 of file femtoos_port.c.

References cfgSysSubTicksPerFullTick, preBitIsSet, and Tuint08.

Referenced by isrStartLoad(), and isrStopLoad().

Here is the caller graph for this function:

void portReboot ( void   ) 

Specify the instructions to reboot your hardware.

This could be a jump to __init or a soft reset. Naturally this function does not return.

Referenced by genReboot().

Here is the caller graph for this function:

void portRestoreContext ( void   ) 

Specify a function that restores all relevant registers and the status register from the stack.

For implementation details see inside port.c. Note this function should never inline due to stack manipulation operations.

void portReturnISR ( void   ) 

Specify a function that switches the stack from isr to os/task.

For implementation details see inside port.c. This method is called by isrEndReturn() to stop executing your interrupt and continue at the point where operations where interupted. Note this function should never inline due to stack manipulation operations.

void portSaveContext ( void   ) 

Specify a function that saves all relevant registers and the status register on the stack, and subsequently performs a stack change from task to os.

For implementation details see inside port.c. Note this function should never inline due to stack manipulation operations.

Referenced by privTickYield(), privWaitForFsAccess(), taskDelayFromNow(), taskDelayFromWake(), taskFileClose(), taskFileOpen(), taskRecreate(), taskRestart(), taskSleep(), taskSleepAll(), taskSuspend(), taskTerminate(), taskWaitForEvent(), and taskYield().

Here is the caller graph for this function:

void portSetupTimerInterrupt ( void   ) 

Specify a function that sets up your hardware so that tick interupts can take place.

The method should not activate the interrupts yet.

Definition at line 502 of file femtoos_port.c.

References cfgSysSubTicksPerFullTick, defTimerPrescaleBits, preBitClr1, preBitSet1, and preEqualMacros.

Referenced by main().

Here is the caller graph for this function:

void portShowError ( Tuint08  uiMessage,
Tuint08  uiCallId,
Tuint08  uiInfoTask 
)

As long as you are developing, it is useful to keep track of errors that occur (in embedded devices we expect no errors during normal operation) Every error encountered is reported through a call to portShowError.

uiMessage contains a 6 bit error message, and uiInfoTask contains (if appropriate) in the first nibble the slot/file or other info and in the last nibble the task number at which the error occurred. You are responsible to get the information off the chip, for example by letting some leds blink. Fatal errors are reported endlessly, non fatal will stop the current task and Femto OS tries to continue operations as far as possible. The system however may crash, hold or reset.

Definition at line 121 of file femtoos_port.c.

References portShortDelay(), and Tuint08.

Here is the call graph for this function:

void portShowReset ( void   ) 

The startup code of the Femto OS contains a special call to show a reset took place, this is portShowReset().

Implement it so you can see a reset took place, for example by blinking some leds. This helps you in finding problems with your software since malicious code often gets into a reset loop.

Definition at line 198 of file femtoos_port.c.

References portShortDelay(), and Tuint08.

Here is the call graph for this function:

void portSleep ( Tuint08  uiTickBlockMinDelay  ) 

Besides the possibility to put the device in a power save mode during idle, the OS supports a low power sleep mode which can be entered for a longer period.

You are responsible for waking the device up, since this may be very device dependent. The uiTickBlockMinDelay specifies the number of tick blocks (1 tick block == 256 ticks) that can safely be slept without disturbing regular functions (maximum sleep time). This means that, if the low power sleep stays within that period, no delay task shall wakeup and all other tasks are in sleep mode, provided that cfgUseLowPowerOnDelay == cfgTrue. Otherwise, a sleep mode only comes when all tasks are indeed sleeping, and uiTickBlockMinDelay will be set to 0xFF (i.e. there is no minimum). Femto OS wakes all tasks if you exceeded the maximum sleep time if you set cfgUseLowPowerDelayRelease, otherwise, make sure you do not exceed the maximum sleep time. Please note that you remain responsible to adjust the tick timer yourself using genAddtoTickCount(). If you don't, Femto OS will not notice time has past and may try to go to sleep immediately. If you manually put tasks to sleep this may exactly be what you want however. The function must return.

Definition at line 249 of file femtoos_port.c.

References appTickSleep(), defCALL, defSleepDivider, defSleepInfinite, genAddtoTickCount(), preBitClr1, preBitClr2, preBitClr4, preBitIsSet, preBitSet1, preBitSet2, preBitSet4, Tuint08, and Tuint16.

Referenced by privEnterSleep().

Here is the call graph for this function:

Here is the caller graph for this function:

void portTrace ( Tuint08  uiEvent  ) 

The femto OS is capable of tracing its own and your functions.

All actions the OS takes are preceded (as early in the code as possible) with a portTrace(byte) call, where byte contains information of the trace point. Specify your code to get the uiEvent off the chip. This must be done as quickly as possible, for you must not uphold the device.

Definition at line 83 of file femtoos_port.c.

References preBitClr1, preBitIsClr, preBitIsSet, preBitSet1, and Tuint08.

void portYieldISR ( void   ) 

Specify a function that switches the stack from isr to os/task.

For implementation details see inside port.c. This method is called by isrEndReturn() to stop executing your interrupt and immediately performs a context switch. Note this function should never inline due to stack manipulation operations.


Variable Documentation

void externally_visible

Definition at line 665 of file femtoos_port.h.

void externally_visible

Definition at line 658 of file femtoos_port.h.

void naked

Definition at line 665 of file femtoos_port.h.

void naked

Definition at line 658 of file femtoos_port.h.

void naked

Definition at line 509 of file femtoos_port.h.

void noinline

Definition at line 619 of file femtoos_port.h.

void noinline

Definition at line 611 of file femtoos_port.h.

void noinline

Definition at line 602 of file femtoos_port.h.

void noinline

Definition at line 593 of file femtoos_port.h.

void noinline

Definition at line 584 of file femtoos_port.h.

void noinline

Definition at line 575 of file femtoos_port.h.

void noinline

Definition at line 479 of file femtoos_port.h.

void noinline

Definition at line 468 of file femtoos_port.h.

void noinline

Definition at line 458 of file femtoos_port.h.

void noinline

Definition at line 448 of file femtoos_port.h.

void noinline

Definition at line 438 of file femtoos_port.h.

void noinline

Definition at line 428 of file femtoos_port.h.

void noreturn

Definition at line 199 of file femtoos_port.h.

void used

Definition at line 665 of file femtoos_port.h.

void used

Definition at line 658 of file femtoos_port.h.

void used

Definition at line 619 of file femtoos_port.h.

void used

Definition at line 611 of file femtoos_port.h.

void used

Definition at line 602 of file femtoos_port.h.

void used

Definition at line 593 of file femtoos_port.h.

void used

Definition at line 584 of file femtoos_port.h.

void used

Definition at line 575 of file femtoos_port.h.


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