📄 csv8950.h
字号:
//**********************************************************************
//
// Filename: CSV8950.h
//
// Description:
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Use of this source code is subject to the terms of the Cirrus end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to
// use this source code. For a copy of the EULA, please see the
// EULA.RTF on your install media.
//
// Copyright(c) Cirrus Logic Corporation 2005, All Rights Reserved
//
//**********************************************************************
#ifndef _CSv8950_H_
#define _CSv8950_H_
#include "Cs8950hw.h"
/*
* 5.1 Receive Descriptor Format
*/
typedef struct RxDesc_tag {
unsigned long RxBufAdr; /* phys buffer address */
unsigned short BufLength; /* size */
#define RxDesc_BufIndx_Mask 0x7FFF /* index number used by driver */
#define RxDesc_NotSOF 0x8000 /* not start of frame (in BufIndx) */
unsigned short BufIndx; /* index number for use by driver */
} RxDesc_t;
/*
* 5.3 Receive Status Format
*
* Warning: RxStat is a ulong compared to ushort for TxStat
*/
typedef struct RxStat_tag {
#define RxStat_RxFP (1L<<0x1f) /* rx frame process bit */
#define RxStat_RxWE (1L<<0x1e) /* rx without error */
#define RxStat_EOF (1L<<0x1d) /* end of frame data */
#define RxStat_EOB (1L<<0x1c) /* end of buffer */
#define RxStat_AdMatch_Mask (0x000C0000) /* address match */
#define RxStat_AdMatch_IA (0x00000000) /* individual address match */
#define RxStat_AdMatch_GA (0x00040000) /* global address match */
#define RxStat_AdMatch_HashIA (0x00080000) /* hashed individual address match */
#define RxStat_AdMatch_HashMC (0x000C0000) /* hashed multicast address match */
#define RxStat_Error_Mask (0x003F0000) /* receive error mask */
#define RxStat_Rx_Err (1L<<0x15) /* RX_ERR (MII pin) set */
#define RxStat_OverrunErr (1L<<0x14) /* overrun */
#define RxStat_FramingErr (1L<<0x13) /* bad crc or incorrect # of bytes */
#define RxStat_Runt (1L<<0x12) /* frame shorter than 64 bytes */
#define RxStat_ExtraData (1L<<0x11) /* frame >= MaxFrameLen reg */
#define RxStat_CRCErr (1L<<0x10) /* bad crc */
#define RxStat_CRCIncluded (1L<<0x0F) /* crc included with frame data */
#define RxStat_HashTbIndx_Mask (0x00003F00) /* hash table index */
#define RxStat_HashTbIndx_IA0 (0x00000100) /* frame matched ind addr 0 */
#define RxStat_HashTbIndx_IA1 (0x00000200) /* frame matched ind addr 1 */
#define RxStat_HashTbIndx_IA2 (0x00000400) /* frame matched ind addr 2 */
#define RxStat_HashTbIndx_IA3 (0x00000800) /* frame matched ind addr 3 */
unsigned long RxStat; /* Rx status double word */
unsigned short FrameLength; /* total bytes copied to buffer */
#define RxStat_BufIndx_Mask 0x7FFF
#define RxStat_RFP 0x8000 /* set to 1 by chip (for use by driver) */
unsigned short BufIndx; /* BufIndx copied from RxDesc */
} RxStat_t;
/*
* 5.10 Transmit Descriptor Format
*/
typedef struct TxDesc_tag {
unsigned long TxBufAdr; /* phys buffer address */
#define TxDesc_BufLength_Mask 0x0fff
#define TxDesc_AbortFrame 0x8000 /* used to invalidate frame */
unsigned short BufLength; /* size */
#define TxDesc_BufIndx_Mask 0x7FFF
#define TxDesc_EOF 0x8000 /* end of frame flag */
unsigned short BufIndx; /* index number for use by driver */
} TxDesc_t;
/*
* 5.12 Transmit Status Format
*
* Warning: TxStat is a ushort compared to ulong for RxStat
*/
typedef struct TxStat_tag {
#define TxStat_BufIndx_Mask 0x7FFF
unsigned short BufIndx; /* BufIndx copied from TxDesc */
#define TxStat_TxFP (1<<0x0f) /* tx frame process bit (chip sets to 1) */
#define TxStat_TxWE (1<<0x0e) /* tx without error */
#define TxStat_FrameAbort (1<<0x0d) /* frame canceled by host (see TxDesc) */
#define TxStat_LossCRS (1<<0x0c) /* MII CRS sig not asserted */
#define TxStat_OutWindow (1<<0x0a) /* collision after 60 bytes transmitted*/
#define TxStat_TxUnderrun (1<<0x09) /* bus latency error */
#define TxStat_ExcessColl (1<<0x08) /* excessive collisions */
#define TxStat_NumColl_Mask (0x001F) /* number of collisions */
#define TxStat_Error_Mask (0x3F00) /* error bit mask */
unsigned short TxStat; /* Tx status word */
} TxStat_t;
#define STATFIFOSIZE 128
#define DESCFIFOSIZE 128
#define DATAFIFOSIZE 1024
#define CS8950_MEMORY_SIZE_RXINDICATE 0x60000 // 384K reserved buffer. 192K is from CS8950
// and another 192K is from EDBG.
//#define TXBUFFCOUNT 8 //@melody changed from 16 to 8. Save 8 for FREE_RX_PKT_CNT.
#define TXBUFFCOUNT 16
#define TXBUFFSIZE 1520 /* Must be multiple of 4,32bits aligned */
#define TXREQCOUNT TXBUFFCOUNT
#define TXDESCCOUNT TXBUFFCOUNT
#define TXSTATCOUNT TXBUFFCOUNT
//#define RXBUFFCOUNT 32 //Change from 64 to 32. Save 32 for FREE_RX_PKT_CNT
#define RXBUFFCOUNT 64
#define RXBUFFSIZE 1520 /* Must be multiple of 4 */
#define RXDESCCOUNT RXBUFFCOUNT
#define RXSTATCOUNT RXBUFFCOUNT
//#define FREE_RX_PKT_CNT 40 //@melody to support non-copying Rx indication.
#define FREE_RX_PKT_CNT 80 //@melody The buffer of Non-copying Rx Indication
// Use the memory reserved for EDBG because CS8950 NDIS driver and Debugger cannot
// run at the same time. They are exclusive.
#define TOTAL_RX_PKT_CNT RXBUFFCOUNT+FREE_RX_PKT_CNT //@melody to support non-copying Rx indication.
#define MAXFRAMELENGTH RXBUFFSIZE
#define TXSTARTMIN 32
#define TXSTARTMAX 944 /* 1024-80 , Fifo size - Minframesize - 16 (Chip FACT) */
#define TXSTARTSTEP 32
#define TXGOODMIN 256
#define PHY_TYPE_NATIONAL 1
#define PHY_TYPE_CRYSTAL 2
#define PHY_TYPE_ICS 3
#define PHY_TYPE_BROADCOM 4
#define PHY_TYPE_LEVEL1 5
#define PHY_TYPE_MICREL_8721BL 6
#define PHY_TYPE_UNKNOWN 0xff
/* Transmit Request */
typedef struct
{
DWORD SendID;
WORD StartIndex;
WORD DescCount;
} TXREQ, *PTXREQ;
/* Buffer Descriptor */
typedef struct
{
BYTE *pBuff;
DWORD PhysAddr;
} BUFF;
/* Maximum number of fragments a frame can have */
#define MAX_FRAGS 34 /* for WinCE */
typedef struct FRAG_t
{
BYTE *pBuffer;
WORD BuffLength;
} FRAG, *PFRAG;
/* Chip Data */
typedef struct
{
RxDesc_t *pRxDesc;
RxDesc_t *pRxDescLimit;
DWORD RxDescPhysAddr;
RxStat_t *pRxStat;
RxStat_t *pRxStatLimit;
RxStat_t *pRxStatNext;
DWORD RxStatPhysAddr;
TxDesc_t *pTxDesc;
TxDesc_t *pTxDescLimit;
TxDesc_t *pTxDescNext;
DWORD TxDescPhysAddr;
TxStat_t *pTxStat;
TxStat_t *pTxStatLimit;
TxStat_t *pTxStatNext;
DWORD TxStatPhysAddr;
BUFF RxBuff[RXBUFFCOUNT+FREE_RX_PKT_CNT];
WORD RxHoldCount;
WORD RxStartIndex;
WORD LastRxStatus;
WORD RxFragCount;
FRAG RxFrag[MAX_FRAGS];
TXREQ TxReq[TXREQCOUNT];
WORD TxReqIndex;
WORD TxDescAvail;
DWORD TxGoodCount;
BYTE PHYType;
BYTE PHYRevision;
WORD PHYAddress;
WORD DaemonTimer;
BUFF TxBuff[TXBUFFCOUNT];
PVOID vIOSpace;
NDIS_MINIPORT_INTERRUPT InterruptObject;
NDIS_HANDLE ReceivePacketPool;
NDIS_HANDLE ReceiveBufferPool;
PNDIS_PACKET RxPacketPtQ[TOTAL_RX_PKT_CNT];
PNDIS_BUFFER RxBuffPtQ[TOTAL_RX_PKT_CNT];
WORD RxFreePacketQ[FREE_RX_PKT_CNT];
WORD NextGetFreePacket;
short NextAddFreePacket;
WORD numNdisPacketsIndicated;
WORD numRxFreePackets;
WORD RxIndex;
} CD, *PCD;
/* Max Frame Length Register */
typedef union
{
struct
{
WORD TxStartThresh;
WORD MaxFrameLength;
} Word;
DWORD DWord;
} MAXFL;
#endif /* _CSv8950_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -