diff options
| author | hathach <[email protected]> | 2021-08-23 11:01:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-08-23 11:01:40 +0700 |
| commit | 6a16f6ccddf77e1b0232aec0c89d2105e391b297 (patch) | |
| tree | bca6923d530ac38e2546613515cdc524ee05b65d /src | |
| parent | 800f85329ea21bdefc778c246c8098dea12fb402 (diff) | |
rename CFG_TUSB_HOST_DEVICE_MAX to CFG_TUH_DEVICE_MAX
Diffstat (limited to 'src')
| -rw-r--r-- | src/class/cdc/cdc_host.c | 4 | ||||
| -rw-r--r-- | src/class/cdc/cdc_rndis_host.c | 10 | ||||
| -rw-r--r-- | src/class/hid/hid_host.c | 2 | ||||
| -rw-r--r-- | src/class/msc/msc_host.c | 4 | ||||
| -rw-r--r-- | src/class/vendor/vendor_host.c | 4 | ||||
| -rw-r--r-- | src/host/hcd.h | 2 | ||||
| -rw-r--r-- | src/host/hub.c | 4 | ||||
| -rw-r--r-- | src/host/usbh.c | 14 | ||||
| -rw-r--r-- | src/host/usbh_hcd.h | 2 | ||||
| -rw-r--r-- | src/portable/ehci/ehci.c | 4 | ||||
| -rw-r--r-- | src/portable/ohci/ohci.h | 2 | ||||
| -rw-r--r-- | src/tusb_option.h | 10 |
12 files changed, 31 insertions, 31 deletions
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index 35b8de3b1..e14cb0bab 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -51,7 +51,7 @@ typedef struct { //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -static cdch_data_t cdch_data[CFG_TUSB_HOST_DEVICE_MAX]; +static cdch_data_t cdch_data[CFG_TUH_DEVICE_MAX]; static inline cdch_data_t* get_itf(uint8_t dev_addr) { @@ -146,7 +146,7 @@ bool tuh_cdc_set_control_line_state(uint8_t dev_addr, bool dtr, bool rts, tuh_co //--------------------------------------------------------------------+ void cdch_init(void) { - tu_memclr(cdch_data, sizeof(cdch_data_t)*CFG_TUSB_HOST_DEVICE_MAX); + tu_memclr(cdch_data, sizeof(cdch_data_t)*CFG_TUH_DEVICE_MAX); } bool cdch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t max_len) diff --git a/src/class/cdc/cdc_rndis_host.c b/src/class/cdc/cdc_rndis_host.c index 42b9993bc..cc4ffd1cf 100644 --- a/src/class/cdc/cdc_rndis_host.c +++ b/src/class/cdc/cdc_rndis_host.c @@ -40,10 +40,10 @@ //--------------------------------------------------------------------+ #define RNDIS_MSG_PAYLOAD_MAX (1024*4) -CFG_TUSB_MEM_SECTION static uint8_t msg_notification[CFG_TUSB_HOST_DEVICE_MAX][8]; +CFG_TUSB_MEM_SECTION static uint8_t msg_notification[CFG_TUH_DEVICE_MAX][8]; CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4) static uint8_t msg_payload[RNDIS_MSG_PAYLOAD_MAX]; -static rndish_data_t rndish_data[CFG_TUSB_HOST_DEVICE_MAX]; +static rndish_data_t rndish_data[CFG_TUH_DEVICE_MAX]; // TODO Microsoft requires message length for any get command must be at least 4096 bytes @@ -88,7 +88,7 @@ static tusb_error_t rndis_body_subtask(void) OSAL_SUBTASK_BEGIN - for (relative_addr = 0; relative_addr < CFG_TUSB_HOST_DEVICE_MAX; relative_addr++) + for (relative_addr = 0; relative_addr < CFG_TUH_DEVICE_MAX; relative_addr++) { } @@ -103,12 +103,12 @@ static tusb_error_t rndis_body_subtask(void) //--------------------------------------------------------------------+ void rndish_init(void) { - tu_memclr(rndish_data, sizeof(rndish_data_t)*CFG_TUSB_HOST_DEVICE_MAX); + tu_memclr(rndish_data, sizeof(rndish_data_t)*CFG_TUH_DEVICE_MAX); //------------- Task creation -------------// //------------- semaphore creation for notificaiton pipe -------------// - for(uint8_t i=0; i<CFG_TUSB_HOST_DEVICE_MAX; i++) + for(uint8_t i=0; i<CFG_TUH_DEVICE_MAX; i++) { rndish_data[i].sem_notification_hdl = osal_semaphore_create( OSAL_SEM_REF(rndish_data[i].semaphore_notification) ); } diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index 2d76df588..915f0b21a 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -62,7 +62,7 @@ typedef struct hidh_interface_t instances[CFG_TUH_HID]; } hidh_device_t; -static hidh_device_t _hidh_dev[CFG_TUSB_HOST_DEVICE_MAX-1]; +static hidh_device_t _hidh_dev[CFG_TUH_DEVICE_MAX-1]; //------------- Internal prototypes -------------// diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c index f02f4550a..c7669aa21 100644 --- a/src/class/msc/msc_host.c +++ b/src/class/msc/msc_host.c @@ -69,7 +69,7 @@ typedef struct msc_csw_t csw; }msch_interface_t; -CFG_TUSB_MEM_SECTION static msch_interface_t _msch_itf[CFG_TUSB_HOST_DEVICE_MAX]; +CFG_TUSB_MEM_SECTION static msch_interface_t _msch_itf[CFG_TUH_DEVICE_MAX]; // buffer used to read scsi information when mounted // largest response data currently is inquiry TODO Inquiry is not part of enum anymore @@ -291,7 +291,7 @@ bool tuh_msc_reset(uint8_t dev_addr) //--------------------------------------------------------------------+ void msch_init(void) { - tu_memclr(_msch_itf, sizeof(msch_interface_t)*CFG_TUSB_HOST_DEVICE_MAX); + tu_memclr(_msch_itf, sizeof(msch_interface_t)*CFG_TUH_DEVICE_MAX); } void msch_close(uint8_t dev_addr) diff --git a/src/class/vendor/vendor_host.c b/src/class/vendor/vendor_host.c index f7a6b2bf0..1e28e9af4 100644 --- a/src/class/vendor/vendor_host.c +++ b/src/class/vendor/vendor_host.c @@ -41,7 +41,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -custom_interface_info_t custom_interface[CFG_TUSB_HOST_DEVICE_MAX]; +custom_interface_info_t custom_interface[CFG_TUH_DEVICE_MAX]; static tusb_error_t cush_validate_paras(uint8_t dev_addr, uint16_t vendor_id, uint16_t product_id, void * p_buffer, uint16_t length) { @@ -90,7 +90,7 @@ tusb_error_t tusbh_custom_write(uint8_t dev_addr, uint16_t vendor_id, uint16_t p //--------------------------------------------------------------------+ void cush_init(void) { - tu_memclr(&custom_interface, sizeof(custom_interface_info_t) * CFG_TUSB_HOST_DEVICE_MAX); + tu_memclr(&custom_interface, sizeof(custom_interface_info_t) * CFG_TUH_DEVICE_MAX); } tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) diff --git a/src/host/hcd.h b/src/host/hcd.h index 7a9aadc73..62ff8b3f2 100644 --- a/src/host/hcd.h +++ b/src/host/hcd.h @@ -84,7 +84,7 @@ typedef struct // Max number of endpoints per device enum { // TODO better computation - HCD_MAX_ENDPOINT = CFG_TUSB_HOST_DEVICE_MAX*(CFG_TUH_HUB + CFG_TUH_HID*2 + CFG_TUH_MSC*2 + CFG_TUH_CDC*3), + HCD_MAX_ENDPOINT = CFG_TUH_DEVICE_MAX*(CFG_TUH_HUB + CFG_TUH_HID*2 + CFG_TUH_MSC*2 + CFG_TUH_CDC*3), HCD_MAX_XFER = HCD_MAX_ENDPOINT*2, }; diff --git a/src/host/hub.c b/src/host/hub.c index 00dce4e65..d685c6529 100644 --- a/src/host/hub.c +++ b/src/host/hub.c @@ -45,7 +45,7 @@ typedef struct hub_port_status_response_t port_status; } hub_interface_t; -CFG_TUSB_MEM_SECTION static hub_interface_t hub_data[CFG_TUSB_HOST_DEVICE_MAX]; +CFG_TUSB_MEM_SECTION static hub_interface_t hub_data[CFG_TUH_DEVICE_MAX]; TU_ATTR_ALIGNED(4) CFG_TUSB_MEM_SECTION static uint8_t _hub_buffer[sizeof(descriptor_hub_desc_t)]; #if CFG_TUSB_DEBUG @@ -144,7 +144,7 @@ bool hub_port_get_status(uint8_t hub_addr, uint8_t hub_port, void* resp, tuh_con //--------------------------------------------------------------------+ void hub_init(void) { - tu_memclr(hub_data, CFG_TUSB_HOST_DEVICE_MAX*sizeof(hub_interface_t)); + tu_memclr(hub_data, CFG_TUH_DEVICE_MAX*sizeof(hub_interface_t)); } bool hub_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t max_len) diff --git a/src/host/usbh.c b/src/host/usbh.c index 40c23a69d..98132a8c0 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -129,7 +129,7 @@ enum { CONFIG_NUM = 1 }; // default to use configuration 1 static bool _usbh_initialized = false; // including zero-address -CFG_TUSB_MEM_SECTION usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1]; +CFG_TUSB_MEM_SECTION usbh_device_t _usbh_devices[CFG_TUH_DEVICE_MAX+1]; // Event queue // role device/host is used by OS NONE for mutex (disable usb isr) @@ -156,7 +156,7 @@ bool tuh_device_configured(uint8_t dev_addr) tusb_speed_t tuh_device_get_speed (uint8_t const dev_addr) { - TU_ASSERT( dev_addr <= CFG_TUSB_HOST_DEVICE_MAX, TUSB_SPEED_INVALID); + TU_ASSERT( dev_addr <= CFG_TUH_DEVICE_MAX, TUSB_SPEED_INVALID); return (tusb_speed_t) _usbh_devices[dev_addr].speed; } @@ -193,7 +193,7 @@ bool tuh_init(uint8_t rhport) TU_ASSERT(_usbh_q != NULL); //------------- Semaphore, Mutex for Control Pipe -------------// - for(uint8_t i=0; i<CFG_TUSB_HOST_DEVICE_MAX+1; i++) // including address zero + for(uint8_t i=0; i<CFG_TUH_DEVICE_MAX+1; i++) // including address zero { usbh_device_t * const dev = &_usbh_devices[i]; @@ -387,7 +387,7 @@ void hcd_event_device_remove(uint8_t hostid, bool in_isr) void process_device_unplugged(uint8_t rhport, uint8_t hub_addr, uint8_t hub_port) { //------------- find the all devices (star-network) under port that is unplugged -------------// - for (uint8_t dev_addr = 0; dev_addr <= CFG_TUSB_HOST_DEVICE_MAX; dev_addr ++) + for (uint8_t dev_addr = 0; dev_addr <= CFG_TUH_DEVICE_MAX; dev_addr ++) { usbh_device_t* dev = &_usbh_devices[dev_addr]; @@ -422,11 +422,11 @@ void process_device_unplugged(uint8_t rhport, uint8_t hub_addr, uint8_t hub_port //--------------------------------------------------------------------+ static uint8_t get_new_address(void) { - for (uint8_t addr=1; addr <= CFG_TUSB_HOST_DEVICE_MAX; addr++) + for (uint8_t addr=1; addr <= CFG_TUH_DEVICE_MAX; addr++) { if (_usbh_devices[addr].state == TUSB_DEVICE_STATE_UNPLUG) return addr; } - return CFG_TUSB_HOST_DEVICE_MAX+1; + return CFG_TUH_DEVICE_MAX+1; } void usbh_driver_set_config_complete(uint8_t dev_addr, uint8_t itf_num) @@ -548,7 +548,7 @@ static bool enum_request_set_addr(void) { // Set Address uint8_t const new_addr = get_new_address(); - TU_ASSERT(new_addr <= CFG_TUSB_HOST_DEVICE_MAX); // TODO notify application we reach max devices + TU_ASSERT(new_addr <= CFG_TUH_DEVICE_MAX); // TODO notify application we reach max devices TU_LOG2("Set Address = %d\r\n", new_addr); diff --git a/src/host/usbh_hcd.h b/src/host/usbh_hcd.h index 450b3e447..9f8d3407d 100644 --- a/src/host/usbh_hcd.h +++ b/src/host/usbh_hcd.h @@ -95,7 +95,7 @@ typedef struct { } usbh_device_t; -extern usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1]; // including zero-address +extern usbh_device_t _usbh_devices[CFG_TUH_DEVICE_MAX+1]; // including zero-address #ifdef __cplusplus } diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c index 48788ba06..62be83468 100644 --- a/src/portable/ehci/ehci.c +++ b/src/portable/ehci/ehci.c @@ -56,7 +56,7 @@ typedef struct struct { ehci_qhd_t qhd; ehci_qtd_t qtd; - }control[CFG_TUSB_HOST_DEVICE_MAX+1]; + }control[CFG_TUH_DEVICE_MAX+1]; ehci_qhd_t qhd_pool[HCD_MAX_ENDPOINT]; ehci_qtd_t qtd_pool[HCD_MAX_XFER] TU_ATTR_ALIGNED(32); @@ -528,7 +528,7 @@ static void period_list_xfer_complete_isr(uint8_t hostid, uint8_t interval_ms) // TODO abstract max loop guard for period while( !next_item.terminate && !(interval_ms > 1 && period_1ms_addr == tu_align32(next_item.address)) && - max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*CFG_TUSB_HOST_DEVICE_MAX) + max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*CFG_TUH_DEVICE_MAX) { switch ( next_item.type ) { diff --git a/src/portable/ohci/ohci.h b/src/portable/ohci/ohci.h index 6a634592a..cd90aa45a 100644 --- a/src/portable/ohci/ohci.h +++ b/src/portable/ohci/ohci.h @@ -159,7 +159,7 @@ typedef struct TU_ATTR_ALIGNED(256) struct { ohci_ed_t ed; ohci_gtd_t gtd; - }control[CFG_TUSB_HOST_DEVICE_MAX+1]; + }control[CFG_TUH_DEVICE_MAX+1]; // ochi_itd_t itd[OHCI_MAX_ITD]; // itd requires alignment of 32 ohci_ed_t ed_pool[HCD_MAX_ENDPOINT]; diff --git a/src/tusb_option.h b/src/tusb_option.h index e189c65bb..bbbf10a84 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -266,14 +266,14 @@ // HOST OPTIONS //-------------------------------------------------------------------- #if TUSB_OPT_HOST_ENABLED - #ifndef CFG_TUSB_HOST_DEVICE_MAX - #define CFG_TUSB_HOST_DEVICE_MAX 1 - #warning CFG_TUSB_HOST_DEVICE_MAX is not defined, default value is 1 + #ifndef CFG_TUH_DEVICE_MAX + #define CFG_TUH_DEVICE_MAX 1 + #warning CFG_TUH_DEVICE_MAX is not defined, default value is 1 #endif //------------- HUB CLASS -------------// - #if CFG_TUH_HUB && (CFG_TUSB_HOST_DEVICE_MAX == 1) - #error There is no benefit enable hub with max device is 1. Please disable hub or increase CFG_TUSB_HOST_DEVICE_MAX + #if CFG_TUH_HUB && (CFG_TUH_DEVICE_MAX == 1) + #error There is no benefit enable hub with max device is 1. Please disable hub or increase CFG_TUH_DEVICE_MAX #endif #ifndef CFG_TUH_ENUMERATION_BUFSIZE |
