implement pio_usb_irq_handler

This commit is contained in:
hathach 2022-03-31 12:56:53 +07:00
parent e2f0aef93b
commit e94d11a5b3
2 changed files with 24 additions and 4 deletions

@ -1 +1 @@
Subproject commit 92268187f3b0490a43d139ed2cb598b06258011f
Subproject commit 4220c05dc6b7ab7b4db33e5e05bb66be7b6c7156

View File

@ -101,7 +101,7 @@ void hcd_port_reset_end(uint8_t rhport)
if (fullspeed_flag && get_port_pin_status(root) == PORT_PIN_FS_IDLE) {
root->root_device = &usb_device[0];
if (!root->root_device->connected) {
configure_fullspeed_host(pp, &pio_host_config, root);
// configure_fullspeed_host(pp, &pio_host_config, root);
root->root_device->is_fullspeed = true;
root->root_device->is_root = true;
root->root_device->connected = true;
@ -111,7 +111,7 @@ void hcd_port_reset_end(uint8_t rhport)
} else if (!fullspeed_flag && get_port_pin_status(root) == PORT_PIN_LS_IDLE) {
root->root_device = &usb_device[0];
if (!root->root_device->connected) {
configure_lowspeed_host(pp, &pio_host_config, root);
// configure_lowspeed_host(pp, &pio_host_config, root);
root->root_device->is_fullspeed = false;
root->root_device->is_root = true;
root->root_device->connected = true;
@ -217,6 +217,7 @@ bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet
return false;
}
bool hcd_edpt_control_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet[8], uint8_t* data)
{
int ret;
@ -242,7 +243,6 @@ bool hcd_edpt_control_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t const setup
return ret == 0;
}
//bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr)
//{
// // EPX is shared, so multiple device addresses and endpoint addresses share that
@ -265,4 +265,24 @@ bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
return true;
}
// IRQ Handler
void pio_usb_irq_handler(uint8_t root_id)
{
root_port_t* port = PIO_USB(root_id);
if ( port->ints & PIO_USB_INTS_CONNECT_BITS )
{
hcd_event_device_attach(root_id+1, true);
port->ints &= ~PIO_USB_INTS_CONNECT_BITS;
}
if ( port->ints & PIO_USB_INTS_DISCONNECT_BITS )
{
hcd_event_device_remove(root_id+1, true);
port->ints &= ~PIO_USB_INTS_DISCONNECT_BITS;
}
}
#endif