1 #ifndef USB2OTG_INTERN_H
2 #define USB2OTG_INTERN_H
4 Copyright © 2013, The AROS Development Team. All rights reserved.
8 #include LC_LIBDEFS_FILE
10 #include <aros/libcall.h>
11 #include <aros/asmcall.h>
12 #include <aros/symbolsets.h>
14 #include <exec/types.h>
15 #include <exec/lists.h>
16 #include <exec/memory.h>
17 #include <exec/libraries.h>
18 #include <exec/interrupts.h>
19 #include <exec/semaphores.h>
20 #include <exec/execbase.h>
21 #include <exec/devices.h>
23 #include <exec/ports.h>
24 #include <exec/errors.h>
25 #include <exec/resident.h>
26 #include <exec/initializers.h>
29 #include <devices/timer.h>
30 #include <utility/utility.h>
32 #include <devices/usbhardware.h>
33 #include <devices/newstyle.h>
38 Force the USB chipset to run in Host mode
39 AFAIK Poseidon doesnt support device mode? - TODO
41 //#define OTG_FORCEHOSTMODE
42 //#define OTG_FORCEDEVICEMODE
44 /* Reply the iorequest with success */
47 /* Magic cookie, don't set error fields & don't reply the ioreq */
48 #define RC_DONTREPLY -1
50 #define MAX_ROOT_PORTS 16
52 struct USBNSDeviceQueryResult
58 const UWORD
*SupportedCommands
; /* 0 terminated list of cmd's */
65 struct List hu_IOPendingQueue
; /* Root Hub Pending IO Requests */
67 struct List hu_TDQueue
;
68 struct List hu_PeriodicTDQueue
;
69 struct List hu_CtrlXFerQueue
;
70 struct List hu_IntXFerQueue
;
71 struct List hu_IsoXFerQueue
;
72 struct List hu_BulkXFerQueue
;
74 struct List hu_AbortQueue
;
76 APTR hu_GlobalIRQHandle
;
77 struct Interrupt hu_PendingInt
;
78 struct Interrupt hu_NakTimeoutInt
;
79 struct timerequest hu_NakTimeoutReq
;
80 struct MsgPort hu_NakTimeoutMsgPort
;
82 UBYTE hu_OperatingMode
; /* HOST/DEVICE mode */
88 BOOL hu_UnitAllocated
; /* unit opened */
89 BOOL hu_HubPortChanged
; /* Root port state change */
92 /* PRIVATE device node */
95 struct Library hd_Library
; /* standard */
96 UWORD hd_Flags
; /* various flags */
98 APTR hd_KernelBase
; /* kernel.resource base */
99 APTR hd_UtilityBase
; /* for tags etc */
101 APTR hd_MemPool
; /* memory pool */
103 struct USB2OTGUnit
*hd_Unit
; /* we only currently support a single unit.. */
105 struct MsgPort
*hd_MsgPort
;
106 struct timerequest
*hd_TimerReq
; /* Timer I/O Requests */
110 #define FNAME_DEV(x) USB2OTG__Dev__ ## x
111 #define FNAME_ROOTHUB(x) USB2OTG__RootHub__ ## x
121 #define UtilityBase USB2OTGBase->hd_UtilityBase
123 #define KernelBase USB2OTGBase->hd_KernelBase
125 struct Unit
*FNAME_DEV(OpenUnit
)(struct IOUsbHWReq
*, LONG
, struct USB2OTGDevice
*);
126 void FNAME_DEV(CloseUnit
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
128 void FNAME_DEV(TermIO
)(struct IOUsbHWReq
*, struct USB2OTGDevice
*);
130 WORD
FNAME_DEV(cmdNSDeviceQuery
)(struct IOStdReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
131 WORD
FNAME_DEV(cmdQueryDevice
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
133 WORD
FNAME_DEV(cmdReset
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
134 WORD
FNAME_DEV(cmdFlush
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
136 WORD
FNAME_DEV(cmdUsbReset
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
137 WORD
FNAME_DEV(cmdUsbResume
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
138 WORD
FNAME_DEV(cmdUsbSuspend
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
139 WORD
FNAME_DEV(cmdUsbOper
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
140 WORD
FNAME_DEV(cmdControlXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
141 WORD
FNAME_DEV(cmdBulkXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
142 WORD
FNAME_DEV(cmdIntXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
143 WORD
FNAME_DEV(cmdIsoXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
145 void FNAME_DEV(Cause
)(struct USB2OTGDevice
*, struct Interrupt
*);
147 WORD
FNAME_ROOTHUB(cmdControlXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
148 WORD
FNAME_ROOTHUB(cmdIntXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
149 void FNAME_ROOTHUB(PendingIO
)(struct USB2OTGUnit
*);
151 #endif /* USB2OTG_INTERN_H */