From a9fcbaba3b2c7355de03baf2308bb9d9049dcdbd Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 25 Oct 2024 18:38:55 +0200 Subject: [PATCH] feat: fix usb bitmaps --- include/usb.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/include/usb.h b/include/usb.h index 848c3e2..13c434e 100644 --- a/include/usb.h +++ b/include/usb.h @@ -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); -- 2.48.1