revert between 56095 -> 55830 in arch
[AROS.git] / rom / usb / pciusbhc / uhci / uhwcmd.h
blobc9304eccdd09c4f18f187eb0157be1553201a5c4
1 #ifndef UHWCMD_H
2 #define UHWCMD_H
4 #include "debug.h"
5 #include "pci_aros.h"
7 #include "uhcichip.h"
8 #include "pciuhci.h"
10 struct Unit *Open_Unit(struct IOUsbHWReq *ioreq, LONG unitnr, struct PCIDevice *base);
11 void Close_Unit(struct PCIDevice *base, struct PCIUnit *unit, struct IOUsbHWReq *ioreq);
13 void SureCause(struct PCIDevice *base, struct Interrupt *interrupt);
14 BOOL uhwOpenTimer(struct PCIUnit *unit, struct PCIDevice *base);
15 void uhwDelayMS(ULONG milli, struct PCIUnit *unit);
16 void uhwCheckSpecialCtrlTransfers(struct PCIController *hc, struct IOUsbHWReq *ioreq);
17 void uhwCheckRootHubChanges(struct PCIUnit *unit);
19 WORD cmdReset(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
20 WORD cmdUsbReset(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
21 WORD cmdUsbResume(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
22 WORD cmdUsbSuspend(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
23 WORD cmdUsbOper(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
25 WORD cmdQueryDevice(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
27 WORD cmdControlXFer(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
28 WORD cmdBulkXFer(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
29 WORD cmdIntXFer(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
30 WORD cmdIsoXFer(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
32 WORD cmdFlush(struct IOUsbHWReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
34 WORD cmdNSDeviceQuery(struct IOStdReq *ioreq, struct PCIUnit *unit, struct PCIDevice *base);
36 BOOL cmdAbortIO(struct IOUsbHWReq *ioreq, struct PCIDevice *base);
38 void TermIO(struct IOUsbHWReq *ioreq, struct PCIDevice *base);
40 AROS_INTP(uhwNakTimeoutInt);
42 BOOL pciInit(struct PCIDevice *hd);
43 void pciExpunge(struct PCIDevice *hd);
44 BOOL pciAllocUnit(struct PCIUnit *hu);
45 void pciFreeUnit(struct PCIUnit *hu);
46 APTR pciGetPhysical(struct PCIController *hc, APTR virtaddr);
48 /* uhcichip.c, in order of appearance */
49 void uhciFreeQContext(struct PCIController *hc, struct UhciQH *uqh);
50 void uhciUpdateIntTree(struct PCIController *hc);
51 void uhciCheckPortStatusChange(struct PCIController *hc);
52 void uhciHandleFinishedTDs(struct PCIController *hc);
53 void uhciScheduleCtrlTDs(struct PCIController *hc);
54 void uhciScheduleIntTDs(struct PCIController *hc);
55 void uhciScheduleBulkTDs(struct PCIController *hc);
56 void uhciUpdateFrameCounter(struct PCIController *hc);
57 BOOL uhciInit(struct PCIController *hc, struct PCIUnit *hu);
58 void uhciFree(struct PCIController *hc, struct PCIUnit *hu);
60 static inline struct UhciQH * uhciAllocQH(struct PCIController *hc);
61 static inline void uhciFreeQH(struct PCIController *hc, struct UhciQH *uqh);
62 static inline struct UhciTD * uhciAllocTD(struct PCIController *hc);
63 static inline void uhciFreeTD(struct PCIController *hc, struct UhciTD *utd);
65 UBYTE PCIXReadConfigByte(struct PCIController *hc, UBYTE offset);
66 UWORD PCIXReadConfigWord(struct PCIController *hc, UBYTE offset);
67 ULONG PCIXReadConfigLong(struct PCIController *hc, UBYTE offset);
68 void PCIXWriteConfigByte(struct PCIController *hc, ULONG offset, UBYTE value);
69 void PCIXWriteConfigWord(struct PCIController *hc, ULONG offset, UWORD value);
70 void PCIXWriteConfigLong(struct PCIController *hc, ULONG offset, ULONG value);
72 struct my_NSDeviceQueryResult
74 ULONG DevQueryFormat; /* this is type 0 */
75 ULONG SizeAvailable; /* bytes available */
76 UWORD DeviceType; /* what the device does */
77 UWORD DeviceSubType; /* depends on the main type */
78 const UWORD *SupportedCommands; /* 0 terminated list of cmd's */
81 /* /// "uhciAllocQH()" */
82 static inline struct UhciQH * uhciAllocQH(struct PCIController *hc)
84 struct UhciQH *uqh = hc->hc_UhciQHPool;
86 if(!uqh)
88 // out of QHs!
89 KPRINTF(20, ("Out of QHs!\n"));
90 return NULL;
93 hc->hc_UhciQHPool = (struct UhciQH *) uqh->uqh_Succ;
94 return(uqh);
96 /* \\\ */
98 /* /// "uhciFreeQH()" */
99 static inline void uhciFreeQH(struct PCIController *hc, struct UhciQH *uqh)
101 uqh->uqh_Succ = (struct UhciXX *) hc->hc_UhciQHPool;
102 hc->hc_UhciQHPool = uqh;
104 /* \\\ */
106 /* /// "uhciAllocTD()" */
107 static inline struct UhciTD * uhciAllocTD(struct PCIController *hc)
109 struct UhciTD *utd = hc->hc_UhciTDPool;
111 if(!utd)
113 // out of TDs!
114 KPRINTF(20, ("Out of TDs!\n"));
115 return NULL;
118 hc->hc_UhciTDPool = (struct UhciTD *) utd->utd_Succ;
119 return(utd);
121 /* \\\ */
123 /* /// "uhciFreeTD()" */
124 static inline void uhciFreeTD(struct PCIController *hc, struct UhciTD *utd)
126 utd->utd_Succ = (struct UhciXX *) hc->hc_UhciTDPool;
127 hc->hc_UhciTDPool = utd;
129 /* \\\ */
131 #endif /* UHWCMD_H */