Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MAC API Encoder

The API Encoder Module Encodes the MAC Api's into appropriate command byte stream.

Macros

#define MAX_MAC_PIB_ATTRIBUTE_ID   (macMinSIFSPeriod)
 
#define MAX_PHY_PIB_ATTRIBUTE_ID   (phySymbolsPerOctet)
 
#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)
 
retval_t wpan_init (void)
 The stack initialization function. More...
 
bool wpan_mcps_data_req (uint8_t SrcAddrMode, wpan_addr_spec_t *DstAddrSpec, uint8_t msduLength, uint8_t *msdu, uint8_t msduHandle, uint8_t TxOptions)
 Initiate MCPS-DATA.request service and have it placed in the MCPS-SAP queue. More...
 
bool wpan_mcps_purge_req (const uint8_t msduHandle)
 Initiate MCPS-PURGE.request service and have it placed in the MCPS-SAP queue. More...
 
bool wpan_mlme_associate_req (uint8_t LogicalChannel, uint8_t ChannelPage, wpan_addr_spec_t *CoordAddrSpec, uint8_t CapabilityInformation)
 Initiate MLME-ASSOCIATE.request service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_associate_resp (uint64_t DeviceAddress, uint16_t AssocShortAddress, uint8_t status)
 Initiate MLME-ASSOCIATE.response service and place it in the MLME-SAP queue. More...
 
bool wpan_mlme_disassociate_req (wpan_addr_spec_t *DeviceAddrSpec, uint8_t DisassociateReason, bool TxIndirect)
 Inititate MLME-DISASSOCIATE.request service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_get_req (uint8_t PIBAttribute)
 Initiate MLME-GET.request service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_gts_req (uint16_t DevShortAddr, gts_char_t GtsChar)
 
bool wpan_mlme_orphan_resp (uint64_t OrphanAddress, uint16_t ShortAddress, bool AssociatedMember)
 Initiate MLME-ORPHAN.response service and have it placed in MLME_SAP queue. More...
 
bool wpan_mlme_poll_req (wpan_addr_spec_t *CoordAddrSpec)
 Initiate MLME-POLL.request service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_reset_req (bool SetDefaultPib)
 Initiate MLME-RESET.request service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_rx_enable_req (bool DeferPermit, uint32_t RxOnTime, uint32_t RxOnDuration)
 Initiate MLME-RX-ENABLE.request service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_scan_req (uint8_t ScanType, uint32_t ScanChannels, uint8_t ScanDuration, uint8_t ChannelPage)
 Initiate MLME-SCAN.request service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_set_req (uint8_t PIBAttribute, void *PIBAttributeValue)
 Initiate MLME-SET.request service and have it placed in MLME_SAP queue. More...
 
bool wpan_mlme_start_req (uint16_t PANId, uint8_t LogicalChannel, uint8_t ChannelPage, uint8_t BeaconOrder, uint8_t SuperframeOrder, bool PANCoordinator, bool BatteryLifeExtension, bool CoordRealignment)
 Initiate MLME-START service and have it placed in the MLME-SAP queue. More...
 
bool wpan_mlme_sync_req (uint8_t LogicalChannel, uint8_t ChannelPage, bool TrackBeacon)
 Initiate MLME-SYNC.request service and have it placed in the MLME-SAP queue. More...
 

Variables

static uint8_t length = 0
 
static uint8_t * tx_buff_ptr = &tx_buffer[CMD_POS]
 
static uint8_t tx_buffer [TX_BUFFER_LENGTH] = {0}
 

#define MAX_MAC_PIB_ATTRIBUTE_ID   (macMinSIFSPeriod)
#define MAX_PHY_PIB_ATTRIBUTE_ID   (phySymbolsPerOctet)
#define MIN_MAC_PIB_ATTRIBUTE_ID   (macAckWaitDuration)
#define MIN_PRIVATE_PIB_ATTRIBUTE_ID   (macIeeeAddress)

static FLASH_DECLARE ( uint8_t  phy_pib_size[])
static
uint8_t mac_get_pib_attribute_size ( uint8_t  pib_attribute_id)
retval_t wpan_init ( void  )

The stack initialization function.

This function initializes all resources, which are used from the stack. It has to be called before any other function of the stack is called.

References MAC_SUCCESS, PROTOCOL_ID, PROTOCOL_ID_POS, rcv_buffer, rcv_frame_ptr, sio2ncp_init(), SOT, and SOT_POS.

Referenced by main().

bool wpan_mcps_data_req ( uint8_t  SrcAddrMode,
wpan_addr_spec_t DstAddrSpec,
uint8_t  msduLength,
uint8_t *  msdu,
uint8_t  msduHandle,
uint8_t  TxOptions 
)

Initiate MCPS-DATA.request service and have it placed in the MCPS-SAP queue.

Parameters
SrcAddrModeAddress Mode of the source address.
DstAddrSpecPointer to wpan_addr_spec_t structure for destination.
msduHandleHandle (identification) of the MSDU.
TxOptionsBitmap for transmission options. Valid values:
msduPointer to the data to be transmitted.
msduLengthLength of the data to be transmitted.
SecurityLevelUsed security level; this parameter is only available if MAC security is enabled via MAC_SECURITY_ZIP
KeyIdModeUsed mode to identify the key; this parameter is only available if MAC security is enabled via MAC_SECURITY_ZIP
KeyIndexUsed index of the key; this parameter is only available if MAC security is enabled via MAC_SECURITY_ZIP
Returns
true - success; false - buffer not available or queue full.

References wpan_addr_spec_tag::Addr, wpan_addr_spec_tag::AddrMode, CMD_POS, EOT, LEN_POS, MCPS_DATA_REQUEST, wpan_addr_spec_tag::PANId, and sio2ncp_tx().

Referenced by bc_data_cb(), gts_data_cb(), indirect_data_cb(), and main().

bool wpan_mcps_purge_req ( const uint8_t  msduHandle)

Initiate MCPS-PURGE.request service and have it placed in the MCPS-SAP queue.

Parameters
msduHandleHandle of MSDU to be purged.
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, MCPS_PURGE_REQUEST, and sio2ncp_tx().

bool wpan_mlme_associate_req ( uint8_t  LogicalChannel,
uint8_t  ChannelPage,
wpan_addr_spec_t CoordAddrSpec,
uint8_t  CapabilityInformation 
)

Initiate MLME-ASSOCIATE.request service and have it placed in the MLME-SAP queue.

Parameters
LogicalChannelThe logical channel on which to attempt association.
ChannelPageThe channel page on which to attempt association.
CoordAddrSpecPointer to wpan_addr_spec_t structure for coordinator.
CapabilityInformationBitmap that describes the nodes capabilities. (WPAN_CAP_ALTPANCOORD | WPAN_CAP_FFD | WPAN_CAP_PWRSOURCE | WPAN_CAP_RXONWHENIDLE | WPAN_CAP_ALLOCADDRESS)
Returns
true - success; false - buffer not available or queue full.

References wpan_addr_spec_tag::Addr, wpan_addr_spec_tag::AddrMode, CMD_POS, EOT, LEN_POS, MLME_ASSOCIATE_REQUEST, wpan_addr_spec_tag::PANId, and sio2ncp_tx().

bool wpan_mlme_associate_resp ( uint64_t  DeviceAddress,
uint16_t  AssocShortAddress,
uint8_t  status 
)

Initiate MLME-ASSOCIATE.response service and place it in the MLME-SAP queue.

Parameters
DeviceAddressExtended address for device requesting association.
AssocShortAddressShort address allocated on successful association.
statusStatus of the association attempt. Valid values:
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, MLME_ASSOCIATE_RESPONSE, and sio2ncp_tx().

Referenced by usr_mlme_associate_ind().

bool wpan_mlme_disassociate_req ( wpan_addr_spec_t DeviceAddrSpec,
uint8_t  DisassociateReason,
bool  TxIndirect 
)

Inititate MLME-DISASSOCIATE.request service and have it placed in the MLME-SAP queue.

Parameters
DeviceAddrSpecPointer to wpan_addr_spec_t structure for device to which to send the disassociation notification command.
DisassociateReasonReason for disassociation. Valid values:
TxIndirectTRUE if the disassociation notification command is to be sent indirectly
Returns
true - success; false - buffer not available or queue full.

References wpan_addr_spec_tag::Addr, wpan_addr_spec_tag::AddrMode, CMD_POS, EOT, LEN_POS, MLME_DISASSOCIATE_REQUEST, wpan_addr_spec_tag::PANId, and sio2ncp_tx().

bool wpan_mlme_get_req ( uint8_t  PIBAttribute)

Initiate MLME-GET.request service and have it placed in the MLME-SAP queue.

Parameters
PIBAttributePIB attribute to be retrieved.
PIBAttributeIndexIndex of the PIB attribute to be read.
Returns
true - success; false - buffer not availability or queue full.

References CMD_POS, EOT, LEN_POS, MLME_GET_REQUEST, and sio2ncp_tx().

Referenced by usr_mlme_comm_status_ind(), usr_mlme_get_conf(), and usr_mlme_reset_conf().

bool wpan_mlme_gts_req ( uint16_t  DevShortAddr,
gts_char_t  GtsChar 
)
bool wpan_mlme_orphan_resp ( uint64_t  OrphanAddress,
uint16_t  ShortAddress,
bool  AssociatedMember 
)

Initiate MLME-ORPHAN.response service and have it placed in MLME_SAP queue.

Parameters
OrphanAddressAddress of orphaned device.
ShortAddressShort address allocated to orphaned device.
AssociatedMemberBoolean true if the orphaned device is associated.
Returns
true - success; false - buffer not availability or queue full.

References CMD_POS, EOT, LEN_POS, MLME_ORPHAN_RESPONSE, and sio2ncp_tx().

bool wpan_mlme_poll_req ( wpan_addr_spec_t CoordAddrSpec)

Initiate MLME-POLL.request service and have it placed in the MLME-SAP queue.

Parameters
CoordAddrSpecPointer to wpan_addr_spec_t structure for the coordinator.
Returns
true - success; false - buffer not availability or queue full.

References wpan_addr_spec_tag::Addr, wpan_addr_spec_tag::AddrMode, CMD_POS, EOT, LEN_POS, MLME_POLL_REQUEST, wpan_addr_spec_tag::PANId, and sio2ncp_tx().

bool wpan_mlme_reset_req ( bool  SetDefaultPib)

Initiate MLME-RESET.request service and have it placed in the MLME-SAP queue.

Parameters
SetDefaultPibBoolean to set all PIB values to their respective defaults.
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, MLME_RESET_REQUEST, and sio2ncp_tx().

Referenced by main(), usr_mlme_reset_conf(), usr_mlme_set_conf(), and usr_mlme_start_conf().

bool wpan_mlme_rx_enable_req ( bool  DeferPermit,
uint32_t  RxOnTime,
uint32_t  RxOnDuration 
)

Initiate MLME-RX-ENABLE.request service and have it placed in the MLME-SAP queue.

Parameters
DeferPermitSet to true if receiver enable can be deferred until next superframe if requested time has already passed.
RxOnTimeNumber of symbols from start of superframe before receiver is enabled.
RxOnDurationNumber of symbols for which the receiver is enabled,
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, MLME_RX_ENABLE_REQUEST, and sio2ncp_tx().

bool wpan_mlme_scan_req ( uint8_t  ScanType,
uint32_t  ScanChannels,
uint8_t  ScanDuration,
uint8_t  ChannelPage 
)

Initiate MLME-SCAN.request service and have it placed in the MLME-SAP queue.

Parameters
ScanTypeType of scan to perform. Valid values:
ScanChannelsChannels to be scanned.
ScanDurationDuration of each scan.
ChannelPageThe channel page on which to perform the scan.
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, MLME_SCAN_REQUEST, and sio2ncp_tx().

Referenced by usr_mlme_set_conf().

bool wpan_mlme_set_req ( uint8_t  PIBAttribute,
void *  PIBAttributeValue 
)

Initiate MLME-SET.request service and have it placed in MLME_SAP queue.

Parameters
PIBAttributePIB attribute to be set.
PIBAttributeIndexIndex of the PIB attribute to be set.
PIBAttributeValuePointer to new PIB attribute value.
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, mac_get_pib_attribute_size(), macBeaconPayload, MLME_SET_REQUEST, and sio2ncp_tx().

Referenced by bcn_payload_update_cb(), usr_mlme_comm_status_ind(), usr_mlme_get_conf(), and usr_mlme_set_conf().

bool wpan_mlme_start_req ( uint16_t  PANId,
uint8_t  LogicalChannel,
uint8_t  ChannelPage,
uint8_t  BeaconOrder,
uint8_t  SuperframeOrder,
bool  PANCoordinator,
bool  BatteryLifeExtension,
bool  CoordRealignment 
)

Initiate MLME-START service and have it placed in the MLME-SAP queue.

Parameters
PANIdPAN identifier to be used by device.
LogicalChannelThe logical channel on which to start using the new superframe configuration.
ChannelPageThe channel page on which to begin using the new superframe configuration.
BeaconOrderBeacon transmission interval.
SuperframeOrderDuration of active portion of superframe.
PANCoordinatorIndicates whether node is PAN coordinator of PAN.
BatteryLifeExtensionBoolean true disables receiver of beaconing device for a period after interframe spacing of beacon frame.
CoordRealignmentBoolean to transmit Coordinator Realignment command prior to changing to new superframe configuration.
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, MLME_START_REQUEST, and sio2ncp_tx().

Referenced by usr_mlme_scan_conf().

bool wpan_mlme_sync_req ( uint8_t  LogicalChannel,
uint8_t  ChannelPage,
bool  TrackBeacon 
)

Initiate MLME-SYNC.request service and have it placed in the MLME-SAP queue.

Parameters
LogicalChannelThe logical channel on which to attempt coordinator synchronization.
ChannelPageThe channel page on which to attempt coordinator synchronization.
TrackBeaconBoolean to synchronize with next beacon and to track all future beacons.
Returns
true - success; false - buffer not available or queue full.

References CMD_POS, EOT, LEN_POS, MLME_SYNC_REQUEST, and sio2ncp_tx().

uint8_t length = 0
static

Referenced by sio2host_tx(), and sio2ncp_tx().

uint8_t* tx_buff_ptr = &tx_buffer[CMD_POS]
static
uint8_t tx_buffer[TX_BUFFER_LENGTH] = {0}
static