Microchip® Advanced Software Framework

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

All Definitions used by the MAC Layer is described here.

Modules

 MAC Data Structures
 This module defines all the MAC Data Structures.
 

Macros

#define BO_USED_FOR_MAC_PERS_TIME   (0)
 
#define FINAL_CAP_SLOT_DEFAULT   (0x0F)
 
#define LAST_MESSAGE   MLME_POLL_CONFIRM
 Bump this when extending the list! More...
 
#define MAC   (4)
 
#define MAC_NHLE_QUEUE_CAPACITY   255
 Capacity of queue between MAC and Next Higher Layer. More...
 
#define macAckWaitDuration_def   (tal_pib.CurrentPage == 0 ? 120 : 54)
 Default value for MIB macAckWaitDuration. More...
 
#define macMaxFrameTotalWaitTime_def   (2784)
 
#define MCPS_DATA_CON_LEN   (7)
 The following defines describe the minimum length of a primitive message. More...
 
#define MCPS_DATA_IND_LEN   (31)
 
#define MCPS_PURGE_CONF_LEN   (3)
 
#define MLME_ASSOCIATE_CONF_LEN   (4)
 
#define MLME_ASSOCIATE_IND_LEN   (10)
 
#define MLME_BEACON_NOTIFY_IND_LEN   (2)
 
#define MLME_COMM_STATUS_IND_LEN   (22)
 
#define MLME_DISASSOCIATE_CONF_LEN   (13)
 
#define MLME_DISASSOCIATE_IND_LEN   (10)
 
#define MLME_GET_CONF_LEN   (4)
 
#define MLME_GTS_CONF_LEN   (3)
 
#define MLME_GTS_IND_LEN   (4)
 
#define MLME_ORPHAN_IND_LEN   (9)
 
#define MLME_POLL_CONF_LEN   (2)
 
#define MLME_RESET_CONF_LEN   (2)
 
#define MLME_RX_ENABLE_CONF_LEN   (2)
 
#define MLME_SCAN_CONF_LEN   (10)
 
#define MLME_SET_CONF_LEN   (3)
 
#define MLME_START_CONF_LEN   (2)
 
#define MLME_SYNC_LOSS_IND_LEN   (6)
 
#define NUMBER_OF_MAC_BEACON_SUPPORT_TIMERS   (0)
 
#define NUMBER_OF_MAC_INDIRECT_DATA_SUPPORT_TIMERS   (1)
 
#define NUMBER_OF_MAC_RX_ENABLE_SUPPORT_TIMERS   (1)
 
#define NUMBER_OF_MAC_SCAN_SUPPORT_TIMERS   (1)
 
#define NUMBER_OF_MAC_TIMERS
 
#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_DESCRIPTOR_LEN   (21)
 
#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 void(* handler_t )(uint8_t *)
 
typedef enum mac_poll_state_tag mac_poll_state_t
 MAC poll states. More...
 
typedef enum
mac_radio_sleep_state_tag 
mac_radio_sleep_state_t
 MAC sleep state type. More...
 
typedef enum mac_scan_state_tag mac_scan_state_t
 Device or coordinator scan states. More...
 
typedef __PACK__DATA__ enum
mac_state_tag 
mac_state_t
 MAC state type. More...
 
typedef enum
mac_superframe_state_tag 
mac_superframe_state_t
 MAC state type. More...
 
typedef enum mac_sync_state_tag mac_sync_state_t
 Device or coordinator sync states. More...
 

Enumerations

enum  mac_poll_state_tag {
  MAC_POLL_IDLE = 0,
  MAC_AWAIT_ASSOC_RESPONSE,
  MAC_POLL_EXPLICIT,
  MAC_POLL_IMPLICIT
}
 MAC poll states. More...
 
enum  mac_radio_sleep_state_tag {
  RADIO_AWAKE = 0,
  RADIO_SLEEPING
}
 MAC sleep state type. More...
 
enum  mac_scan_state_tag {
  MAC_SCAN_IDLE = 0,
  MAC_SCAN_ED,
  MAC_SCAN_ACTIVE,
  MAC_SCAN_ORPHAN,
  MAC_SCAN_PASSIVE
}
 Device or coordinator scan states. More...
 
enum  mac_state_tag {
  MAC_IDLE = 0,
  MAC_ASSOCIATED = 1,
  MAC_COORDINATOR = 2,
  MAC_PAN_COORD_STARTED = 3
}
 MAC state type. More...
 
enum  mac_superframe_state_tag {
  MAC_ACTIVE_CAP = 0,
  MAC_INACTIVE,
  MAC_NOBEACON
}
 MAC state type. More...
 
enum  mac_sync_state_tag {
  MAC_SYNC_NEVER = 0,
  MAC_SYNC_ONCE,
  MAC_SYNC_TRACKING_BEACON,
  MAC_SYNC_BEFORE_ASSOC
}
 Device or coordinator sync states. More...
 
enum  msg_code {
  TAL_DATA_INDICATION = (0x00),
  MLME_ASSOCIATE_REQUEST = (0x01),
  MLME_ASSOCIATE_RESPONSE = (0x02),
  MCPS_DATA_REQUEST = (0x03),
  MCPS_PURGE_REQUEST = (0x04),
  MLME_DISASSOCIATE_REQUEST = (0x05),
  MLME_SET_REQUEST = (0x06),
  MLME_ORPHAN_RESPONSE = (0x07),
  MLME_GET_REQUEST = (0x08),
  MLME_RESET_REQUEST = (0x09),
  MLME_RX_ENABLE_REQUEST = (0x0A),
  MLME_SCAN_REQUEST = (0x0B),
  MLME_GTS_REQUEST = (0x0C),
  MLME_START_REQUEST = (0x0D),
  MLME_POLL_REQUEST = (0x0E),
  MLME_SYNC_REQUEST = (0x0F),
  MCPS_DATA_CONFIRM = (0x10),
  MCPS_DATA_INDICATION = (0x11),
  MCPS_PURGE_CONFIRM = (0x12),
  MLME_ASSOCIATE_INDICATION = (0x13),
  MLME_ASSOCIATE_CONFIRM = (0x14),
  MLME_DISASSOCIATE_INDICATION = (0x15),
  MLME_DISASSOCIATE_CONFIRM = (0x16),
  MLME_BEACON_NOTIFY_INDICATION = (0x17),
  MLME_GTS_CONFIRM = (0x18),
  MLME_GTS_INDICATION = (0x19),
  MLME_ORPHAN_INDICATION = (0x1A),
  MLME_SCAN_CONFIRM = (0x1B),
  MLME_COMM_STATUS_INDICATION = (0x1C),
  MLME_SYNC_LOSS_INDICATION = (0x1D),
  MLME_GET_CONFIRM = (0x1E),
  MLME_SET_CONFIRM = (0x1F),
  MLME_RESET_CONFIRM = (0x20),
  MLME_RX_ENABLE_CONFIRM = (0x21),
  MLME_START_CONFIRM = (0x22),
  MLME_POLL_CONFIRM = (0x23),
  MAC_INC_FRAME = (0x24)
}
 This type contains the service primitives of the PHY-, MAC- and Network-layer as well the command-interface primitives. More...
 

Functions

retval_t mac_timers_init (void)
 
retval_t mac_timers_stop (void)
 
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_mlme_gts_req (uint16_t DevShortAddr, gts_char_t GtsChar)
 

Variables

enum msg_code SHORTENUM
 
uint8_t T_Poll_Wait_Time
 
uint8_t T_Rx_Enable
 
uint8_t T_Scan_Duration
 

#define BO_USED_FOR_MAC_PERS_TIME   (0)
#define FINAL_CAP_SLOT_DEFAULT   (0x0F)
#define LAST_MESSAGE   MLME_POLL_CONFIRM

Bump this when extending the list!

Referenced by dispatch_event().

#define MAC   (4)
#define MAC_NHLE_QUEUE_CAPACITY   255

Capacity of queue between MAC and Next Higher Layer.

Referenced by wpan_init().

#define macAckWaitDuration_def   (tal_pib.CurrentPage == 0 ? 120 : 54)

Default value for MIB macAckWaitDuration.

The default value for this PIB attribute depends on the current channel page (i.e. the modulation scheme: BPSK or O-QPSK).

#define macMaxFrameTotalWaitTime_def   (2784)

Referenced by do_init_pib().

#define MCPS_DATA_CON_LEN   (7)

The following defines describe the minimum length of a primitive message.

#define MCPS_DATA_IND_LEN   (31)
#define MCPS_PURGE_CONF_LEN   (3)
#define MLME_ASSOCIATE_CONF_LEN   (4)
#define MLME_ASSOCIATE_IND_LEN   (10)
#define MLME_BEACON_NOTIFY_IND_LEN   (2)
#define MLME_COMM_STATUS_IND_LEN   (22)
#define MLME_DISASSOCIATE_CONF_LEN   (13)
#define MLME_DISASSOCIATE_IND_LEN   (10)
#define MLME_GET_CONF_LEN   (4)
#define MLME_GTS_CONF_LEN   (3)
#define MLME_GTS_IND_LEN   (4)
#define MLME_ORPHAN_IND_LEN   (9)
#define MLME_POLL_CONF_LEN   (2)
#define MLME_RESET_CONF_LEN   (2)
#define MLME_RX_ENABLE_CONF_LEN   (2)
#define MLME_SCAN_CONF_LEN   (10)
#define MLME_SET_CONF_LEN   (3)
#define MLME_START_CONF_LEN   (2)
#define MLME_SYNC_LOSS_IND_LEN   (6)
#define NUMBER_OF_MAC_BEACON_SUPPORT_TIMERS   (0)
#define NUMBER_OF_MAC_INDIRECT_DATA_SUPPORT_TIMERS   (1)
#define NUMBER_OF_MAC_RX_ENABLE_SUPPORT_TIMERS   (1)
#define NUMBER_OF_MAC_SCAN_SUPPORT_TIMERS   (1)
#define NUMBER_OF_MAC_TIMERS
Value:
#define NUMBER_OF_MAC_SCAN_SUPPORT_TIMERS
Definition: mac_config.h:99
#define NUMBER_OF_MAC_BEACON_SUPPORT_TIMERS
Definition: mac_config.h:83
#define NUMBER_OF_MAC_INDIRECT_DATA_SUPPORT_TIMERS
Definition: mac_config.h:91
#define NUMBER_OF_MAC_RX_ENABLE_SUPPORT_TIMERS
Definition: mac_config.h:106
#define WPAN_ADDRMODE_LONG   (0x03)

Value for the address mode, where a 64 bit long address is given.

(see wpan_addr_spec_t::AddrMode)

Referenced by mlme_disassociate_request(), and wpan_mcps_data_req().

#define WPAN_ADDRMODE_NONE   (0x00)

Value for the address mode, where no address is given.

(see wpan_addr_spec_t::AddrMode)

#define WPAN_ADDRMODE_SHORT   (0x02)
#define WPAN_CAP_ALLOCADDRESS   (0x80)

Flag value for capability information field (see wpan_mlme_associate_req()).

The allocate address subfield shall be set if the device wishes the coordinator to allocate a short address as a result of the association procedure. If this subfield is set to 0, the special short address of 0xfffe shall be allocated to the device and returned through the association response command. In this case, the device shall communicate on the PAN using only its 64 bit extended address.

Referenced by usr_mlme_beacon_notify_ind(), and usr_mlme_scan_conf().

#define WPAN_CAP_ALTPANCOORD   (0x01)

Flag value for capability information field (see wpan_mlme_associate_req()).

The alternate PAN coordinator subfield shall be set if the device is capable of becoming a PAN coordinator. Otherwise, the alternate PAN coordinator subfield shall be set to 0.

#define WPAN_CAP_FFD   (0x02)

Flag value for capability information field (see wpan_mlme_associate_req()).

The device type subfield shall be set if the device is an FFD. Otherwise, the device type subfield shall be set to 0 to indicate an RFD.

#define WPAN_CAP_PWRSOURCE   (0x04)

Flag value for capability information field (see wpan_mlme_associate_req()).

The power source subfield shall be set if the device is receiving power from the alternating current mains. Otherwise, the power source subfield shall be set to 0.

#define WPAN_CAP_RXONWHENIDLE   (0x08)

Flag value for capability information field (see wpan_mlme_associate_req()).

The receiver on when idle subfield shall be set if the device does not disable its receiver to conserve power during idle periods. Otherwise, the receiver on when idle subfield shall be set to 0.

#define WPAN_DESCRIPTOR_LEN   (21)
#define WPAN_DISASSOC_BYCHILD   (0x02)

Symbolic constant for disassociate reason - initiated by child (see wpan_mlme_disassociate_req())

#define WPAN_DISASSOC_BYPARENT   (0x01)

Symbolic constant for disassociate reason - initiated by parent (see wpan_mlme_disassociate_req())

#define WPAN_NUM_EXTENDED_ADDR_PENDING (   x)    (((x) >> 4) & 0x7)

Macro to extract size of extended address list in PAN descriptor.

#define WPAN_NUM_SHORT_ADDR_PENDING (   x)    ((x) & 0x7)

Marco to extract size of short address list in PAN descriptor.

typedef void(* handler_t)(uint8_t *)

MAC poll states.

These states describe the current status of the MAC for polling for devices or coordinators, not for PAN coordinator.

MAC sleep state type.

Device or coordinator scan states.

MAC state type.

MAC state type.

Device or coordinator sync states.

MAC poll states.

These states describe the current status of the MAC for polling for devices or coordinators, not for PAN coordinator.

Enumerator
MAC_POLL_IDLE 

No polling ongoing.

MAC_AWAIT_ASSOC_RESPONSE 

Successful transmission of association request frame, wait for Association response.

MAC_POLL_EXPLICIT 

Explicit poll ongoing (MLME_POLL.request), Ack after Data request frame transmission received, awaiting data response.

MAC_POLL_IMPLICIT 

Implicit poll ongoing (more pending data detected, either in beacon or data frame), awaiting data response,.

MAC sleep state type.

Enumerator
RADIO_AWAKE 

Radio is awake.

Radio is in sleep mode

RADIO_SLEEPING 

Device or coordinator scan states.

Enumerator
MAC_SCAN_IDLE 

No scanning ongoing.

MAC_SCAN_ED 

ED scan ongoing.

MAC_SCAN_ACTIVE 

Active scan proceeding.

MAC_SCAN_ORPHAN 

Orphan scan proceeding.

MAC_SCAN_PASSIVE 

Passive scan proceeding.

MAC state type.

Enumerator
MAC_IDLE 

Node is idle, i.e.

it is neither associated nor has started its own network

MAC_ASSOCIATED 
MAC_COORDINATOR 

Coordinator successfully associated with PAN Coordinator and successfully started network with same PAN-Id (not as PAN Coordinator)

MAC_PAN_COORD_STARTED 

PAN coordinator successfully started.

MAC state type.

Enumerator
MAC_ACTIVE_CAP 
MAC_INACTIVE 
MAC_NOBEACON 

Device or coordinator sync states.

Enumerator
MAC_SYNC_NEVER 

Do not track beacons.

MAC_SYNC_ONCE 

Track the next beacon.

MAC_SYNC_TRACKING_BEACON 

Track beacons continuously.

MAC_SYNC_BEFORE_ASSOC 

Track beacons continuously before beeing associated in order to obtain synchronization with desired network.

enum msg_code

This type contains the service primitives of the PHY-, MAC- and Network-layer as well the command-interface primitives.

Enumerator
TAL_DATA_INDICATION 
MLME_ASSOCIATE_REQUEST 
MLME_ASSOCIATE_RESPONSE 
MCPS_DATA_REQUEST 
MCPS_PURGE_REQUEST 
MLME_DISASSOCIATE_REQUEST 
MLME_SET_REQUEST 
MLME_ORPHAN_RESPONSE 
MLME_GET_REQUEST 
MLME_RESET_REQUEST 
MLME_RX_ENABLE_REQUEST 
MLME_SCAN_REQUEST 
MLME_GTS_REQUEST 
MLME_START_REQUEST 
MLME_POLL_REQUEST 
MLME_SYNC_REQUEST 
MCPS_DATA_CONFIRM 
MCPS_DATA_INDICATION 
MCPS_PURGE_CONFIRM 
MLME_ASSOCIATE_INDICATION 
MLME_ASSOCIATE_CONFIRM 
MLME_DISASSOCIATE_INDICATION 
MLME_DISASSOCIATE_CONFIRM 
MLME_BEACON_NOTIFY_INDICATION 
MLME_GTS_CONFIRM 
MLME_GTS_INDICATION 
MLME_ORPHAN_INDICATION 
MLME_SCAN_CONFIRM 
MLME_COMM_STATUS_INDICATION 
MLME_SYNC_LOSS_INDICATION 
MLME_GET_CONFIRM 
MLME_SET_CONFIRM 
MLME_RESET_CONFIRM 
MLME_RX_ENABLE_CONFIRM 
MLME_START_CONFIRM 
MLME_POLL_CONFIRM 
MAC_INC_FRAME 

retval_t mac_timers_init ( void  )
retval_t mac_timers_stop ( void  )
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, ADDR_COPY_DST_SRC_64, wpan_addr_spec_tag::AddrMode, aMaxMACPayloadSize, bmm_buffer_alloc(), bmm_buffer_free(), BMM_BUFFER_POINTER, mcps_data_req_tag::cmdcode, CPU_ENDIAN_TO_LE16, mcps_data_req_tag::DstAddr, mcps_data_req_tag::DstAddrMode, mcps_data_req_tag::DstPANId, FCS_LEN, LARGE_BUFFER_SIZE, address_field_t::long_address, MAC_SUCCESS, MCPS_DATA_REQUEST, mcps_data_req_tag::msduHandle, mcps_data_req_tag::msduLength, nhle_mac_q, wpan_addr_spec_tag::PANId, qmm_queue_append(), mcps_data_req_tag::SrcAddrMode, mcps_data_req_tag::TxOptions, WPAN_ADDRMODE_LONG, and WPAN_ADDRMODE_SHORT.

Referenced by send_data(), and usr_mlme_beacon_notify_ind().

bool wpan_mlme_gts_req ( uint16_t  DevShortAddr,
gts_char_t  GtsChar 
)

Referenced by usr_mlme_associate_conf().