@@ 23,9 23,9 @@ typedef enum {
} usb_setup_command_recipient_t;
typedef struct {
+ uint8_t recipient : 5;
+ usb_setup_command_type_t type : 2;
usb_setup_command_direction_t direction : 1;
- usb_setup_command_direction_t type : 2;
- usb_setup_command_direction_t recipient : 5;
} usb_setup_command_request_type_t;
typedef enum {
@@ 56,7 56,7 @@ typedef enum {
} usb_descriptor_type_t;
#pragma GCC diagnostic error "-Wpadded"
-typedef struct {
+typedef struct __attribute__((packed)) {
usb_setup_command_request_type_t bmRequestType;
usb_setup_request_t bRequest;
uint16_t wValue;
@@ 137,9 137,9 @@ typedef enum {
} usb_endpoint_direction_t;
typedef struct {
- uint8_t direction : 1;
- uint8_t reserved : 3;
uint8_t endpoint_number : 4;
+ uint8_t reserved : 3;
+ uint8_t direction : 1;
} usb_endpoint_address_t;
typedef enum {
@@ 164,10 164,10 @@ typedef enum {
} usb_endpoint_usage_type_t;
typedef struct __attribute__((packed)) {
- uint8_t reserved_zeros : 2;
- usb_endpoint_usage_type_t usage_type : 2;
- usb_endpoint_synchronization_type_t synchronization_type : 2;
usb_endpoint_transfer_type_t transfer_type : 2;
+ usb_endpoint_synchronization_type_t synchronization_type : 2;
+ usb_endpoint_usage_type_t usage_type : 2;
+ uint8_t reserved_zeros : 2;
} usb_endpoint_attributes_t;
typedef struct __attribute__((packed)) {
@@ 191,6 191,10 @@ typedef struct {
uint8_t *bString;
} usb_unicode_string_descriptor_t;
+
+void usb_generic_send(uint8_t* data, uint16_t size, uint32_t *fifo_tx_target);
+void usb_generic_read(uint8_t *data, uint16_t size, uint32_t *fifo_rx_source);
+
void usb_send_descriptor(usb_descriptor_t* descriptor, uint32_t *fifo_tx_target);
/* void usb_send_ack(uint32_t* fifo_tx_target); */
void usb_send_configuration_descriptor(usb_configuration_descriptor_t* descriptor, uint32_t *fifo_tx_target);