implement hcd_port_speed_get

move port reset & speed detection from isr context to usbh enumeration task
- decrease time in isr significantly from 50 ms to 580us
fix bug with osal_task_delay for freeRTOS buil
This commit is contained in:
hathach
2013-04-25 17:48:55 +07:00
parent 3763e22c9a
commit c0104b996e
7 changed files with 27 additions and 16 deletions

View File

@@ -137,7 +137,7 @@ void hcd_port_reset(uint8_t hostid)
#ifndef _TEST_
// NXP specific, port reset will automatically be 0 when reset sequence complete
// there is chance device is unplugged while reset sequence is not complete
while( regs->portsc_bit.port_reset) {}
while( regs->portsc_bit.port_reset) {} // TODO use task delay to remove blocking
#endif
}
@@ -146,6 +146,11 @@ bool hcd_port_connect_status(uint8_t hostid)
return get_operational_register(hostid)->portsc_bit.current_connect_status;
}
tusb_speed_t hcd_port_speed_get(uint8_t hostid)
{
return get_operational_register(hostid)->portsc_bit.nxp_port_speed; // NXP specific port speed
}
//--------------------------------------------------------------------+
// Controller API
//--------------------------------------------------------------------+
@@ -479,8 +484,7 @@ void port_connect_status_change_isr(uint8_t hostid)
if (regs->portsc_bit.current_connect_status) // device plugged
{
hcd_port_reset(hostid);
usbh_device_plugged_isr(hostid, regs->portsc_bit.nxp_port_speed); // NXP specific port speed
usbh_device_plugged_isr(hostid);
}else // device unplugged
{
usbh_device_unplugged_isr(hostid);