mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
rename CFG_TUSB_HOST_DEVICE_MAX to CFG_TUH_DEVICE_MAX
This commit is contained in:
parent
800f85329e
commit
6a16f6ccdd
@ -92,7 +92,7 @@ void tuh_msc_umount_cb(uint8_t dev_addr)
|
||||
//
|
||||
// if ( phy_disk == f_get_current_drive() )
|
||||
// { // active drive is unplugged --> change to other drive
|
||||
// for(uint8_t i=0; i<CFG_TUSB_HOST_DEVICE_MAX; i++)
|
||||
// for(uint8_t i=0; i<CFG_TUH_DEVICE_MAX; i++)
|
||||
// {
|
||||
// if ( disk_is_ready(i) )
|
||||
// {
|
||||
|
@ -80,7 +80,7 @@
|
||||
#define CFG_TUH_MSC 1
|
||||
#define CFG_TUH_VENDOR 0
|
||||
|
||||
#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUH_HUB ? 5 : 1) // normal hub has 4 ports
|
||||
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 5 : 1) // normal hub has 4 ports
|
||||
|
||||
//------------- HID -------------//
|
||||
#define CFG_TUH_HID_EPIN_BUFSIZE 64
|
||||
|
@ -36,7 +36,7 @@
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
// TODO change it to portable init
|
||||
static DSTATUS disk_state[CFG_TUSB_HOST_DEVICE_MAX];
|
||||
static DSTATUS disk_state[CFG_TUH_DEVICE_MAX];
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
@ -61,7 +61,7 @@ static DRESULT wait_for_io_complete(uint8_t usb_addr)
|
||||
|
||||
void diskio_init(void)
|
||||
{
|
||||
memset(disk_state, STA_NOINIT, CFG_TUSB_HOST_DEVICE_MAX);
|
||||
memset(disk_state, STA_NOINIT, CFG_TUH_DEVICE_MAX);
|
||||
}
|
||||
|
||||
//pdrv Specifies the physical drive number.
|
||||
|
@ -83,7 +83,7 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
static inline bool disk_is_ready(BYTE pdrv);
|
||||
static inline bool disk_is_ready(BYTE pdrv)
|
||||
{
|
||||
return (pdrv < CFG_TUSB_HOST_DEVICE_MAX) &&
|
||||
return (pdrv < CFG_TUH_DEVICE_MAX) &&
|
||||
( (disk_status(pdrv) & (STA_NOINIT | STA_NODISK)) == 0 );
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
||||
/ Physical Drive Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _VOLUMES CFG_TUSB_HOST_DEVICE_MAX
|
||||
#define _VOLUMES CFG_TUH_DEVICE_MAX
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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) );
|
||||
}
|
||||
|
@ -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 -------------//
|
||||
|
||||
|
@ -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)
|
||||
|
4
src/class/vendor/vendor_host.c
vendored
4
src/class/vendor/vendor_host.c
vendored
@ -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)
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user