usb: USB device attach/detach infrastructure
This commit is contained in:
@@ -86,12 +86,22 @@ typedef struct
|
|||||||
void* priv;
|
void* priv;
|
||||||
} usb_device_t;
|
} usb_device_t;
|
||||||
|
|
||||||
|
enum usb_bus_types
|
||||||
|
{
|
||||||
|
USB_BUS_OHCI = 0,
|
||||||
|
USB_BUS_UHCI = 1
|
||||||
|
};
|
||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
extern const device_t usb_device;
|
extern const device_t usb_device;
|
||||||
|
|
||||||
/* Functions. */
|
/* Functions. */
|
||||||
extern void uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable);
|
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);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
12
src/usb.c
12
src/usb.c
@@ -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);
|
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
|
static void
|
||||||
usb_reset(void *priv)
|
usb_reset(void *priv)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user