首先MAC顶层架构分析
(一)MAC静态数据结构变量
1:static mac_pcb_t pcb :MAC protocol control block instantiation
typedef struct
{
U8 mac_state; ///< Current state
struct ctimer mlme_tmr; ///< Callback timer shared by MAC managment functions// association
address_t parent_addr; ///< Address of parent this device is requesting to join
U8 assoc_req_dsn; ///< DSN of association request// channel scanning
U16 original_pan_id; ///< Original PAN ID before channel scan
U8 curr_scan_channel; ///< Current channel being scanned
U32 channel_mask; ///< Channel mask for this scan
U8 duration; ///< Duration of this scan
U8 nwk_cnt; ///< Number of networks found
U8 scan_type; ///< Type of scan to be performed
bool coor_realign_rcvd; ///< Coordinator alignment received for orphan scan
U8 energy_list[MAC_MAX_CHANNELS]; ///< Energy list to store values from energy scan// statistics
U16 total_xmit; ///< Total number of transmissions attempted
U16 total_fail;