Microchip® Advanced Software Framework

mac_api.h File Reference

MAC API for IEEE 802.15.4-2006.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include "return_val.h"
#include "mac_build_config.h"

Data Structures

union  address_field_t
 MAC Address type. More...
 
struct  wpan_addr_spec_tag
 Device address specification structure. More...
 
struct  wpan_pandescriptor_tag
 PAN descriptor information structure. More...
 

Macros

#define MAC_NHLE_QUEUE_CAPACITY   255
 Capacity of queue between MAC and Next Higher Layer. More...
 
#define WPAN_ADDRMODE_LONG   (0x03)
 Value for the address mode, where a 64 bit long address is given. More...
 
#define WPAN_ADDRMODE_NONE   (0x00)
 Value for the address mode, where no address is given. More...
 
#define WPAN_ADDRMODE_SHORT   (0x02)
 Value for the address mode, where a 16 bit short address is given. More...
 
#define WPAN_CAP_ALLOCADDRESS   (0x80)
 Flag value for capability information field (see wpan_mlme_associate_req()). More...
 
#define WPAN_CAP_ALTPANCOORD   (0x01)
 Flag value for capability information field (see wpan_mlme_associate_req()). More...
 
#define WPAN_CAP_FFD   (0x02)
 Flag value for capability information field (see wpan_mlme_associate_req()). More...
 
#define WPAN_CAP_PWRSOURCE   (0x04)
 Flag value for capability information field (see wpan_mlme_associate_req()). More...
 
#define WPAN_CAP_RXONWHENIDLE   (0x08)
 Flag value for capability information field (see wpan_mlme_associate_req()). More...
 
#define WPAN_DISASSOC_BYCHILD   (0x02)
 Symbolic constant for disassociate reason - initiated by child (see wpan_mlme_disassociate_req()) More...
 
#define WPAN_DISASSOC_BYPARENT   (0x01)
 Symbolic constant for disassociate reason - initiated by parent (see wpan_mlme_disassociate_req()) More...
 
#define WPAN_NUM_EXTENDED_ADDR_PENDING(x)   (((x) >> 4) & 0x7)
 Macro to extract size of extended address list in PAN descriptor. More...
 
#define WPAN_NUM_SHORT_ADDR_PENDING(x)   ((x) & 0x7)
 Marco to extract size of short address list in PAN descriptor. More...
 

Typedefs

typedef struct wpan_addr_spec_tag wpan_addr_spec_t
 Device address specification structure. More...
 
typedef struct
wpan_pandescriptor_tag 
wpan_pandescriptor_t
 PAN descriptor information structure. More...
 

Functions

uint8_t mac_get_pib_attribute_size (uint8_t pib_attribute_id)
 
uint32_t mac_ready_to_sleep (void)
 Checks if the mac stack is ready to sleep. More...
 
void usr_mcps_data_conf (uint8_t msduHandle, uint8_t status, uint32_t Timestamp)
 Callback function that must be implemented by application (NHLE) for MAC service MCPS-DATA.confirm. More...
 
void usr_mcps_data_ind (wpan_addr_spec_t *SrcAddrSpec, wpan_addr_spec_t *DstAddrSpec, uint8_t msduLength, uint8_t *msdu, uint8_t mpduLinkQuality, uint8_t DSN, uint32_t Timestamp, uint8_t SecurityLevel, uint8_t KeyIdMode, uint8_t KeyIndex)
 Callback function that must be implemented by application (NHLE) for MAC service MCPS-DATA.indication. More...
 
void usr_mcps_purge_conf (uint8_t msduHandle, uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MCPS-PURGE.confirm. More...
 
void usr_mlme_associate_conf (uint16_t AssocShortAddress, uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-ASSOCIATE.confirm. More...
 
void usr_mlme_associate_ind (uint64_t DeviceAddress, uint8_t CapabilityInformation)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-ASSOCIATE.indication. More...
 
void usr_mlme_beacon_notify_ind (uint8_t BSN, wpan_pandescriptor_t *PANDescriptor, uint8_t PendAddrSpec, uint8_t *AddrList, uint8_t sduLength, uint8_t *sdu)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-BEACON-NOTIFY.indication. More...
 
void usr_mlme_comm_status_ind (wpan_addr_spec_t *SrcAddrSpec, wpan_addr_spec_t *DstAddrSpec, uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-COMM-STATUS.indication. More...
 
void usr_mlme_disassociate_conf (uint8_t status, wpan_addr_spec_t *DeviceAddrSpec)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-DISASSOCIATE.confirm. More...
 
void usr_mlme_disassociate_ind (uint64_t DeviceAddress, uint8_t DisassociateReason)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-DISASSOCIATE.indication. More...
 
void usr_mlme_get_conf (uint8_t status, uint8_t PIBAttribute, void *PIBAttributeValue)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-GET.confirm. More...
 
void usr_mlme_orphan_ind (uint64_t OrphanAddress)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-ORPHAN.indication. More...
 
void usr_mlme_poll_conf (uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-POLL.confirm. More...
 
void usr_mlme_reset_conf (uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-RESET.confirm. More...
 
void usr_mlme_rx_enable_conf (uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-RX-ENABLE.confirm. More...
 
void usr_mlme_scan_conf (uint8_t status, uint8_t ScanType, uint8_t ChannelPage, uint32_t UnscannedChannels, uint8_t ResultListSize, void *ResultList)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-SCAN.confirm. More...
 
void usr_mlme_set_conf (uint8_t status, uint8_t PIBAttribute)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-SET.confirm. More...
 
void usr_mlme_start_conf (uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-START.confirm. More...
 
void usr_mlme_sync_loss_ind (uint8_t LossReason, uint16_t PANId, uint8_t LogicalChannel, uint8_t ChannelPage)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-SYNC-LOSS.indication. More...
 
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...
 
bool wpan_task (void)
 The stack task function called by the application. More...