summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-04-26 00:35:16 +0700
committerhathach <[email protected]>2022-04-26 00:35:16 +0700
commit26a25279bc7196d93ca074203ac35260298df472 (patch)
treebdad95142d92edd08cdbac2515ff7d42716fbdf7 /src
parent2f9b9a31be9d511d0bbb99671a2f5e7818cf8a55 (diff)
follow pio usb changes
Diffstat (limited to 'src')
-rw-r--r--src/portable/raspberrypi/pio_usb/dcd_pio_usb.c11
-rw-r--r--src/portable/raspberrypi/pio_usb/hcd_pio_usb.c40
2 files changed, 26 insertions, 25 deletions
diff --git a/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c b/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
index d73419fe3..09be69afa 100644
--- a/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
+++ b/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
@@ -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
diff --git a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c b/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
index f881716ec..2b3d72df8 100644
--- a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
+++ b/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
@@ -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 )