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

📄 rndisdev.h

📁 基于TI DSP/BIOS的usb网卡的实现
💻 H
字号:
#ifndef _usb_rndis_dev_h
#define _usb_rndis_dev_h

#include "rndis.h"
#include "usb_ch9.h"
#include "dsp_tcpip.h"
#include "usbdefs.h"
#include "loopbuff.h"

#define  USB_TSK_PRI    2

#define ETH_ALEN        6       /* Octets in one ethernet addr   */
#define ETH_HLEN        14      /* Total octets in header.   */
#define USB_RNDIS_MTU   1600    //mtu

enum ep_status
{
    EP_STATUS_STALL = 0,
    EP_STATUS_IDLE,     /*no operation on endpoint*/
    EP_STATUS_IN,       /*data is writing by slave*/
    EP_STATUS_OUT      /*data is being reading by slave*/
};

struct control_trans
{     
    struct usb_ctrlrequest  DeviceRequest;    
    u8           dataBuffer[MAX_SETUP_BUFFER_SIZE];
    u16          dataLength;
    u16          transmitLength;    
};

struct generic_trans
{
    u8    dataBuffer[MAX_PACKET_BUFFER_SIZE];
    u16   dataLength;
    u16   transmitLength;
};

/*bulk and endpoint*/
struct usb_ep_general
{
    enum ep_status     status;           
    struct generic_trans  * trans;
    u8                 index;  
};

struct usb_ep_control
{
    enum ep_status          status;
    struct control_trans    * trans;
    u8                      index;
};

struct net_device_stats1
{
    unsigned long   rx_packets;     /* total packets received   */
    unsigned long   tx_packets;     /* total packets transmitted    */
    unsigned long   rx_bytes;       /* total bytes received     */
    unsigned long   tx_bytes;       /* total bytes transmitted  */
    unsigned long   rx_errors;      /* bad packets received     */
    unsigned long   tx_errors;      /* packet transmit problems */
    unsigned long   rx_dropped;     /* no space in linux buffers    */
    unsigned long   tx_dropped;     /* no space available in linux  */
    unsigned long   rx_frame_errors;    /* recv'd frame alignment error */
};

struct rndis_dev{    
    enum usb_device_state   usbstate;
    struct usb_ep_general   in_ep, out_ep, status_ep;
    struct usb_ep_control   ctrl_ep;
    u16                     config;

    struct LoopBuffCtl      tx_queue;
    usb_lock_t              lock;
    struct ei_device        * net;
    struct net_device_stats1 stats;      
    u16                     cdc_filter;
    u8                      mac[6]; //host side mac address
    u16                     mtu;
};

#endif

⌨️ 快捷键说明

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