update: add usb align up for every buffer when use dcache clean&invalid api

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-03-28 13:15:01 +08:00
parent 5666fcb540
commit 83695e77cf
20 changed files with 50 additions and 43 deletions

View File

@@ -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;

View File

@@ -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;