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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#ifndef REGS_SDIO_H
#define REGS_SDIO_H
#include "register.h"
class SDIO {
public:
class POWER : Register32 {
public:
enum class PWRCTRL : uint8_t {
Off = 0,
On = 3
};
REGS_TYPE_FIELD(PWRCTRL, 1, 0);
};
class CLKCR : Register32 {
public:
enum class WIDBUS : uint8_t {
Default = 0,
FourBits = 1,
EightBits = 2
};
REGS_FIELD(CLKDIV, uint8_t, 7, 0);
REGS_BOOL_FIELD(CLKEN, 8);
REGS_BOOL_FIELD(PWRSAV, 9);
REGS_BOOL_FIELD(BYPASS, 10);
REGS_TYPE_FIELD(WIDBUS, 12, 11);
REGS_BOOL_FIELD(NEGEDGE, 13);
REGS_BOOL_FIELD(HWFC_EN, 14);
};
class ARG : public Register32 {
};
class CMD : public Register32 {
public:
using Register32::Register32;
enum class WAITRESP : uint8_t {
None = 0,
Short = 1,
Long = 3
};
REGS_FIELD(CMDINDEX, uint8_t, 5, 0);
REGS_TYPE_FIELD(WAITRESP, 7, 6);
REGS_BOOL_FIELD(WAITINT, 8);
REGS_BOOL_FIELD(WAITPEND, 9);
REGS_BOOL_FIELD(CPSMEN, 10);
};
class RESP : public Register32 {
};
class STA : Register32 {
public:
REGS_BOOL_FIELD_R(CCRCFAIL, 0);
REGS_BOOL_FIELD_R(DCRCFAIL, 1);
REGS_BOOL_FIELD_R(CTIMEOUT, 2);
REGS_BOOL_FIELD_R(DTIMEOUT, 3);
REGS_BOOL_FIELD_R(TXUNDERR, 4);
REGS_BOOL_FIELD_R(RXOVERR, 5);
REGS_BOOL_FIELD_R(CMDREND, 6);
REGS_BOOL_FIELD_R(CMDSENT, 7);
REGS_BOOL_FIELD_R(DATAEND, 8);
REGS_BOOL_FIELD_R(DBCKEND, 10);
REGS_BOOL_FIELD_R(CMDACT, 11);
REGS_BOOL_FIELD_R(TXACT, 12);
REGS_BOOL_FIELD_R(RXACT, 13);
REGS_BOOL_FIELD_R(TXFIFOHE, 14);
REGS_BOOL_FIELD_R(RXFIFOHF, 15);
REGS_BOOL_FIELD_R(TXFIFOF, 16);
REGS_BOOL_FIELD_R(RXFIFOF, 17);
REGS_BOOL_FIELD_R(TXFIFOE, 18);
REGS_BOOL_FIELD_R(RXFIFOE, 19);
REGS_BOOL_FIELD_R(TXDAVL, 20);
REGS_BOOL_FIELD_R(RXDAVL, 21);
REGS_BOOL_FIELD_R(SDIOIT, 22);
};
class ICR : public Register32 {
public:
using Register32::Register32;
REGS_BOOL_FIELD_W(CCRCFAILC, 0);
REGS_BOOL_FIELD_W(DCRCFAILC, 1);
REGS_BOOL_FIELD_W(CTIMEOUTC, 2);
REGS_BOOL_FIELD_W(DTIMEOUTC, 3);
REGS_BOOL_FIELD_W(TXUNDERRC, 4);
REGS_BOOL_FIELD_W(RXOVERRC, 5);
REGS_BOOL_FIELD_W(CMDRENDC, 6);
REGS_BOOL_FIELD_W(CMDSENTC, 7);
REGS_BOOL_FIELD_W(DATAENDC, 8);
REGS_BOOL_FIELD_W(DBCKENDC, 10);
REGS_BOOL_FIELD_W(SDIOITC, 22);
};
constexpr SDIO() {};
REGS_REGISTER_AT(POWER, 0x00);
REGS_REGISTER_AT(CLKCR, 0x04);
REGS_REGISTER_AT(ARG, 0x08);
REGS_REGISTER_AT(CMD, 0x0C);
volatile RESP * RESP(int i ) const { return (class RESP *)(Base() + 0x10+4*i); };
REGS_REGISTER_AT(STA, 0x34);
REGS_REGISTER_AT(ICR, 0x38);
private:
constexpr uint32_t Base() const {
return 0x40012C00;
}
};
constexpr SDIO SDIO;
#endif
|