move hub and hport variable into common ram to reduce nocache ram usage

This commit is contained in:
sakumisu
2023-02-18 15:18:49 +08:00
parent 2baec4fd32
commit 75ddfc8e4d
9 changed files with 37 additions and 32 deletions

View File

@@ -10,6 +10,7 @@ struct usbh_class_info *usbh_class_info_table_begin = NULL;
struct usbh_class_info *usbh_class_info_table_end = NULL;
USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t ep0_request_buffer[CONFIG_USBHOST_REQUEST_BUFFER_LEN];
USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX struct usb_setup_packet g_setup[CONFIG_USBHOST_MAX_EXTHUBS + 1][CONFIG_USBHOST_MAX_EHPORTS];
/* general descriptor field offsets */
#define DESC_bLength 0 /** Length offset */
@@ -415,8 +416,8 @@ int usbh_enumerate(struct usbh_hubport *hport)
uint16_t ep_mps;
int ret;
#define USB_REQUEST_BUFFER_SIZE 256
setup = &hport->setup;
hport->setup = &g_setup[hport->parent->index - 1][hport->port - 1];
setup = hport->setup;
/* Configure EP0 with the default maximum packet size */
usbh_hport_activate_ep0(hport);

View File

@@ -123,11 +123,11 @@ struct usbh_interface_altsetting {
};
struct usbh_interface {
struct usbh_interface_altsetting altsetting[CONFIG_USBHOST_MAX_INTF_ALTSETTINGS];
uint8_t altsetting_num;
char devname[CONFIG_USBHOST_DEV_NAMELEN];
struct usbh_class_driver *class_driver;
void *priv;
struct usbh_interface_altsetting altsetting[CONFIG_USBHOST_MAX_INTF_ALTSETTINGS];
uint8_t altsetting_num;
};
struct usbh_configuration {
@@ -146,8 +146,8 @@ struct usbh_hubport {
const char *iManufacturer;
const char *iProduct;
const char *iSerialNumber;
uint8_t* raw_config_desc;
USB_MEM_ALIGNX struct usb_setup_packet setup;
uint8_t *raw_config_desc;
struct usb_setup_packet *setup;
struct usbh_hub *parent;
};
@@ -158,7 +158,7 @@ struct usbh_hub {
uint8_t index;
uint8_t hub_addr;
usbh_pipe_t intin;
USB_MEM_ALIGNX uint8_t int_buffer[1];
uint8_t *int_buffer;
struct usbh_urb intin_urb;
struct usb_hub_descriptor hub_desc;
struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS];
@@ -184,6 +184,7 @@ struct usbh_hubport *usbh_find_hubport(uint8_t dev_addr);
void *usbh_find_class_instance(const char *devname);
int lsusb(int argc, char **argv);
#ifdef __cplusplus
}
#endif