Implements the MAC PIB attribute handling.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <compiler.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include "pal.h"
#include "return_val.h"
#include "bmm.h"
#include "qmm.h"
#include "tal.h"
#include "ieee_const.h"
#include "mac_msg_const.h"
#include "mac_api.h"
#include "mac_msg_types.h"
#include "mac_data_structures.h"
#include "stack_config.h"
#include "mac_internal.h"
#include "mac.h"
#include "mac_build_config.h"
Macros | |
#define | MAX_MAC_PIB_ATTRIBUTE_ID (macMinSIFSPeriod) |
#define | MAX_PHY_PIB_ATTRIBUTE_ID (phySymbolsPerOctet) |
#define | MIN(a, b) (((a) < (b)) ? (a) : (b)) |
#define | MIN_MAC_PIB_ATTRIBUTE_ID (macAckWaitDuration) |
#define | MIN_PRIVATE_PIB_ATTRIBUTE_ID (macIeeeAddress) |
Functions | |
static | FLASH_DECLARE (uint8_t phy_pib_size[]) |
uint8_t | mac_get_pib_attribute_size (uint8_t pib_attribute_id) |
Gets the size of a PIB attribute. More... | |
retval_t | mlme_get (uint8_t attribute, pib_value_t *attribute_value) |
retval_t | mlme_set (uint8_t attribute, pib_value_t *attribute_value, bool set_trx_to_sleep) |
Setting of MAC PIB attributes via functional access. 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 MAX_MAC_PIB_ATTRIBUTE_ID (macMinSIFSPeriod) |
Referenced by mac_get_pib_attribute_size().
#define MAX_PHY_PIB_ATTRIBUTE_ID (phySymbolsPerOctet) |
Referenced by mac_get_pib_attribute_size().
#define MIN | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
#define MIN_MAC_PIB_ATTRIBUTE_ID (macAckWaitDuration) |
Referenced by mac_get_pib_attribute_size().
#define MIN_PRIVATE_PIB_ATTRIBUTE_ID (macIeeeAddress) |
Referenced by mac_get_pib_attribute_size().
|
static |
retval_t mlme_get | ( | uint8_t | attribute, |
pib_value_t * | attribute_value | ||
) |
References ADDR_COPY_DST_SRC_16, ADDR_COPY_DST_SRC_64, mac_pib_tag::mac_AutoRequest, mac_pib_tag::mac_BattLifeExtPeriods, mac_pib_tag::mac_CoordExtendedAddress, mac_pib_tag::mac_CoordShortAddress, mac_pib_tag::mac_DSN, MAC_INVALID_INDEX, mac_pib, mac_pib_tag::mac_ResponseWaitTime, mac_pib_tag::mac_RxOnWhenIdle, mac_pib_tag::mac_SecurityEnabled, mac_state, MAC_SUCCESS, mac_sync_state, MAC_UNSUPPORTED_ATTRIBUTE, macAssociatedPANCoord, macAssociationPermit, macAutoRequest, macBattLifeExt, macBattLifeExtPeriods, macBeaconOrder, macBeaconPayload, macBeaconPayloadLength, macBeaconTxTime, macBSN, macCoordExtendedAddress, macCoordShortAddress, macDSN, macIeeeAddress, macMaxBE, macMaxCSMABackoffs, macMaxFrameRetries, macMaxFrameTotalWaitTime, macMinBE, macPANId, macPromiscuousMode, macResponseWaitTime, macRxOnWhenIdle, macSecurityEnabled, macShortAddress, macSuperframeOrder, macTransactionPersistenceTime, MEMCPY_ENDIAN, phyCCAMode, phyChannelsSupported, phyCurrentChannel, phyCurrentPage, phyMaxFrameDuration, phySHRDuration, phySymbolsPerOctet, phyTransmitPower, pib_value_t::pib_value_16bit, pib_value_t::pib_value_8bit, and tal_pib.
retval_t mlme_set | ( | uint8_t | attribute, |
pib_value_t * | attribute_value, | ||
bool | set_trx_to_sleep | ||
) |
Setting of MAC PIB attributes via functional access.
In case the highest stack layer is above MAC (e.g. NWK or even higher), it is not efficient to change PIB attributes using the standard request / confirm primitive concept via the NHLE_MAC queue. In order to allow a more efficient way to change PIB attributes residing in MAC or TAL, this function replaces the standard primitive access via a functional interface.
An additional parameter allows for forcing the transceiver back to sleep after PIB setting. Otherwise the transceiver will stay awake (if it has been woken up before). This enables the higher layer to change several PIB attributes without waking up the transceiver and putting it back to sleep several times.
attribute | PIB attribute to be set |
attribute_index | Index of the PIB attribute to be set |
attribute_value | Attribute value to be set |
set_trx_to_sleep | Set TRX back to sleep after this PIB access if it was before starting this TRX access. Otherwise the transceiver state will remain as it is, i.e. in case the transceiver was woken up, it will stay awake. The default value for just changing one variable is true, i.e. the transceiver will be put back to sleep if it has been woken up. |
References aMaxBeaconPayloadLength, mac_pib_tag::mac_AutoRequest, mac_pib_tag::mac_BattLifeExtPeriods, mac_pib_tag::mac_CoordExtendedAddress, mac_pib_tag::mac_CoordShortAddress, mac_pib_tag::mac_DSN, MAC_INVALID_INDEX, MAC_INVALID_PARAMETER, mac_pib, mac_pib_tag::mac_ResponseWaitTime, mac_pib_tag::mac_RxOnWhenIdle, mac_pib_tag::mac_SecurityEnabled, mac_sleep_trans(), MAC_SUCCESS, mac_trx_wakeup(), MAC_UNSUPPORTED_ATTRIBUTE, macAckWaitDuration, macAssociatedPANCoord, macAssociationPermit, macAutoRequest, macBattLifeExt, macBattLifeExtPeriods, macBeaconOrder, macBeaconPayload, macBeaconPayloadLength, macBSN, macCoordExtendedAddress, macCoordShortAddress, macDSN, macGTSPermit, macIeeeAddress, macMaxBE, macMaxCSMABackoffs, macMaxFrameRetries, macMaxFrameTotalWaitTime, macMinBE, macPANCoordExtendedAddress, macPANCoordShortAddress, macPANId, macPromiscuousMode, macResponseWaitTime, macRxOnWhenIdle, macSecurityEnabled, macShortAddress, macSuperframeOrder, macTransactionPersistenceTime, PHY_RX_ON, phyCCAMode, phyCurrentChannel, phyCurrentPage, phyTransmitPower, pib_value_t::pib_value_16bit, pib_value_t::pib_value_32bit, pib_value_t::pib_value_64bit, pib_value_t::pib_value_8bit, SLEEP_MODE_1, tal_pib_set(), tal_rx_enable(), TAL_TRX_ASLEEP, tal_trx_sleep(), and tal_trx_wakeup().