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

📄 usbspec.h

📁 瑞星微公司RK27XX系列芯片的SDK开发包
💻 H
字号:
/********************************************************************
   COPYRIGHT (c)   2007 BY ROCK-CHIP FUZHOU
      --  ALL RIGHTS RESERVED  --
* File Name: UsbSpec.h
* Author:  Oliver Miao
* Created:  2007-6-20 16:29
* Modified:
* Revision:  1.00
*
*********************************************************************
********************
* Module History
********************
*2007-6-20 16:30 Creater by Oli
*********************************************************************/
#ifndef _USB_SPEC_H_
#define _USB_SPEC_H_

/* spec defined standard command value --- only GET_DESCRIPTOR used here */
#define GET_DESCRIPTOR     6

/* spec defined const */
#define FULL_SPEED_CTRL_PACKET_SIZE 8
#define FULL_SPEED_BULK_PACKET_SIZE 64
#define HI_SPEED_CTRL_PACKET_SIZE 64
#define HI_SPEED_BULK_PACKET_SIZE 512
#define MAX_STR_DES_SIZE   128

#include "typedef.h"//oli 2007-5-25 11:46

typedef struct _std_setup_format
{
    UINT8 bmRequestType;
    UINT8 bRequest;
    UINT16 wValue;
    UINT16 wIndex;
    UINT16 wLength;
}setup_request_t;

typedef struct _std_dev_dscr
{
    UINT8 bLength;
    UINT8 bDescriptorType;
    UINT16 bcdUSB;
    UINT8 bDeviceClass;
    UINT8 bDeviceSubClass;
    UINT8 bDeviceProtocal;
    UINT8 bMaxPacketSize;
    UINT16 idVendor;
    UINT16 idProduct;
    UINT16 bcdDevice;
    UINT8 iManufacturer;
    UINT8 iProduct;
    UINT8 iSerialNumber;
    UINT8 bNumConfigurations;
}std_dev_dscr, *pstd_dev_dscr;

typedef struct _std_dev_qual_dscr
{
    UINT8 bLength;
    UINT8 bDescriptorType;
    UINT16 bcdUSB;
    UINT8 bDeviceClass;
    UINT8 bDeviceSubClass;
    UINT8 bDeviceProtocal;
    UINT8 bMaxPacketSize;
    UINT8 bNumConfigurations;
    UINT8 bReserved;
}std_dev_qual_dscr, *pstd_dev_qual_dscr;

typedef struct _std_cfg_dscr
{
    UINT8 bLength;
    UINT8 bDescriptorType;
    UINT16 wTotalLength;
    UINT8 bNumInterfaces;
    UINT8 bConfigurationValue;
    UINT8 iConfiguration;
    UINT8 bmAttributes;
    UINT8 MaxPower;
}std_cfg_dscr, *pstd_cfg_dscr;

typedef struct _std_if_dscr
{
    UINT8 bLength;
    UINT8 bDescriptorType;
    UINT8 bInterfaceNumber;
    UINT8 bAlternateSetting;
    UINT8 bNumEndpoints;
    UINT8 bInterfaceClass;
    UINT8 bInterfaceSubClass;
    UINT8 bInterfaceProtocol;
    UINT8 iInterface;
}std_if_dscr, *pstd_if_dscr;

typedef struct _std_edp_dscr
{
    UINT8 bLength;
    UINT8 bDescriptorType;
    UINT8 bEndpointAddress;
    UINT8 bmAttributes;
    UINT16 wMaxPacketSize;
    UINT8 bInterval;
}std_edp_dscr, *pstd_edp_dscr;

typedef struct _std_str_dscr_h
{
    UINT8 bLength;
    UINT8 bDescriptorType;
    UINT8 bString[1];

}std_str_dscr_h, *pstd_str_dscr_h;

/* descriptor type */
#define DEV_DSCR_TYPE   1
#define CFG_DSCR_TYPE   2
#define STR_DSCR_TYPE   3
#define INTF_DSCR_TYPE    4
#define EDP_DSCR_TYPE   5
#define QUAL_DSCR_TYPE   6
#define OTHERSPD_DSCR_TYPE  7

/* bmRequestType Mask */
#define REQ_MASK_DIR   0x80
#define REQ_MASK_TYPE   0x60
#define REQ_MASK_RECP   0x1f

#define REQ_DIR_HOST_TO_DEV     (0x0 << 7)
#define REQ_DIR_DEV_TO_HOST     (0x1 << 7)
#define GET_REQ_DIR(x)   ((x) & REQ_MASK_DIR)

#define REQ_TYPE_STANDARD  (0x0 << 5)
#define REQ_TYPE_CLASS   (0x1 << 5)
#define REQ_TYPE_VENDOR   (0x2 << 5)
#define GET_REQ_TYPE(x)   ((x) & REQ_MASK_TYPE)

#define REQ_RECP_DEVICE   (0x0)
#define REQ_RECP_INTERFACE  (0x1)
#define REQ_RECP_ENDPOINT  (0x2)
#define GET_REQ_RECP(x)   ((x) & REQ_MASK_RECP)

#endif /* _usb_spec_h_ */

⌨️ 快捷键说明

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