📄 rxtx.c
字号:
/* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * This software is copyrighted by and is the sole property of * VIA Networking Technologies, Inc. This software may only be used * in accordance with the corresponding license agreement. Any unauthorized * use, duplication, transmission, distribution, or disclosure of this * software is expressly forbidden. * * This software is provided by VIA Networking Technologies, Inc. "as is" * and any express or implied warranties, including, but not limited to, the * implied warranties of merchantability and fitness for a particular purpose * are disclaimed. In no event shall VIA Networking Technologies, Inc. * be liable for any direct, indirect, incidental, special, exemplary, or * consequential damages. * * File: rxtx.c * * Purpose: handle WMAC/802.3/802.11 rx & tx functions * * Author: Lyndon Chen * * Date: May 20, 2003 * * Functions: * s_vGenerateTxParameter - Generate tx dma requried parameter. * s_vGenerateMACHeader - Translate 802.3 to 802.11 header * csBeacon_xmit - beacon tx function * csMgmt_xmit - management tx function * s_uGetDataDuration - get tx data required duration * s_uFillDataHead- fulfill tx data duration header * s_uGetRTSCTSDuration- get rtx/cts requried duration * s_uGetRTSCTSRsvTime- get rts/cts reserved time * s_uGetTxRsvTime- get frame reserved time * s_vFillCTSHead- fulfill CTS ctl header * s_vFillFragParameter- Set fragement ctl parameter. * s_vFillRTSHead- fulfill RTS ctl header * s_vFillTxKey- fulfill tx encrypt key * s_vSWencryption- Software encrypt header * vDMA0_tx_80211- tx 802.11 frame via dma0 * vGenerateFIFOHeader- Generate tx FIFO ctl header * * Revision History: * */ #if !defined(__DEVICE_H__)#include "device.h"#endif#if !defined(__RXTX_H__)#include "rxtx.h"#endif#if !defined(__TETHER_H__)#include "tether.h"#endif#if !defined(__CARD_H__)#include "card.h"#endif#if !defined(__BSSDB_H__)#include "bssdb.h"#endif#if !defined(__MAC_H__)#include "mac.h"#endif#if !defined(__BASEBAND_H__)#include "baseband.h"#endif#if !defined(__UMEM_H__)#include "umem.h"#endif#if !defined(__MICHAEL_H__)#include "michael.h"#endif#if !defined(__TKIP_H__)#include "tkip.h"#endif#if !defined(__TCRC_H__)#include "tcrc.h"#endif#if !defined(__WCTL_H__)#include "wctl.h"#endif#if !defined(__TBIT_H__)#include "tbit.h"#endif#if !defined(__HOSTAP_H__)#include "hostap.h"#endif#if !defined(__RF_H__)#include "rf.h"#endif#if !defined(__DATARATE_H__)#include "datarate.h"#endif#if !defined(__USBPIPE_H__)#include "usbpipe.h"#endif#ifdef WPA_SM_Transtatus#if !defined(__IOCMD_H__)#include "iocmd.h"#endif#endif/*--------------------- Static Definitions -------------------------*//*--------------------- Static Classes ----------------------------*//*--------------------- Static Variables --------------------------*///static int msglevel =MSG_LEVEL_DEBUG;static int msglevel =MSG_LEVEL_INFO;/*--------------------- Static Functions --------------------------*//*--------------------- Static Definitions -------------------------*/#define CRITICAL_PACKET_LEN 256 // if packet size < 256 -> in-direct send // packet size >= 256 -> direct sendconst WORD wTimeStampOff[2][MAX_RATE] = { {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble }; const WORD wFB_Opt0[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, // fallback_rate0 {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, // fallback_rate1 };const WORD wFB_Opt1[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, // fallback_rate0 {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1 }; #define RTSDUR_BB 0#define RTSDUR_BA 1#define RTSDUR_AA 2#define CTSDUR_BA 3#define RTSDUR_BA_F0 4#define RTSDUR_AA_F0 5#define RTSDUR_BA_F1 6#define RTSDUR_AA_F1 7#define CTSDUR_BA_F0 8#define CTSDUR_BA_F1 9#define DATADUR_B 10#define DATADUR_A 11#define DATADUR_A_F0 12#define DATADUR_A_F1 13/*--------------------- Static Functions --------------------------*/staticVOID s_vSaveTxPktInfo( IN PSDevice pDevice, IN BYTE byPktNum, IN PBYTE pbyDestAddr, IN WORD wPktLength, IN WORD wFIFOCtl);staticPVOIDs_vGetFreeContext( PSDevice pDevice );staticVOIDs_vGenerateTxParameter( IN PSDevice pDevice, IN BYTE byPktType, IN WORD wCurrentRate, IN PVOID pTxBufHead, IN PVOID pvRrvTime, IN PVOID pvRTS, IN PVOID pvCTS, IN UINT cbFrameSize, IN BOOL bNeedACK, IN UINT uDMAIdx, IN PSEthernetHeader psEthHeader ); staticUINTs_uFillDataHead ( IN PSDevice pDevice, IN BYTE byPktType, IN WORD wCurrentRate, IN PVOID pTxDataHead, IN UINT cbFrameLength, IN UINT uDMAIdx, IN BOOL bNeedAck, IN UINT uFragIdx, IN UINT cbLastFragmentSize, IN UINT uMACfragNum, IN BYTE byFBOption ); staticVOIDs_vGenerateMACHeader ( IN PSDevice pDevice, IN PBYTE pbyBufferAddr, IN WORD wDuration, IN PSEthernetHeader psEthHeader, IN BOOL bNeedEncrypt, IN WORD wFragType, IN UINT uDMAIdx, IN UINT uFragIdx ); staticVOIDs_vFillTxKey( IN PSDevice pDevice, IN PBYTE pbyBuf, IN PBYTE pbyIVHead, IN PSKeyItem pTransmitKey, IN PBYTE pbyHdrBuf, IN WORD wPayloadLen, OUT PBYTE pMICHDR ); staticVOIDs_vSWencryption ( IN PSDevice pDevice, IN PSKeyItem pTransmitKey, IN PBYTE pbyPayloadHead, IN WORD wPayloadSize ); staticUINTs_uGetTxRsvTime ( IN PSDevice pDevice, IN BYTE byPktType, IN UINT cbFrameLength, IN WORD wRate, IN BOOL bNeedAck ); staticUINTs_uGetRTSCTSRsvTime ( IN PSDevice pDevice, IN BYTE byRTSRsvType, IN BYTE byPktType, IN UINT cbFrameLength, IN WORD wCurrentRate ); staticVOIDs_vFillCTSHead ( IN PSDevice pDevice, IN UINT uDMAIdx, IN BYTE byPktType, IN PVOID pvCTS, IN UINT cbFrameLength, IN BOOL bNeedAck, IN BOOL bDisCRC, IN WORD wCurrentRate, IN BYTE byFBOption ); staticVOIDs_vFillRTSHead( IN PSDevice pDevice, IN BYTE byPktType, IN PVOID pvRTS, IN UINT cbFrameLength, IN BOOL bNeedAck, IN BOOL bDisCRC, IN PSEthernetHeader psEthHeader, IN WORD wCurrentRate, IN BYTE byFBOption ); staticUINTs_uGetDataDuration ( IN PSDevice pDevice, IN BYTE byDurType, IN UINT cbFrameLength, IN BYTE byPktType, IN WORD wRate, IN BOOL bNeedAck, IN UINT uFragIdx, IN UINT cbLastFragmentSize, IN UINT uMACfragNum, IN BYTE byFBOption ); staticUINTs_uGetRTSCTSDuration ( IN PSDevice pDevice, IN BYTE byDurType, IN UINT cbFrameLength, IN BYTE byPktType, IN WORD wRate, IN BOOL bNeedAck, IN BYTE byFBOption ); /*--------------------- Export Variables --------------------------*/staticPVOIDs_vGetFreeContext( PSDevice pDevice )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -