9 static const uint8_t ES8311_REG00_RESET = 0x00;
10 static const uint8_t ES8311_REG01_CLK_MANAGER = 0x01;
11 static const uint8_t ES8311_REG02_CLK_MANAGER = 0x02;
12 static const uint8_t ES8311_REG03_CLK_MANAGER = 0x03;
13 static const uint8_t ES8311_REG04_CLK_MANAGER = 0x04;
14 static const uint8_t ES8311_REG05_CLK_MANAGER = 0x05;
15 static const uint8_t ES8311_REG06_CLK_MANAGER = 0x06;
16 static const uint8_t ES8311_REG07_CLK_MANAGER = 0x07;
17 static const uint8_t ES8311_REG08_CLK_MANAGER = 0x08;
18 static const uint8_t ES8311_REG09_SDPIN = 0x09;
19 static const uint8_t ES8311_REG0A_SDPOUT = 0x0A;
20 static const uint8_t ES8311_REG0B_SYSTEM = 0x0B;
21 static const uint8_t ES8311_REG0C_SYSTEM = 0x0C;
22 static const uint8_t ES8311_REG0D_SYSTEM = 0x0D;
23 static const uint8_t ES8311_REG0E_SYSTEM = 0x0E;
24 static const uint8_t ES8311_REG0F_SYSTEM = 0x0F;
25 static const uint8_t ES8311_REG10_SYSTEM = 0x10;
26 static const uint8_t ES8311_REG11_SYSTEM = 0x11;
27 static const uint8_t ES8311_REG12_SYSTEM = 0x12;
28 static const uint8_t ES8311_REG13_SYSTEM = 0x13;
29 static const uint8_t ES8311_REG14_SYSTEM = 0x14;
30 static const uint8_t ES8311_REG15_ADC = 0x15;
31 static const uint8_t ES8311_REG16_ADC = 0x16;
32 static const uint8_t ES8311_REG17_ADC = 0x17;
33 static const uint8_t ES8311_REG18_ADC = 0x18;
34 static const uint8_t ES8311_REG19_ADC = 0x19;
35 static const uint8_t ES8311_REG1A_ADC = 0x1A;
36 static const uint8_t ES8311_REG1B_ADC = 0x1B;
37 static const uint8_t ES8311_REG1C_ADC = 0x1C;
38 static const uint8_t ES8311_REG1D_ADCEQ = 0x1D;
39 static const uint8_t ES8311_REG1E_ADCEQ = 0x1E;
40 static const uint8_t ES8311_REG1F_ADCEQ = 0x1F;
41 static const uint8_t ES8311_REG20_ADCEQ = 0x20;
42 static const uint8_t ES8311_REG21_ADCEQ = 0x21;
43 static const uint8_t ES8311_REG22_ADCEQ = 0x22;
44 static const uint8_t ES8311_REG23_ADCEQ = 0x23;
45 static const uint8_t ES8311_REG24_ADCEQ = 0x24;
46 static const uint8_t ES8311_REG25_ADCEQ = 0x25;
47 static const uint8_t ES8311_REG26_ADCEQ = 0x26;
48 static const uint8_t ES8311_REG27_ADCEQ = 0x27;
49 static const uint8_t ES8311_REG28_ADCEQ = 0x28;
50 static const uint8_t ES8311_REG29_ADCEQ = 0x29;
51 static const uint8_t ES8311_REG2A_ADCEQ = 0x2A;
52 static const uint8_t ES8311_REG2B_ADCEQ = 0x2B;
53 static const uint8_t ES8311_REG2C_ADCEQ = 0x2C;
54 static const uint8_t ES8311_REG2D_ADCEQ = 0x2D;
55 static const uint8_t ES8311_REG2E_ADCEQ = 0x2E;
56 static const uint8_t ES8311_REG2F_ADCEQ = 0x2F;
57 static const uint8_t ES8311_REG30_ADCEQ = 0x30;
58 static const uint8_t ES8311_REG31_DAC = 0x31;
59 static const uint8_t ES8311_REG32_DAC = 0x32;
60 static const uint8_t ES8311_REG33_DAC = 0x33;
61 static const uint8_t ES8311_REG34_DAC = 0x34;
62 static const uint8_t ES8311_REG35_DAC = 0x35;
63 static const uint8_t ES8311_REG36_DAC = 0x36;
64 static const uint8_t ES8311_REG37_DAC = 0x37;
65 static const uint8_t ES8311_REG38_DACEQ = 0x38;
66 static const uint8_t ES8311_REG39_DACEQ = 0x39;
67 static const uint8_t ES8311_REG3A_DACEQ = 0x3A;
68 static const uint8_t ES8311_REG3B_DACEQ = 0x3B;
69 static const uint8_t ES8311_REG3C_DACEQ = 0x3C;
70 static const uint8_t ES8311_REG3D_DACEQ = 0x3D;
71 static const uint8_t ES8311_REG3E_DACEQ = 0x3E;
72 static const uint8_t ES8311_REG3F_DACEQ = 0x3F;
73 static const uint8_t ES8311_REG40_DACEQ = 0x40;
74 static const uint8_t ES8311_REG41_DACEQ = 0x41;
75 static const uint8_t ES8311_REG42_DACEQ = 0x42;
76 static const uint8_t ES8311_REG43_DACEQ = 0x43;
77 static const uint8_t ES8311_REG44_GPIO = 0x44;
78 static const uint8_t ES8311_REG45_GP = 0x45;
79 static const uint8_t ES8311_REGFA_I2C = 0xFA;
80 static const uint8_t ES8311_REGFC_FLAG = 0xFC;
81 static const uint8_t ES8311_REGFD_CHD1 = 0xFD;
82 static const uint8_t ES8311_REGFE_CHD2 = 0xFE;
83 static const uint8_t ES8311_REGFF_CHVER = 0xFF;
86 static const ES8311Coefficient ES8311_COEFFICIENTS[] = {
93 {12288000, 8000, 0x06, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
94 {18432000, 8000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x05, 0xff, 0x18, 0x10, 0x20},
95 {16384000, 8000, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
96 { 8192000, 8000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
97 { 6144000, 8000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
98 { 4096000, 8000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
99 { 3072000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
100 { 2048000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
101 { 1536000, 8000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
102 { 1024000, 8000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
105 {11289600, 11025, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
106 { 5644800, 11025, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
107 { 2822400, 11025, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
108 { 1411200, 11025, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
111 {12288000, 12000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
112 { 6144000, 12000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
113 { 3072000, 12000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
114 { 1536000, 12000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
117 {12288000, 16000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
118 {18432000, 16000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, 0x20},
119 {16384000, 16000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
120 { 8192000, 16000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
121 { 6144000, 16000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
122 { 4096000, 16000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
123 { 3072000, 16000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
124 { 2048000, 16000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
125 { 1536000, 16000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
126 { 1024000, 16000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
129 {11289600, 22050, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
130 { 5644800, 22050, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
131 { 2822400, 22050, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
132 { 1411200, 22050, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
135 {12288000, 24000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
136 {18432000, 24000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
137 { 6144000, 24000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
138 { 3072000, 24000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
139 { 1536000, 24000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
142 {12288000, 32000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
143 {18432000, 32000, 0x03, 0x04, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, 0x10},
144 {16384000, 32000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
145 { 8192000, 32000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
146 { 6144000, 32000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
147 { 4096000, 32000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
148 { 3072000, 32000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
149 { 2048000, 32000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
150 { 1536000, 32000, 0x03, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
151 { 1024000, 32000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
154 {11289600, 44100, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
155 { 5644800, 44100, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
156 { 2822400, 44100, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
157 { 1411200, 44100, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
160 {12288000, 48000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
161 {18432000, 48000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
162 { 6144000, 48000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
163 { 3072000, 48000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
164 { 1536000, 48000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
167 {12288000, 64000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
168 {18432000, 64000, 0x03, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, 0x10},
169 {16384000, 64000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
170 { 8192000, 64000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
171 { 6144000, 64000, 0x01, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, 0x10},
172 { 4096000, 64000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
173 { 3072000, 64000, 0x01, 0x08, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, 0x10},
174 { 2048000, 64000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
175 { 1536000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0xbf, 0x03, 0x18, 0x18},
176 { 1024000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
179 {11289600, 88200, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
180 { 5644800, 88200, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
181 { 2822400, 88200, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
182 { 1411200, 88200, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
185 {12288000, 96000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
186 {18432000, 96000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
187 { 6144000, 96000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
188 { 3072000, 96000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
189 { 1536000, 96000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
Implementation of SPI Controller mode.