Contiki 2.6
|
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. | |
void | mac_put_event (event_object_t *object) |
Puts an event into the queue of events. | |
event_object_t * | mac_get_event (void) |
Pulls an event from the event queue. | |
void | mac_task (process_event_t ev, process_data_t data) |
This is the main loop task for the MAC. | |
int | sicslowmac_dataRequest (void) |
This is the implementation of the 15.4 MAC Data Request primitive. | |
void | sicslowmac_resetRequest (bool setDefaultPIB) |
This is the implementation of the 15.4 MAC Reset Request primitive. |
Example glue code between the existing MAC code and the Contiki mac interface.
Definition in file sicslowmac.h.
uint8_t mac_event_pending | ( | void | ) |
Checks for any pending events in the queue.
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().
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.
object | is 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.
0 | Failure. |
1 | Success. |
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.
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.
setDefaultPIB | True if the default PIB values should be set. |
0 | Failure. |
1 | Success. |
Sets all PIB values to default.
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().