--- qemu/roms/seabios/src/usb.h 2018/04/24 18:27:17 1.1.1.3 +++ qemu/roms/seabios/src/usb.h 2018/04/24 19:43:28 1.1.1.6 @@ -6,20 +6,35 @@ // Information on a USB end point. struct usb_pipe { - struct usb_s *cntl; + union { + struct usb_s *cntl; + struct usb_pipe *freenext; + }; u8 type; u8 ep; u8 devaddr; u8 speed; u16 maxpacket; - u8 tt_devaddr; - u8 tt_port; + u8 eptype; +}; + +// Common information for usb devices. +struct usbdevice_s { + struct usbhub_s *hub; + struct usb_pipe *defpipe; + u32 port; + struct usb_config_descriptor *config; + struct usb_interface_descriptor *iface; + int imax; + u8 speed; + u8 devaddr; }; // Common information for usb controllers. struct usb_s { - struct usb_pipe *defaultpipe; + struct usb_pipe *freelist; struct mutex_s resetlock; + struct pci_device *pci; int busid; u8 type; u8 maxaddr; @@ -28,7 +43,7 @@ struct usb_s { // Information for enumerating USB hubs struct usbhub_s { struct usbhub_op_s *op; - struct usb_pipe *pipe; + struct usbdevice_s *usbdev; struct usb_s *cntl; struct mutex_s lock; u32 powerwait; @@ -195,20 +210,21 @@ struct usb_endpoint_descriptor { ****************************************************************/ // usb.c -void usb_setup(void); -void usb_enumerate(struct usbhub_s *hub); +struct usb_pipe *usb_alloc_pipe(struct usbdevice_s *usbdev + , struct usb_endpoint_descriptor *epdesc); +int usb_send_bulk(struct usb_pipe *pipe, int dir, void *data, int datasize); +int usb_poll_intr(struct usb_pipe *pipe, void *data); int send_default_control(struct usb_pipe *pipe, const struct usb_ctrlrequest *req , void *data); -int usb_send_bulk(struct usb_pipe *pipe, int dir, void *data, int datasize); void free_pipe(struct usb_pipe *pipe); -struct usb_pipe *alloc_bulk_pipe(struct usb_pipe *pipe - , struct usb_endpoint_descriptor *epdesc); -struct usb_pipe *alloc_intr_pipe(struct usb_pipe *pipe - , struct usb_endpoint_descriptor *epdesc); -int usb_poll_intr(struct usb_pipe *pipe, void *data); -struct usb_endpoint_descriptor *findEndPointDesc( - struct usb_interface_descriptor *iface, int imax, int type, int dir); -u32 mkendpFromDesc(struct usb_pipe *pipe +struct usb_pipe *usb_getFreePipe(struct usb_s *cntl, u8 eptype); +void usb_desc2pipe(struct usb_pipe *pipe, struct usbdevice_s *usbdev , struct usb_endpoint_descriptor *epdesc); +int usb_getFrameExp(struct usbdevice_s *usbdev + , struct usb_endpoint_descriptor *epdesc); +struct usb_endpoint_descriptor *findEndPointDesc(struct usbdevice_s *usbdev + , int type, int dir); +void usb_enumerate(struct usbhub_s *hub); +void usb_setup(void); #endif // usb.h