femtoos_source/femtoos_port.c File Reference

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

Include dependency graph for femtoos_port.c:

Go to the source code of this file.

Defines

#define LoadTIMSK(rx)   "in " #rx ", %[_TIMSKio_] \n\t"
#define StoreTIMSK(rx)   "out %[_TIMSKio_], " #rx " \n\t"
#define CheckRegisterR1   "cpse r1,r30 \n\t"
#define ClearRegisterR1   "clr r1 \n\t"
#define FillRegisterR1   ""
#define ReturnState(arg)   ""
#define ReturnField   0
#define SaveOsStatus(stat, save, key)
#define RestoreOsStatus(stat, save)
#define SaveGroup7b
#define SaveGroup7a
#define SaveGroup6
#define SaveGroup5
#define SaveGroup4
#define SaveGroup3
#define SaveGroup2
#define SaveGroup1
#define SaveGroup0
#define TestSaveGroup7
#define TestSaveGroup6
#define TestSaveGroup5
#define TestSaveGroup4
#define TestSaveGroup3
#define TestSaveGroup2
#define TestSaveGroup1
#define TestSaveGroup0
#define CheckGroup7
#define CheckGroup6
#define CheckGroup5
#define CheckGroup4
#define CheckGroup3
#define CheckGroup2
#define CheckGroup1
#define CheckGroup0
#define RestoreGroup7
#define RestoreGroup6
#define RestoreGroup5
#define RestoreGroup4
#define RestoreGroup3
#define RestoreGroup2
#define RestoreGroup1
#define RestoreGroup0
#define TestRestoreGroup7
#define TestRestoreGroup6
#define TestRestoreGroup5
#define TestRestoreGroup4
#define TestRestoreGroup3
#define TestRestoreGroup2
#define TestRestoreGroup1
#define TestRestoreGroup0
#define SkipFillGroup0   "rjmp 10f \n\t"
#define TestFillGroup0
#define SkipRestoreGroup0   "rjmp 10f \n\t"
#define FillGroup7
#define FillGroup6
#define FillGroup5
#define FillGroup4
#define FillGroup3
#define FillGroup2
#define FillGroup1
#define FillGroup0

Functions

static void portShortDelay (Tuint08 uiLoops)
 For reporting errors it may be handy to have a function that delays the message for some time.
void portTrace (Tuint08 uiEvent)
 The femto OS is capable of tracing its own and your functions.
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 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 portReboot (void)
void portIdle (void)
Taddress portInitContext (Taddress pTaskStart, Taddress pStackTop, Tuint08 uiRegisterCount, Tuint08 uiInterruptStart)
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 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)
void portExitGlobalInterrupts (void)
void portEnterTickInterrupts (void)
void portExitTickInterrupts (void)
void portDisableTickInterrupts (void)
void portEnableTickInterrupts (void)
void portEnterISR (void)
void portBeginISR (void)
void portReturnISR (void)
void portYieldISR (void)
void portSaveContext (void)
void portRestoreContext (void)


Define Documentation

#define CheckGroup0

Value:

CheckRegisterR1 \
   "sbr  r30,0x01        \n\t" \
   "cpse r0,r29          \n\t" \
   "sbr  r30,0x01        \n\t" \
   "cpse r2,r29          \n\t" \
   "sbr  r30,0x01        \n\t" \
   "cpse r3,r29          \n\t" \
   "sbr  r30,0x01        \n\t"

Definition at line 1587 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckGroup1

Value:

"cpse r4,r29          \n\t" \
   "sbr  r30,0x02        \n\t" \
   "cpse r5,r29          \n\t" \
   "sbr  r30,0x02        \n\t" \
   "cpse r6,r29          \n\t" \
   "sbr  r30,0x02        \n\t" \
   "cpse r7,r29          \n\t" \
   "sbr  r30,0x02        \n\t"

Definition at line 1572 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckGroup2

Value:

"cpse r8,r29          \n\t" \
   "sbr  r30,0x04        \n\t" \
   "cpse r9,r29          \n\t" \
   "sbr  r30,0x04        \n\t" \
   "cpse r10,r29         \n\t" \
   "sbr  r30,0x04        \n\t" \
   "cpse r11,r29         \n\t" \
   "sbr  r30,0x04        \n\t"

Definition at line 1557 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckGroup3

Value:

"cpse r12,r29         \n\t" \
   "sbr  r30,0x08        \n\t" \
   "cpse r13,r29         \n\t" \
   "sbr  r30,0x08        \n\t" \
   "cpse r14,r29         \n\t" \
   "sbr  r30,0x08        \n\t" \
   "cpse r15,r29         \n\t" \
   "sbr  r30,0x08        \n\t"

Definition at line 1542 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckGroup4

Value:

"cpse r16,r29         \n\t" \
   "sbr  r30,0x10        \n\t" \
   "cpse r17,r29         \n\t" \
   "sbr  r30,0x10        \n\t" \
   "cpse r18,r29         \n\t" \
   "sbr  r30,0x10        \n\t" \
   "cpse r19,r29         \n\t" \
   "sbr  r30,0x10        \n\t"

Definition at line 1527 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckGroup5

Value:

"cpse r20,r29         \n\t" \
   "sbr  r30,0x20        \n\t" \
   "cpse r21,r29         \n\t" \
   "sbr  r30,0x20        \n\t" \
   "cpse r22,r29         \n\t" \
   "sbr  r30,0x20        \n\t" \
   "cpse r23,r29         \n\t" \
   "sbr  r30,0x20        \n\t"

Definition at line 1512 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckGroup6

Value:

"cpse r24,r29         \n\t" \
   "sbr  r30,0x40        \n\t" \
   "cpse r25,r29         \n\t" \
   "sbr  r30,0x40        \n\t" \
   "cpse r26,r29         \n\t" \
   "sbr  r30,0x40        \n\t" \
   "cpse r27,r29         \n\t" \
   "sbr  r30,0x40        \n\t"

Definition at line 1497 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckGroup7

Value:

"lds  r28,%[_r28_]    \n\t" \
   "cpse r28,r29         \n\t" \
   "sbr  r30,0x80        \n\t" \
   "lds  r28,%[_r29_]    \n\t" \
   "cpse r28,r29         \n\t" \
   "sbr  r30,0x80        \n\t" \
   "lds  r28,%[_r30_]    \n\t" \
   "cpse r28,r29         \n\t" \
   "sbr  r30,0x80        \n\t" \
   "lds  r28,%[_r31_]    \n\t" \
   "cpse r28,r29         \n\t" \
   "sbr  r30,0x80        \n\t"

Definition at line 1478 of file femtoos_port.c.

Referenced by portSaveContext().

#define CheckRegisterR1   "cpse r1,r30 \n\t"

Definition at line 1069 of file femtoos_port.c.

#define ClearRegisterR1   "clr r1 \n\t"

Definition at line 1070 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup0

Value:

"mov  r3,r2           \n\t" \
    FillRegisterR1             \
   "mov  r0,r2           \n\t"

Definition at line 2170 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup1

Value:

"mov  r7,r2           \n\t" \
   "mov  r6,r2           \n\t" \
   "mov  r5,r2           \n\t" \
   "mov  r4,r2           \n\t"

Definition at line 2159 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup2

Value:

"mov  r11,r2          \n\t" \
   "mov  r10,r2          \n\t" \
   "mov  r9,r2           \n\t" \
   "mov  r8,r2           \n\t"

Definition at line 2148 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup3

Value:

"mov  r15,r2          \n\t" \
   "mov  r14,r2          \n\t" \
   "mov  r13,r2          \n\t" \
   "mov  r12,r2          \n\t"

Definition at line 2137 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup4

Value:

"mov  r19,r2          \n\t" \
   "mov  r18,r2          \n\t" \
   "mov  r17,r2          \n\t" \
   "mov  r16,r2          \n\t"

Definition at line 2126 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup5

Value:

"mov  r23,r2          \n\t" \
   "mov  r22,r2          \n\t" \
   "mov  r21,r2          \n\t" \
   "mov  r20,r2          \n\t"

Definition at line 2115 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup6

Value:

"mov  r27,r2          \n\t" \
   "mov  r26,r2          \n\t" \
   "mov  r25,r2          \n\t" \
   "mov  r24,r2          \n\t"

Definition at line 2104 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillGroup7

Value:

"mov  r30,r2          \n\t" \
   "mov  r29,r2          \n\t" \
   "mov  r28,r2          \n\t"

Definition at line 2094 of file femtoos_port.c.

Referenced by portRestoreContext().

#define FillRegisterR1   ""

Definition at line 1071 of file femtoos_port.c.

#define LoadTIMSK ( rx   )     "in " #rx ", %[_TIMSKio_] \n\t"

Definition at line 677 of file femtoos_port.c.

Referenced by portDisableTickInterrupts(), portEnableTickInterrupts(), portEnterTickInterrupts(), portExitTickInterrupts(), portRestoreContext(), and portSaveContext().

#define RestoreGroup0

Value:

"pop  r3              \n\t" \
   "pop  r2              \n\t" \
   "pop  r1              \n\t" \
   "pop  r0              \n\t"

Definition at line 1996 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreGroup1

Value:

"pop  r7              \n\t" \
   "pop  r6              \n\t" \
   "pop  r5              \n\t" \
   "pop  r4              \n\t"

Definition at line 1985 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreGroup2

Value:

"pop  r11             \n\t" \
   "pop  r10             \n\t" \
   "pop  r9              \n\t" \
   "pop  r8              \n\t"

Definition at line 1974 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreGroup3

Value:

"pop  r15             \n\t" \
   "pop  r14             \n\t" \
   "pop  r13             \n\t" \
   "pop  r12             \n\t"

Definition at line 1963 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreGroup4

Value:

"pop  r19             \n\t" \
   "pop  r18             \n\t" \
   "pop  r17             \n\t" \
   "pop  r16             \n\t"

Definition at line 1952 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreGroup5

Value:

"pop  r23             \n\t" \
   "pop  r22             \n\t" \
   "pop  r21             \n\t" \
   "pop  r20             \n\t"

Definition at line 1941 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreGroup6

Value:

"pop  r27             \n\t" \
   "pop  r26             \n\t" \
   "pop  r25             \n\t" \
   "pop  r24             \n\t"

Definition at line 1930 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreGroup7

Value:

"pop  r31             \n\t" \
   "pop  r30             \n\t" \
   "pop  r29             \n\t" \
   "pop  r28             \n\t"

Definition at line 1919 of file femtoos_port.c.

Referenced by portRestoreContext().

#define RestoreOsStatus ( stat,
save   ) 

Value:

"lds  r31," #save "   \n\t" /* Recall the original value of the uiOSstatus                                                    */\
   "sts  " #stat ", r31  \n\t"

Definition at line 1111 of file femtoos_port.c.

Referenced by portReturnISR(), and portYieldISR().

#define ReturnField   0

Definition at line 1090 of file femtoos_port.c.

Referenced by portRestoreContext().

#define ReturnState ( arg   )     ""

Definition at line 1089 of file femtoos_port.c.

Referenced by portRestoreContext().

#define SaveGroup0

Value:

"push r0              \n\t" \
   "push r1              \n\t" \
   "push r2              \n\t" \
   "push r3              \n\t"

Definition at line 1393 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup1

Value:

"push r4              \n\t" \
   "push r5              \n\t" \
   "push r6              \n\t" \
   "push r7              \n\t"

Definition at line 1382 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup2

Value:

"push r8              \n\t" \
   "push r9              \n\t" \
   "push r10             \n\t" \
   "push r11             \n\t"

Definition at line 1371 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup3

Value:

"push r12             \n\t" \
   "push r13             \n\t" \
   "push r14             \n\t" \
   "push r15             \n\t"

Definition at line 1360 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup4

Value:

"push r16             \n\t" \
   "push r17             \n\t" \
   "push r18             \n\t" \
   "push r19             \n\t"

Definition at line 1349 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup5

Value:

"push r20             \n\t" \
   "push r21             \n\t" \
   "push r22             \n\t" \
   "push r23             \n\t"

Definition at line 1338 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup6

Value:

"push r24             \n\t" \
   "push r25             \n\t" \
   "push r26             \n\t" \
   "push r27             \n\t"

Definition at line 1327 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup7a

Value:

"lds  r31,%[_r31_]    \n\t" \
   "push r28             \n\t" \
   "push r29             \n\t" \
   "push r30             \n\t" \
   "push r31             \n\t"

Definition at line 1314 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveGroup7b

Value:

"lds  r28,%[_r28_]    \n\t" /* Load original value of register r28     */ \
   "push r28             \n\t" /* Push it on the right place on the stack */ \
   "lds  r28,%[_r29_]    \n\t" /* Load original value of register r29     */ \
   "push r28             \n\t" /* Push it on the right place on the stack */ \
   "lds  r28,%[_r30_]    \n\t" /* Load original value of register r30     */ \
   "push r28             \n\t" /* Push it on the right place on the stack */ \
   "lds  r28,%[_r31_]    \n\t" /* Load original value of register r31     */ \
   "push r28             \n\t"

Definition at line 1303 of file femtoos_port.c.

Referenced by portSaveContext().

#define SaveOsStatus ( stat,
save,
key   ) 

Value:

"lds  r31," #stat "   \n\t" /* Load the uiOSstatus                                                                            */\
   "sts  " #save ", r31  \n\t" /* Save that value in r31 background variable.                                                    */\
   "ldi  r31," #key "    \n\t" /* Load the defContextStateIsr key                                                                */\
   "sts  " #stat ", r31  \n\t"

Definition at line 1105 of file femtoos_port.c.

Referenced by portBeginISR().

#define SkipFillGroup0   "rjmp 10f \n\t"

Definition at line 2073 of file femtoos_port.c.

#define SkipRestoreGroup0   "rjmp 10f \n\t"

Definition at line 2085 of file femtoos_port.c.

Referenced by portRestoreContext().

#define StoreTIMSK ( rx   )     "out %[_TIMSKio_], " #rx " \n\t"

Definition at line 678 of file femtoos_port.c.

Referenced by portDisableTickInterrupts(), portEnableTickInterrupts(), portEnterTickInterrupts(), portExitTickInterrupts(), portRestoreContext(), and portSaveContext().

#define TestFillGroup0

Value:

"sbrc r0, 0           \n\t" \
   "rjmp 0f              \n\t"

Definition at line 2082 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup0

Value:

"sbrs r0, 0           \n\t" \
   "rjmp 0f              \n\t"

Definition at line 2070 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup1

Value:

"sbrs r0, 1           \n\t" \
   "rjmp 1f              \n\t"

Definition at line 2061 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup2

Value:

"sbrs r0, 2           \n\t" \
   "rjmp 2f              \n\t"

Definition at line 2052 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup3

Value:

"sbrs r0, 3           \n\t" \
   "rjmp 3f              \n\t"

Definition at line 2043 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup4

Value:

"sbrs r0, 4           \n\t" \
   "rjmp 4f              \n\t"

Definition at line 2034 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup5

Value:

"sbrs r0, 5           \n\t" \
   "rjmp 5f              \n\t"

Definition at line 2025 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup6

Value:

"sbrs r0, 6           \n\t" \
   "rjmp 6f              \n\t"

Definition at line 2016 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestRestoreGroup7

Value:

"sbrs r0, 7           \n\t" \
   "rjmp 7f              \n\t"

Definition at line 2007 of file femtoos_port.c.

Referenced by portRestoreContext().

#define TestSaveGroup0

Value:

"sbrs r31, 0          \n\t" \
   "rjmp 0f              \n\t"

Definition at line 1468 of file femtoos_port.c.

Referenced by portSaveContext().

#define TestSaveGroup1

Value:

"sbrs r31, 1          \n\t" \
   "rjmp 1f              \n\t"

Definition at line 1459 of file femtoos_port.c.

Referenced by portSaveContext().

#define TestSaveGroup2

Value:

"sbrs r31, 2          \n\t" \
   "rjmp 2f              \n\t"

Definition at line 1450 of file femtoos_port.c.

Referenced by portSaveContext().

#define TestSaveGroup3

Value:

"sbrs r31, 3          \n\t" \
   "rjmp 3f              \n\t"

Definition at line 1441 of file femtoos_port.c.

Referenced by portSaveContext().

#define TestSaveGroup4

Value:

"sbrs r31, 4          \n\t" \
   "rjmp 4f              \n\t"

Definition at line 1432 of file femtoos_port.c.

Referenced by portSaveContext().

#define TestSaveGroup5

Value:

"sbrs r31, 5          \n\t" \
   "rjmp 5f              \n\t"

Definition at line 1423 of file femtoos_port.c.

Referenced by portSaveContext().

#define TestSaveGroup6

Value:

"sbrs r31, 6          \n\t" \
   "rjmp 6f              \n\t"

Definition at line 1414 of file femtoos_port.c.

Referenced by portSaveContext().

#define TestSaveGroup7

Value:

"sbrs r31, 7          \n\t" \
   "rjmp 7f              \n\t"

Definition at line 1405 of file femtoos_port.c.

Referenced by portSaveContext().


Function Documentation

void portBeginISR ( void   ) 

Definition at line 1182 of file femtoos_port.c.

References defContextStateIsr, ISRstackFirstByte, ISRstackLastByte, ISRstackSecondByte, ISRstackSPH, ISRstackSPL, ISRstackStart, ISRstackThirdByte, TosData::pxSave, TtaskSave::r31, SaveOsStatus, StackISR, uiOsStatus, and xOS.

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   ) 

Definition at line 1023 of file femtoos_port.c.

References LoadTIMSK, preBitClr1, and StoreTIMSK.

void portEnableTickInterrupts ( void   ) 

Definition at line 1046 of file femtoos_port.c.

References LoadTIMSK, preBitSet1, and StoreTIMSK.

void portEnterGlobalInterrupts ( void   ) 

Definition at line 872 of file femtoos_port.c.

void portEnterISR ( void   ) 

Definition at line 1122 of file femtoos_port.c.

References defContextStateIsr, ISRstackFirstByte, ISRstackSecondByte, ISRstackStart, ISRstackThirdByte, StackISR, and uiOsStatus.

void portEnterTickInterrupts ( void   ) 

Definition at line 954 of file femtoos_port.c.

References LoadTIMSK, preBitClr1, and StoreTIMSK.

void portExitGlobalInterrupts ( void   ) 

Definition at line 907 of file femtoos_port.c.

void portExitTickInterrupts ( void   ) 

Definition at line 987 of file femtoos_port.c.

References LoadTIMSK, preBitSet1, and StoreTIMSK.

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 689 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   ) 

Definition at line 388 of file femtoos_port.c.

References devSigTimerCompare(), preBitClr3, and preBitSet1.

Here is the call graph for this function:

Taddress portInitContext ( Taddress  pTaskStart,
Taddress  pStackTop,
Tuint08  uiRegisterCount,
Tuint08  uiInterruptStart 
)

Definition at line 416 of file femtoos_port.c.

References cfgGlobSet, cfgTickSet, defInitCPUStatusRegister, defInitialInterruptAbsent, defInitialInterruptGetMask, Tuint08, and Tuint16.

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   ) 

Definition at line 368 of file femtoos_port.c.

References preBitClr5, preBitSet1, and preBitSet2.

void portRestoreContext ( void   ) 

Definition at line 2179 of file femtoos_port.c.

References cfgSysRegisterCheckByte, ClearRegisterR1, defCheckStackBit, defRet0, defRet1, FillGroup0, FillGroup1, FillGroup2, FillGroup3, FillGroup4, FillGroup5, FillGroup6, FillGroup7, LoadTIMSK, preBitClr1, preBitClr2, preBitSet1, TosData::pxSave, RestoreGroup0, RestoreGroup1, RestoreGroup2, RestoreGroup3, RestoreGroup4, RestoreGroup5, RestoreGroup6, RestoreGroup7, ReturnField, ReturnState, SkipRestoreGroup0, StoreTIMSK, TestFillGroup0, TestRestoreGroup0, TestRestoreGroup1, TestRestoreGroup2, TestRestoreGroup3, TestRestoreGroup4, TestRestoreGroup5, TestRestoreGroup6, TestRestoreGroup7, TtaskSave::uiRegisterUse, and xOS.

void portReturnISR ( void   ) 

Definition at line 1229 of file femtoos_port.c.

References ISRstackLastByte, ISRstackSPH, ISRstackSPL, TosData::pxSave, TtaskSave::r31, RestoreOsStatus, StackISR, uiOsStatus, and xOS.

void portSaveContext ( void   ) 

Definition at line 1601 of file femtoos_port.c.

References cfgSysRegisterCheckByte, CheckGroup0, CheckGroup1, CheckGroup2, CheckGroup3, CheckGroup4, CheckGroup5, CheckGroup6, CheckGroup7, defCheckStackBit, defContextStateSaveBit, LoadTIMSK, OSstackFirstByte, OSstackSecondByte, OSstackStart, OSstackThirdByte, TtaskSave::pcStackLevel, TtaskSave::pcStackOffset, preBitClr1, preBitSet1, TosData::pxSave, TtaskSave::r30, TtaskSave::r31, SaveGroup0, SaveGroup1, SaveGroup2, SaveGroup3, SaveGroup4, SaveGroup5, SaveGroup6, SaveGroup7a, SaveGroup7b, TosData::StackOS, StoreTIMSK, TestSaveGroup0, TestSaveGroup1, TestSaveGroup2, TestSaveGroup3, TestSaveGroup4, TestSaveGroup5, TestSaveGroup6, TestSaveGroup7, uiOsStatus, TtaskSave::uiRegisterUse, and xOS.

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:

static void portShortDelay ( Tuint08  uiLoops  )  [static]

For reporting errors it may be handy to have a function that delays the message for some time.

Implement it in this function.

Definition at line 159 of file femtoos_port.c.

References preBitClr1, preBitClr2, preBitIsClr, preBitSet1, and preEqualMacros.

Referenced by portShowError(), and portShowReset().

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 221 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   ) 

Definition at line 1257 of file femtoos_port.c.

References ISRstackLastByte, ISRstackSPH, ISRstackSPL, portJump, TosData::pxSave, TtaskSave::r31, RestoreOsStatus, StackISR, taskYield(), uiOsStatus, and xOS.

Here is the call graph for this function:


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