硬件收报-协议层

上传人:kms****20 文档编号:40486793 上传时间:2018-05-26 格式:DOC 页数:22 大小:110KB
返回 下载 相关 举报
硬件收报-协议层_第1页
第1页 / 共22页
硬件收报-协议层_第2页
第2页 / 共22页
硬件收报-协议层_第3页
第3页 / 共22页
硬件收报-协议层_第4页
第4页 / 共22页
硬件收报-协议层_第5页
第5页 / 共22页
点击查看更多>>
资源描述

《硬件收报-协议层》由会员分享,可在线阅读,更多相关《硬件收报-协议层(22页珍藏版)》请在金锄头文库上搜索。

1、收报的一般流程流程收报的一般流程流程初始化设备时申请了 DMA buffer,用来收报文,初始化的末尾阶段,开启中断,等待数据包到来;数据 报文来了之后,一般硬件上有 rx_buf(是个 FIFO,先进先出,类似管道) ,当 rx_buf 数据到达一定容限,或者 超时,触发硬件收报中断,报文以 DMA 方式传送到 DMA buffer,然后向协议层报告数据报文的所在的 DMA buffer 地址等描述符相关信息,协议层完成剩余的处理流程,处理完成后一般还有一个反馈过程,但是我们的 驱动中没有这样的过程。硬件寄存器定义硬件寄存器定义/* DMA Control and Interrupt Reg

2、isters */ #define AR_CR 0x0008 /* MAC control register */ #define AR_RXDP 0x000C /* MAC receive queue descriptor pointer */ #define AR_CFG 0x0014 /* MAC configuration and status register */ #define AR_IER 0x0024 /* MAC Interrupt enable register */ /* Get the RX Descriptor.*/ u_int32_t ar5416GetRxDP(

3、struct ath_hal *ath) return OS_REG_READ(ath, AR_RXDP); /* Set the Rx Descriptor.*/ void ar5416SetRxDP(struct ath_hal *ah, u_int32_t rxdp) OS_REG_WRITE(ah, AR_RXDP, rxdp);HALASSERT(OS_REG_READ(ah, AR_RXDP) = rxdp); HAL 层的层的 API /* Hardware Access Layer (HAL) API.* Clients of the HAL call ath_hal_atta

4、ch to obtain a reference to an* ath_hal structure for use with the device. Hardware-related operations* that follow must call back into the HAL through interface, supplying* the reference as the first parameter. Note that before using the* reference returned by ath_hal_attach the caller should verif

5、y the* ABI version number.*/ struct ath_hal()/结构体 . /硬件收报相关的函数指针表/* Receive Functions 定义*/u_int32_t _ahdecl(*ah_getRxDP)(struct ath_hal*);void _ahdecl(*ah_setRxDP)(struct ath_hal*, u_int32_t rxdp);void _ahdecl(*ah_enableReceive)(struct ath_hal*);HAL_BOOL _ahdecl(*ah_stopDmaReceive)(struct ath_hal*);

6、void _ahdecl(*ah_startPcuReceive)(struct ath_hal*);void _ahdecl(*ah_stopPcuReceive)(struct ath_hal*);void _ahdecl(*ah_setMulticastFilter)(struct ath_hal*,u_int32_t filter0, u_int32_t filter1);HAL_BOOL _ahdecl(*ah_setMulticastFilterIndex)(struct ath_hal*,u_int32_t index);HAL_BOOL _ahdecl(*ah_clrMulti

7、castFilterIndex)(struct ath_hal*,u_int32_t index);u_int32_t _ahdecl(*ah_getRxFilter)(struct ath_hal*);void _ahdecl(*ah_setRxFilter)(struct ath_hal*, u_int32_t);HAL_BOOL _ahdecl(*ah_setRxAbort)(struct ath_hal*, HAL_BOOL);HAL_BOOL _ahdecl(*ah_setupRxDesc)(struct ath_hal *, struct ath_desc *,u_int32_t

8、size, u_int flags);HAL_STATUS _ahdecl(*ah_procRxDesc)(struct ath_hal *, struct ath_desc *,u_int32_t phyAddr, struct ath_desc *next,u_int64_t tsf);void _ahdecl(*ah_rxMonitor)(struct ath_hal *,const HAL_NODE_STATS *, HAL_CHANNEL *);void _ahdecl(*ah_procMibEvent)(struct ath_hal *,const HAL_NODE_STATS *

9、);; ath_hal_attach 阶段根据芯片的 ID,使用不同的芯片 attch 函数,如 ar5312Attach,ar5212Attach,ar5211Attach,ar5210Attach,ar5416Attachstatic const struct ath_hal_private ar5416hal()/9223,9283 等芯片的 hal attach 函数 struct ath_hal();./* RX Functions 实体化*/ar5416GetRxDP,ar5416SetRxDP,ar5416EnableReceive,ar5416StopDmaReceive,ar

10、5416StartPcuReceive,ar5416StopPcuReceive,ar5416SetMulticastFilter,ar5416SetMulticastFilterIndex,ar5416ClrMulticastFilterIndex,ar5416GetRxFilter,ar5416SetRxFilter,ar5416SetRxAbort,ar5416SetupRxDesc,ar5416ProcRxDesc,ar5416AniArPoll,ar5416ProcessMibIntr, struct ath_hal_5416 /9223,928x 等对应的 hal 对象 struc

11、t ath_hal_private ah_priv; /其他特性的函数 ar5416Attach 时初始化 (驱动编译时选择 ar5416 相关的宏) ar5416Attach() ah (hal 结构体)/给函数指针赋值,函数绑定ah-ah_set11nTxDesc = ar5416Set11nTxDesc;ah-ah_set11nRateScenario = ar5416Set11nRateScenario;ah-ah_set11nAggrFirst = ar5416Set11nAggrFirst;ah-ah_set11nAggrMiddle = ar5416Set11nAggrMiddl

12、e;ah-ah_set11nAggrLast = ar5416Set11nAggrLast;ah-ah_clr11nAggr = ar5416Clr11nAggr;ah-ah_set11nBurstDuration = ar5416Set11nBurstDuration;ah-ah_setupRxDesc = ar5416SetupRxDesc;ah-ah_procRxDesc = ar5416ProcRxDesc;ah-ah_updateCTSForBursting= ar5416UpdateCTSForBursting;ah-ah_setupTxDesc = ar5416SetupTxDe

13、sc;ah-ah_setupXTxDesc = ar5416SetupXTxDesc;ah-ah_fillTxDesc = ar5416FillTxDesc;ah-ah_clearTxDescStatus = ar5416ClearTxDescStatus;ah-ah_procTxDesc = ar5416ProcTxDesc; 宏替换宏替换将 ath_hal_5416 (hal 对象)中的函数名做了一次宏替换/* HAL definitions to comply with local coding convention.*/ #define ath_hal_reset(_ah, _opmo

14、de, _chan, _macmode, _txchainmask, _rxchainmask, _extprotspacing, _outdoor, _pstatus) (*(_ah)-ah_reset)(_ah), (_opmode), (_chan), (_macmode), (_txchainmask), (_rxchainmask), (_extprotspacing), (_outdoor), (_pstatus) #define ath_hal_getratetable(_ah, _mode) (*(_ah)-ah_getRateTable)(_ah), (_mode) #def

15、ine ath_hal_getmac(_ah, _mac) (*(_ah)-ah_getMacAddress)(_ah), (_mac) #define ath_hal_setmac(_ah, _mac) (*(_ah)-ah_setMacAddress)(_ah), (_mac) #define ath_hal_getbssidmask(_ah, _mask) (*(_ah)-ah_getBssIdMask)(_ah), (_mask) #define ath_hal_setbssidmask(_ah, _mask) (*(_ah)-ah_setBssIdMask)(_ah), (_mask) #define ath_hal_intrset(_ah, _mask) (*(_ah)-ah_setInterrupts)(_ah), (_mask) #define ath_hal_intrget(_ah) (*(_ah)-ah_getInterrupts)(_ah) #de

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号