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

📄 net_nic.h

📁 在ST的ARM9上跑uCOS加uCTCPIP时要用的STR91X的内置网卡驱动
💻 H
字号:
/*
*********************************************************************************************************
*                                              uC/TCP-IP
*                                      The Embedded TCP/IP Suite
*
*                          (c) Copyright 2003-2006; Micrium, Inc.; Weston, FL
*
*                   All rights reserved.  Protected by international copyright laws.
*                   Knowledge of the source code may not be used to write a similar
*                   product.  This file may only be used in accordance with a license
*                   and should not be redistributed in any way.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                        NETWORK INTERFACE CARD
*
*                                       STR91x MAC/DMA Controller
*
* Filename      : net_nic.h
* Version       : V1.00
*********************************************************************************************************
*/

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

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

/*
*********************************************************************************************************
*                                          GLOBAL VARIABLES
*********************************************************************************************************
*/

NET_NIC_EXT  CPU_BOOLEAN  NetNIC_ConnStatus;                    /* NIC's connection status : DEF_ON/DEF_OFF.            */


#if (NET_CTR_CFG_STAT_EN == DEF_ENABLED)                        /* ------------------- NET DRV STATS ------------------ */
NET_NIC_EXT  NET_CTR      NetNIC_StatRxPktCtr;
NET_NIC_EXT  NET_CTR      NetNIC_StatTxPktCtr;
#endif

#if (NET_CTR_CFG_ERR_EN  == DEF_ENABLED)                        /* ------------------- NET DRV ERRS ------------------- */
NET_NIC_EXT  NET_CTR      NetNIC_ErrRxPktDiscardedCtr;
NET_NIC_EXT  NET_CTR      NetNIC_ErrTxPktDiscardedCtr;
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                         FUNCTION PROTOTYPES
*********************************************************************************************************
*/

void         NetNIC_Init             (NET_ERR      *perr);

void         NetNIC_IntEn            (NET_ERR      *perr);



                                                                /* ------------------- STATUS FNCTS ------------------- */
void         NetNIC_ConnStatusChk    (void);

CPU_BOOLEAN  NetNIC_ConnStatusGet    (void);

void         NetNIC_RxISR_Handler     (void);                   /* Rx ISR signals Net Drv Task of NIC rx pkts.          */

void         NetNIC_TxISR_Handler     (void);                   /* Tx ISR signals Net Drv Tx of empty tx FIFO.          */

                                                                /* --------------------- RX FNCTS --------------------- */
CPU_INT16U   NetNIC_RxPktGetSize     (void);                    /* Get NIC rx pkt size.                                 */

void         NetNIC_RxPkt            (void         *ppkt,       /* Rx pkt from NIC.                                     */
                                      CPU_INT16U    size,
                                      NET_ERR      *perr);

void         NetNIC_RxPktDiscard     (CPU_INT16U    size,       /* Discard rx pkt in NIC.                               */
                                      NET_ERR      *perr);



                                                                /* --------------------- TX FNCTS --------------------- */
void         NetNIC_TxPkt            (void         *ppkt,
                                      CPU_INT16U    size,
                                      NET_ERR      *perr);

/*$PAGE*/
/*
*********************************************************************************************************
*                                         FUNCTION PROTOTYPES
*                                      DEFINED IN OS'S  net_os.c
*********************************************************************************************************
*/

void         NetOS_NIC_Init          (NET_ERR      *perr);      /* Create Drv objs & start Drv tasks.                   */


void         NetOS_NIC_TxRdyWait     (NET_ERR      *perr);      /* Wait on drv tx rdy signal from NIC.                  */

void         NetOS_NIC_TxRdySignal   (void);                    /* Post    drv tx rdy signal from NIC.                  */


/*$PAGE*/
/*
*********************************************************************************************************
*                                         FUNCTION PROTOTYPES
*                                    DEFINED IN PRODUCT'S  net_bsp.c
*********************************************************************************************************
*/

                                                                /* See this 'net_nic.h  Notes #3b & #3c'.               */
#if (NET_NIC_CFG_RD_WR_SEL == NET_NIC_RD_WR_SEL_FNCT)
CPU_INT32U   NetNIC_Rd_32             (CPU_INT32U    reg_offset);

void         NetNIC_Wr_32             (CPU_INT32U    reg_offset,
                                       CPU_INT32U    val);
#endif

/*
*********************************************************************************************************
*                                         FUNCTION PROTOTYPES
*                                    DEFINED IN PRODUCT'S  net_bsp.c
*********************************************************************************************************
*/

#if (NET_NIC_CFG_INT_CTRL_EN == DEF_ENABLED)
void         NetNIC_IntInit          (void);                    /* Init int ctrl'r        [see Note #1].                */

void         NetNIC_IntClr           (void);                    /* Clr  int ctrl'r src(s) [see Note #2].                */
#endif


/*$PAGE*/
/*
*********************************************************************************************************
*                                        CONFIGURATION ERRORS
*********************************************************************************************************
*/

#ifndef  NET_NIC_CFG_INT_CTRL_EN
#error  "NET_NIC_CFG_INT_CTRL_EN           not #define'd in 'net_cfg.h'"
#error  "                            [MUST be  DEF_DISABLED]           "
#error  "                            [     ||  DEF_ENABLED ]           "
#elif  ((NET_NIC_CFG_INT_CTRL_EN != DEF_DISABLED) && \
        (NET_NIC_CFG_INT_CTRL_EN != DEF_ENABLED ))
#error  "NET_NIC_CFG_INT_CTRL_EN     illegally #define'd in 'net_cfg.h'"
#error  "                            [MUST be  DEF_DISABLED]           "
#error  "                            [     ||  DEF_ENABLED ]           "
#endif

⌨️ 快捷键说明

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