diff options
| author | sakumisu <[email protected]> | 2025-03-28 13:15:01 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-03-28 13:29:04 +0800 |
| commit | 83695e77cf9fabc57c66080468eafeada49b7564 (patch) | |
| tree | b662ef31b5f6fab3bd9da2c1c20e204da07452e5 /core | |
| parent | 5666fcb540fbb6133cb278278b041317b8840232 (diff) | |
update: add usb align up for every buffer when use dcache clean&invalid api
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'core')
| -rw-r--r-- | core/usbd_core.c | 4 | ||||
| -rw-r--r-- | core/usbh_core.c | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/core/usbd_core.c b/core/usbd_core.c index 2a2fda46..2a425868 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -41,7 +41,7 @@ USB_NOCACHE_RAM_SECTION struct usbd_core_priv { /** Setup packet */ USB_MEM_ALIGNX struct usb_setup_packet setup; /** Pointer to data buffer */ - uint8_t *ep0_data_buf; + USB_MEM_ALIGNX uint8_t *ep0_data_buf; /** Remaining bytes in buffer */ uint32_t ep0_data_buf_residue; /** Total length of control transfer */ @@ -59,7 +59,7 @@ USB_NOCACHE_RAM_SECTION struct usbd_core_priv { struct usb_webusb_descriptor *webusb_url_desc; #endif /* Buffer used for storing standard, class and vendor request data */ - USB_MEM_ALIGNX uint8_t req_data[CONFIG_USBDEV_REQUEST_BUFFER_LEN]; + USB_MEM_ALIGNX uint8_t req_data[USB_ALIGN_UP(CONFIG_USBDEV_REQUEST_BUFFER_LEN, CONFIG_USB_ALIGN_SIZE)]; /** Currently selected configuration */ uint8_t configuration; diff --git a/core/usbh_core.c b/core/usbh_core.c index 38b5439f..29c6c2bc 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -14,8 +14,12 @@ struct usbh_class_info *usbh_class_info_table_end = NULL; usb_slist_t g_bus_head = USB_SLIST_OBJECT_INIT(g_bus_head); +struct setup_align_buffer { + uint8_t buffer[USB_ALIGN_UP(8, CONFIG_USB_ALIGN_SIZE)]; +}; + USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t ep0_request_buffer[CONFIG_USBHOST_MAX_BUS][USB_ALIGN_UP(CONFIG_USBHOST_REQUEST_BUFFER_LEN, CONFIG_USB_ALIGN_SIZE)]; -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX struct usb_setup_packet g_setup_buffer[CONFIG_USBHOST_MAX_BUS][CONFIG_USBHOST_MAX_EXTHUBS + 1][CONFIG_USBHOST_MAX_EHPORTS]; +USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX struct setup_align_buffer g_setup_buffer[CONFIG_USBHOST_MAX_BUS][CONFIG_USBHOST_MAX_EXTHUBS + 1][CONFIG_USBHOST_MAX_EHPORTS]; struct usbh_bus g_usbhost_bus[CONFIG_USBHOST_MAX_BUS]; @@ -363,7 +367,7 @@ int usbh_enumerate(struct usbh_hubport *hport) uint8_t config_index; int ret; - hport->setup = &g_setup_buffer[hport->bus->busid][hport->parent->index - 1][hport->port - 1]; + hport->setup = (struct usb_setup_packet *)&g_setup_buffer[hport->bus->busid][hport->parent->index - 1][hport->port - 1]; setup = hport->setup; ep = &hport->ep0; |
