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

📄 net_nic.h

📁 ucos下的dm9000EP的tcp-ip驱动
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
*********************************************************************************************************
*                                              uC/TCP-IP
*                                      The Embedded TCP/IP Suite
*
*                          (c) Copyright 2003-2007; Micrium, Inc.; Weston, FL
*
*               All rights reserved.  Protected by international copyright laws.
*
*               uC/TCP-IP is provided in source form for FREE evaluation, for educational
*               use or peaceful research.  If you plan on using uC/TCP-IP in a commercial
*               product you need to contact Micrium to properly license its use in your
*               product.  We provide ALL the source code for your convenience and to help
*               you experience uC/TCP-IP.  The fact that the source code is provided does
*               NOT mean that you can use it without paying a licensing fee.
*
*               Network Interface Card (NIC) port files provided, as is, for FREE and do
*               NOT require any additional licensing or licensing fee.
*
*               Knowledge of the source code may NOT be used to develop a similar product.
*
*               Please help us continue to provide the Embedded community with the finest
*               software available.  Your honesty is greatly appreciated.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                        NETWORK INTERFACE CARD
*
*                                           Davicom DM9000EP
*
* Filename      : net_nic.h
* Version       : V1.90
* Programmer(s) : EHS
*********************************************************************************************************
* Note(s)       : (1) Supports the Davicom DM9000EP Ethernet Controller
*
*                         Davicom: (http://www.davicom.com.tw)
*
*                 (2) REQUIREs Ethernet Network Interface Layer located in the following network directory :
*
*                         \<Network Protocol Suite>\IF\Ether\
*
*                              where
*                                      <Network Protocol Suite>    directory path for network protocol suite.
*********************************************************************************************************
*/

#ifndef __NET_NIC_H__
#define __NET_NIC_H__


/*
*********************************************************************************************************
*                                                EXTERNS
*********************************************************************************************************
*/

#ifdef   NET_NIC_MODULE
#define  NET_NIC_EXT
#else
#define  NET_NIC_EXT  extern
#endif


/*
*********************************************************************************************************
*                                             INCLUDE FILES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                                DEFINES
*********************************************************************************************************
*/

#define DM9000EP_10MHD                      0
#define DM9000EP_100MHD                     1
#define DM9000EP_10MFD                      4
#define DM9000EP_100MFD                     5
#define DM9000EP_AUTO                       8
#define DM9000EP_1M_HPNA                   16

#define DM9000EP_IO_8_BITS                  1
#define DM9000EP_IO_16_BITS                 2

#define DM9000EP_QUEUE_ONE_PACKET           1
#define DM9000EP_QUEUE_TWO_PACKETS          2

#define DM9000EP_ID	               0x90000A46L                          /* Davicom chip ID (same for DM9000A)                       */

#define DM9000EP_PKT_MAX	             1536                           /* Received packet max size                                 */
#define DM9000EP_PKT_RDY	             0x01                           /* Packet ready to receive                                  */
#define DM9000EP_PKT_NONE                0x00                           /* No packet is present in the DM9000EP SRAM                */

/*
*********************************************************************************************************
*                                   DM9000EP REGISTER ADDRESS DEFINES
*********************************************************************************************************
*/

#define DM9000EP_NCR                     0x00                           /* Network Control Register                                 */
#define DM9000EP_NSR                     0x01                           /* Network Status  Register                                 */
#define DM9000EP_TCR                     0x02                           /* TX Control Register                                      */
#define DM9000EP_TSR1                    0x03                           /* TX Status  Register 1                                    */
#define DM9000EP_TSR2                    0x04                           /* TX Status  Register 2                                    */
#define DM9000EP_RCR                     0x05                           /* RX Control Register                                      */
#define DM9000EP_RSR                     0x06                           /* RX Status  Register                                      */
#define DM9000EP_ROCR                    0x07                           /* Receive Overflow Counter Register                        */
#define DM9000EP_BPTR                    0x08                           /* Back Pressure Threshold Register                         */
#define DM9000EP_FCTR                    0x09                           /* Flow Control  Threshold Resgister                        */
#define DM9000EP_FCR                     0x0A                           /* RX Flow Control Register                                 */ 

#define DM9000EP_EPCR                    0x0B                           /* EEPROM & PHY Control Register                            */
#define DM9000EP_EPAR                    0x0C                           /* EEPROM & PHY Address Register                            */
#define DM9000EP_EPDRL                   0x0D                           /* EEPROM & PHY Low  Byte Data Register                     */
#define DM9000EP_EPDRH                   0x0E                           /* EEPROM & PHY High Byte Data Register                     */

#define DM9000EP_WCR                     0x0F                           /* Wake Up Control Register                        (8-bit)  */

#define DM9000EP_PAR0                    0x10                           /* Physical  Address Register, Byte 0                       */
#define DM9000EP_PAR1                    0x11                           /*    "         "        "   , Byte 1                       */
#define DM9000EP_PAR2                    0x12                           /*    "         "        "   , Byte 2                       */
#define DM9000EP_PAR3                    0x13                           /*    "         "        "   , Byte 3                       */
#define DM9000EP_PAR4                    0x14                           /*    "         "        "   , Byte 4                       */
#define DM9000EP_PAR5                    0x15                           /*    "         "        "   , Byte 5                       */
#define DM9000EP_MAR0                    0x16                           /* Multicast Address Register, Byte 0                       */
#define DM9000EP_MAR1                    0x17                           /*    "         "        "   , Byte 1                       */
#define DM9000EP_MAR2                    0x18                           /*    "         "        "   , Byte 2                       */
#define DM9000EP_MAR3                    0x19                           /*    "         "        "   , Byte 3                       */
#define DM9000EP_MAR4                    0x1A                           /*    "         "        "   , Byte 4                       */
#define DM9000EP_MAR5                    0x1B                           /*    "         "        "   , Byte 5                       */
#define DM9000EP_MAR6                    0x1C                           /*    "         "        "   , Byte 6                       */
#define DM9000EP_MAR7                    0x1D                           /*    "         "        "   , Byte 7                       */

#define DM9000EP_GPCR	                 0x1E                           /* General Purpose Control Register                (8-bit)  */
#define DM9000EP_GPR                     0x1F                           /* General Purpose Register                                 */
#define DM9000EP_TRPAL                   0x22                           /* TX SRAM Read  Pointer Address Low  Byte                  */
#define DM9000EP_TRPAH                   0x23                           /* TX SRAM Read  Pointer Address High Byte                  */
#define DM9000EP_RWPAL                   0x24                           /* RX SRAM Write Pointer Address Low  Byte                  */
#define DM9000EP_RWPAH                   0x25                           /* RX SRAM Write Pointer Address High Byte                  */

#define DM9000EP_VIDL                    0x28                           /* Vendor  ID Low  Byte                                     */
#define DM9000EP_VIDH                    0x29                           /* Vendor  ID High Byte                                     */
#define DM9000EP_PIDL                    0x2A                           /* Product ID Low  Byte                                     */
#define DM9000EP_PIDH                    0x2B                           /* Product ID High Byte                                     */
#define DM9000EP_CHIPR                   0x2C                           /* Chip Revision                                            */
#define DM9000EP_SMCR                    0x2F                           /* Special Mode Control Register                            */

#define DM9000EP_MRCMDX                  0xF0                           /* Memory Data Pre-Fetch Rd Cmd w/o Address Increment Reg.  */
#define DM9000EP_MRCMD                   0xF2                           /* Memory Data Read  Command with   Address Increment Reg.  */

#define DM9000EP_MRRL                    0xF4                           /* Memory Data Read  Address Register Low  Byte             */
#define DM9000EP_MRRH                    0xF5                           /* Memory Data Read  Address Register High Byte             */

#define DM9000EP_MWCMDX	                 0xF6                           /* Memory Data Write Command w/o    Address Increment Reg.  */
#define DM9000EP_MWCMD                   0xF8                           /* Memory Data Write Command with   Address Increment Reg.  */
#define DM9000EP_MWRL                    0xFA                           /* Memory Data Write Address Register Low  Byte             */
#define DM9000EP_MWRH                    0xFB                           /* Memory Data Write Address Register High Byte             */

#define DM9000EP_TXPLL                   0xFC                           /* TX Packet Length Low  Byte Register                      */
#define DM9000EP_TXPLH                   0xFD                           /* TX Packet Length High Byte Register                      */

#define DM9000EP_ISR                     0xFE                           /* Interrupt Status Register                                */
#define DM9000EP_IMR                     0xFF                           /* Interrupt Mask   Register                               */


#define DM9000EP_PHY                     0x40                           /* PHY address                                              */

/*
*********************************************************************************************************
*                      DM9000EP PHY REGISTER ADDRESS DEFINES & REGISTER VALUE DEFINES
*********************************************************************************************************
*/

#define DM9000EP_PHY_BMCR               0x00
#define DM9000EP_PHY_BMSR               0x01
#define DM9000EP_PHY_PHYID1             0x02
#define DM9000EP_PHY_PHYID2             0x02
#define DM9000EP_PHY_ANAR               0x04
#define DM9000EP_PHY_ANLPAR             0x05
#define DM9000EP_PHY_ANER               0x06
#define DM9000EP_PHY_DSCR               0x10
#define DM9000EP_PHY_DSCSR              0x11
#define DM9000EP_PHY_10BTCSR            0x12

                                                                        /* Defines for PHY register [0x00]                          */
#define PHY_BMCR_RESET          (1 << 15)
#define PHY_BMCR_LBK_EN         (1 << 14)
#define PHY_BMCR_SPEED_SEL      (1 << 13)
#define PHY_BMCR_AN_EN          (1 << 12)
#define PHY_BMCR_PWR_DN         (1 << 11)
#define PHY_BMCR_ISOLATE        (1 << 10)
#define PHY_BMCR_AN_RESTART     (1 <<  9)
#define PHY_BMCR_FDX            (1 <<  8)
#define PHY_BMCR_COLL_EN        (1 <<  7)

                                                                        /* Defines for PHY register [0x01]                          */
#define PHY_BMSR_T4             (1 << 15)
#define PHY_BMSR_TX_FDX         (1 << 14)
#define PHY_BMSR_TX_HDX         (1 << 13)
#define PHY_BMSR_10_FDX         (1 << 12)
#define PHY_BMSR_10_HDX         (1 << 11)
#define PHY_BMSR_MF             (1 <<  6)
#define PHY_BMSR_AN_COMP        (1 <<  5)
#define PHY_BMSR_FAULT          (1 <<  4)
#define PHY_BMSR_AN_CAP         (1 <<  3)
#define PHY_BMSR_LINK_STATUS    (1 <<  2)
#define PHY_BMSR_JABBER         (1 <<  1)
#define PHY_BMSR_EXT_CAP        (1 <<  0)

                                                                        /* Defines for PHY register [0x04]                          */
#define PHY_ANAR_NP             (1 << 15)
#define PHY_ANAR_ACK            (1 << 14)
#define PHY_ANAR_RF             (1 << 13)
#define PHY_ANAR_FCS            (1 << 10)
#define PHY_ANAR_T4             (1 <<  9)
#define PHY_ANAR_TX_FDX         (1 <<  8)
#define PHY_ANAR_TX_HDX         (1 <<  7)
#define PHY_ANAR_10_FDX         (1 <<  6)
#define PHY_ANAR_10_HDX         (1 <<  5)


/*
*********************************************************************************************************
*                                     DM9000EP REGISTER VALUE DEFINES
*********************************************************************************************************
*/
                                                                        /* Defines for register [0x00]                              */
#define NCR_EXT_PHY          (1 << 7)
#define NCR_WAKEEN           (1 << 6)
#define NCR_FCOL             (1 << 4)
#define NCR_FDX              (1 << 3)
#define NCR_LBK_PHY          (2 << 1)
#define NCR_LBK_MAC          (1 << 1)
#define NCR_LBK_NORMAL       (0 << 1)
#define NCR_RST              (1 << 0)

                                                                        /* Defines for register [0x01]                              */
#define NSR_SPEED            (1 << 7)
#define NSR_LINKST           (1 << 6)
#define NSR_WAKEST           (1 << 5)
#define NSR_TX2END           (1 << 3)
#define NSR_TX1END           (1 << 2)
#define NSR_RXOV             (1 << 1)

                                                                        /* Defines for register [0x02]                              */
#define TCR_TJDIS            (1 << 6)
#define TCR_EXCECM           (1 << 5)
#define TCR_PAD_DIS2         (1 << 4)
#define TCR_CRC_DIS2         (1 << 3)
#define TCR_PAD_DIS1         (1 << 2)
#define TCR_CRC_DIS1         (1 << 1)
#define TCR_TXREQ            (1 << 0)

                                                                        /* Defines for register [0x03]                              */
                                                                        /* Defines for register [0x04]                              */
#define TSR_TJTO             (1 << 7)
#define TSR_LC               (1 << 6)
#define TSR_NC               (1 << 5)
#define TSR_LCOL             (1 << 4)
#define TSR_COL              (1 << 3)
#define TSR_EC               (1 << 2)
                                                                        /* Defines for register [0x05]                              */
#define RCR_WTDIS            (1 << 6)
#define RCR_DIS_LONG         (1 << 5)
#define RCR_DIS_CRC          (1 << 4)

⌨️ 快捷键说明

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