?? rt_linux.h
字號:
//Patch for ASIC turst read/write bug, needs to remove after metel fix#define RTMP_IO_READ32(_A, _R, _pV) \{ \ (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ (*_pV = SWAP32(readl((void *)((_A)->CSRBaseAddress + (_R))))); \}#define RTMP_IO_READ8(_A, _R, _pV) \{ \ (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ (*_pV = readb((void *)((_A)->CSRBaseAddress + (_R)))); \}#define RTMP_IO_WRITE32(_A, _R, _V) \{ \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writel(SWAP32(_V), (void *)((_A)->CSRBaseAddress + (_R))); \}#define RTMP_IO_WRITE8(_A, _R, _V) \{ \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \}#define RTMP_IO_WRITE16(_A, _R, _V) \{ \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writew(SWAP16((_V)), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \}#else//Patch for ASIC turst read/write bug, needs to remove after metel fix#define RTMP_IO_READ32(_A, _R, _pV) \{ \ (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \}#define RTMP_IO_READ8(_A, _R, _pV) \{ \ (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ (*_pV = readb((void *)((_A)->CSRBaseAddress + (_R)))); \}#define RTMP_IO_WRITE32(_A, _R, _V) \{ \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writel(_V, (void *)((_A)->CSRBaseAddress + (_R))); \}#define RTMP_IO_WRITE8(_A, _R, _V) \{ \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \}#define RTMP_IO_WRITE16(_A, _R, _V) \{ \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \}#endif#else//Patch for ASIC turst read/write bug, needs to remove after metel fix#define RTMP_IO_READ32(_A, _R, _pV) \{ \}#define RTMP_IO_READ8(_A, _R, _pV) \{ \}#define RTMP_IO_WRITE32(_A, _R, _V) \{ \ printk("_V = %x\n", _V); \}#define RTMP_IO_WRITE8(_A, _R, _V) \{ \ printk("_V = %x\n", _V); \}#define RTMP_IO_WRITE16(_A, _R, _V) \{ \}#endif typedef void (*TIMER_FUNCTION)(unsigned long);#define RTMP_IndicateMediaState()#define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN)#define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE)#define MlmeFreeMemory(_pAd, _pVA) os_free_mem(_pAd, _pVA)#define BUILD_TIMER_FUNCTION(_func) \void linux_##_func(unsigned long data) \{ \ PRALINK_TIMER_STRUCT pTimer = (PRALINK_TIMER_STRUCT) data; \ \ _func(NULL, (PVOID) pTimer->cookie, NULL, NULL); \ if (pTimer->Repeat) \ RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \}#define DECLARE_TIMER_FUNCTION(_func) \void linux_##_func(unsigned long data) #define GET_TIMER_FUNCTION(_func) \ linux_##_func DECLARE_TIMER_FUNCTION(MlmePeriodicExec);DECLARE_TIMER_FUNCTION(MlmeRssiReportExec);DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout);DECLARE_TIMER_FUNCTION(APSDPeriodicExec);DECLARE_TIMER_FUNCTION(AsicRfTuningExec);#ifdef CONFIG_STA_SUPPORTDECLARE_TIMER_FUNCTION(BeaconTimeout);DECLARE_TIMER_FUNCTION(ScanTimeout);DECLARE_TIMER_FUNCTION(AuthTimeout);DECLARE_TIMER_FUNCTION(AssocTimeout);DECLARE_TIMER_FUNCTION(ReassocTimeout);DECLARE_TIMER_FUNCTION(DisassocTimeout);DECLARE_TIMER_FUNCTION(LinkDownExec);#ifdef LEAP_SUPPORTDECLARE_TIMER_FUNCTION(LeapAuthTimeout);#endifDECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec);DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);#endif // CONFIG_STA_SUPPORT //void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time);/* * packet helper * - convert internal rt packet to os packet or * os packet to rt packet */ #define RTPKT_TO_OSPKT(_p) ((struct sk_buff *)(_p))#define OSPKT_TO_RTPKT(_p) ((PNDIS_PACKET)(_p))#define GET_OS_PKT_DATAPTR(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->data)#define GET_OS_PKT_LEN(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->len)#define GET_OS_PKT_TYPE(_pkt) \ (RTPKT_TO_OSPKT(_pkt))#define GET_OS_PKT_NEXT(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->next)#define OS_NTOHS(_Val) \ (ntohs(_Val))#define OS_HTONS(_Val) \ (htons(_Val))#define OS_NTOHL(_Val) \ (ntohl(_Val))#define OS_HTONL(_Val) \ (htonl(_Val))/* statistics counter */#define STATS_INC_RX_PACKETS(_pAd, _dev)#define STATS_INC_TX_PACKETS(_pAd, _dev)#define STATS_INC_RX_BYTESS(_pAd, _dev, len)#define STATS_INC_TX_BYTESS(_pAd, _dev, len)#define STATS_INC_RX_ERRORS(_pAd, _dev)#define STATS_INC_TX_ERRORS(_pAd, _dev)#define STATS_INC_RX_DROPPED(_pAd, _dev)#define STATS_INC_TX_DROPPED(_pAd, _dev)#define CB_OFF 10// check DDK NDIS_PACKET data structure and find out only MiniportReservedEx[0..7] can be used by our driver without// ambiguity. Fields after pPacket->MiniportReservedEx[8] may be used by other wrapper layer thus crashes the driver////#define RTMP_GET_PACKET_MR(_p) (RTPKT_TO_OSPKT(_p))// User Priority#define RTMP_SET_PACKET_UP(_p, _prio) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0] = _prio)#define RTMP_GET_PACKET_UP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0])// Fragment ##define RTMP_SET_PACKET_FRAGMENTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1] = _num) #define RTMP_GET_PACKET_FRAGMENTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1])// 0x0 ~0x7f: TX to AP's own BSS which has the specified AID. if AID>127, set bit 7 in RTMP_SET_PACKET_EMACTAB too. //(this value also as MAC(on-chip WCID) table index)// 0x80~0xff: TX to a WDS link. b0~6: WDS index#define RTMP_SET_PACKET_WCID(_p, _wdsidx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2] = _wdsidx)#define RTMP_GET_PACKET_WCID(_p) ((UCHAR)(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2]))// 0xff: PKTSRC_NDIS, others: local TX buffer index. This value affects how to a packet#define RTMP_SET_PACKET_SOURCE(_p, _pktsrc) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3] = _pktsrc)#define RTMP_GET_PACKET_SOURCE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3]) // RTS/CTS-to-self protection method#define RTMP_SET_PACKET_RTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4] = _num)#define RTMP_GET_PACKET_RTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4]) // see RTMP_S(G)ET_PACKET_EMACTAB// TX rate index#define RTMP_SET_PACKET_TXRATE(_p, _rate) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5] = _rate)#define RTMP_GET_PACKET_TXRATE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5])// From which Interface #define RTMP_SET_PACKET_IF(_p, _ifdx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6] = _ifdx)#define RTMP_GET_PACKET_IF(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6])#define RTMP_SET_PACKET_NET_DEVICE_MBSSID(_p, _bss) RTMP_SET_PACKET_IF((_p), (_bss))#define RTMP_SET_PACKET_NET_DEVICE_WDS(_p, _bss) RTMP_SET_PACKET_IF((_p), ((_bss) + MIN_NET_DEVICE_FOR_WDS))#define RTMP_SET_PACKET_NET_DEVICE_APCLI(_p, _idx) RTMP_SET_PACKET_IF((_p), ((_idx) + MIN_NET_DEVICE_FOR_APCLI))#define RTMP_GET_PACKET_NET_DEVICE_MBSSID(_p) RTMP_GET_PACKET_IF((_p))#define RTMP_GET_PACKET_NET_DEVICE(_p) RTMP_GET_PACKET_IF((_p))#define RTMP_SET_PACKET_MOREDATA(_p, _morebit) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7] = _morebit)#define RTMP_GET_PACKET_MOREDATA(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7])//#define RTMP_SET_PACKET_NET_DEVICE_MBSSID(_p, _bss) (RTPKT_TO_OSPKT(_p)->cb[8] = _bss)//#define RTMP_GET_PACKET_NET_DEVICE_MBSSID(_p) (RTPKT_TO_OSPKT(_p)->cb[8])#define RTMP_SET_PACKET_DHCP(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] = _flg)#define RTMP_GET_PACKET_DHCP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11])// This frame is WPA four-way handshaking message #define RTMP_SET_PACKET_WPA_4WAY_MSG(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12] = _flg)#define RTMP_GET_PACKET_WPA_4WAY_MSG(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12])#define RTMP_SET_PACKET_5VT(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22] = _flg)#define RTMP_GET_PACKET_5VT(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22])#ifdef CONFIG_5VT_ENHANCE#define BRIDGE_TAG 0x35564252 // depends on 5VT define in br_input.c#endif#define NDIS_SET_PACKET_STATUS(_p, _status)#define GET_SG_LIST_FROM_PACKET(_p, _sc) \ rt_get_sg_list_from_packet(_p, _sc)#define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length)#define NdisZeroMemory(Destination, Length) memset(Destination, 0, Length)#define NdisFillMemory(Destination, Length, Fill) memset(Destination, Fill, Length)#define NdisEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length))#define RTMPEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length)) #define RTMP_INC_REF(_A) 0#define RTMP_DEC_REF(_A) 0#define RTMP_GET_REF(_A) 0/* * ULONG * RTMP_GetPhysicalAddressLow( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); */#define RTMP_GetPhysicalAddressLow(PhysicalAddress) (PhysicalAddress)/* * ULONG * RTMP_GetPhysicalAddressHigh( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); */#define RTMP_GetPhysicalAddressHigh(PhysicalAddress) (0)/* * VOID * RTMP_SetPhysicalAddressLow( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, * IN ULONG Value); */#define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value) \ PhysicalAddress = Value;/* * VOID * RTMP_SetPhysicalAddressHigh( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, * IN ULONG Value); */#define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value)//CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx);#define QUEUE_ENTRY_TO_PACKET(pEntry) \ (PNDIS_PACKET)(pEntry)#define PACKET_TO_QUEUE_ENTRY(pPacket) \ (PQUEUE_ENTRY)(pPacket)#ifndef CONTAINING_RECORD#define CONTAINING_RECORD(address, type, field) \((type *)((PCHAR)(address) - offsetof(type, field)))#endif#define RELEASE_NDIS_PACKET(_pAd, _pPacket, _Status) \{ \ if (RTMP_GET_PACKET_SOURCE(_pPacket) == PKTSRC_NDIS) \ { \ RTMPFreeNdisPacket(_pAd, _pPacket); \ _pAd->RalinkCounters.PendingNdisPacketCount --; \ } \ else \ RTMPFreeNdisPacket(_pAd, _pPacket); \}#define SWITCH_PhyAB(_pAA, _pBB) \{ \ ULONG AABasePaHigh; \ ULONG AABasePaLow; \ ULONG BBBasePaHigh; \ ULONG BBBasePaLow; \ BBBasePaHigh = RTMP_GetPhysicalAddressHigh(_pBB); \ BBBasePaLow = RTMP_GetPhysicalAddressLow(_pBB); \ AABasePaHigh = RTMP_GetPhysicalAddressHigh(_pAA); \ AABasePaLow = RTMP_GetPhysicalAddressLow(_pAA); \ RTMP_SetPhysicalAddressHigh(_pAA, BBBasePaHigh); \ RTMP_SetPhysicalAddressLow(_pAA, BBBasePaLow); \ RTMP_SetPhysicalAddressHigh(_pBB, AABasePaHigh); \ RTMP_SetPhysicalAddressLow(_pBB, AABasePaLow); \}#define NdisWriteErrorLogEntry(_a, _b, _c, _d)#define NdisMAllocateMapRegisters(_a, _b, _c, _d, _e) NDIS_STATUS_SUCCESS#define NdisAcquireSpinLock RTMP_SEM_LOCK#define NdisReleaseSpinLock RTMP_SEM_UNLOCKstatic inline void NdisGetSystemUpTime(ULONG *time){ *time = jiffies;}//pPacket = CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx);#define QUEUE_ENTRY_TO_PKT(pEntry) \ ((PNDIS_PACKET) (pEntry))int rt2860_packet_xmit(struct sk_buff *skb);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -