⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csstruct.h

📁 EP931X系列的WinCE以太网调试驱动源代码
💻 H
字号:
//**********************************************************************
//                                                                      
// Filename: csstruct.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.
// Copyright(c) Cirrus Logic Corporation 2001, All Rights Reserved                       
//                                                                      
//**********************************************************************

#ifndef _CSSTRUCT_H_
#define _CSSTRUCT_H_

#ifdef  _MSC_VER
#define __packed
#endif // _MSC_VER

#pragma pack(1)

/*
*       5.1 Receive Descriptor Format
*/
__packed typedef struct RxDesc_tag {
        volatile unsigned long   RxBufAdr;      /* phys buffer address */
        volatile unsigned short  BufLength;     /* size */
#define RxDesc_BufIndx_Mask     0x7FFF          /* index number used by driver */
#define RxDesc_NotSOF           0x8000          /* not start of frame (in BufIndx) */
        volatile 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
*/
__packed typedef struct RxStat_tag {

#define RxStat_RxFP             (1UL<<0x1f)     /* rx frame process bit */
#define RxStat_RxWE             (1UL<<0x1e)     /* rx without error */
#define RxStat_EOF              (1UL<<0x1d)     /* end of frame data */
#define RxStat_EOB              (1UL<<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           (1UL<<0x15)     /* RX_ERR (MII pin) set */
#define RxStat_OverrunErr       (1UL<<0x14)     /* overrun */
#define RxStat_FramingErr       (1UL<<0x13)     /* bad crc or incorrect # of bytes */
#define RxStat_Runt             (1UL<<0x12)     /* frame shorter than 64 bytes */
#define RxStat_ExtraData        (1UL<<0x11)     /* frame >= MaxFrameLen reg */
#define RxStat_CRCErr           (1UL<<0x10)     /* bad crc */
#define RxStat_CRCIncluded      (1UL<<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 */

        volatile unsigned long   RxStat;        /* Rx status double word */
        volatile unsigned short  FrameLength;   /* total bytes copied to buffer */
#define RxStat_BufIndx_Mask     0x7FFF
#define RxStat_RFP              0x8000UL        /* set to 1 by chip (for use by driver) */
        volatile unsigned short  BufIndx;       /* BufIndx copied from RxDesc */
} RxStat_t;


/*
*       5.10 Transmit Descriptor Format
*/
__packed typedef struct TxDesc_tag {
        volatile unsigned long   TxBufAdr;      /* phys buffer address */

#define TxDesc_BufLength_Mask   0x0fff
#define TxDesc_AbortFrame       0x8000          /* used to invalidate frame */
        volatile unsigned short  BufLength;     /* size */

#define TxDesc_BufIndx_Mask     0x7FFF
#define TxDesc_EOF              0x8000          /* end of frame flag */
        volatile 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
*/
__packed typedef struct TxStat_tag {

#define TxStat_BufIndx_Mask     0x7FFF
        volatile 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 */
        volatile unsigned short  TxStat;        /* Tx status word */
} TxStat_t;

#pragma pack()

#endif  /* _CSSTRUCT_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -