1 #ifndef USB2OTG_INTERN_H
2 #define USB2OTG_INTERN_H
4 Copyright © 2013-2015, 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>
37 extern IPTR __arm_periiobase
;
38 #define ARM_PERIIOBASE __arm_periiobase
39 #include <hardware/bcm2708.h>
40 #include <hardware/usb2otg.h>
43 Force the USB chipset to run in Host mode
44 AFAIK Poseidon doesnt support device mode? - TODO
46 //#define OTG_FORCEHOSTMODE
47 //#define OTG_FORCEDEVICEMODE
49 /* Reply the iorequest with success */
52 /* Magic cookie, don't set error fields & don't reply the ioreq */
53 #define RC_DONTREPLY -1
55 #define MAX_ROOT_PORTS 16
57 struct USBNSDeviceQueryResult
63 const UWORD
*SupportedCommands
; /* 0 terminated list of cmd's */
70 struct List hu_IOPendingQueue
; /* Root Hub Pending IO Requests */
72 struct List hu_TDQueue
;
73 struct List hu_PeriodicTDQueue
;
74 struct List hu_CtrlXFerQueue
;
75 struct List hu_IntXFerQueue
;
76 struct List hu_IsoXFerQueue
;
77 struct List hu_BulkXFerQueue
;
79 struct List hu_AbortQueue
;
81 APTR hu_GlobalIRQHandle
;
82 struct Interrupt hu_PendingInt
;
83 struct Interrupt hu_NakTimeoutInt
;
84 struct timerequest hu_NakTimeoutReq
;
85 struct MsgPort hu_NakTimeoutMsgPort
;
87 UBYTE hu_OperatingMode
; /* HOST/DEVICE mode */
93 BOOL hu_UnitAllocated
; /* unit opened */
94 BOOL hu_HubPortChanged
; /* Root port state change */
97 /* PRIVATE device node */
100 struct Library hd_Library
; /* standard */
101 UWORD hd_Flags
; /* various flags */
103 APTR hd_KernelBase
; /* kernel.resource base */
104 APTR hd_UtilityBase
; /* for tags etc */
106 APTR hd_MemPool
; /* memory pool */
108 struct USB2OTGUnit
*hd_Unit
; /* we only currently support a single unit.. */
110 struct MsgPort
*hd_MsgPort
;
111 struct timerequest
*hd_TimerReq
; /* Timer I/O Requests */
115 #define FNAME_DEV(x) USB2OTG__Dev__ ## x
116 #define FNAME_ROOTHUB(x) USB2OTG__RootHub__ ## x
126 #define UtilityBase USB2OTGBase->hd_UtilityBase
128 #define KernelBase USB2OTGBase->hd_KernelBase
130 struct Unit
*FNAME_DEV(OpenUnit
)(struct IOUsbHWReq
*, LONG
, struct USB2OTGDevice
*);
131 void FNAME_DEV(CloseUnit
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
133 void FNAME_DEV(TermIO
)(struct IOUsbHWReq
*, struct USB2OTGDevice
*);
135 WORD
FNAME_DEV(cmdNSDeviceQuery
)(struct IOStdReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
136 WORD
FNAME_DEV(cmdQueryDevice
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
138 WORD
FNAME_DEV(cmdReset
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
139 WORD
FNAME_DEV(cmdFlush
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
141 WORD
FNAME_DEV(cmdUsbReset
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
142 WORD
FNAME_DEV(cmdUsbResume
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
143 WORD
FNAME_DEV(cmdUsbSuspend
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
144 WORD
FNAME_DEV(cmdUsbOper
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
145 WORD
FNAME_DEV(cmdControlXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
146 WORD
FNAME_DEV(cmdBulkXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
147 WORD
FNAME_DEV(cmdIntXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
148 WORD
FNAME_DEV(cmdIsoXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
150 void FNAME_DEV(Cause
)(struct USB2OTGDevice
*, struct Interrupt
*);
152 WORD
FNAME_ROOTHUB(cmdControlXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
153 WORD
FNAME_ROOTHUB(cmdIntXFer
)(struct IOUsbHWReq
*, struct USB2OTGUnit
*, struct USB2OTGDevice
*);
154 void FNAME_ROOTHUB(PendingIO
)(struct USB2OTGUnit
*);
156 #endif /* USB2OTG_INTERN_H */