MAC层源码分析并移植

本文档详细分析了MAC层的源码,包括MAC协议控制块实例化、信息库实例化、初始化函数以及MAC层的各类接口。重点介绍了mac_init()函数的执行流程,mac_data_req()和mac_cmd_handler()函数在处理数据请求和命令帧时的角色。同时提到了MAC子层的多个辅助函数,这些函数在处理网络连接、数据传输和响应中起到关键作用。
摘要由CSDN通过智能技术生成

首先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;                                                    

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值