diff options
-rw-r--r-- | include/kernel/udcd.h | 113 |
1 files changed, 86 insertions, 27 deletions
diff --git a/include/kernel/udcd.h b/include/kernel/udcd.h index 2b44ea6..c686ab5 100644 --- a/include/kernel/udcd.h +++ b/include/kernel/udcd.h @@ -24,22 +24,53 @@ extern "C" { /* * Descriptor types */ -#define USB_DT_DEVICE 0x01 -#define USB_DT_CONFIG 0x02 -#define USB_DT_STRING 0x03 -#define USB_DT_INTERFACE 0x04 -#define USB_DT_ENDPOINT 0x05 -#define USB_DT_DEVQUAL 0x06 -#define USB_DT_OTHERSPEED 0x07 +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 + +/* + * Standard requests + */ +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 +#define USB_REQ_SET_FEATURE 0x03 +#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_GET_DESCRIPTOR 0x06 +#define USB_REQ_SET_DESCRIPTOR 0x07 +#define USB_REQ_GET_CONFIG 0x08 +#define USB_REQ_SET_CONFIG 0x09 +#define USB_REQ_GET_INTERFACE 0x0a +#define USB_REQ_SET_INTERFACE 0x0b +#define USB_REQ_SYNC_FRAME 0x0c /* * Descriptor sizes per descriptor type */ -#define USB_DT_DEVICE_SIZE 18 -#define USB_DT_CONFIG_SIZE 9 -#define USB_DT_INTERFACE_SIZE 9 -#define USB_DT_ENDPOINT_SIZE 7 -#define USB_DT_DEVQUAL_SIZE 10 +#define USB_DT_DEVICE_SIZE 18 +#define USB_DT_CONFIG_SIZE 9 +#define USB_DT_INTERFACE_SIZE 9 +#define USB_DT_ENDPOINT_SIZE 7 +#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ +#define USB_DT_HUB_NONVAR_SIZE 7 + +/* + * Control message request type bitmask + */ +#define USB_CTRLTYPE_DIR_MASK 0x80 +#define USB_CTRLTYPE_DIR_HOST2DEVICE (0 << 7) +#define USB_CTRLTYPE_DIR_DEVICE2HOST (1 << 7) +#define USB_CTRLTYPE_TYPE_MASK 0x60 +#define USB_CTRLTYPE_TYPE_STANDARD (0 << 5) +#define USB_CTRLTYPE_TYPE_CLASS (1 << 5) +#define USB_CTRLTYPE_TYPE_VENDOR (2 << 5) +#define USB_CTRLTYPE_TYPE_RESERVED (3 << 5) +#define USB_CTRLTYPE_REC_MASK 0x1f +#define USB_CTRLTYPE_REC_DEVICE 0 +#define USB_CTRLTYPE_REC_INTERFACE 1 +#define USB_CTRLTYPE_REC_ENDPOINT 2 +#define USB_CTRLTYPE_REC_OTHER 3 /* * Endpoint types and masks @@ -47,29 +78,58 @@ extern "C" { #define USB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ #define USB_ENDPOINT_DIR_MASK 0x80 +#define USB_FEATURE_ENDPOINT_HALT 0 + +#define USB_ENDPOINT_IN 0x80 +#define USB_ENDPOINT_OUT 0x00 + #define USB_ENDPOINT_TYPE_MASK 0x03 /* in bmAttributes */ #define USB_ENDPOINT_TYPE_CONTROL 0 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 1 #define USB_ENDPOINT_TYPE_BULK 2 #define USB_ENDPOINT_TYPE_INTERRUPT 3 +/* HID constants. Not part of chapter 9 */ /* - * Standard requests + * Class-Specific Requests */ -#define USB_REQ_GET_STATUS 0x00 -#define USB_REQ_CLEAR_FEATURE 0x01 -/* 0x02 is reserved */ -#define USB_REQ_SET_FEATURE 0x03 -/* 0x04 is reserved */ -#define USB_REQ_SET_ADDRESS 0x05 -#define USB_REQ_GET_DESCRIPTOR 0x06 -#define USB_REQ_SET_DESCRIPTOR 0x07 -#define USB_REQ_GET_CONFIGURATION 0x08 -#define USB_REQ_SET_CONFIGURATION 0x09 -#define USB_REQ_GET_INTERFACE 0x0A -#define USB_REQ_SET_INTERFACE 0x0B -#define USB_REQ_SYNCH_FRAME 0x0C +#define HID_REQUEST_GET_REPORT 0x01 +#define HID_REQUEST_GET_IDLE 0x02 +#define HID_REQUEST_GET_PROTOCOL 0x03 +#define HID_REQUEST_SET_REPORT 0x09 +#define HID_REQUEST_SET_IDLE 0x0A +#define HID_REQUEST_SET_PROTOCOL 0x0B + +/* + * Class Descriptor Types + */ +#define HID_DESCRIPTOR_HID 0x21 +#define HID_DESCRIPTOR_REPORT 0x22 +#define HID_DESRIPTOR_PHY 0x23 + +/* + * Protocol Selection + */ +#define BOOT_PROTOCOL 0x00 +#define RPT_PROTOCOL 0x01 + +/* + * HID Interface Class Code + */ +#define HID_INTF 0x03 + +/* + * HID Interface Class SubClass Codes + */ +#define BOOT_INTF_SUBCLASS 0x01 + +/* + * HID Interface Class Protocol Codes + */ +#define HID_PROTOCOL_NONE 0x00 +#define HID_PROTOCOL_KEYBOARD 0x01 +#define HID_PROTOCOL_MOUSE 0x02 /* @@ -100,7 +160,6 @@ extern "C" { #define SCE_UDCD_MAX_ENDPOINTS 9 #define SCE_UDCD_MAX_ALTERNATE 2 - #define SCE_UDCD_RETCODE_CANCEL -1 #define SCE_UDCD_RETCODE_CANCEL_ALL -2 #define SCE_UDCD_RETCODE_CANCELTRANSMISSION -3 |