sepearate CFG_TUH_DEVICE_MAX and CFG_TUH_HUB
separate dev0 from _usbh_devices pool to save sram
This commit is contained in:
@@ -240,6 +240,8 @@ bool cdch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32
|
||||
|
||||
void cdch_close(uint8_t dev_addr)
|
||||
{
|
||||
TU_VERIFY(dev_addr <= CFG_TUH_DEVICE_MAX, );
|
||||
|
||||
cdch_data_t * p_cdc = get_itf(dev_addr);
|
||||
tu_memclr(p_cdc, sizeof(cdch_data_t));
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ typedef struct
|
||||
hidh_interface_t instances[CFG_TUH_HID];
|
||||
} hidh_device_t;
|
||||
|
||||
static hidh_device_t _hidh_dev[CFG_TUH_DEVICE_MAX-1];
|
||||
static hidh_device_t _hidh_dev[CFG_TUH_DEVICE_MAX];
|
||||
|
||||
//------------- Internal prototypes -------------//
|
||||
|
||||
@@ -240,6 +240,8 @@ bool hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint3
|
||||
|
||||
void hidh_close(uint8_t dev_addr)
|
||||
{
|
||||
TU_VERIFY(dev_addr <= CFG_TUH_DEVICE_MAX, );
|
||||
|
||||
hidh_device_t* hid_dev = get_dev(dev_addr);
|
||||
if (tuh_hid_umount_cb)
|
||||
{
|
||||
|
||||
@@ -76,6 +76,7 @@ CFG_TUSB_MEM_SECTION static msch_interface_t _msch_itf[CFG_TUH_DEVICE_MAX];
|
||||
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4)
|
||||
static uint8_t _msch_buffer[sizeof(scsi_inquiry_resp_t)];
|
||||
|
||||
TU_ATTR_ALWAYS_INLINE
|
||||
static inline msch_interface_t* get_itf(uint8_t dev_addr)
|
||||
{
|
||||
return &_msch_itf[dev_addr-1];
|
||||
@@ -291,11 +292,13 @@ bool tuh_msc_reset(uint8_t dev_addr)
|
||||
//--------------------------------------------------------------------+
|
||||
void msch_init(void)
|
||||
{
|
||||
tu_memclr(_msch_itf, sizeof(msch_interface_t)*CFG_TUH_DEVICE_MAX);
|
||||
tu_memclr(_msch_itf, sizeof(_msch_itf));
|
||||
}
|
||||
|
||||
void msch_close(uint8_t dev_addr)
|
||||
{
|
||||
TU_VERIFY(dev_addr <= CFG_TUH_DEVICE_MAX, );
|
||||
|
||||
msch_interface_t* p_msc = get_itf(dev_addr);
|
||||
|
||||
// invoke Application Callback
|
||||
|
||||
Reference in New Issue
Block a user