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 | 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... | |
#define MAKE_MAC_BUSY | ( | ) |
This macro sets the MAC to busy.
Referenced by mac_awake_disassociate(), mac_build_and_tx_data_req(), mac_process_tal_tx_status(), mac_tx_gts_data(), mcps_data_request(), mlme_associate_request(), mlme_gts_request(), scan_set_complete(), send_scan_cmd(), and tx_pan_id_conf_notif().
#define MAKE_MAC_NOT_BUSY | ( | ) |
This macro sets the MAC to not busy.
Referenced by mac_process_data_response(), mac_t_poll_wait_time_cb(), and 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(), and wpan_task().
void flush_gts_queues | ( | void | ) |
References qmm_queue_flush().
Referenced by flush_queues().
void handle_gts_data_req | ( | mcps_data_req_t * | data_req, |
uint8_t * | msg | ||
) |
References ADDR_COPY_DST_SRC_16, BMM_BUFFER_POINTER, frame_info_tag::buffer_header, calc_frame_transmit_duration(), dev_tx_gts_q, DEV_TX_SLOT_INDEX, mcps_data_req_tag::DstAddr, GTS_RX_SLOT, if(), MAC_ASSOCIATED, MAC_CHANNEL_ACCESS_FAILURE, mac_pib_tag::mac_CoordShortAddress, mac_dev_gts_table, MAC_DEV_GTS_TX, MAC_FRAME_TOO_LONG, mac_gen_mcps_data_conf(), MAC_INVALID_GTS, MAC_PAN_COORD_STARTED, mac_pib, mac_state, mac_superframe_state, mac_tx_gts_data(), frame_info_tag::mpdu, mcps_data_req_tag::msduHandle, qmm_queue_append(), qmm_queue_read(), qmm_queue_remove(), QUEUE_FULL, queue_tag::size, sw_timer_get_residual_time(), T_CAP, TAL_CONVERT_SYMBOLS_TO_US, TAL_GET_SUPERFRAME_DURATION_TIME, and tal_pib.
Referenced by mcps_data_request().
void handle_gts_data_tx_end | ( | void | ) |
References MAC_ASSOCIATED, MAC_DEV_GTS_TX, MAC_PAN_COORD_STARTED, mac_state, mac_superframe_state, mac_tx_gts_data(), and port_pin_toggle_output_level().
Referenced by mac_process_tal_tx_status().
void handle_gts_sync_loss | ( | void | ) |
References GTS_DEALLOCATE, GTS_STATE_ALLOCATED, GTS_STATE_REQ_SENT, gts_char_tag::GtsCharType, gts_char_tag::GtsDirection, gts_char_tag::GtsLength, mac_pib_tag::mac_CoordShortAddress, mac_dev_gts_table, mac_gen_mlme_gts_conf(), MAC_NO_DATA, mac_pib, mac_send_gts_ind(), MAX_GTS_ON_DEV, and tal_pib.
Referenced by mac_sync_loss().
void init_gts_queues | ( | void | ) |
References mac_pan_gts_mgmt_tag::gts_data_q, and qmm_queue_init().
Referenced by reset_gts_globals().
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.
This function builds and transmits a data request command frame.
expl_poll | Data request due to explicit MLME poll request |
force_own_long_addr | Forces the usage of the Extended Address as Source Address. This a allows for implicitly poll for pending data at the coordinator if the Extended Address was used in the Beacon frame. |
expl_dest_addr_mode | Mode of subsequent destination address to be used explicitly (0/2/3). 0: No explicit destination address attached, use either macCoordShortAddress or macCoordExtendedAddress 2: Use explicitly attached address in parameter expl_dest_addr as destination address as short address 3: Use explicitly attached address in parameter expl_dest_addr as destination address as extended address |
expl_dest_addr | Explicitly attached destination address for data request frame. This is to be treated as either not present, short or extended address, depending on parameter expl_dest_addr_mode. |
expl_dest_pan_id | Explicitly attached destination PAN-Id (Coordinator PAN-Id) for data request frame. This is to be treated only as present, depending on parameter expl_dest_addr_mode. |
References bmm_buffer_alloc(), bmm_buffer_free(), BMM_BUFFER_POINTER, BROADCAST, frame_info_tag::buffer_header, CCPU_ENDIAN_TO_LE16, convert_16_bit_to_byte_array(), convert_64_bit_to_byte_array(), convert_spec_16_bit_to_byte_array(), CSMA_SLOTTED, CSMA_UNSLOTTED, DATA_REQ_PAYLOAD_LEN, DATAREQUEST, DATAREQUEST_IMPL_POLL, FCF_ACK_REQUEST, FCF_FRAMETYPE_MAC_CMD, FCF_LONG_ADDR, FCF_NO_ADDR, FCF_PAN_ID_COMPRESSION, FCF_SET_DEST_ADDR_MODE, FCF_SET_FRAMETYPE, FCF_SET_SOURCE_ADDR_MODE, FCF_SHORT_ADDR, LARGE_BUFFER_SIZE, address_field_t::long_address, MAC_ASSOCIATED, mac_pib_tag::mac_CoordExtendedAddress, MAC_COORDINATOR, mac_pib_tag::mac_CoordShortAddress, mac_pib_tag::mac_DSN, MAC_IDLE, MAC_NO_SHORT_ADDR_VALUE, mac_pib, MAC_START_REQUEST_CONFIRM, mac_state, MAC_SUCCESS, MAC_SYNC_BEFORE_ASSOC, mac_sync_state, MAKE_MAC_BUSY, frame_info_tag::mpdu, frame_info_tag::msg_type, NON_BEACON_NWK, address_field_t::short_address, tal_pib, and tal_tx_frame().
Referenced by mac_process_beacon_frame(), mac_process_data_frame(), mac_t_response_wait_cb(), and mlme_poll_request().
void mac_gen_mcps_data_conf | ( | buffer_t * | buf_ptr, |
uint8_t | status, | ||
uint8_t | handle, | ||
uint32_t | timestamp | ||
) |
References BMM_BUFFER_POINTER, mcps_data_conf_tag::cmdcode, mac_nhle_q, MCPS_DATA_CONFIRM, mcps_data_conf_tag::msduHandle, qmm_queue_append(), mcps_data_conf_tag::status, and mcps_data_conf_tag::Timestamp.
Referenced by handle_gts_data_req(), mac_process_tal_tx_status(), mac_tx_gts_data(), mcps_data_request(), and process_deallocate_data_q().
void mac_gen_mlme_associate_conf | ( | buffer_t * | buf_ptr, |
uint8_t | status, | ||
uint16_t | assoc_short_addr | ||
) |
References mlme_associate_conf_tag::AssocShortAddress, BMM_BUFFER_POINTER, mlme_associate_conf_tag::cmdcode, mac_nhle_q, MLME_ASSOCIATE_CONFIRM, qmm_queue_append(), and mlme_associate_conf_tag::status.
Referenced by mac_process_associate_response(), mac_process_tal_tx_status(), mac_t_assocresponsetime_cb(), mac_t_response_wait_cb(), and mlme_associate_request().
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.
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_parse_bcn_gts_info | ( | uint8_t | gts_count, |
uint8_t | gts_dir, | ||
mac_gts_list_t * | gts_list_ptr | ||
) |
References mac_gts_list_tag::dev_addr, DEV_TX_SLOT_INDEX, GTS_ALLOCATE, GTS_DEALLOCATE, GTS_STATE_ALLOCATED, GTS_STATE_IDLE, GTS_STATE_REQ_SENT, gts_char_tag::GtsCharType, gts_char_tag::GtsDirection, gts_char_tag::GtsLength, if(), mac_gts_list_tag::length, mac_pib_tag::mac_CoordShortAddress, MAC_DENIED, mac_dev_gts_table, mac_gen_mlme_gts_conf(), mac_pib, mac_send_gts_ind(), MAC_SUCCESS, process_deallocate_data_q(), gts_char_tag::Reserved, mac_gts_list_tag::starting_slot, and tal_pib.
Referenced by mac_process_beacon_frame().
void mac_prep_disassoc_conf | ( | buffer_t * | buf, |
uint8_t | status | ||
) |
Prepares a disassociation confirm message with device address information.
This functions prepares a disassociation confirm message in case the device address information needs to be extracted.
buf | Buffer for sending MLME disassociate confirm message to NHLE |
status | Status of disassociation |
References BMM_BUFFER_POINTER, BROADCAST, CCPU_ENDIAN_TO_LE16, convert_byte_array_to_16_bit(), convert_byte_array_to_64_bit(), FCF_2_DEST_ADDR_OFFSET, FCF_LONG_ADDR, FCF_SHORT_ADDR, mac_pib_tag::mac_CoordExtendedAddress, MAC_COORDINATOR, mac_pib_tag::mac_CoordShortAddress, mac_gen_mlme_disassociate_conf(), MAC_NO_SHORT_ADDR_VALUE, MAC_PAN_COORD_STARTED, mac_pib, mac_state, frame_info_tag::mpdu, PL_POS_DST_ADDR_START, PL_POS_FCF_2, and tal_pib.
Referenced by mac_process_tal_tx_status().
void mac_process_associate_response | ( | buffer_t * | assoc_resp | ) |
Processing of an associaton reponse command frame.
This function processes the received association response command frame.
assoc_resp | Association response receive buffer |
References ADDR_COPY_DST_SRC_64, Assert, frame_payload_t::assoc_response_data, ASSOCIATION_SUCCESSFUL, bmm_buffer_free(), INVALID_SHORT_ADDRESS, address_field_t::long_address, MAC_ASSOCIATED, mac_conf_buf_ptr, mac_pib_tag::mac_CoordExtendedAddress, mac_pib_tag::mac_CoordShortAddress, mac_gen_mlme_associate_conf(), mac_parse_data, parse_tag::mac_payload_data, mac_pib, MAC_POLL_IDLE, mac_poll_state, mac_sleep_trans(), mac_state, MAC_SUCCESS, MAC_SYNC_BEFORE_ASSOC, mac_sync_state, MAC_SYNC_TRACKING_BEACON, macCoordShortAddress_def, macPANId, macPANId_def, macShortAddress, set_tal_pib_internal(), and parse_tag::src_addr.
Referenced by mac_process_tal_data_ind().
void mac_process_beacon_frame | ( | buffer_t * | beacon | ) |
Processes received beacon frame.
This function processes a received beacon frame. When the system is scanning it records PAN descriptor information contained in the beacon. These PAN descriptors will be reported to the next higher layer via MLME_SCAN.confirm. Also this routine constructs the MLME_BEACON_NOTIFY.indication. Additionally when a device is synced with the coordinator, it tracks beacon frames, checks whether the coordinator does have pending data and will initiate the transmission of a data request frame. The routine uses global "parse_data" structure. The PAN descriptors are stored in the mlme_scan_conf_t structure.
beacon | Pointer to the buffer in which the beacon was received |
References wpan_addr_spec_tag::Addr, ADDR_COPY_DST_SRC_16, ADDR_COPY_DST_SRC_64, mlme_beacon_notify_ind_tag::AddrList, wpan_addr_spec_tag::AddrMode, aMaxSIFSFrameSize, Assert, aUnitBackoffPeriod, frame_payload_t::beacon_data, mac_beacon_payload_tag::beacon_payload_len, bmm_buffer_free(), BMM_BUFFER_POINTER, mlme_beacon_notify_ind_tag::BSN, wpan_pandescriptor_tag::ChannelPage, mlme_beacon_notify_ind_tag::cmdcode, convert_byte_array_to_16_bit(), convert_byte_array_to_64_bit(), wpan_pandescriptor_tag::CoordAddrSpec, parse_tag::fcf, FCF_FRAME_PENDING, FCF_SHORT_ADDR, FUNC_PTR, GET_BEACON_ORDER, GET_FINAL_CAP, GET_GTS_PERMIT, GET_SUPERFRAME_ORDER, GTS_ALLOCATE, mac_beacon_payload_tag::gts_direction, mac_beacon_payload_tag::gts_list, mac_beacon_payload_tag::gts_spec, GTS_STATE_IDLE, GTS_STATE_REQ_SENT, gts_char_tag::GtsCharType, gts_char_tag::GtsDirection, gts_char_tag::GtsLength, wpan_pandescriptor_tag::GTSPermit, wpan_pandescriptor_tag::LinkQuality, wpan_pandescriptor_tag::LogicalChannel, address_field_t::long_address, mac_pib_tag::mac_AutoRequest, mac_pib_tag::mac_BattLifeExtPeriods, mac_bc_data_indicated, mac_build_and_tx_data_req(), mac_conf_buf_ptr, mac_dev_gts_table, mac_final_cap_slot, mac_gen_mlme_gts_conf(), mac_pib_tag::mac_GTSPermit, mac_pib_tag::mac_MaxFrameTotalWaitTime, mac_nhle_q, MAC_NO_DATA, MAC_PAN_COORD_STARTED, mac_parse_bcn_gts_info(), mac_parse_data, parse_tag::mac_payload_data, mac_pib, MAC_POLL_IDLE, mac_poll_state, MAC_SCAN_ACTIVE, MAC_SCAN_IDLE, MAC_SCAN_PASSIVE, mac_scan_state, mac_state, MAC_SUCCESS, MAC_SYNC_NEVER, mac_sync_state, mac_t_wait_for_bc_time_cb(), macBeaconOrder, macMinLIFSPeriod_def, macMinSIFSPeriod_def, macSuperframeOrder, MAX_GTS_ON_DEV, MAX_PANDESCRIPTORS, MLME_BEACON_NOTIFY_INDICATION, parse_tag::mpdu_length, NON_BEACON_NWK, NUM_LONG_PEND_ADDR, NUM_SHORT_PEND_ADDR, pal_timer_start(), mlme_beacon_notify_ind_tag::PANDescriptor, wpan_addr_spec_tag::PANId, mlme_beacon_notify_ind_tag::PendAddrSpec, mac_beacon_payload_tag::pending_addr_list, mac_beacon_payload_tag::pending_addr_spec, PHY_OVERHEAD, parse_tag::ppdu_link_quality, qmm_queue_append(), gts_char_tag::Reserved, mlme_scan_conf_tag::ResultListSize, mlme_scan_conf_tag::scan_result_list, mlme_beacon_notify_ind_tag::sdu, mlme_beacon_notify_ind_tag::sduLength, parse_tag::sequence_number, set_tal_pib_internal(), address_field_t::short_address, parse_tag::src_addr, parse_tag::src_addr_mode, parse_tag::src_panid, mac_beacon_payload_tag::superframe_spec, wpan_pandescriptor_tag::SuperframeSpec, SYMBOLS_PER_OCTET, T_Poll_Wait_Time, TAL_CONVERT_SYMBOLS_TO_US, tal_pib, parse_tag::time_stamp, TIMEOUT_RELATIVE, wpan_pandescriptor_tag::TimeStamp, and WPAN_ADDRMODE_SHORT.
Referenced by process_data_ind_not_transient(), and process_data_ind_scanning().
void mac_process_coord_realign | ( | buffer_t * | ind | ) |
Processing a coordinator realignment command frame.
This function processes a coordinator realignment command frame received from the coordinator (while NOT being in the middle of an Orphan scan, but rather after initiation of a start request primitive from the coordinator indicating realingment. The PAN ID, coord. short address, logical channel, and the device's new short address will be written to the PIB.
ind | Frame reception buffer |
References Assert, bmm_buffer_free(), BROADCAST, mac_coord_realign_tag::channel_page, frame_payload_t::coord_realign_data, parse_tag::fcf, FCF_FRAME_VERSION_2006, mac_coord_realign_tag::logical_channel, mac_pib_tag::mac_CoordShortAddress, mac_parse_data, parse_tag::mac_payload_data, mac_pib, MAC_REALIGNMENT, MAC_SUCCESS, mac_sync_loss(), macPANId, macShortAddress, mac_coord_realign_tag::pan_id, phyCurrentChannel, phyCurrentPage, set_tal_pib_internal(), and mac_coord_realign_tag::short_addr.
Referenced by mac_process_tal_data_ind(), 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, GTS_TX_SLOT, address_field_t::long_address, mac_build_and_tx_data_req(), 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, port_pin_toggle_output_level(), parse_tag::ppdu_link_quality, qmm_queue_append(), reset_gts_expiry(), parse_tag::sequence_number, address_field_t::short_address, parse_tag::src_addr, parse_tag::src_addr_mode, parse_tag::src_panid, and parse_tag::time_stamp.
Referenced by mac_process_tal_data_ind(), and process_data_ind_not_transient().
void mac_process_data_response | ( | void | ) |
Processes a data response to an MLME-POLL.request.
This function processes a data response to an MLME-POLL.request. Our coordinator has responded with a data frame. It is checked whether any data has been received, and the appropriate MLME-POLL.confirm message is constructed.
References Assert, FCF_FRAMETYPE_BEACON, FCF_FRAMETYPE_DATA, parse_tag::frame_type, gen_mlme_poll_conf(), mac_conf_buf_ptr, MAC_NO_DATA, mac_parse_data, parse_tag::mac_payload_length, MAC_POLL_EXPLICIT, MAC_POLL_IDLE, mac_poll_state, MAC_SUCCESS, MAKE_MAC_NOT_BUSY, pal_is_timer_running(), pal_timer_stop(), and T_Poll_Wait_Time.
Referenced by mac_process_tal_data_ind().
void mac_process_disassociate_notification | ( | buffer_t * | msg | ) |
Process a disassociation notification command.
This functions processes a received disassociation notification command frame. Actual data are taken from the incoming frame in mac_parse_buffer.
msg | Frame buffer to be filled in |
References ADDR_COPY_DST_SRC_64, BMM_BUFFER_POINTER, mlme_disassociate_ind_tag::cmdcode, mlme_disassociate_ind_tag::DeviceAddress, frame_payload_t::disassoc_req_data, mlme_disassociate_ind_tag::DisassociateReason, INVALID_SHORT_ADDRESS, address_field_t::long_address, mac_pib_tag::mac_CoordExtendedAddress, mac_pib_tag::mac_CoordShortAddress, mac_nhle_q, mac_parse_data, parse_tag::mac_payload_data, mac_pib, MLME_DISASSOCIATE_INDICATION, qmm_queue_append(), and parse_tag::src_addr.
Referenced by mac_process_tal_data_ind(), and process_data_ind_not_transient().
void mac_process_gts_request | ( | buffer_t * | gts_req | ) |
Referenced by process_data_ind_not_transient().
void mac_process_orphan_realign | ( | buffer_t * | buf_ptr | ) |
Processing a coordinator realignment command frame during Orphan scan.
This function processes a coordinator realignment command frame received as a response to the reception of an orphan notification command frame (i.e. while being in the middle of an orphan scan procedure). The PAN ID, coord. short address, logical channel, and the device's new short address will be written to the PIB.
ind | Frame reception buffer |
References Assert, bmm_buffer_free(), BMM_BUFFER_POINTER, BROADCAST, mac_coord_realign_tag::channel_page, mlme_scan_conf_tag::cmdcode, frame_payload_t::coord_realign_data, parse_tag::fcf, FCF_FRAME_VERSION_2006, mac_coord_realign_tag::logical_channel, mac_conf_buf_ptr, mac_pib_tag::mac_CoordShortAddress, mac_nhle_q, mac_parse_data, parse_tag::mac_payload_data, mac_pib, mac_scan_cmd_buf_ptr, MAC_SCAN_IDLE, mac_scan_state, mac_sleep_trans(), MAC_SUCCESS, macPANId, macShortAddress, MLME_SCAN_CONFIRM, MLME_SCAN_TYPE_ORPHAN, mac_coord_realign_tag::pan_id, phyCurrentChannel, phyCurrentPage, qmm_queue_append(), mlme_scan_conf_tag::ResultListSize, scan_set_complete(), mlme_scan_conf_tag::ScanType, set_tal_pib_internal(), mac_coord_realign_tag::short_addr, mlme_scan_conf_tag::status, and mlme_scan_conf_tag::UnscannedChannels.
Referenced by process_data_ind_scanning().
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_associate_response(), mac_process_coord_realign(), mac_process_data_frame(), mac_process_data_response(), mac_process_disassociate_notification(), 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(), process_data_ind_scanning(), qmm_queue_append(), T_Poll_Wait_Time, tal_mac_q, and tal_pib.
void mac_scan_send_complete | ( | retval_t | status | ) |
Continue scanning after the completion of frame transmission.
This functions continues the corresponding scaning depending on status from the transmission of a beacon request or orphan notification frame.
status | Status of transmission |
References Assert, FUNC_PTR, MAC_CALCULATE_SYMBOL_TIME_SCANDURATION, mac_conf_buf_ptr, mac_pib_tag::mac_DSN, mac_pib, mac_pib_tag::mac_ResponseWaitTime, MAC_SCAN_ACTIVE, mac_scan_state, MAC_SUCCESS, mac_t_scan_duration_cb(), pal_timer_start(), scan_curr_channel, scan_duration, scan_proceed(), scan_type, T_Scan_Duration, TAL_CONVERT_SYMBOLS_TO_US, and TIMEOUT_RELATIVE.
Referenced by tal_tx_frame_done_cb().
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_superframe_state, MAC_SYNC_NEVER, mac_sync_state, mac_trx_init_sleep(), NON_BEACON_NWK, pal_is_timer_running(), T_Beacon_Tracking_Period, and tal_pib.
Referenced by gen_mlme_poll_conf(), mac_awake_scan(), mac_coord_realignment_command_tx_success(), mac_idle_trans(), mac_init(), mac_process_associate_response(), mac_process_data_frame(), mac_process_orphan_realign(), mac_process_tal_tx_status(), mac_sync_loss(), mac_t_assocresponsetime_cb(), mac_t_rx_off_cb(), mac_t_start_inactive_device_cb(), mac_t_wait_for_bc_time_cb(), mcps_data_request(), mlme_associate_request(), mlme_disassociate_request(), mlme_reset_request(), mlme_set(), mlme_start_request(), process_data_ind_not_transient(), scan_clean_up(), scan_proceed(), and set_tal_pib_internal().
void mac_start_missed_beacon_timer | ( | void | ) |
References aMaxLostBeacons, Assert, FUNC_PTR, MAC_BEACON_LOSS, MAC_SUCCESS, mac_sync_loss(), mac_t_missed_beacons_cb(), NON_BEACON_NWK, pal_is_timer_running(), pal_timer_start(), pal_timer_stop(), T_Missed_Beacon, TAL_CONVERT_SYMBOLS_TO_US, TAL_GET_BEACON_INTERVAL_TIME, tal_pib, and TIMEOUT_RELATIVE.
Referenced by mlme_sync_request(), and process_data_ind_not_transient().
void mac_sync_loss | ( | uint8_t | loss_reason | ) |
Function to initiate MLME-SYNC-LOSS.indication to NHLE.
loss_reason | MAC_REALIGNMENT if sync loss is due to receiving coordinator realignment command and MAC_BEACON_LOSS if beacon was lost following a sync request. |
References buffer_t::body, mlme_sync_loss_ind_tag::cmdcode, handle_gts_sync_loss(), MAC_ASSOCIATED, MAC_IDLE, mac_nhle_q, MAC_POLL_IDLE, mac_poll_state, MAC_SCAN_IDLE, mac_scan_orig_channel, mac_scan_orig_page, mac_scan_orig_panid, mac_scan_state, mac_sleep_trans(), mac_state, MAC_SYNC_NEVER, mac_sync_state, MLME_SYNC_LOSS_INDICATION, qmm_queue_append(), and tal_pib.
Referenced by mac_process_coord_realign(), mac_process_tal_tx_status(), mac_start_missed_beacon_timer(), mac_t_missed_beacons_cb(), mlme_sync_request(), and process_data_ind_not_transient().
void mac_t_assocresponsetime_cb | ( | void * | callback_parameter | ) |
References Assert, BROADCAST, mac_conf_buf_ptr, mac_pib_tag::mac_CoordExtendedAddress, mac_pib_tag::mac_CoordShortAddress, mac_gen_mlme_associate_conf(), MAC_NO_DATA, mac_pib, MAC_POLL_IDLE, mac_poll_state, mac_sleep_trans(), MAC_SUCCESS, macCoordShortAddress_def, macPANId, macPANId_def, and set_tal_pib_internal().
Referenced by mac_t_response_wait_cb().
void mac_t_gts_cb | ( | void * | callback_parameter | ) |
References DEV_TX_SLOT_INDEX, ENTER_CRITICAL_REGION, FINAL_CAP_SLOT_DEFAULT, FUNC_PTR, mac_pan_gts_mgmt_tag::gts_data_q, mac_pan_gts_mgmt_tag::GtsDesc, mac_gts_desc_tag::GtsLength, LEAVE_CRITICAL_REGION, MAC_ACTIVE_CAP, MAC_ASSOCIATED, MAC_DEV_GTS_IDLE, MAC_DEV_GTS_IDLE1, MAC_DEV_GTS_IDLE2, mac_dev_gts_table, MAC_DEV_GTS_TX, mac_final_cap_slot, MAC_PAN_COORD_STARTED, mac_state, mac_superframe_state, mac_t_gts_cb(), mac_trx_wakeup(), mac_tx_gts_data(), pal_timer_start(), port_pin_set_output_level(), reset_gts_expiry(), queue_tag::size, T_CAP, TAL_CONVERT_SYMBOLS_TO_US, TAL_GET_SUPERFRAME_DURATION_TIME, tal_pib, and TIMEOUT_RELATIVE.
Referenced by mac_t_gts_cb(), and process_data_ind_not_transient().
void mac_t_poll_wait_time_cb | ( | void * | callback_parameter | ) |
T_Poll_Wait_Time timer callback.
This function implements the T_Poll_Wait_Time timer callback. If a poll request is pending, a mlme-poll-confirm is generated.
callback_parameter | Callback parameter |
References gen_mlme_poll_conf(), mac_conf_buf_ptr, MAC_NO_DATA, MAC_POLL_EXPLICIT, MAC_POLL_IDLE, mac_poll_state, and MAKE_MAC_NOT_BUSY.
Referenced by mac_process_tal_tx_status().
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.
callback_parameter | Callback parameter. |
References Assert, FUNC_PTR, INVALID_SHORT_ADDRESS, mac_build_and_tx_data_req(), MAC_CHANNEL_ACCESS_FAILURE, mac_conf_buf_ptr, mac_gen_mlme_associate_conf(), mac_pib, mac_pib_tag::mac_ResponseWaitTime, MAC_SUCCESS, mac_t_assocresponsetime_cb(), pal_timer_start(), T_Poll_Wait_Time, TAL_CONVERT_SYMBOLS_TO_US, and TIMEOUT_RELATIVE.
Referenced by mac_process_tal_tx_status().
void mac_t_start_inactive_device_cb | ( | void * | callback_parameter | ) |
References MAC_INACTIVE, mac_sleep_trans(), and mac_superframe_state.
Referenced by process_data_ind_not_transient().
void mac_t_tracking_beacons_cb | ( | void * | callback_parameter | ) |
References MAC_ACTIVE_CAP, mac_superframe_state, mac_trx_wakeup(), PHY_RX_ON, and tal_rx_enable().
Referenced by process_data_ind_not_transient().
void mac_trx_init_sleep | ( | void | ) |
MAC function to put the radio to sleep mode.
References DEEP_SLEEP_MODE, 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(), mac_t_gts_cb(), mac_t_tracking_beacons_cb(), mcps_data_request(), mlme_associate_request(), mlme_disassociate_request(), mlme_gts_request(), mlme_poll_request(), mlme_reset_request(), mlme_scan_request(), mlme_set(), mlme_start_request(), mlme_sync_request(), process_data_ind_not_transient(), and set_tal_pib_internal().
void mac_tx_gts_data | ( | queue_t * | gts_data | ) |
References Assert, BMM_BUFFER_POINTER, frame_info_tag::buffer_header, FCF_SECURITY_ENABLED, frame_info_tag::gts_queue, MAC_CHANNEL_ACCESS_FAILURE, mac_gen_mcps_data_conf(), MAC_SUCCESS, mac_superframe_state, MAKE_MAC_BUSY, frame_info_tag::mpdu, mcps_data_req_tag::msduHandle, frame_info_tag::msduHandle, NO_CSMA_WITH_IFS, qmm_queue_remove(), and tal_tx_frame().
Referenced by handle_gts_data_req(), handle_gts_data_tx_end(), and mac_t_gts_cb().
void reset_gts_expiry | ( | mac_pan_gts_mgmt_t * | mac_pan_gts_entry | ) |
Referenced by mac_process_data_frame(), and mac_t_gts_cb().
void reset_gts_globals | ( | void | ) |
References init_gts_queues(), mac_dev_gts_table, mac_dev_gts_table_len, and MAX_GTS_ON_DEV.
Referenced by reset_globals().
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_awake_scan(), mac_coord_realignment_command_tx_success(), mac_idle_trans(), mac_process_associate_response(), mac_process_beacon_frame(), mac_process_coord_realign(), mac_process_orphan_realign(), mac_t_assocresponsetime_cb(), mlme_associate_request(), mlme_start_request(), mlme_sync_request(), process_data_ind_not_transient(), scan_clean_up(), and scan_proceed().