12 #if (__WORDSIZE == 64)
14 APTR
usbGetBuffer(APTR data
, ULONG len
, UWORD dir
);
15 void usbReleaseBuffer(APTR buffer
, APTR data
, ULONG len
, UWORD dir
);
19 /* On 32-bit systems we don't need mirroring */
21 #define usbGetBuffer(data, len, dir) ({ (void)(len); (void)(dir); (data);})
22 #define usbReleaseBuffer(buffer, data, len, dir) do { (void)(buffer); (void)(data); (void)(len); (void)(dir); } while (0)
26 struct Unit
*Open_Unit(struct IOUsbHWReq
*ioreq
, LONG unitnr
, struct PCIDevice
*base
);
27 void Close_Unit(struct PCIDevice
*base
, struct PCIUnit
*unit
, struct IOUsbHWReq
*ioreq
);
29 void SureCause(struct PCIDevice
*base
, struct Interrupt
*interrupt
);
30 BOOL
uhwOpenTimer(struct PCIUnit
*unit
, struct PCIDevice
*base
);
31 void uhwDelayMS(ULONG milli
, struct PCIUnit
*unit
);
32 void uhwCheckSpecialCtrlTransfers(struct PCIController
*hc
, struct IOUsbHWReq
*ioreq
);
33 void uhwCheckRootHubChanges(struct PCIUnit
*unit
);
35 WORD
cmdReset(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
36 WORD
cmdUsbReset(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
37 WORD
cmdUsbResume(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
38 WORD
cmdUsbSuspend(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
39 WORD
cmdUsbOper(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
41 WORD
cmdQueryDevice(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
43 WORD
cmdControlXFer(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
44 WORD
cmdBulkXFer(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
45 WORD
cmdIntXFer(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
46 WORD
cmdIsoXFer(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
48 WORD
cmdFlush(struct IOUsbHWReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
50 WORD
cmdNSDeviceQuery(struct IOStdReq
*ioreq
, struct PCIUnit
*unit
, struct PCIDevice
*base
);
52 BOOL
cmdAbortIO(struct IOUsbHWReq
*ioreq
, struct PCIDevice
*base
);
54 void TermIO(struct IOUsbHWReq
*ioreq
, struct PCIDevice
*base
);
56 AROS_UFP1(void, uhwNakTimeoutInt
,
57 AROS_UFPA(struct PCIUnit
*, unit
, A1
));
59 BOOL
pciInit(struct PCIDevice
*hd
);
60 void pciExpunge(struct PCIDevice
*hd
);
61 BOOL
pciAllocUnit(struct PCIUnit
*hu
);
62 void pciFreeUnit(struct PCIUnit
*hu
);
63 APTR
pciGetPhysical(struct PCIController
*hc
, APTR virtaddr
);
65 /* uhcichip.c, in order of appearance */
66 void uhciFreeQContext(struct PCIController
*hc
, struct UhciQH
*uqh
);
67 void uhciUpdateIntTree(struct PCIController
*hc
);
68 void uhciCheckPortStatusChange(struct PCIController
*hc
);
69 void uhciHandleFinishedTDs(struct PCIController
*hc
);
70 void uhciScheduleCtrlTDs(struct PCIController
*hc
);
71 void uhciScheduleIntTDs(struct PCIController
*hc
);
72 void uhciScheduleBulkTDs(struct PCIController
*hc
);
73 void uhciUpdateFrameCounter(struct PCIController
*hc
);
74 void uhciCompleteInt(struct PCIController
*hc
);
75 void uhciIntCode(HIDDT_IRQ_Handler
*irq
, HIDDT_IRQ_HwInfo
*hw
);
76 BOOL
uhciInit(struct PCIController
*hc
, struct PCIUnit
*hu
);
77 void uhciFree(struct PCIController
*hc
, struct PCIUnit
*hu
);
79 static inline struct UhciQH
* uhciAllocQH(struct PCIController
*hc
);
80 static inline void uhciFreeQH(struct PCIController
*hc
, struct UhciQH
*uqh
);
81 static inline struct UhciTD
* uhciAllocTD(struct PCIController
*hc
);
82 static inline void uhciFreeTD(struct PCIController
*hc
, struct UhciTD
*utd
);
84 /* ehcichip.c, in order of appearance */
85 void ehciFreeAsyncContext(struct PCIController
*hc
, struct IOUsbHWReq
*ioreq
);
86 void ehciFreePeriodicContext(struct PCIController
*hc
, struct IOUsbHWReq
*ioreq
);
87 void ehciFreeQHandTDs(struct PCIController
*hc
, struct EhciQH
*eqh
);
88 void ehciUpdateIntTree(struct PCIController
*hc
);
89 void ehciHandleFinishedTDs(struct PCIController
*hc
);
90 void ehciScheduleCtrlTDs(struct PCIController
*hc
);
91 void ehciScheduleIntTDs(struct PCIController
*hc
);
92 void ehciScheduleBulkTDs(struct PCIController
*hc
);
93 void ehciUpdateFrameCounter(struct PCIController
*hc
);
94 void ehciCompleteInt(struct PCIController
*hc
);
95 void ehciIntCode(HIDDT_IRQ_Handler
*irq
, HIDDT_IRQ_HwInfo
*hw
);
96 BOOL
ehciInit(struct PCIController
*hc
, struct PCIUnit
*hu
);
97 void ehciFree(struct PCIController
*hc
, struct PCIUnit
*hu
);
99 static inline struct EhciQH
* ehciAllocQH(struct PCIController
*hc
);
100 static inline void ehciFreeQH(struct PCIController
*hc
, struct EhciQH
*eqh
);
101 static inline struct EhciTD
* ehciAllocTD(struct PCIController
*hc
);
102 static inline void ehciFreeTD(struct PCIController
*hc
, struct EhciTD
*etd
);
104 UBYTE
PCIXReadConfigByte(struct PCIController
*hc
, UBYTE offset
);
105 UWORD
PCIXReadConfigWord(struct PCIController
*hc
, UBYTE offset
);
106 ULONG
PCIXReadConfigLong(struct PCIController
*hc
, UBYTE offset
);
107 void PCIXWriteConfigByte(struct PCIController
*hc
, ULONG offset
, UBYTE value
);
108 void PCIXWriteConfigWord(struct PCIController
*hc
, ULONG offset
, UWORD value
);
109 void PCIXWriteConfigLong(struct PCIController
*hc
, ULONG offset
, ULONG value
);
111 struct my_NSDeviceQueryResult
113 ULONG DevQueryFormat
; /* this is type 0 */
114 ULONG SizeAvailable
; /* bytes available */
115 UWORD DeviceType
; /* what the device does */
116 UWORD DeviceSubType
; /* depends on the main type */
117 const UWORD
*SupportedCommands
; /* 0 terminated list of cmd's */
120 /* /// "uhciAllocQH()" */
121 static inline struct UhciQH
* uhciAllocQH(struct PCIController
*hc
)
123 struct UhciQH
*uqh
= hc
->hc_UhciQHPool
;
128 KPRINTF(20, ("Out of QHs!\n"));
132 hc
->hc_UhciQHPool
= (struct UhciQH
*) uqh
->uqh_Succ
;
134 uqh
->uqh_SetupBuffer
= NULL
;
135 uqh
->uqh_DataBuffer
= NULL
;
140 /* /// "uhciFreeQH()" */
141 static inline void uhciFreeQH(struct PCIController
*hc
, struct UhciQH
*uqh
)
143 uqh
->uqh_Succ
= (struct UhciXX
*) hc
->hc_UhciQHPool
;
144 hc
->hc_UhciQHPool
= uqh
;
148 /* /// "uhciAllocTD()" */
149 static inline struct UhciTD
* uhciAllocTD(struct PCIController
*hc
)
151 struct UhciTD
*utd
= hc
->hc_UhciTDPool
;
156 KPRINTF(20, ("Out of TDs!\n"));
160 hc
->hc_UhciTDPool
= (struct UhciTD
*) utd
->utd_Succ
;
165 /* /// "uhciFreeTD()" */
166 static inline void uhciFreeTD(struct PCIController
*hc
, struct UhciTD
*utd
)
168 utd
->utd_Succ
= (struct UhciXX
*) hc
->hc_UhciTDPool
;
169 hc
->hc_UhciTDPool
= utd
;
173 /* /// "ehciAllocQH()" */
174 static inline struct EhciQH
* ehciAllocQH(struct PCIController
*hc
)
176 struct EhciQH
*eqh
= hc
->hc_EhciQHPool
;
181 KPRINTF(20, ("Out of QHs!\n"));
185 hc
->hc_EhciQHPool
= (struct EhciQH
*) eqh
->eqh_Succ
;
190 /* /// "ehciFreeQH()" */
191 static inline void ehciFreeQH(struct PCIController
*hc
, struct EhciQH
*eqh
)
193 eqh
->eqh_Succ
= hc
->hc_EhciQHPool
;
194 hc
->hc_EhciQHPool
= eqh
;
198 /* /// "ehciAllocTD()" */
199 static inline struct EhciTD
* ehciAllocTD(struct PCIController
*hc
)
201 struct EhciTD
*etd
= hc
->hc_EhciTDPool
;
206 KPRINTF(20, ("Out of TDs!\n"));
210 hc
->hc_EhciTDPool
= (struct EhciTD
*) etd
->etd_Succ
;
215 /* /// "ehciFreeTD()" */
216 static inline void ehciFreeTD(struct PCIController
*hc
, struct EhciTD
*etd
)
218 etd
->etd_Succ
= hc
->hc_EhciTDPool
;
219 hc
->hc_EhciTDPool
= etd
;
223 #endif /* UHWCMD_H */