6663b6c9
adorian
projet complet av...
|
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
|
#ifndef ION_DEVICE_USB_SETUP_PACKET_H
#define ION_DEVICE_USB_SETUP_PACKET_H
#include <stdint.h>
namespace Ion {
namespace USB {
namespace Device {
class SetupPacket {
public:
enum class TransactionType {
SetupTransaction,
InTransaction,
OutTransaction
};
enum class RequestType {
Standard = 0,
Class = 1,
Vendor = 2
};
enum class RecipientType {
Device = 0,
Interface = 1,
Endpoint = 2,
Other = 3
};
constexpr SetupPacket() :
m_bmRequestType(0),
m_bRequest(0),
m_wValue(0),
m_wIndex(0),
m_wLength(0)
{
}
SetupPacket(void * buffer);
TransactionType followingTransaction() const;
RequestType requestType() const;
RecipientType recipientType() const;
int descriptorIndex();
int descriptorType();
uint8_t bmRequestType() { return m_bmRequestType; }
uint8_t bRequest() { return m_bRequest; }
uint16_t wValue() { return m_wValue; }
uint16_t wIndex() { return m_wIndex; }
uint16_t wLength() { return m_wLength; }
private:
uint8_t m_bmRequestType;
uint8_t m_bRequest;
uint16_t m_wValue;
uint16_t m_wIndex;
uint16_t m_wLength;
};
static_assert(sizeof(SetupPacket) == 8, "SetupData must be packed");
}
}
}
#endif
|