Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / rom / usb / pciusb / uhwcmd.h
blob01447c78dda98630e2f678144a683f7512274f39
1 #ifndef UHWCMD_H
2 #define UHWCMD_H
4 #include "debug.h"
5 #include "pci_aros.h"
7 #include "uhcichip.h"
8 #include "ohcichip.h"
9 #include "ehcichip.h"
10 #include "pciusb.h"
12 #if (__WORDSIZE == 64)
14 APTR usbGetBuffer(APTR data, ULONG len, UWORD dir);
15 void usbReleaseBuffer(APTR buffer, APTR data, ULONG len, UWORD dir);
17 #else
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)
24 #endif
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_INTP(uhwNakTimeoutInt);
58 BOOL pciInit(struct PCIDevice *hd);
59 void pciExpunge(struct PCIDevice *hd);
60 BOOL pciAllocUnit(struct PCIUnit *hu);
61 void pciFreeUnit(struct PCIUnit *hu);
62 APTR pciGetPhysical(struct PCIController *hc, APTR virtaddr);
64 /* uhcichip.c, in order of appearance */
65 void uhciFreeQContext(struct PCIController *hc, struct UhciQH *uqh);
66 void uhciUpdateIntTree(struct PCIController *hc);
67 void uhciCheckPortStatusChange(struct PCIController *hc);
68 void uhciHandleFinishedTDs(struct PCIController *hc);
69 void uhciScheduleCtrlTDs(struct PCIController *hc);
70 void uhciScheduleIntTDs(struct PCIController *hc);
71 void uhciScheduleBulkTDs(struct PCIController *hc);
72 void uhciUpdateFrameCounter(struct PCIController *hc);
73 BOOL uhciInit(struct PCIController *hc, struct PCIUnit *hu);
74 void uhciFree(struct PCIController *hc, struct PCIUnit *hu);
76 static inline struct UhciQH * uhciAllocQH(struct PCIController *hc);
77 static inline void uhciFreeQH(struct PCIController *hc, struct UhciQH *uqh);
78 static inline struct UhciTD * uhciAllocTD(struct PCIController *hc);
79 static inline void uhciFreeTD(struct PCIController *hc, struct UhciTD *utd);
81 /* ehcichip.c, in order of appearance */
82 void ehciFreeAsyncContext(struct PCIController *hc, struct IOUsbHWReq *ioreq);
83 void ehciFreePeriodicContext(struct PCIController *hc, struct IOUsbHWReq *ioreq);
84 void ehciFreeQHandTDs(struct PCIController *hc, struct EhciQH *eqh);
85 void ehciUpdateIntTree(struct PCIController *hc);
86 void ehciHandleFinishedTDs(struct PCIController *hc);
87 void ehciScheduleCtrlTDs(struct PCIController *hc);
88 void ehciScheduleIntTDs(struct PCIController *hc);
89 void ehciScheduleBulkTDs(struct PCIController *hc);
90 void ehciUpdateFrameCounter(struct PCIController *hc);
91 BOOL ehciInit(struct PCIController *hc, struct PCIUnit *hu);
92 void ehciFree(struct PCIController *hc, struct PCIUnit *hu);
94 static inline struct EhciQH * ehciAllocQH(struct PCIController *hc);
95 static inline void ehciFreeQH(struct PCIController *hc, struct EhciQH *eqh);
96 static inline struct EhciTD * ehciAllocTD(struct PCIController *hc);
97 static inline void ehciFreeTD(struct PCIController *hc, struct EhciTD *etd);
99 UBYTE PCIXReadConfigByte(struct PCIController *hc, UBYTE offset);
100 UWORD PCIXReadConfigWord(struct PCIController *hc, UBYTE offset);
101 ULONG PCIXReadConfigLong(struct PCIController *hc, UBYTE offset);
102 void PCIXWriteConfigByte(struct PCIController *hc, ULONG offset, UBYTE value);
103 void PCIXWriteConfigWord(struct PCIController *hc, ULONG offset, UWORD value);
104 void PCIXWriteConfigLong(struct PCIController *hc, ULONG offset, ULONG value);
105 BOOL PCIXAddInterrupt(struct PCIController *hc, struct Interrupt *interrupt);
107 struct my_NSDeviceQueryResult
109 ULONG DevQueryFormat; /* this is type 0 */
110 ULONG SizeAvailable; /* bytes available */
111 UWORD DeviceType; /* what the device does */
112 UWORD DeviceSubType; /* depends on the main type */
113 const UWORD *SupportedCommands; /* 0 terminated list of cmd's */
116 /* /// "uhciAllocQH()" */
117 static inline struct UhciQH * uhciAllocQH(struct PCIController *hc)
119 struct UhciQH *uqh = hc->hc_UhciQHPool;
121 if(!uqh)
123 // out of QHs!
124 KPRINTF(20, ("Out of QHs!\n"));
125 return NULL;
128 hc->hc_UhciQHPool = (struct UhciQH *) uqh->uqh_Succ;
130 uqh->uqh_SetupBuffer = NULL;
131 uqh->uqh_DataBuffer = NULL;
132 return(uqh);
134 /* \\\ */
136 /* /// "uhciFreeQH()" */
137 static inline void uhciFreeQH(struct PCIController *hc, struct UhciQH *uqh)
139 uqh->uqh_Succ = (struct UhciXX *) hc->hc_UhciQHPool;
140 hc->hc_UhciQHPool = uqh;
142 /* \\\ */
144 /* /// "uhciAllocTD()" */
145 static inline struct UhciTD * uhciAllocTD(struct PCIController *hc)
147 struct UhciTD *utd = hc->hc_UhciTDPool;
149 if(!utd)
151 // out of TDs!
152 KPRINTF(20, ("Out of TDs!\n"));
153 return NULL;
156 hc->hc_UhciTDPool = (struct UhciTD *) utd->utd_Succ;
157 return(utd);
159 /* \\\ */
161 /* /// "uhciFreeTD()" */
162 static inline void uhciFreeTD(struct PCIController *hc, struct UhciTD *utd)
164 utd->utd_Succ = (struct UhciXX *) hc->hc_UhciTDPool;
165 hc->hc_UhciTDPool = utd;
167 /* \\\ */
169 /* /// "ehciAllocQH()" */
170 static inline struct EhciQH * ehciAllocQH(struct PCIController *hc)
172 struct EhciQH *eqh = hc->hc_EhciQHPool;
174 if(!eqh)
176 // out of QHs!
177 KPRINTF(20, ("Out of QHs!\n"));
178 return NULL;
181 hc->hc_EhciQHPool = (struct EhciQH *) eqh->eqh_Succ;
182 return(eqh);
184 /* \\\ */
186 /* /// "ehciFreeQH()" */
187 static inline void ehciFreeQH(struct PCIController *hc, struct EhciQH *eqh)
189 eqh->eqh_Succ = hc->hc_EhciQHPool;
190 hc->hc_EhciQHPool = eqh;
192 /* \\\ */
194 /* /// "ehciAllocTD()" */
195 static inline struct EhciTD * ehciAllocTD(struct PCIController *hc)
197 struct EhciTD *etd = hc->hc_EhciTDPool;
199 if(!etd)
201 // out of TDs!
202 KPRINTF(20, ("Out of TDs!\n"));
203 return NULL;
206 hc->hc_EhciTDPool = (struct EhciTD *) etd->etd_Succ;
207 return(etd);
209 /* \\\ */
211 /* /// "ehciFreeTD()" */
212 static inline void ehciFreeTD(struct PCIController *hc, struct EhciTD *etd)
214 etd->etd_Succ = hc->hc_EhciTDPool;
215 hc->hc_EhciTDPool = etd;
217 /* \\\ */
219 #endif /* UHWCMD_H */