Declares MAC internal functions, globals, and macros.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include "pal.h"
#include "tal.h"
#include "ieee_const.h"
#include "mac_data_structures.h"
#include "return_val.h"
#include "mac_msg_types.h"
Data Structures | |
struct | mac_pib_tag |
Macros | |
#define | BO_USED_FOR_MAC_PERS_TIME (0) |
#define | DEV_RX_SLOT_INDEX (GTS_RX_SLOT) |
#define | DEV_TX_SLOT_INDEX (GTS_TX_SLOT) |
#define | FINAL_CAP_SLOT_DEFAULT (0x0F) |
#define | GTS_REQ_PAYLOAD_LEN (2) |
#define | macAckWaitDuration_def (54) |
Default value for MIB macAckWaitDuration. More... | |
#define | macMaxFrameTotalWaitTime_def (1986) |
#define | MAKE_MAC_BUSY() |
This macro sets the MAC to busy. More... | |
#define | MAKE_MAC_NOT_BUSY() |
This macro sets the MAC to not busy. More... | |
#define | MAX_GTS_ON_DEV (4) |
#define | PAN_RX_SLOT_INDEX ((PANC_SLOT << 1) | GTS_RX_SLOT) |
#define | PAN_TX_SLOT_INDEX ((PANC_SLOT << 1) | GTS_TX_SLOT) |
#define | PANC_SLOT (1) |
Typedefs | |
typedef void(* | handler_t )(uint8_t *) |
typedef struct mac_pib_tag | mac_pib_t |
typedef enum mac_poll_state_tag | mac_poll_state_t |
MAC poll states. More... | |
typedef enum mac_radio_sleep_state_tag | mac_radio_sleep_state_t |
MAC sleep state type. More... | |
typedef enum mac_scan_state_tag | mac_scan_state_t |
Device or coordinator scan states. More... | |
typedef __PACK__DATA__ enum mac_state_tag | mac_state_t |
MAC state type. More... | |
typedef enum mac_superframe_state_tag | mac_superframe_state_t |
MAC state type. More... | |
typedef enum mac_sync_state_tag | mac_sync_state_t |
Device or coordinator sync states. More... | |
Enumerations | |
enum | mac_poll_state_tag { MAC_POLL_IDLE = 0, MAC_AWAIT_ASSOC_RESPONSE, MAC_POLL_EXPLICIT, MAC_POLL_IMPLICIT } |
MAC poll states. More... | |
enum | mac_radio_sleep_state_tag { RADIO_AWAKE = 0, RADIO_SLEEPING } |
MAC sleep state type. More... | |
enum | mac_scan_state_tag { MAC_SCAN_IDLE = 0, MAC_SCAN_ED, MAC_SCAN_ACTIVE, MAC_SCAN_ORPHAN, MAC_SCAN_PASSIVE } |
Device or coordinator scan states. More... | |
enum | mac_state_tag { MAC_IDLE = 0, MAC_ASSOCIATED = 1, MAC_COORDINATOR = 2, MAC_PAN_COORD_STARTED = 3 } |
MAC state type. More... | |
enum | mac_superframe_state_tag { MAC_ACTIVE_CAP = 0, MAC_DEV_GTS_TX, MAC_DEV_GTS_IDLE, MAC_DEV_GTS_IDLE1, MAC_DEV_GTS_IDLE2, MAC_INACTIVE, MAC_NOBEACON } |
MAC state type. More... | |
enum | mac_sync_state_tag { MAC_SYNC_NEVER = 0, MAC_SYNC_ONCE, MAC_SYNC_TRACKING_BEACON, MAC_SYNC_BEFORE_ASSOC } |
Device or coordinator sync states. More... | |
Functions | |
void | dispatch_event (uint8_t *event) |
Obtains the message type from the buffer and calls the respective handler. More... | |
void | flush_gts_queues (void) |
void | handle_gts_data_req (mcps_data_req_t *data_req, uint8_t *msg) |
void | handle_gts_data_tx_end (void) |
void | handle_gts_sync_loss (void) |
void | init_gts_queues (void) |
uint8_t | mac_add_gts_info (uint8_t *frame_ptr) |
bool | mac_build_and_tx_data_req (bool expl_poll, bool force_own_long_addr, uint8_t expl_dest_addr_mode, address_field_t *expl_dest_addr, uint16_t expl_dest_pan_id) |
Build and transmits data request command frame. More... | |
void | mac_gen_mcps_data_conf (buffer_t *buf_ptr, uint8_t status, uint8_t handle, uint32_t timestamp) |
void | mac_gen_mlme_associate_conf (buffer_t *buf_ptr, uint8_t status, uint16_t assoc_short_addr) |
void | mac_gen_mlme_gts_conf (buffer_t *buf_ptr, uint8_t status, gts_char_t gts_char) |
void | mac_gts_table_update (void) |
void | mac_idle_trans (void) |
Resets the MAC helper variables and transition to idle state. More... | |
void | mac_parse_bcn_gts_info (uint8_t gts_count, uint8_t gts_dir, mac_gts_list_t *gts_list_ptr) |
void | mac_prep_disassoc_conf (buffer_t *buf_ptr, uint8_t status) |
Prepares a disassociation confirm message with device address information. More... | |
void | mac_process_associate_response (buffer_t *buf_ptr) |
Processing of an associaton reponse command frame. More... | |
void | mac_process_beacon_frame (buffer_t *msg) |
Processes received beacon frame. More... | |
void | mac_process_coord_realign (buffer_t *buf_ptr) |
Processing a coordinator realignment command frame. More... | |
void | mac_process_data_frame (buffer_t *buf_ptr) |
Processes data frames. More... | |
void | mac_process_data_response (void) |
Processes a data response to an MLME-POLL.request. More... | |
void | mac_process_disassociate_notification (buffer_t *buf_ptr) |
Process a disassociation notification command. More... | |
void | mac_process_gts_request (buffer_t *gts_req) |
void | mac_process_orphan_realign (buffer_t *buf_ptr) |
Processing a coordinator realignment command frame during Orphan scan. More... | |
void | mac_process_tal_data_ind (uint8_t *msg) |
Depending on received frame the appropriate function is called. More... | |
void | mac_scan_send_complete (retval_t status) |
Continue scanning after the completion of frame transmission. More... | |
void | mac_sleep_trans (void) |
Puts the radio to sleep if this is allowed. More... | |
void | mac_start_missed_beacon_timer (void) |
void | mac_sync_loss (uint8_t loss_reason) |
Function to initiate MLME-SYNC-LOSS.indication to NHLE. More... | |
void | mac_t_assocresponsetime_cb (void *callback_parameter) |
void | mac_t_gts_cb (void *callback_parameter) |
void | mac_t_poll_wait_time_cb (void *callback_parameter) |
T_Poll_Wait_Time timer callback. More... | |
void | mac_t_response_wait_cb (void *callback_parameter) |
Handle T_Poll_Wait_Time timer after successful transmission of an association request frame and before sending out the subsequent data request frame. More... | |
void | mac_t_start_inactive_device_cb (void *callback_parameter) |
void | mac_t_tracking_beacons_cb (void *callback_parameter) |
void | mac_trx_init_sleep (void) |
MAC function to put the radio to sleep mode. More... | |
void | mac_trx_wakeup (void) |
MAC function to wake-up the radio from sleep state. More... | |
void | mac_tx_gts_data (queue_t *gts_data) |
void | reset_gts_expiry (mac_pan_gts_mgmt_t *mac_pan_gts_entry) |
void | reset_gts_globals (void) |
retval_t | set_tal_pib_internal (uint8_t attribute, pib_value_t *attribute_value) |
Wakes-up the radio and sets the corresponding TAL PIB attribute. More... | |
Variables | |
bool | mac_bc_data_indicated |
Flag stating that the last received beacon frame from the parent indicated pending broadcast data to be received. More... | |
bool | mac_busy |
MAC busy state, indicates whether MAC can process any request from NHLE. More... | |
__PACK__RST_DATA__ uint8_t * | mac_conf_buf_ptr |
Holds the mlme request buffer pointer, used to give the respective confirmation in scan, poll and association. More... | |
mac_dev_gts_mgmt_t | mac_dev_gts_table [] |
uint8_t | mac_dev_gts_table_len |
uint8_t | mac_final_cap_slot |
Final Cap Slot of current Superframe. More... | |
uint8_t | mac_last_dsn |
uint64_t | mac_last_src_addr |
parse_t | mac_parse_data |
Global parse data. More... | |
mac_pib_t | mac_pib |
mac_poll_state_t | mac_poll_state |
Current state of MAC poll state machine, e.g. More... | |
mac_radio_sleep_state_t | mac_radio_sleep_state |
Radio sleep state. More... | |
bool | mac_rx_enabled |
uint8_t * | mac_scan_cmd_buf_ptr |
Holds the buffer pointer which is used to send scan command. More... | |
uint8_t | mac_scan_orig_channel |
Stores the original channel before start of scanning. More... | |
uint8_t | mac_scan_orig_page |
Stores the original channel page before start of scanning. More... | |
uint16_t | mac_scan_orig_panid |
Stores the original PAN-Id before start of scanning. More... | |
mac_scan_state_t | mac_scan_state |
Current state of scanning process. More... | |
mac_state_t | mac_state |
Current state of the MAC state machine. More... | |
mac_superframe_state_t | mac_superframe_state |
mac_sync_state_t | mac_sync_state |
Current state of syncronization with parent (either coordinator or PAN coordinator). More... | |
queue_t | tal_mac_q |
Queue used by MAC for its internal operation. More... | |