The MAC Core Layer (MCL) abstracts and implements IEEE 802.15.4-2006 compliant behavior for non-beacon enabled and beacon-enabled network support.
Macros | |
#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... | |
Functions | |
void | dispatch_event (uint8_t *event) |
Obtains the message type from the buffer and calls the respective handler. More... | |
void | mac_gen_mcps_data_conf (buffer_t *buf_ptr, uint8_t status, uint8_t handle) |
void | mac_idle_trans (void) |
Resets the MAC helper variables and transition to idle state. More... | |
void | mac_process_data_frame (buffer_t *buf_ptr) |
Processes data frames. More... | |
void | mac_process_tal_data_ind (uint8_t *msg) |
Depending on received frame the appropriate function is called. More... | |
void | mac_sleep_trans (void) |
Puts the radio to sleep if this is allowed. More... | |
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... | |
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... | |
#define MAKE_MAC_BUSY | ( | ) |
This macro sets the MAC to busy.
Referenced by mac_process_tal_tx_status(), and mcps_data_request().
#define MAKE_MAC_NOT_BUSY | ( | ) |
This macro sets the MAC to not busy.
Referenced by tal_tx_frame_done_cb().
void dispatch_event | ( | uint8_t * | event | ) |
Obtains the message type from the buffer and calls the respective handler.
This function decodes all events/messages and calls the appropriate handler.
event | Pointer to the buffer header whose body part holds the message type and message elemnets |
References Assert, bmm_buffer_free(), BMM_BUFFER_POINTER, CMD_ID_OCTET, LAST_MESSAGE, and PGM_READ_WORD.
Referenced by mac_task().
void mac_gen_mcps_data_conf | ( | buffer_t * | buf_ptr, |
uint8_t | status, | ||
uint8_t | handle | ||
) |
References BMM_BUFFER_POINTER, mcps_data_conf_tag::cmdcode, mac_nhle_q, MCPS_DATA_CONFIRM, mcps_data_conf_tag::msduHandle, qmm_queue_append(), and mcps_data_conf_tag::status.
Referenced by mac_process_tal_tx_status(), and mcps_data_request().
void mac_idle_trans | ( | void | ) |
Resets the MAC helper variables and transition to idle state.
This function sets the MAC to idle state and resets MAC helper variables
References Assert, mac_sleep_trans(), mac_soft_reset(), MAC_SUCCESS, mac_trx_wakeup(), macPANId, macPANId_def, macShortAddress, macShortAddress_def, and set_tal_pib_internal().
Referenced by mac_process_tal_data_ind(), mac_process_tal_tx_status(), and process_data_ind_not_transient().
void mac_process_data_frame | ( | buffer_t * | buf_ptr | ) |
Processes data frames.
This function processes the data frames received and sends mcps_data_indication to the NHLE.
buf_ptr | Pointer to receive buffer of the data frame |
References ADDR_COPY_DST_SRC_16, ADDR_COPY_DST_SRC_64, bmm_buffer_free(), BMM_BUFFER_POINTER, frame_payload_t::data, parse_tag::dest_addr, parse_tag::dest_addr_mode, parse_tag::dest_panid, parse_tag::fcf, FCF_FRAME_PENDING, FCF_LONG_ADDR, FCF_SHORT_ADDR, address_field_t::long_address, mac_last_dsn, mac_last_src_addr, mac_nhle_q, MAC_PAN_COORD_STARTED, mac_parse_data, parse_tag::mac_payload_data, parse_tag::mac_payload_length, mac_sleep_trans(), mac_state, MCPS_DATA_INDICATION, mac_data_payload_tag::payload, parse_tag::ppdu_link_quality, qmm_queue_append(), parse_tag::sequence_number, address_field_t::short_address, parse_tag::src_addr, parse_tag::src_addr_mode, and parse_tag::src_panid.
Referenced by mac_process_tal_data_ind(), and process_data_ind_not_transient().
void mac_process_tal_data_ind | ( | uint8_t * | msg | ) |
Depending on received frame the appropriate function is called.
msg | Pointer to the buffer header. |
References Assert, ASSOCIATIONREQUEST, ASSOCIATIONRESPONSE, BEACONREQUEST, bmm_buffer_free(), BMM_BUFFER_POINTER, COORDINATORREALIGNMENT, DATAREQUEST, DISASSOCIATIONNOTIFICATION, FCF_FRAMETYPE_DATA, FCF_FRAMETYPE_MAC_CMD, parse_tag::frame_type, LQI_LEN, MAC_AWAIT_ASSOC_RESPONSE, mac_busy, parse_tag::mac_command, MAC_COORDINATOR, mac_idle_trans(), mac_parse_data, MAC_POLL_EXPLICIT, MAC_POLL_IDLE, MAC_POLL_IMPLICIT, mac_poll_state, mac_process_data_frame(), MAC_SCAN_IDLE, mac_scan_state, mac_state, frame_info_tag::mpdu, parse_tag::mpdu_length, ORPHANNOTIFICATION, pal_is_timer_running(), pal_timer_stop(), PANIDCONFLICTNOTIFICAION, parse_mpdu(), parse_tag::ppdu_link_quality, process_data_ind_not_transient(), qmm_queue_append(), tal_mac_q, and tal_pib.
void mac_sleep_trans | ( | void | ) |
Puts the radio to sleep if this is allowed.
References MAC_INACTIVE, mac_pib, mac_rx_enabled, mac_pib_tag::mac_RxOnWhenIdle, MAC_SYNC_NEVER, mac_sync_state, mac_trx_init_sleep(), NON_BEACON_NWK, pal_is_timer_running(), and tal_pib.
Referenced by mac_coord_realignment_command_tx_success(), mac_idle_trans(), mac_init(), mac_process_data_frame(), mac_process_tal_tx_status(), mac_t_rx_off_cb(), mcps_data_request(), mlme_reset_request(), mlme_set(), mlme_start_request(), process_data_ind_not_transient(), and set_tal_pib_internal().
void mac_trx_init_sleep | ( | void | ) |
MAC function to put the radio to sleep mode.
References mac_radio_sleep_state, MAC_SUCCESS, pal_timer_source_select(), RADIO_AWAKE, RADIO_SLEEPING, SLEEP_MODE_1, tal_trx_sleep(), TMR_CLK_SRC_DURING_TRX_AWAKE, and TMR_CLK_SRC_DURING_TRX_SLEEP.
Referenced by mac_sleep_trans().
void mac_trx_wakeup | ( | void | ) |
MAC function to wake-up the radio from sleep state.
References FAILURE, mac_radio_sleep_state, pal_timer_source_select(), RADIO_AWAKE, RADIO_SLEEPING, tal_trx_wakeup(), and TMR_CLK_SRC_DURING_TRX_AWAKE.
Referenced by mac_idle_trans(), mac_rx_enable(), mcps_data_request(), mlme_reset_request(), mlme_set(), mlme_start_request(), process_data_ind_not_transient(), and set_tal_pib_internal().
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.
attribute | PIB attribute to be set |
attribute_value | Attribute value to be set |
References mac_radio_sleep_state, mac_sleep_trans(), mac_trx_wakeup(), RADIO_SLEEPING, and tal_pib_set().
Referenced by mac_coord_realignment_command_tx_success(), mac_idle_trans(), mlme_start_request(), and process_data_ind_not_transient().