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

@@ -68,7 +68,7 @@ void tearDown(void)
void test_isr_device_connect_highspeed(void)
{
usbh_device_plugged_isr_Expect(hostid, TUSB_SPEED_HIGH);
usbh_device_plugged_isr_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_HIGH);
@@ -76,7 +76,7 @@ void test_isr_device_connect_highspeed(void)
void test_isr_device_connect_fullspeed(void)
{
usbh_device_plugged_isr_Expect(hostid, TUSB_SPEED_FULL);
usbh_device_plugged_isr_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_FULL);
@@ -84,7 +84,7 @@ void test_isr_device_connect_fullspeed(void)
void test_isr_device_connect_slowspeed(void)
{
usbh_device_plugged_isr_Expect(hostid, TUSB_SPEED_LOW);
usbh_device_plugged_isr_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_LOW);

View File

@@ -55,9 +55,10 @@ usbh_enumerate_t const enum_connect = {
.core_id = 0,
.hub_addr = 0,
.hub_port = 0,
.speed = TUSB_SPEED_FULL
};
tusb_speed_t device_speed = TUSB_SPEED_FULL;
void queue_recv_stub (osal_queue_handle_t const queue_hdl, uint32_t *p_data, uint32_t msec, tusb_error_t *p_error, int num_call);
void semaphore_wait_success_stub(osal_semaphore_handle_t const sem_hdl, uint32_t msec, tusb_error_t *p_error, int num_call);
tusb_error_t control_xfer_stub(uint8_t dev_addr, const tusb_std_request_t * const p_request, uint8_t data[], int num_call);
@@ -71,6 +72,8 @@ void setUp(void)
hcd_pipe_control_xfer_StubWithCallback(control_xfer_stub);
hcd_port_connect_status_ExpectAndReturn(enum_connect.core_id, true);
hcd_port_reset_Expect(enum_connect.core_id);
hcd_port_speed_get_ExpectAndReturn(enum_connect.core_id, device_speed);
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
hcd_pipe_control_open_ExpectAndReturn(0, 8, TUSB_ERROR_NONE);
}