revert commit 56204.
[AROS.git] / rom / usb / vusbhc / vusbhci_device.h
blobc9e7dadfa2b2185352168128f10b76c0676b4822
1 /*
2 Copyright © 2015-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #ifndef VUSBHCI_DEVICE_H
10 #define VUSBHCI_DEVICE_H
12 #include <aros/debug.h>
13 #include <aros/macros.h>
15 #include <exec/semaphores.h>
17 #include <proto/exec.h>
18 #include <proto/arossupport.h>
20 #include <devices/usb.h>
21 #include <devices/usb_hub.h>
22 #include <devices/newstyle.h>
23 #include <devices/usbhardware.h>
25 #define RC_OK 0
26 #define RC_DONTREPLY -1
28 #define MYBUG_LEVEL 1
29 #define mybug(l, x) D(if ((l>=MYBUG_LEVEL)||(l==-1)) { do { { bug x; } } while (0); } )
30 #define mybug_unit(l, x) D(if ((l>=MYBUG_LEVEL)||(l==-1)) { do { { bug("%s %s: ", unit->name, __FUNCTION__); bug x; } } while (0); } )
32 struct VUSBHCIUnit {
33 struct Node node;
34 CONST_STRPTR name;
35 ULONG state;
36 BOOL allocated;
38 struct timerequest *tr;
39 struct MsgPort *mp;
41 struct IOUsbHWReq *ioreq_ctrl;
42 struct IOUsbHWReq *ioreq_intr;
43 struct IOUsbHWReq *ioreq_bulk;
44 struct IOUsbHWReq *ioreq_isoc;
46 struct Task *handler_task;
47 ULONG handler_task_sig_run;
49 BOOL ctrlxfer_pending;
50 BOOL intrxfer_pending;
51 BOOL bulkxfer_pending;
52 BOOL isocxfer_pending;
54 struct SignalSemaphore ctrlxfer_queue_lock;
55 struct SignalSemaphore intrxfer_queue_lock;
56 struct SignalSemaphore bulkxfer_queue_lock;
57 struct SignalSemaphore isocxfer_queue_lock;
59 struct List ctrlxfer_queue;
60 struct List intrxfer_queue;
61 struct List bulkxfer_queue;
62 struct List isocxfer_queue;
64 struct VUSBHCIRootHub {
66 struct SignalSemaphore intrxfer_queue_lock;
67 struct List intrxfer_queue; /* Status Change endpoint */
69 UWORD addr;
71 struct UsbStdDevDesc devdesc;
73 struct RHConfig {
74 struct UsbStdCfgDesc cfgdesc;
75 struct UsbStdIfDesc ifdesc;
76 struct UsbStdEPDesc epdesc;
77 } config;
79 union {
80 struct UsbHubDesc hubdesc;
81 struct UsbSSHubDesc sshubdesc;
84 struct UsbHubStatus hubstatus;
86 struct UsbPortStatus portstatus;
88 } roothub;
92 struct VUSBHCIBase {
93 struct Device device;
95 //struct Library *HostLibBase;
97 struct VUSBHCIUnit *usbunit200;
99 struct VUSBHCIUnit *usbunit300;
103 BOOL cmdAbortIO(struct IOUsbHWReq *ioreq);
104 WORD cmdFlush(struct IOUsbHWReq *ioreq);
105 WORD cmdUsbReset(struct IOUsbHWReq *ioreq);
106 WORD cmdNSDeviceQuery(struct IOStdReq *ioreq);
107 WORD cmdQueryDevice(struct IOUsbHWReq *ioreq);
108 WORD cmdControlXFerRootHub(struct IOUsbHWReq *ioreq);
109 WORD cmdIntXFerRootHub(struct IOUsbHWReq *ioreq);
110 WORD cmdIntXFer(struct IOUsbHWReq *ioreq);
111 WORD cmdControlXFer(struct IOUsbHWReq *ioreq);
112 WORD cmdBulkXFer(struct IOUsbHWReq *ioreq);
113 WORD cmdISOXFer(struct IOUsbHWReq *ioreq);
114 void uhwCheckRootHubChanges(struct VUSBHCIUnit *unit);
116 void call_libusb_event_handler(void);
117 int do_libusb_ctrl_transfer(struct IOUsbHWReq *ioreq);
118 int do_libusb_intr_transfer(struct IOUsbHWReq *ioreq);
119 int do_libusb_bulk_transfer(struct IOUsbHWReq *ioreq);
120 int do_libusb_isoc_transfer(struct IOUsbHWReq *ioreq);
122 BOOL libusb_bridge_init(struct VUSBHCIBase *VUSBHCIBase);
123 VOID libusb_bridge_cleanup();
125 #endif /* VUSBHCI_DEVICE_H */