forked from RehabMan/OS-X-Generic-USB3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Async.h
90 lines (83 loc) · 2.73 KB
/
Async.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// Async.h
// GenericUSBXHCI
//
// Created by Zenith432 on February 10th 2013.
// Copyright (c) 2013 Zenith432. All rights reserved.
//
#ifndef GenericUSBXHCI_Async_h
#define GenericUSBXHCI_Async_h
struct XHCIAsyncTD;
struct XHCIAsyncEndpoint
{
ringStruct* pRing; // 0x10 (start)
XHCIAsyncTD* queuedHead; // 0x18
XHCIAsyncTD* queuedTail; // 0x20
XHCIAsyncTD* scheduledHead; // 0x28
XHCIAsyncTD* scheduledTail; // 0x30
XHCIAsyncTD* doneHead; // 0x38
XHCIAsyncTD* doneTail; // 0x40
XHCIAsyncTD* freeHead; // 0x48
XHCIAsyncTD* freeTail; // 0x50
uint32_t numTDsQueued; // 0x58
uint32_t numTDsScheduled; // 0x5C
uint32_t numTDsDone; // 0x60
uint32_t numTDsFree; // 0x64
bool aborting; // 0x68
uint32_t maxPacketSize; // 0x6C
uint32_t maxBurst; // 0x70
uint32_t multiple; // 0x74
uint32_t maxTDBytes; // 0x78
GenericUSBXHCI* provider; // 0x80
// sizeof 0x88
IOReturn CreateTDs(IOUSBCommand*, uint16_t, uint32_t, uint8_t, uint8_t const*);
void ScheduleTDs(void);
IOReturn Abort(void);
XHCIAsyncTD* GetTDFromActiveQueueWithIndex(uint16_t);
void RetireTDs(XHCIAsyncTD*, IOReturn, bool, bool);
XHCIAsyncTD* GetTDFromFreeQueue(bool);
void PutTDonDoneQueue(XHCIAsyncTD*);
void FlushTDs(IOUSBCommand*, int32_t);
void MoveTDsFromReadyQToDoneQ(IOUSBCommand*);
void MoveAllTDsFromReadyQToDoneQ(void);
void Complete(IOReturn);
bool NeedTimeouts(void);
void UpdateTimeouts(bool, uint32_t, bool);
static XHCIAsyncTD* GetTD(XHCIAsyncTD**, XHCIAsyncTD**, uint32_t*);
static void PutTD(XHCIAsyncTD**, XHCIAsyncTD**, XHCIAsyncTD*, uint32_t*);
static void PutTDAtHead(XHCIAsyncTD**, XHCIAsyncTD**, XHCIAsyncTD*, uint32_t*);
static void wipeAsyncList(XHCIAsyncTD*, XHCIAsyncTD*);
static XHCIAsyncEndpoint* withParameters(GenericUSBXHCI*, ringStruct*, uint32_t, uint32_t, uint32_t);
void setParameters(uint32_t, uint32_t, uint32_t);
bool checkOwnership(GenericUSBXHCI*, ringStruct*);
void release(void);
void nuke(void);
};
struct XHCIAsyncTD
{
IOUSBCommand* command; // 0x10 (start)
uint32_t bytesThisTD; // 0x18
size_t bytesFollowingThisTD; // 0x1C - original uint32_t
size_t bytesPreceedingThisTD; // 0x20
uint32_t firstTrbIndex; // 0x28
uint32_t TrbCount; // 0x2C
bool interruptThisTD; // 0x30
bool multiTDTransaction; // 0x31
uint16_t numTDsThisTransaction; // 0x32
uint32_t mystery; // 0x34
uint32_t shortfall; // 0x38
uint16_t maxNumPagesInTD; // 0x3C
bool haveImmediateData; // 0x3E
bool finalTDInTransaction; // 0x3F
uint8_t immediateData[8]; // 0x40
uint16_t streamId; // 0x48
int16_t lastTrbIndex; // 0x4A
bool absoluteShortfall; // Added
XHCIAsyncEndpoint* provider; // 0x50
XHCIAsyncTD* next; // 0x58
// sizeof 0x60
static XHCIAsyncTD* ForEndpoint(XHCIAsyncEndpoint*);
void reinit(void);
void release(void);
};
#endif