OpenWSN Firmware
Schedule

Manages the IEEE802.15.4e schedule. More...

Data Structures

struct  scheduleEntry_t
 
struct  debugScheduleEntry_t
 
struct  slotinfo_element_t
 
struct  schedule_vars_t
 

Macros

#define SUPERFRAME_LENGTH   11
 The length of the superframe, in slots. More...
 
#define NUMADVSLOTS   1
 
#define NUMSHAREDTXRX   5
 
#define NUMSERIALRX   3
 
#define MAXACTIVESLOTS   (NUMADVSLOTS+NUMSHAREDTXRX+NUMSERIALRX)
 Maximum number of active slots in a superframe. More...
 
#define MINBE   2
 Minimum backoff exponent. More...
 
#define MAXBE   4
 Maximum backoff exponent. More...
 
#define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS   5
 
#define SCHEDULE_MINIMAL_6TISCH_EB_CELLS   1
 
#define SCHEDULE_MINIMAL_6TISCH_SLOTFRAME_SIZE   101
 
#define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE   1
 
#define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_NUMBER   1
 

Typedefs

typedef uint8_t channelOffset_t
 
typedef uint16_t slotOffset_t
 
typedef uint16_t frameLength_t
 

Enumerations

enum  cellType_t {
  CELLTYPE_OFF = 0, CELLTYPE_ADV = 1, CELLTYPE_TX = 2, CELLTYPE_RX = 3,
  CELLTYPE_TXRX = 4, CELLTYPE_SERIALRX = 5, CELLTYPE_MORESERIALRX = 6
}
 

Functions

void schedule_init (void)
 Initialize this module. More...
 
bool debugPrint_schedule (void)
 Trigger this module to print status information, over serial. More...
 
bool debugPrint_backoff (void)
 Trigger this module to print status information, over serial. More...
 
void schedule_setFrameLength (frameLength_t newFrameLength)
 Set frame length. More...
 
owerror_t schedule_addActiveSlot (slotOffset_t slotOffset, cellType_t type, bool shared, uint8_t channelOffset, open_addr_t *neighbor)
 Add a new active slot into the schedule. More...
 
void schedule_getSlotInfo (slotOffset_t slotOffset, open_addr_t *neighbor, slotinfo_element_t *info)
 Get the information of a specific slot. More...
 
owerror_t schedule_removeActiveSlot (slotOffset_t slotOffset, open_addr_t *neighbor)
 Remove an active slot from the schedule. More...
 
bool schedule_isSlotOffsetAvailable (uint16_t slotOffset)
 
void schedule_syncSlotOffset (slotOffset_t targetSlotOffset)
 
void schedule_advanceSlot (void)
 advance to next active slot More...
 
slotOffset_t schedule_getNextActiveSlotOffset (void)
 return slotOffset of next active slot More...
 
frameLength_t schedule_getFrameLength (void)
 Get the frame length. More...
 
cellType_t schedule_getType (void)
 Get the type of the current schedule entry. More...
 
void schedule_getNeighbor (open_addr_t *addrToWrite)
 Get the neighbor associated wit the current schedule entry. More...
 
channelOffset_t schedule_getChannelOffset (void)
 Get the channel offset of the current schedule entry. More...
 
bool schedule_getOkToSend (void)
 Check whether I can send on this slot. More...
 
void schedule_resetBackoff (void)
 Reset the backoff and backoffExponent. More...
 
void schedule_indicateRx (asn_t *asnTimestamp)
 Indicate the reception of a packet. More...
 
void schedule_indicateTx (asn_t *asnTimestamp, bool succesfullTx)
 Indicate the transmission of a packet. More...
 

Detailed Description

Manages the IEEE802.15.4e schedule.

Author
Thomas Watteyne watte.nosp@m.yne@.nosp@m.eecs..nosp@m.berk.nosp@m.eley..nosp@m.edu, August 2011

Macro Definition Documentation

#define MAXACTIVESLOTS   (NUMADVSLOTS+NUMSHAREDTXRX+NUMSERIALRX)

Maximum number of active slots in a superframe.

Note that this is merely used to allocate RAM memory for the schedule. The schedule is represented, in RAM, by a table. There is one row per active slot in that table; a slot is "active" when it is not of type CELLTYPE_OFF.

Set this number to the exact number of active slots you are planning on having in your schedule, so not to waste RAM.

#define MAXBE   4

Maximum backoff exponent.

See MINBE for an explanation of backoff.

#define MINBE   2

Minimum backoff exponent.

Backoff is used only in slots that are marked as shared in the schedule. When not shared, the mote assumes that schedule is collision-free, and therefore does not use any backoff mechanism when a transmission fails.

#define NUMADVSLOTS   1
#define NUMSERIALRX   3
#define NUMSHAREDTXRX   5
#define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS   5
#define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE   1
#define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_NUMBER   1
#define SCHEDULE_MINIMAL_6TISCH_EB_CELLS   1
#define SCHEDULE_MINIMAL_6TISCH_SLOTFRAME_SIZE   101
#define SUPERFRAME_LENGTH   11

The length of the superframe, in slots.

The superframe repears over time and can be arbitrarly long.

Typedef Documentation

typedef uint8_t channelOffset_t
typedef uint16_t frameLength_t
typedef uint16_t slotOffset_t

Enumeration Type Documentation

enum cellType_t
Enumerator
CELLTYPE_OFF 
CELLTYPE_ADV 
CELLTYPE_TX 
CELLTYPE_RX 
CELLTYPE_TXRX 
CELLTYPE_SERIALRX 
CELLTYPE_MORESERIALRX 

Function Documentation

bool debugPrint_backoff ( void  )

Trigger this module to print status information, over serial.

debugPrint_* functions are used by the openserial module to continuously print status information about several modules in the OpenWSN stack.

Returns
TRUE if this function printed something, FALSE otherwise.
bool debugPrint_schedule ( void  )

Trigger this module to print status information, over serial.

debugPrint_* functions are used by the openserial module to continuously print status information about several modules in the OpenWSN stack.

Returns
TRUE if this function printed something, FALSE otherwise.
owerror_t schedule_addActiveSlot ( slotOffset_t  slotOffset,
cellType_t  type,
bool  shared,
channelOffset_t  channelOffset,
open_addr_t neighbor 
)

Add a new active slot into the schedule.

Parameters
slotOffsetThe slotoffset of the new slot
typeThe type of the cell
sharedWhether this cell is shared (TRUE) or not (FALSE).
channelOffsetThe channelOffset of the new slot
neighborThe neighbor associated with this cell (all 0's if none)
void schedule_advanceSlot ( void  )

advance to next active slot

channelOffset_t schedule_getChannelOffset ( void  )

Get the channel offset of the current schedule entry.

Returns
The channel offset of the current schedule entry.
frameLength_t schedule_getFrameLength ( void  )

Get the frame length.

Returns
The frame length.
void schedule_getNeighbor ( open_addr_t addrToWrite)

Get the neighbor associated wit the current schedule entry.

Returns
The neighbor associated wit the current schedule entry.
slotOffset_t schedule_getNextActiveSlotOffset ( void  )

return slotOffset of next active slot

bool schedule_getOkToSend ( void  )

Check whether I can send on this slot.

This function is called at the beginning of every TX slot. If the slot is not a shared slot, it always return TRUE. If the slot is a shared slot, it decrements the backoff counter and returns TRUE only if it hits 0.

Note that the backoff counter is global, not per slot.

Returns
TRUE if it is OK to send on this slot, FALSE otherwise.
void schedule_getSlotInfo ( slotOffset_t  slotOffset,
open_addr_t neighbor,
slotinfo_element_t info 
)

Get the information of a specific slot.

Parameters
slotOffset
neighbor
info
cellType_t schedule_getType ( void  )

Get the type of the current schedule entry.

Returns
The type of the current schedule entry.
void schedule_indicateRx ( asn_t asnTimestamp)

Indicate the reception of a packet.

void schedule_indicateTx ( asn_t asnTimestamp,
bool  succesfullTx 
)

Indicate the transmission of a packet.

void schedule_init ( void  )

Initialize this module.

Postcondition
Call this function before calling any other function in this module.
bool schedule_isSlotOffsetAvailable ( uint16_t  slotOffset)
owerror_t schedule_removeActiveSlot ( slotOffset_t  slotOffset,
open_addr_t neighbor 
)

Remove an active slot from the schedule.

Parameters
slotOffsetThe slotoffset of the slot to remove.
neighborThe neighbor associated with this cell (all 0's if none)
void schedule_resetBackoff ( void  )

Reset the backoff and backoffExponent.

void schedule_setFrameLength ( frameLength_t  newFrameLength)

Set frame length.

Parameters
newFrameLengthThe new frame length.
void schedule_syncSlotOffset ( slotOffset_t  targetSlotOffset)