Stack Integration
Stack Integration
The reference implementation of IEEE802.15.4e provided here is part of the OpenWSN stack implementation. Now, while the IEEE802154E.c file does not contain any hardware-dependent functions, it does depend on a couple of modules around it, which we list in this page.
Overview
The image on the right shows the stack organization of OpenWSN. While you can use the IEEE802.15.4e in a different stack/OS, this figure gives you a clear idea of what needs to go "around" IEEE802.15.4e, in terms of layers and modules.
The link layer consists of two sublayers:
- "02a-MAClow" is the "lower MAC". It consists of the IEEE802.15.4e implementation and the associated timer. IEEE802.15.4e feeds from the queue of packets to be sent (the
OpenQueue
module), and the schedule (in theschedule
schedule). It runs entirely in ISR (interrupt service routine) mode and "executes" the schedule without modifying it - "02b-MAChigh" is the "upper MAC" which is responsible for managing the schedule. It runs entirely in task mode (same goes for everything in the stack except IEEE802.15.4e)
In the source code, you will find a folder structure which mimics the layers at openwsn.
Dependencies
The reference code for the IEEE802.15.4e is at IEEE802154E.c. It calls functions from the different modules. These are implemented in OpenWSN. You're free to either reuse them, or implement them in your stack/OS. Most likely, you'll already have very similar functionality.
radio
The radio driver and IEEE802.15.4e work close together because they create the interface between the stack and the hardware. This module is detailed in TschRadio.
ieee154etimer
The timer and IEEE802.15.4e work close together since many of the function calls have to be tightly timed. This module is detailed in TschTimer.
IEEE802154
This module 's only functionality is to parse and add IEEE802.15.4 headers. It contains no state. It implements the following functions IEEE802.15.4e calls:
ieee802154_prependHeader
which adds a IEEE802.15.4 header to the front of the packet;ieee802154_retrieveHeader
which parses the IEEE802.15.4 header from a packet and returns its fields.
For a detailed description of this module, look at:
openqueue
This module manages a pool of OpenQueueEntry_t
buffers. It implements the following functions IEEE802.15.4e calls:
openqueue_getFreePacketBuffer
returns a points to a unusedOpenQueueEntry_t
buffer, orNULL
if they're all being used;openqueue_freePacketBuffer
instructs the module that thisOpenQueueEntry_t
buffer is no more needed; the module then frees it;openqueue_getAdvPacket
returns anOpenQueueEntry_t
buffer which contains an advertisement packet, orNULL
if there are none;openqueue_getDataPacket
returns anOpenQueueEntry_t
buffer which contains a data packet destined to a particular neighbor, orNULL
if there are none.
For a detailed description of this module, look at:
idmanager
This module keeps track of the mote's addresses. It implements the following functions IEEE802.15.4e calls:
idmanager_getIsDAGroot
returnTRUE
if the mote is the time master,FALSE
otherwise;idmanager_getMyID
returns the mote's address (PANID (Previous Access Network Identifier), 16-bit or EUI-64 (Extended Unique Identifier));idmanager_isMyAddress
returnsTRUE
if the address passed as a parameter is the mote's,FALSE
otherwise.
For a detailed description of this module, look at:
openserial
This module is used to print messages through the serial port. It implements the following functions IEEE802.15.4e calls:
openserial_printError
prints an error message over the mote's serial port;openserial_stop
instructs the serial module to stop sending/receiving;openserial_startOutput
instructs the serial module to start outputting bytes.
For a detailed description of this module, look at:
schedule
This module stores the IEEE802.15.4e schedule. It implements the following functions IEEE802.15.4e calls:
schedule_getType
returns the type of slot the current slot is (reception, transmission, advertisement, etc.);schedule_getNeighbor
returns the neighbor associated with the current slot;schedule_getChannelOffset
returns the channel offset associated with the current slot.
For a detailed description of this module, look at:
sixtop
This module manages the IEEE802.15.4e schedule and serves as a pass-through between IEEE802.15.4e and the upper layer. It implements the following functions IEEE802.15.4e calls:
task_sixtopNotifSendDone indicates IEEE802.15.4e is done sending a packet generated by an upper layer;
task_sixtopNotifReceive indicates IEEE802.15.4e received a packet for an upper layer.
For a detailed description of this module, look at:
packetfunctions
This module is a container for miscellaneous useful functions. It does not contain any state. It implements the following functions IEEE802.15.4e calls:
packetfunctions_isBroadcastMulticast
returnsTRUE
if the address passed as a parameter is a broadcast address,FALSE
otherwise;packetfunctions_sameAddress
returnsTRUE
if the two addresses passed as parameters are the same,FALSE
otherwise;packetfunctions_reserveHeaderSize
changes thepayload
andlength
fields of anOpenQueueEntry_t
buffer to leave space for a header at the beginning of a packet;packetfunctions_reserveFooterSize
changes thepayload
andlength
fields of anOpenQueueEntry_t
buffer to leave space for a footer at the end of a packet;packetfunctions_tossHeader
"removes" the header at the beginning of a packet by changing the thepayload
andlength
fields of anOpenQueueEntry_t
buffer;
For a detailed description of this module, look at:
leds
This module drives the LEDs of the board. It implements the following functions IEEE802.15.4e calls:
LED_D1_ON
turns on the LED labeled "D1";LED_D1_OFF
turns off the LED labeled "D1".
For a detailed description of this module, look at: