mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-01 19:26:13 -04:00
WIP: Add USB HID and framing support over UART
- Add USB HID support. - Add framing to distinguish between CDC and HID data sent over the UART. - Add some debug printing. - Cleanup of code and formatting.
This commit is contained in:
parent
f6c0501db9
commit
a0910e25c3
12 changed files with 2047 additions and 1138 deletions
|
@ -11,6 +11,8 @@ Header file for CH554 microcontrollers.
|
|||
#ifndef __USB_DEF__
|
||||
#define __USB_DEF__
|
||||
|
||||
#include "mem.h"
|
||||
|
||||
/*----- USB constant and structure define --------------------------------*/
|
||||
|
||||
/* USB PID */
|
||||
|
@ -53,34 +55,41 @@ Header file for CH554 microcontrollers.
|
|||
#define HUB_SET_DESCRIPTOR 0x07
|
||||
#endif
|
||||
|
||||
/* USB HID class request code */
|
||||
#ifndef HID_GET_REPORT
|
||||
#define HID_GET_REPORT 0x01
|
||||
#define HID_GET_IDLE 0x02
|
||||
#define HID_GET_PROTOCOL 0x03
|
||||
#define HID_SET_REPORT 0x09
|
||||
#define HID_SET_IDLE 0x0A
|
||||
#define HID_SET_PROTOCOL 0x0B
|
||||
#endif
|
||||
|
||||
/* Bit define for USB request type */
|
||||
#ifndef USB_REQ_TYP_MASK
|
||||
#define USB_REQ_TYP_IN 0x80 /* control IN, device to host */
|
||||
#define USB_REQ_TYP_OUT 0x00 /* control OUT, host to device */
|
||||
#define USB_REQ_TYP_READ 0x80 /* control read, device to host */
|
||||
#define USB_REQ_TYP_WRITE 0x00 /* control write, host to device */
|
||||
#define USB_REQ_TYP_MASK 0x60 /* bit mask of request type */
|
||||
#define USB_REQ_TYP_STANDARD 0x00
|
||||
#define USB_REQ_TYP_CLASS 0x20
|
||||
#define USB_REQ_TYP_VENDOR 0x40
|
||||
#define USB_REQ_TYP_RESERVED 0x60
|
||||
#define USB_REQ_RECIP_MASK 0x1F /* bit mask of request recipient */
|
||||
#ifndef USB_REQ_TYPE_MASK
|
||||
#define USB_REQ_TYPE_IN 0x80 /* Control IN, device to host */
|
||||
#define USB_REQ_TYPE_OUT 0x00 /* Control OUT, host to device */
|
||||
#define USB_REQ_TYPE_READ 0x80 /* Control read, device to host */
|
||||
#define USB_REQ_TYPE_WRITE 0x00 /* Control write, host to device */
|
||||
#define USB_REQ_TYPE_MASK 0x60 /* Bit mask of request type */
|
||||
#define USB_REQ_TYPE_STANDARD 0x00
|
||||
#define USB_REQ_TYPE_CLASS 0x20
|
||||
#define USB_REQ_TYPE_VENDOR 0x40
|
||||
#define USB_REQ_TYPE_RESERVED 0x60
|
||||
#define USB_REQ_RECIP_MASK 0x1F /* Bit mask of request recipient */
|
||||
#define USB_REQ_RECIP_DEVICE 0x00
|
||||
#define USB_REQ_RECIP_INTERF 0x01
|
||||
#define USB_REQ_RECIP_ENDP 0x02
|
||||
#define USB_REQ_RECIP_OTHER 0x03
|
||||
#endif
|
||||
|
||||
/* USB HID class request code */
|
||||
#ifndef USB_HID_REQ_TYPE
|
||||
#define USB_HID_REQ_TYPE_GET_REPORT 0x01
|
||||
#define USB_HID_REQ_TYPE_GET_IDLE 0x02
|
||||
#define USB_HID_REQ_TYPE_GET_PROTOCOL 0x03
|
||||
#define USB_HID_REQ_TYPE_SET_REPORT 0x09
|
||||
#define USB_HID_REQ_TYPE_SET_IDLE 0x0A
|
||||
#define USB_HID_REQ_TYPE_SET_PROTOCOL 0x0B
|
||||
#endif
|
||||
|
||||
/* USB CDC class request code */
|
||||
#ifndef USB_CDC_REQ_TYPE
|
||||
#define USB_CDC_REQ_TYPE_SET_LINE_CODING 0x20
|
||||
#define USB_CDC_REQ_TYPE_GET_LINE_CODING 0x21
|
||||
#define USB_CDC_REQ_TYPE_SET_CONTROL_LINE_STATE 0x22
|
||||
#endif
|
||||
|
||||
/* USB request type for hub class request */
|
||||
#ifndef HUB_GET_HUB_DESCRIPTOR
|
||||
#define HUB_CLEAR_HUB_FEATURE 0x20
|
||||
|
@ -96,95 +105,127 @@ Header file for CH554 microcontrollers.
|
|||
|
||||
/* Hub class feature selectors */
|
||||
#ifndef HUB_PORT_RESET
|
||||
#define HUB_C_HUB_LOCAL_POWER 0
|
||||
#define HUB_C_HUB_OVER_CURRENT 1
|
||||
#define HUB_PORT_CONNECTION 0
|
||||
#define HUB_PORT_ENABLE 1
|
||||
#define HUB_PORT_SUSPEND 2
|
||||
#define HUB_PORT_OVER_CURRENT 3
|
||||
#define HUB_PORT_RESET 4
|
||||
#define HUB_PORT_POWER 8
|
||||
#define HUB_PORT_LOW_SPEED 9
|
||||
#define HUB_C_PORT_CONNECTION 16
|
||||
#define HUB_C_PORT_ENABLE 17
|
||||
#define HUB_C_PORT_SUSPEND 18
|
||||
#define HUB_C_PORT_OVER_CURRENT 19
|
||||
#define HUB_C_PORT_RESET 20
|
||||
#define HUB_C_HUB_LOCAL_POWER 0
|
||||
#define HUB_C_HUB_OVER_CURRENT 1
|
||||
#define HUB_PORT_CONNECTION 0
|
||||
#define HUB_PORT_ENABLE 1
|
||||
#define HUB_PORT_SUSPEND 2
|
||||
#define HUB_PORT_OVER_CURRENT 3
|
||||
#define HUB_PORT_RESET 4
|
||||
#define HUB_PORT_POWER 8
|
||||
#define HUB_PORT_LOW_SPEED 9
|
||||
#define HUB_C_PORT_CONNECTION 16
|
||||
#define HUB_C_PORT_ENABLE 17
|
||||
#define HUB_C_PORT_SUSPEND 18
|
||||
#define HUB_C_PORT_OVER_CURRENT 19
|
||||
#define HUB_C_PORT_RESET 20
|
||||
#endif
|
||||
|
||||
/* USB descriptor type */
|
||||
#ifndef USB_DESCR_TYP_DEVICE
|
||||
#define USB_DESCR_TYP_DEVICE 0x01
|
||||
#define USB_DESCR_TYP_CONFIG 0x02
|
||||
#define USB_DESCR_TYP_STRING 0x03
|
||||
#define USB_DESCR_TYP_INTERF 0x04
|
||||
#define USB_DESCR_TYP_ENDP 0x05
|
||||
#define USB_DESCR_TYP_QUALIF 0x06
|
||||
#define USB_DESCR_TYP_SPEED 0x07
|
||||
#define USB_DESCR_TYP_OTG 0x09
|
||||
#define USB_DESCR_TYP_HID 0x21
|
||||
#define USB_DESCR_TYP_REPORT 0x22
|
||||
#define USB_DESCR_TYP_PHYSIC 0x23
|
||||
#define USB_DESCR_TYP_CS_INTF 0x24
|
||||
#define USB_DESCR_TYP_CS_ENDP 0x25
|
||||
#define USB_DESCR_TYP_HUB 0x29
|
||||
#ifndef USB_DESC_TYPE_DEVICE
|
||||
#define USB_DESC_TYPE_DEVICE 0x01 // USB 1.1
|
||||
#define USB_DESC_TYPE_CONFIGURATION 0x02 // USB 1.1
|
||||
#define USB_DESC_TYPE_STRING 0x03 // USB 1.1
|
||||
#define USB_DESC_TYPE_INTERFACE 0x04 // USB 1.1
|
||||
#define USB_DESC_TYPE_ENDPOINT 0x05 // USB 1.1
|
||||
#define USB_DESC_TYPE_DEVICE_QUALIFIER 0x06 // USB 2.0
|
||||
#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 0x07 // USB 2.0
|
||||
#define USB_DESC_TYPE_INTERFACE_POWER 0x08 // USB 2.0
|
||||
#define USB_DESC_TYPE_OTG 0x09 // USB 2.0
|
||||
#define USB_DESC_TYPE_DEBUG 0x0A // USB 2.0
|
||||
#define USB_DESC_TYPE_INTERFACE_ASSOCIATION 0x0B // USB 2.0
|
||||
#define USB_DESC_TYPE_BOS 0x0F // USB 3.x (Binary Object Store)
|
||||
#define USB_DESC_TYPE_DEVICE_CAPABILITY 0x10 // USB 3.x
|
||||
#define USB_DESC_TYPE_HID 0x21 // HID 1.11
|
||||
#define USB_DESC_TYPE_REPORT 0x22 // HID 1.11
|
||||
#define USB_DESC_TYPE_PHYSICAL 0x23 // HID 1.11
|
||||
#define USB_DESC_TYPE_CS_INTERFACE 0x24 // Class-Specific (Audio, HID, CDC, etc.)
|
||||
#define USB_DESC_TYPE_CS_ENDPOINT 0x25 // Class-Specific (Audio, Not HID normally, CDC, etc.)
|
||||
#define USB_DESC_TYPE_SUPERSPEED_USB_ENDPOINT_COMPANION 0x30 // USB 3.x
|
||||
#define USB_DESC_TYPE_SUPERSPEEDPLUS_ISOCHRONOUS_ENDPOINT_COMPANION 0x31 // USB 3.x
|
||||
#endif
|
||||
|
||||
/* USB device class */
|
||||
#ifndef USB_DEV_CLASS_HUB
|
||||
#define USB_DEV_CLASS_RESERVED 0x00
|
||||
#define USB_DEV_CLASS_AUDIO 0x01
|
||||
#define USB_DEV_CLASS_COMMUNIC 0x02
|
||||
#define USB_DEV_CLASS_HID 0x03
|
||||
#define USB_DEV_CLASS_MONITOR 0x04
|
||||
#define USB_DEV_CLASS_PHYSIC_IF 0x05
|
||||
#define USB_DEV_CLASS_POWER 0x06
|
||||
#define USB_DEV_CLASS_PRINTER 0x07
|
||||
#define USB_DEV_CLASS_STORAGE 0x08
|
||||
#define USB_DEV_CLASS_HUB 0x09
|
||||
#define USB_DEV_CLASS_VEN_SPEC 0xFF
|
||||
#ifndef USB_DEV_CLASS
|
||||
// Descriptor Usage; Description ; Examples
|
||||
#define USB_DEV_CLASS_RESERVED 0x00 // Device ; Unspecified ; Device class is unspecified, interface descriptors are used to determine needed drivers
|
||||
#define USB_DEV_CLASS_AUDIO 0x01 // Interface ; Audio ; Speaker, microphone, sound card, MIDI
|
||||
#define USB_DEV_CLASS_CDC_CONTROL 0x02 // Both ; Communications and CDC control ; UART and RS-232 serial adapter, modem, Wi-Fi adapter, Ethernet adapter. Used together with class 0Ah (CDC-Data) below
|
||||
#define USB_DEV_CLASS_HID 0x03 // Interface ; Human interface device (HID) ; Keyboard, mouse, joystick
|
||||
#define USB_DEV_CLASS_PHYSICAL 0x05 // Interface ; Physical interface device (PID) ; Force feedback joystick
|
||||
#define USB_DEV_CLASS_IMAGE 0x06 // Interface ; Media (PTP/MTP) ; Scanner, Camera
|
||||
#define USB_DEV_CLASS_PRINTER 0x07 // Interface ; Printer ; Laser printer, inkjet printer, CNC machine
|
||||
#define USB_DEV_CLASS_MASS_STORAGE 0x08 // Interface ; USB mass storage, USB Attached SCSI ; USB flash drive, memory card reader, digital audio player, digital camera, external drive
|
||||
#define USB_DEV_CLASS_HUB 0x09 // Device ; USB hub ; High speed USB hub
|
||||
#define USB_DEV_CLASS_CDC_DATA 0x0A // Interface ; CDC-Data ; Used together with class 02h (Communications and CDC Control) above
|
||||
#define USB_DEV_CLASS_SMART_CARD 0x0B // Interface ; Smart card ; USB smart card reader
|
||||
#define USB_DEV_CLASS_CONTENT_SECURITY 0x0D // Interface ; Content security ; Fingerprint reader
|
||||
#define USB_DEV_CLASS_VIDEO 0x0E // Interface ; Video ; Webcam
|
||||
#define USB_DEV_CLASS_PERSONAL_HEALTHCARE 0x0F // Interface ; Personal healthcare device class (PHDC) ; Pulse monitor (watch)
|
||||
#define USB_DEV_CLASS_AUDIO_VIDEO DEVICES 0x10 // Interface ; Audio/Video (AV) ; Webcam, TV
|
||||
#define USB_DEV_CLASS_BILLBOARD 0x11 // Device ; Billboard ; Describes USB-C alternate modes supported by device
|
||||
#define USB_DEV_CLASS_USB_TYPE_C_BRIDGE 0x12 // Interface ; ;
|
||||
#define USB_DEV_CLASS_USB_BULK_DISPLAY 0x13 // Interface ; ;
|
||||
#define USB_DEV_CLASS_MCTP_OVER_USB 0x14 // Interface ; ;
|
||||
#define USB_DEV_CLASS_I3C_DEVICE_CLASS 0x3C // Interface ; ;
|
||||
#define USB_DEV_CLASS_DIAGNOSTIC_DEVICE 0xDC // Both ; Diagnostic device ; USB compliance testing device
|
||||
#define USB_DEV_CLASS_WIRELESS_CONTROLLER 0xE0 // Interface ; Wireless Controller ; Bluetooth adapter, Microsoft RNDIS
|
||||
#define USB_DEV_CLASS_MISCELLANEOUS 0xEF // Both ; Miscellaneous ; ActiveSync device
|
||||
#define USB_DEV_CLASS_APPLICATION_SPECIFIC 0xFE // Interface ; Application-specific ; IrDA Bridge, Test & Measurement Class (USBTMC), USB DFU (Device Firmware Upgrade)
|
||||
#define USB_DEV_CLASS_VENDOR_SPECIFIC 0xFF // Both ; Vendor-specific ; Indicates that a device needs vendor-specific drivers
|
||||
#endif
|
||||
|
||||
/* USB endpoint type and attributes */
|
||||
#ifndef USB_ENDP_TYPE_MASK
|
||||
#define USB_ENDP_DIR_MASK 0x80
|
||||
#define USB_ENDP_ADDR_MASK 0x0F
|
||||
#define USB_ENDP_TYPE_MASK 0x03
|
||||
#define USB_ENDP_TYPE_CTRL 0x00
|
||||
#define USB_ENDP_TYPE_ISOCH 0x01
|
||||
#define USB_ENDP_TYPE_BULK 0x02
|
||||
#define USB_ENDP_TYPE_INTER 0x03
|
||||
#ifndef USB_EP_TYPE_MASK
|
||||
#define USB_EP_TYPE_CONTROL 0x00
|
||||
#define USB_EP_TYPE_ISOCHRONOUS 0x01
|
||||
#define USB_EP_TYPE_BULK 0x02
|
||||
#define USB_EP_TYPE_INTERRUPT 0x03
|
||||
|
||||
#define USB_EP_DIR_MASK 0x80
|
||||
#define USB_EP_ADDR_MASK 0x0F
|
||||
#define USB_EP_TYPE_MASK 0x03
|
||||
#endif
|
||||
|
||||
/* USB string index */
|
||||
#ifndef USB_IDX_STR
|
||||
#define USB_IDX_LANGID_STR 0x00
|
||||
#define USB_IDX_MFC_STR 0x01
|
||||
#define USB_IDX_PRODUCT_STR 0x02
|
||||
#define USB_IDX_SERIAL_STR 0x03
|
||||
#define USB_IDX_CONFIG_STR 0x04
|
||||
#define USB_IDX_INTERFACE_STR 0x05
|
||||
#endif
|
||||
|
||||
#ifndef USB_DEVICE_ADDR
|
||||
#define USB_DEVICE_ADDR 0x02 /* 默认的USB设备地址 */
|
||||
#define USB_DEVICE_ADDR 0x02
|
||||
#endif
|
||||
#ifndef DEFAULT_ENDP0_SIZE
|
||||
#define DEFAULT_ENDP0_SIZE 8 /* default maximum packet size for endpoint 0 */
|
||||
#ifndef DEFAULT_EP0_SIZE
|
||||
#define DEFAULT_EP0_SIZE 8 /* Default maximum packet size for Endpoint 0 */
|
||||
#endif
|
||||
#ifndef DEFAULT_ENDP1_SIZE
|
||||
#define DEFAULT_ENDP1_SIZE 8 /* default maximum packet size for endpoint 1 */
|
||||
#ifndef DEFAULT_EP1_SIZE
|
||||
#define DEFAULT_EP1_SIZE 8 /* Default maximum packet size for Endpoint 1 */
|
||||
#endif
|
||||
#ifndef MAX_PACKET_SIZE
|
||||
#define MAX_PACKET_SIZE 64 /* maximum packet size */
|
||||
#define MAX_PACKET_SIZE 64 /* Maximum packet size */
|
||||
#endif
|
||||
#ifndef USB_BO_CBW_SIZE
|
||||
#define USB_BO_CBW_SIZE 0x1F /* 命令块CBW的总长度 */
|
||||
#define USB_BO_CSW_SIZE 0x0D /* 命令状态块CSW的总长度 */
|
||||
#define USB_BO_CBW_SIZE 0x1F
|
||||
#define USB_BO_CSW_SIZE 0x0D
|
||||
#endif
|
||||
#ifndef USB_BO_CBW_SIG0
|
||||
#define USB_BO_CBW_SIG0 0x55 /* 命令块CBW识别标志'USBC' */
|
||||
#define USB_BO_CBW_SIG0 0x55
|
||||
#define USB_BO_CBW_SIG1 0x53
|
||||
#define USB_BO_CBW_SIG2 0x42
|
||||
#define USB_BO_CBW_SIG3 0x43
|
||||
#define USB_BO_CSW_SIG0 0x55 /* 命令状态块CSW识别标志'USBS' */
|
||||
#define USB_BO_CSW_SIG0 0x55
|
||||
#define USB_BO_CSW_SIG1 0x53
|
||||
#define USB_BO_CSW_SIG2 0x42
|
||||
#define USB_BO_CSW_SIG3 0x53
|
||||
#endif
|
||||
|
||||
typedef struct _USB_SETUP_REQ {
|
||||
uint8_t bRequestType;
|
||||
uint8_t bmRequestType;
|
||||
uint8_t bRequest;
|
||||
uint8_t wValueL;
|
||||
uint8_t wValueH;
|
||||
|
@ -194,7 +235,7 @@ typedef struct _USB_SETUP_REQ {
|
|||
uint8_t wLengthH;
|
||||
} USB_SETUP_REQ, *PUSB_SETUP_REQ;
|
||||
|
||||
typedef USB_SETUP_REQ __xdata *PXUSB_SETUP_REQ;
|
||||
typedef USB_SETUP_REQ XDATA *PXUSB_SETUP_REQ;
|
||||
|
||||
typedef struct _USB_DEVICE_DESCR {
|
||||
uint8_t bLength;
|
||||
|
@ -217,7 +258,7 @@ typedef struct _USB_DEVICE_DESCR {
|
|||
uint8_t bNumConfigurations;
|
||||
} USB_DEV_DESCR, *PUSB_DEV_DESCR;
|
||||
|
||||
typedef USB_DEV_DESCR __xdata *PXUSB_DEV_DESCR;
|
||||
typedef USB_DEV_DESCR XDATA *PXUSB_DEV_DESCR;
|
||||
|
||||
typedef struct _USB_CONFIG_DESCR {
|
||||
uint8_t bLength;
|
||||
|
@ -231,7 +272,7 @@ typedef struct _USB_CONFIG_DESCR {
|
|||
uint8_t MaxPower;
|
||||
} USB_CFG_DESCR, *PUSB_CFG_DESCR;
|
||||
|
||||
typedef USB_CFG_DESCR __xdata *PXUSB_CFG_DESCR;
|
||||
typedef USB_CFG_DESCR XDATA *PXUSB_CFG_DESCR;
|
||||
|
||||
typedef struct _USB_INTERF_DESCR {
|
||||
uint8_t bLength;
|
||||
|
@ -245,7 +286,7 @@ typedef struct _USB_INTERF_DESCR {
|
|||
uint8_t iInterface;
|
||||
} USB_ITF_DESCR, *PUSB_ITF_DESCR;
|
||||
|
||||
typedef USB_ITF_DESCR __xdata *PXUSB_ITF_DESCR;
|
||||
typedef USB_ITF_DESCR XDATA *PXUSB_ITF_DESCR;
|
||||
|
||||
typedef struct _USB_ENDPOINT_DESCR {
|
||||
uint8_t bLength;
|
||||
|
@ -257,7 +298,7 @@ typedef struct _USB_ENDPOINT_DESCR {
|
|||
uint8_t bInterval;
|
||||
} USB_ENDP_DESCR, *PUSB_ENDP_DESCR;
|
||||
|
||||
typedef USB_ENDP_DESCR __xdata *PXUSB_ENDP_DESCR;
|
||||
typedef USB_ENDP_DESCR XDATA *PXUSB_ENDP_DESCR;
|
||||
|
||||
typedef struct _USB_CONFIG_DESCR_LONG {
|
||||
USB_CFG_DESCR cfg_descr;
|
||||
|
@ -265,7 +306,7 @@ typedef struct _USB_CONFIG_DESCR_LONG {
|
|||
USB_ENDP_DESCR endp_descr[1];
|
||||
} USB_CFG_DESCR_LONG, *PUSB_CFG_DESCR_LONG;
|
||||
|
||||
typedef USB_CFG_DESCR_LONG __xdata *PXUSB_CFG_DESCR_LONG;
|
||||
typedef USB_CFG_DESCR_LONG XDATA *PXUSB_CFG_DESCR_LONG;
|
||||
|
||||
typedef struct _USB_HUB_DESCR {
|
||||
uint8_t bDescLength;
|
||||
|
@ -279,7 +320,7 @@ typedef struct _USB_HUB_DESCR {
|
|||
uint8_t PortPwrCtrlMask;
|
||||
} USB_HUB_DESCR, *PUSB_HUB_DESCR;
|
||||
|
||||
typedef USB_HUB_DESCR __xdata *PXUSB_HUB_DESCR;
|
||||
typedef USB_HUB_DESCR XDATA *PXUSB_HUB_DESCR;
|
||||
|
||||
typedef struct _USB_HID_DESCR {
|
||||
uint8_t bLength;
|
||||
|
@ -293,9 +334,9 @@ typedef struct _USB_HID_DESCR {
|
|||
uint8_t wDescriptorLengthH;
|
||||
} USB_HID_DESCR, *PUSB_HID_DESCR;
|
||||
|
||||
typedef USB_HID_DESCR __xdata *PXUSB_HID_DESCR;
|
||||
typedef USB_HID_DESCR XDATA *PXUSB_HID_DESCR;
|
||||
|
||||
typedef struct _UDISK_BOC_CBW { /* command of BulkOnly USB-FlashDisk */
|
||||
typedef struct _UDISK_BOC_CBW { /* Command of BulkOnly USB-FlashDisk */
|
||||
uint8_t mCBW_Sig0;
|
||||
uint8_t mCBW_Sig1;
|
||||
uint8_t mCBW_Sig2;
|
||||
|
@ -307,16 +348,16 @@ typedef struct _UDISK_BOC_CBW { /* command of BulkOnly USB-FlashDisk */
|
|||
uint8_t mCBW_DataLen0;
|
||||
uint8_t mCBW_DataLen1;
|
||||
uint8_t mCBW_DataLen2;
|
||||
uint8_t mCBW_DataLen3; /* uppest byte of data length, always is 0 */
|
||||
uint8_t mCBW_Flag; /* transfer direction and etc. */
|
||||
uint8_t mCBW_DataLen3; /* MSB byte of data length, always is 0 */
|
||||
uint8_t mCBW_Flag; /* Transfer direction and etc. */
|
||||
uint8_t mCBW_LUN;
|
||||
uint8_t mCBW_CB_Len; /* length of command block */
|
||||
uint8_t mCBW_CB_Buf[16]; /* command block buffer */
|
||||
uint8_t mCBW_CB_Len; /* Length of command block */
|
||||
uint8_t mCBW_CB_Buf[16]; /* Command block buffer */
|
||||
} UDISK_BOC_CBW, *PUDISK_BOC_CBW;
|
||||
|
||||
typedef UDISK_BOC_CBW __xdata *PXUDISK_BOC_CBW;
|
||||
typedef UDISK_BOC_CBW XDATA *PXUDISK_BOC_CBW;
|
||||
|
||||
typedef struct _UDISK_BOC_CSW { /* status of BulkOnly USB-FlashDisk */
|
||||
typedef struct _UDISK_BOC_CSW { /* Status of BulkOnly USB-FlashDisk */
|
||||
uint8_t mCSW_Sig0;
|
||||
uint8_t mCSW_Sig1;
|
||||
uint8_t mCSW_Sig2;
|
||||
|
@ -325,13 +366,13 @@ typedef struct _UDISK_BOC_CSW { /* status of BulkOnly USB-FlashDisk */
|
|||
uint8_t mCSW_Tag1;
|
||||
uint8_t mCSW_Tag2;
|
||||
uint8_t mCSW_Tag3;
|
||||
uint8_t mCSW_Residue0; /* return: remainder bytes */
|
||||
uint8_t mCSW_Residue0; /* Return: remainder bytes */
|
||||
uint8_t mCSW_Residue1;
|
||||
uint8_t mCSW_Residue2;
|
||||
uint8_t mCSW_Residue3; /* uppest byte of remainder length, always is 0 */
|
||||
uint8_t mCSW_Status; /* return: result status */
|
||||
uint8_t mCSW_Residue3; /* MSB byte of remainder length, always is 0 */
|
||||
uint8_t mCSW_Status; /* Return: result status */
|
||||
} UDISK_BOC_CSW, *PUDISK_BOC_CSW;
|
||||
|
||||
typedef UDISK_BOC_CSW __xdata *PXUDISK_BOC_CSW;
|
||||
typedef UDISK_BOC_CSW XDATA *PXUDISK_BOC_CSW;
|
||||
|
||||
#endif // __USB_DEF__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue