add tuh_configure() for port/dynamic host behavior config

This commit is contained in:
hathach
2022-06-08 01:17:01 +07:00
parent 896c707cd4
commit 8cbc34de11
6 changed files with 67 additions and 23 deletions

View File

@@ -46,8 +46,8 @@ typedef void (*tuh_xfer_cb_t)(tuh_xfer_t* xfer);
// Note1: layout and order of this will be changed in near future
// it is advised to initialize it using member name
// Note2: not all field is available/meaningful in callback, some info is not saved by
// usbh to save SRAM
// Note2: not all field is available/meaningful in callback,
// some info is not saved by usbh to save SRAM
struct tuh_xfer_s
{
uint8_t daddr;
@@ -69,6 +69,12 @@ struct tuh_xfer_s
// uint32_t timeout_ms; // place holder, not supported yet
};
// ConfigID for tuh_config()
enum
{
TUH_CFGID_RPI_PIO_USB_CONFIGURATION = OPT_MCU_RP2040 // cfg_param: pio_usb_configuration_t
};
//--------------------------------------------------------------------+
// APPLICATION CALLBACK
//--------------------------------------------------------------------+
@@ -85,6 +91,12 @@ TU_ATTR_WEAK void tuh_umount_cb(uint8_t daddr);
// APPLICATION API
//--------------------------------------------------------------------+
// Configure host stack behavior with dynamic or port-specific parameters.
// Should be called before tuh_init()
// - cfg_id : configure ID (TBD)
// - cfg_param: configure data, structure depends on the ID
bool tuh_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param);
// Init host stack
bool tuh_init(uint8_t rhport);