mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 01:20:19 +00:00
correct error using local p_interface_desc with subtask invoke (require static)
This commit is contained in:
parent
4023d07df0
commit
5eca6d69c3
tinyusb
@ -96,7 +96,7 @@ static inline void hidh_init(void)
|
|||||||
void hidh_init(void);
|
void hidh_init(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tusb_error_t hidh_install_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *descriptor, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
|
tusb_error_t hidh_install_subtask(uint8_t dev_addr, uint8_t const *descriptor, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ tusb_error_t usbh_init(void)
|
|||||||
return TUSB_ERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// function called within a task, requesting os blocking services
|
// function called within a task, requesting os blocking services, subtask input parameter must be static/global variables
|
||||||
tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, tusb_std_request_t const* p_request, uint8_t* data)
|
tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, tusb_std_request_t const* p_request, uint8_t* data)
|
||||||
{
|
{
|
||||||
tusb_error_t error;
|
tusb_error_t error;
|
||||||
@ -257,22 +257,18 @@ OSAL_TASK_DECLARE(usbh_enumeration_task)
|
|||||||
// parse each interfaces
|
// parse each interfaces
|
||||||
while( p_desc < enum_data_buffer + ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength )
|
while( p_desc < enum_data_buffer + ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength )
|
||||||
{
|
{
|
||||||
tusb_descriptor_interface_t *p_interface_desc = (tusb_descriptor_interface_t*) p_desc;
|
TASK_ASSERT( TUSB_DESC_INTERFACE == ((tusb_descriptor_interface_t*) p_desc)->bDescriptorType ); // TODO should we skip this descriptor and advance
|
||||||
|
|
||||||
TASK_ASSERT( TUSB_DESC_INTERFACE == p_interface_desc->bDescriptorType ); // TODO should we skip this descriptor and advance
|
|
||||||
|
|
||||||
// NOTE: cannot use switch (conflicted with OSAL_NONE task)
|
// NOTE: cannot use switch (conflicted with OSAL_NONE task)
|
||||||
if (TUSB_CLASS_UNSPECIFIED == p_interface_desc->bInterfaceClass)
|
if (TUSB_CLASS_UNSPECIFIED == ((tusb_descriptor_interface_t*) p_desc)->bInterfaceClass)
|
||||||
{
|
{
|
||||||
TASK_ASSERT( false ); // corrupted data
|
TASK_ASSERT( false ); // corrupted data
|
||||||
}
|
}
|
||||||
#if HOST_CLASS_HID
|
#if HOST_CLASS_HID
|
||||||
else if ( TUSB_CLASS_HID == p_interface_desc->bInterfaceClass)
|
else if ( TUSB_CLASS_HID == ((tusb_descriptor_interface_t*) p_desc)->bInterfaceClass)
|
||||||
{
|
{
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
OSAL_SUBTASK_INVOKED_AND_WAIT (
|
OSAL_SUBTASK_INVOKED_AND_WAIT ( hidh_install_subtask(new_addr, p_desc, &length) );
|
||||||
hidh_install_subtask(new_addr, p_interface_desc, &length)
|
|
||||||
);
|
|
||||||
p_desc += length;
|
p_desc += length;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user