follow pio usb changes

This commit is contained in:
hathach 2022-04-26 00:35:16 +07:00
parent 2f9b9a31be
commit 26a25279bc
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
3 changed files with 27 additions and 26 deletions

@ -1 +1 @@
Subproject commit 496454021deab00e1c425a6eb70009666fa036b3
Subproject commit d2c70ae7b6a122027b7c5c9aa4769fab19e8e886

View File

@ -74,11 +74,8 @@ void dcd_int_disable (uint8_t rhport)
// Receive Set Address request, mcu port must also include status IN response
void dcd_set_address (uint8_t rhport, uint8_t dev_addr)
{
uint8_t const pio_rhport = RHPORT_PIO(rhport);
// must be called before queuing status
pio_usb_device_set_address(pio_rhport, dev_addr);
pio_usb_device_set_address(dev_addr);
dcd_edpt_xfer(rhport, 0x80, NULL, 0);
}
@ -107,8 +104,8 @@ void dcd_disconnect(uint8_t rhport)
// Configure endpoint's registers according to descriptor
bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_ep)
{
uint8_t const pio_rhport = RHPORT_PIO(rhport);
return pio_usb_device_endpoint_open(pio_rhport, (uint8_t const*) desc_ep);
(void) rhport;
return pio_usb_device_endpoint_open((uint8_t const*) desc_ep);
}
void dcd_edpt_close_all (uint8_t rhport)
@ -121,7 +118,7 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
{
(void) rhport;
endpoint_t *ep = pio_usb_device_get_endpoint_by_address(ep_addr);
return pio_usb_ll_endpoint_transfer(ep, buffer, total_bytes);
return pio_usb_ll_transfer_start(ep, buffer, total_bytes);
}
// Submit a transfer where is managed by FIFO, When complete dcd_event_xfer_complete() is invoked to notify the stack - optional, however, must be listed in usbd.c

View File

@ -59,21 +59,21 @@ bool hcd_init(uint8_t rhport)
void hcd_port_reset(uint8_t rhport)
{
rhport = RHPORT_PIO(rhport);
pio_usb_host_port_reset_start(rhport);
uint8_t pio_rhport = RHPORT_PIO(rhport);
pio_usb_host_port_reset_start(pio_rhport);
}
void hcd_port_reset_end(uint8_t rhport)
{
rhport = RHPORT_PIO(rhport);
pio_usb_host_port_reset_end(rhport);
uint8_t pio_rhport = RHPORT_PIO(rhport);
pio_usb_host_port_reset_end(pio_rhport);
}
bool hcd_port_connect_status(uint8_t rhport)
{
rhport = RHPORT_PIO(rhport);
uint8_t pio_rhport = RHPORT_PIO(rhport);
root_port_t *root = PIO_USB_ROOT_PORT(rhport);
root_port_t *root = PIO_USB_ROOT_PORT(pio_rhport);
port_pin_status_t line_state = pio_usb_bus_get_line_state(root);
return line_state != PORT_PIN_SE0;
@ -82,28 +82,31 @@ bool hcd_port_connect_status(uint8_t rhport)
tusb_speed_t hcd_port_speed_get(uint8_t rhport)
{
// TODO determine link speed
rhport = RHPORT_PIO(rhport);
return PIO_USB_ROOT_PORT(rhport)->is_fullspeed ? TUSB_SPEED_FULL : TUSB_SPEED_LOW;
uint8_t pio_rhport = RHPORT_PIO(rhport);
return PIO_USB_ROOT_PORT(pio_rhport)->is_fullspeed ? TUSB_SPEED_FULL : TUSB_SPEED_LOW;
}
// Close all opened endpoint belong to this device
void hcd_device_close(uint8_t rhport, uint8_t dev_addr)
{
rhport = RHPORT_PIO(rhport);
pio_usb_host_close_device(rhport, dev_addr);
uint8_t pio_rhport = RHPORT_PIO(rhport);
pio_usb_host_close_device(pio_rhport, dev_addr);
}
uint32_t hcd_frame_number(uint8_t rhport)
{
(void) rhport;
return 0;
}
void hcd_int_enable(uint8_t rhport)
{
(void) rhport;
}
void hcd_int_disable(uint8_t rhport)
{
(void) rhport;
}
//--------------------------------------------------------------------+
@ -116,20 +119,20 @@ bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const
hcd_devtree_get_info(dev_addr, &dev_tree);
bool const need_pre = (dev_tree.hub_addr && dev_tree.speed == TUSB_SPEED_LOW);
rhport = RHPORT_PIO(rhport);
return pio_usb_host_endpoint_open(rhport, dev_addr, (uint8_t const*) desc_ep, need_pre);
uint8_t pio_rhport = RHPORT_PIO(rhport);
return pio_usb_host_endpoint_open(pio_rhport, dev_addr, (uint8_t const*) desc_ep, need_pre);
}
bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen)
{
rhport = RHPORT_PIO(rhport);
return pio_usb_host_endpoint_transfer(rhport, dev_addr, ep_addr, buffer, buflen);
uint8_t pio_rhport = RHPORT_PIO(rhport);
return pio_usb_host_endpoint_transfer(pio_rhport, dev_addr, ep_addr, buffer, buflen);
}
bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet[8])
{
rhport = RHPORT_PIO(rhport);
return pio_usb_host_send_setup(rhport, dev_addr, setup_packet);
uint8_t pio_rhport = RHPORT_PIO(rhport);
return pio_usb_host_send_setup(pio_rhport, dev_addr, setup_packet);
}
//bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr)
@ -200,17 +203,18 @@ static void __no_inline_not_in_flash_func(handle_endpoint_irq)(root_port_t* port
// IRQ Handler
void __no_inline_not_in_flash_func(pio_usb_host_irq_handler)(uint8_t root_id)
{
uint8_t const tu_rhport = root_id + 1;
root_port_t* port = PIO_USB_ROOT_PORT(root_id);
uint32_t const ints = port->ints;
if ( ints & PIO_USB_INTS_CONNECT_BITS )
{
hcd_event_device_attach(root_id+1, true);
hcd_event_device_attach(tu_rhport, true);
}
if ( ints & PIO_USB_INTS_DISCONNECT_BITS )
{
hcd_event_device_remove(root_id+1, true);
hcd_event_device_remove(tu_rhport, true);
}
if ( ints & PIO_USB_INTS_ENDPOINT_COMPLETE_BITS )