usb: USB device attach/detach infrastructure

This commit is contained in:
Cacodemon345
2023-05-05 22:46:18 +06:00
parent b8fb1754d9
commit 1d0c18c3a9
2 changed files with 22 additions and 0 deletions

View File

@@ -86,12 +86,22 @@ typedef struct
void* priv;
} usb_device_t;
enum usb_bus_types
{
USB_BUS_OHCI = 0,
USB_BUS_UHCI = 1
};
/* Global variables. */
extern const device_t usb_device;
/* Functions. */
extern void uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable);
extern void ohci_update_mem_mapping(usb_t *dev, uint8_t base1, uint8_t base2, uint8_t base3, int enable);
/* Attach USB device to a port of a USB bus. Returns the port to which it got attached to. */
extern uint8_t usb_attach_device(usb_t *dev, usb_device_t* device, uint8_t bus_type);
/* Detach USB device from a port. */
extern void usb_detach_device(usb_t *dev, uint8_t port, uint8_t bus_type);
#ifdef __cplusplus
}

View File

@@ -464,6 +464,18 @@ ohci_update_mem_mapping(usb_t *dev, uint8_t base1, uint8_t base2, uint8_t base3,
mem_mapping_set_addr(&dev->ohci_mmio_mapping, dev->ohci_mem_base, 0x1000);
}
uint8_t
usb_attach_device(usb_t *dev, usb_device_t* device, uint8_t bus_type)
{
return 255;
}
void
usb_detach_device(usb_t *dev, uint8_t port, uint8_t bus_type)
{
/* Unused. */
}
static void
usb_reset(void *priv)
{