Contiki 2.5
Functions
sicslowmac.h File Reference

    Example glue code between the existing MAC code and the
    Contiki mac interface
More...

#include <stdbool.h>
#include <stdint.h>
#include "contiki.h"
#include "dev/radio.h"
#include "frame.h"

Go to the source code of this file.

Functions

uint8_t mac_event_pending (void)
 Checks for any pending events in the queue. More...
 
void mac_put_event (event_object_t *object)
 Puts an event into the queue of events. More...
 
event_object_t * mac_get_event (void)
 Pulls an event from the event queue. More...
 
void mac_task (process_event_t ev, process_data_t data)
 This is the main loop task for the MAC. More...
 
int sicslowmac_dataRequest (void)
 This is the implementation of the 15.4 MAC Data Request primitive. More...
 
void sicslowmac_resetRequest (bool setDefaultPIB)
 This is the implementation of the 15.4 MAC Reset Request primitive. More...
 

Detailed Description

    Example glue code between the existing MAC code and the
    Contiki mac interface
Author
Adam Dunkels adam@.nosp@m.sics.nosp@m..se Eric Gnoske egnos.nosp@m.ke@g.nosp@m.mail..nosp@m.com Blake Leverett bleve.nosp@m.rett.nosp@m.@gmai.nosp@m.l.co.nosp@m.m

Definition in file sicslowmac.h.

Function Documentation

uint8_t mac_event_pending ( void  )

Checks for any pending events in the queue.

Returns
True if there is a pending event, else false.

Definition at line 123 of file sicslowmac.c.

Referenced by mac_task().

event_object_t* mac_get_event ( void  )

Pulls an event from the event queue.

Assumes that there is an event in the queue. See mac_event_pending().

Returns
Pointer to the event object, or NULL in the event of empty queue.

Definition at line 163 of file sicslowmac.c.

References NULL.

Referenced by mac_task().

void mac_put_event ( event_object_t *  object)

Puts an event into the queue of events.

Parameters
objectis a pointer to the event to add to queue.

Definition at line 134 of file sicslowmac.c.

Referenced by rx_frame_parse().

void mac_task ( process_event_t  ev,
process_data_t  data 
)

This is the main loop task for the MAC.

Called by the main application loop.

Definition at line 194 of file sicslowmac.c.

References mac_event_pending(), and mac_get_event().

Referenced by PROCESS_THREAD().

int sicslowmac_dataRequest ( void  )

This is the implementation of the 15.4 MAC Data Request primitive.

Returns
Integer denoting success or failure.
Return values
0Failure.
1Success.
        The data request primitive creates the frame header based
        on static and dynamic data. The static data will be refined
        in phase II of the project. The frame payload and length are
        retrieved from the rime buffer and rime length respectively.

        When the header and payload are assembled into the
        frame_create_params structure, the frame is created
        by a call to frame_tx_create and then transmited via
        radio_send_data.
Todo:
For phase 1 the addresses are all long. We'll need a mechanism in the rime attributes to tell the mac to use long or short for phase 2.
Todo:
: Fix delay in sicslowmac so they do not block receiving

Definition at line 397 of file sicslowmac.c.

References fcf_t::ackRequired, addr_t::addr16, addr_t::addr64, frame_create_params_t::dest_addr, frame_create_params_t::dest_pid, fcf_t::destAddrMode, frame_create_params_t::fcf, frame_result_t::frame, frame_tx_create(), fcf_t::framePending, fcf_t::frameType, fcf_t::frameVersion, ieee_15_4_manager::get_dst_panid, ieee_15_4_manager::get_long_addr, ieee_15_4_manager::get_src_panid, frame_result_t::length, macDSN, packetbuf_datalen(), packetbuf_dataptr(), fcf_t::panIdCompression, frame_create_params_t::payload, frame_create_params_t::payload_len, radio_send_data(), RADIO_SUCCESS, RADIO_WRONG_STATE, rimeaddr_cmp(), rimeaddr_null, fcf_t::securityEnabled, frame_create_params_t::seq, frame_create_params_t::src_addr, frame_create_params_t::src_pid, and fcf_t::srcAddrMode.

Referenced by PROCESS_THREAD().

void sicslowmac_resetRequest ( bool  setDefaultPIB)

This is the implementation of the 15.4 MAC Reset Request primitive.

Parameters
setDefaultPIBTrue if the default PIB values should be set.
Returns
Integer denoting success or failure.
Return values
0Failure.
1Success.
        Sets all PIB values to default.
Todo:
This might be read from the serial eeprom onboard Raven.

Definition at line 560 of file sicslowmac.c.

References AVR_ENTER_CRITICAL_REGION, AVR_LEAVE_CRITICAL_REGION, macCoordShortAddress, macDSN, macDstPANId, macLongAddr, macShortAddress, and macSrcPANId.

Referenced by mac_init().