ESP8266
Main Page
Related Pages
Modules
Classes
esp8266
cores
esp8266
esp8266_peri.h
1
/*
2
esp8266_peri.h - Peripheral registers exposed in more AVR style for esp8266
3
4
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
5
This file is part of the esp8266 core for Arduino environment.
6
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
11
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
16
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
#ifndef ESP8266_PERI_H_INCLUDED
22
#define ESP8266_PERI_H_INCLUDED
23
24
#include "c_types.h"
25
26
#define ESP8266_REG(addr) *((volatile uint32_t *)(0x60000000+(addr)))
27
#define ESP8266_DREG(addr) *((volatile uint32_t *)(0x3FF00000+(addr)))
28
#define ESP8266_CLOCK 80000000UL
29
30
#define i2c_readReg_Mask(block, host_id, reg_add, Msb, Lsb) rom_i2c_readReg_Mask(block, host_id, reg_add, Msb, Lsb)
31
#define i2c_readReg_Mask_def(block, reg_add) i2c_readReg_Mask(block, block##_hostid, reg_add, reg_add##_msb, reg_add##_lsb)
32
#define i2c_writeReg_Mask(block, host_id, reg_add, Msb, Lsb, indata) rom_i2c_writeReg_Mask(block, host_id, reg_add, Msb, Lsb, indata)
33
#define i2c_writeReg_Mask_def(block, reg_add, indata) i2c_writeReg_Mask(block, block##_hostid, reg_add, reg_add##_msb, reg_add##_lsb, indata)
34
35
//CPU Register
36
#define CPU2X ESP8266_DREG(0x14) //when bit 0 is set, F_CPU = 160MHz
37
38
//OTP Registers
39
#define MAC0 ESP8266_DREG(0x50)
40
#define MAC1 ESP8266_DREG(0x54)
41
#define CHIPID ESP8266_DREG(0x58)
42
43
//GPIO (0-15) Control Registers
44
#define GPO ESP8266_REG(0x300) //GPIO_OUT R/W (Output Level)
45
#define GPOS ESP8266_REG(0x304) //GPIO_OUT_SET WO
46
#define GPOC ESP8266_REG(0x308) //GPIO_OUT_CLR WO
47
#define GPE ESP8266_REG(0x30C) //GPIO_ENABLE R/W (Enable)
48
#define GPES ESP8266_REG(0x310) //GPIO_ENABLE_SET WO
49
#define GPEC ESP8266_REG(0x314) //GPIO_ENABLE_CLR WO
50
#define GPI ESP8266_REG(0x318) //GPIO_IN RO (Read Input Level)
51
#define GPIE ESP8266_REG(0x31C) //GPIO_STATUS R/W (Interrupt Enable)
52
#define GPIES ESP8266_REG(0x320) //GPIO_STATUS_SET WO
53
#define GPIEC ESP8266_REG(0x324) //GPIO_STATUS_CLR WO
54
55
#define GPOP(p) ((GPO & (1 << ((p) & 0xF))) != 0)
56
#define GPEP(p) ((GPE & (1 << ((p) & 0xF))) != 0)
57
#define GPIP(p) ((GPI & (1 << ((p) & 0xF))) != 0)
58
#define GPIEP(p) ((GPIE & (1 << ((p) & 0xF))) != 0)
59
60
//GPIO (0-15) PIN Control Registers
61
#define GPC(p) ESP8266_REG(0x328 + ((p & 0xF) * 4))
62
#define GPC0 ESP8266_REG(0x328) //GPIO_PIN0
63
#define GPC1 ESP8266_REG(0x32C) //GPIO_PIN1
64
#define GPC2 ESP8266_REG(0x330) //GPIO_PIN2
65
#define GPC3 ESP8266_REG(0x334) //GPIO_PIN3
66
#define GPC4 ESP8266_REG(0x338) //GPIO_PIN4
67
#define GPC5 ESP8266_REG(0x33C) //GPIO_PIN5
68
#define GPC6 ESP8266_REG(0x340) //GPIO_PIN6
69
#define GPC7 ESP8266_REG(0x344) //GPIO_PIN7
70
#define GPC8 ESP8266_REG(0x348) //GPIO_PIN8
71
#define GPC9 ESP8266_REG(0x34C) //GPIO_PIN9
72
#define GPC10 ESP8266_REG(0x350) //GPIO_PIN10
73
#define GPC11 ESP8266_REG(0x354) //GPIO_PIN11
74
#define GPC12 ESP8266_REG(0x358) //GPIO_PIN12
75
#define GPC13 ESP8266_REG(0x35C) //GPIO_PIN13
76
#define GPC14 ESP8266_REG(0x360) //GPIO_PIN14
77
#define GPC15 ESP8266_REG(0x364) //GPIO_PIN15
78
79
//GPIO (0-15) PIN Control Bits
80
#define GPCWE 10 //WAKEUP_ENABLE (can be 1 only when INT_TYPE is high or low)
81
#define GPCI 7 //INT_TYPE (3bits) 0:disable,1:rising,2:falling,3:change,4:low,5:high
82
#define GPCD 2 //DRIVER 0:normal,1:open drain
83
#define GPCS 0 //SOURCE 0:GPIO_DATA,1:SigmaDelta
84
85
#define GPMUX ESP8266_REG(0x800)
86
//GPIO (0-15) PIN Function Registers
87
#define GPF0 ESP8266_REG(0x834)
88
#define GPF1 ESP8266_REG(0x818)
89
#define GPF2 ESP8266_REG(0x838)
90
#define GPF3 ESP8266_REG(0x814)
91
#define GPF4 ESP8266_REG(0x83C)
92
#define GPF5 ESP8266_REG(0x840)
93
#define GPF6 ESP8266_REG(0x81C)
94
#define GPF7 ESP8266_REG(0x820)
95
#define GPF8 ESP8266_REG(0x824)
96
#define GPF9 ESP8266_REG(0x828)
97
#define GPF10 ESP8266_REG(0x82C)
98
#define GPF11 ESP8266_REG(0x830)
99
#define GPF12 ESP8266_REG(0x804)
100
#define GPF13 ESP8266_REG(0x808)
101
#define GPF14 ESP8266_REG(0x80C)
102
#define GPF15 ESP8266_REG(0x810)
103
104
extern
uint8_t esp8266_gpioToFn[16];
105
#define GPF(p) ESP8266_REG(0x800 + esp8266_gpioToFn[(p & 0xF)])
106
107
//GPIO (0-15) PIN Function Bits
108
#define GPFSOE 0 //Sleep OE
109
#define GPFSS 1 //Sleep Sel
110
#define GPFSPD 2 //Sleep Pulldown
111
#define GPFSPU 3 //Sleep Pullup
112
#define GPFFS0 4 //Function Select bit 0
113
#define GPFFS1 5 //Function Select bit 1
114
#define GPFPD 6 //Pulldown
115
#define GPFPU 7 //Pullup
116
#define GPFFS2 8 //Function Select bit 2
117
#define GPFFS(f) (((((f) & 4) != 0) << GPFFS2) | ((((f) & 2) != 0) << GPFFS1) | ((((f) & 1) != 0) << GPFFS0))
118
#define GPFFS_GPIO(p) (((p)==0||(p)==2||(p)==4||(p)==5)?0:((p)==16)?1:3)
119
#define GPFFS_BUS(p) (((p)==1||(p)==3)?0:((p)==2||(p)==12||(p)==13||(p)==14||(p)==15)?2:((p)==0)?4:1)
120
121
//GPIO 16 Control Registers
122
#define GP16O ESP8266_REG(0x768)
123
#define GP16E ESP8266_REG(0x774)
124
#define GP16I ESP8266_REG(0x78C)
125
126
//GPIO 16 PIN Control Register
127
#define GP16C ESP8266_REG(0x790)
128
#define GPC16 GP16C
129
130
//GPIO 16 PIN Function Register
131
#define GP16F ESP8266_REG(0x7A0)
132
#define GPF16 GP16F
133
134
//GPIO 16 PIN Function Bits
135
#define GP16FFS0 0 //Function Select bit 0
136
#define GP16FFS1 1 //Function Select bit 1
137
#define GP16FPD 3 //Pulldown
138
#define GP16FSPD 5 //Sleep Pulldown
139
#define GP16FFS2 6 //Function Select bit 2
140
#define GP16FFS(f) (((f) & 0x03) | (((f) & 0x04) << 4))
141
142
//Timer 1 Registers (23bit CountDown Timer)
143
#define T1L ESP8266_REG(0x600) //Load Value (Starting Value of Counter) 23bit (0-8388607)
144
#define T1V ESP8266_REG(0x604) //(RO) Current Value
145
#define T1C ESP8266_REG(0x608) //Control Register
146
#define T1I ESP8266_REG(0x60C) //Interrupt Status Register (1bit) write to clear
147
//edge interrupt enable register
148
#define TEIE ESP8266_DREG(0x04)
149
#define TEIE1 0x02 //bit for timer 1
150
151
//Timer 2 Registers (32bit CountUp Timer)
152
#define T2L ESP8266_REG(0x620) //Load Value (Starting Value of Counter)
153
#define T2V ESP8266_REG(0x624) //(RO) Current Value
154
#define T2C ESP8266_REG(0x628) //Control Register
155
#define T2I ESP8266_REG(0x62C) //Interrupt Status Register (1bit) write to clear
156
#define T2A ESP8266_REG(0x630) //Alarm Value
157
158
//Timer Control Bits
159
#define TCIS 8 //Interrupt Status
160
#define TCTE 7 //Timer Enable
161
#define TCAR 6 //AutoReload (restart timer when condition is reached)
162
#define TCPD 2 //Prescale Devider (2bit) 0:1(12.5ns/tick), 1:16(0.2us/tick), 2/3:256(3.2us/tick)
163
#define TCIT 0 //Interrupt Type 0:edge, 1:level
164
165
//RTC Registers
166
#define RTCSV ESP8266_REG(0x704) //RTC SLEEP COUNTER Target Value
167
#define RTCCV ESP8266_REG(0x71C) //RTC SLEEP COUNTER Value
168
#define RTCIS ESP8266_REG(0x720) //RTC INT Status
169
#define RTCIC ESP8266_REG(0x724) //RTC INT Clear
170
#define RTCIE ESP8266_REG(0x728) //RTC INT Enable
171
172
//IO SWAP Register
173
#define IOSWAP ESP8266_DREG(0x28)
174
#define IOSWAPU 0 //Swaps UART
175
#define IOSWAPS 1 //Swaps SPI
176
#define IOSWAPU0 2 //Swaps UART 0 pins (u0rxd <-> u0cts), (u0txd <-> u0rts)
177
#define IOSWAPU1 3 //Swaps UART 1 pins (u1rxd <-> u1cts), (u1txd <-> u1rts)
178
#define IOSWAPHS 5 //Sets HSPI with higher prio
179
#define IOSWAP2HS 6 //Sets Two SPI Masters on HSPI
180
#define IOSWAP2CS 7 //Sets Two SPI Masters on CSPI
181
182
//UART INT Status
183
#define UIS ESP8266_DREG(0x20020)
184
#define UIS0 0
185
#define UIS1 2
186
187
//UART 0 Registers
188
#define U0F ESP8266_REG(0x000) //UART FIFO
189
#define U0IR ESP8266_REG(0x004) //INT_RAW
190
#define U0IS ESP8266_REG(0x008) //INT_STATUS
191
#define U0IE ESP8266_REG(0x00c) //INT_ENABLE
192
#define U0IC ESP8266_REG(0x010) //INT_CLEAR
193
#define U0D ESP8266_REG(0x014) //CLKDIV
194
#define U0A ESP8266_REG(0x018) //AUTOBAUD
195
#define U0S ESP8266_REG(0x01C) //STATUS
196
#define U0C0 ESP8266_REG(0x020) //CONF0
197
#define U0C1 ESP8266_REG(0x024) //CONF1
198
#define U0LP ESP8266_REG(0x028) //LOW_PULSE
199
#define U0HP ESP8266_REG(0x02C) //HIGH_PULSE
200
#define U0PN ESP8266_REG(0x030) //PULSE_NUM
201
#define U0DT ESP8266_REG(0x078) //DATE
202
#define U0ID ESP8266_REG(0x07C) //ID
203
204
//UART 1 Registers
205
#define U1F ESP8266_REG(0xF00) //UART FIFO
206
#define U1IR ESP8266_REG(0xF04) //INT_RAW
207
#define U1IS ESP8266_REG(0xF08) //INT_STATUS
208
#define U1IE ESP8266_REG(0xF0c) //INT_ENABLE
209
#define U1IC ESP8266_REG(0xF10) //INT_CLEAR
210
#define U1D ESP8266_REG(0xF14) //CLKDIV
211
#define U1A ESP8266_REG(0xF18) //AUTOBAUD
212
#define U1S ESP8266_REG(0xF1C) //STATUS
213
#define U1C0 ESP8266_REG(0xF20) //CONF0
214
#define U1C1 ESP8266_REG(0xF24) //CONF1
215
#define U1LP ESP8266_REG(0xF28) //LOW_PULSE
216
#define U1HP ESP8266_REG(0xF2C) //HIGH_PULSE
217
#define U1PN ESP8266_REG(0xF30) //PULSE_NUM
218
#define U1DT ESP8266_REG(0xF78) //DATE
219
#define U1ID ESP8266_REG(0xF7C) //ID
220
221
//UART(uart) Registers
222
#define USF(u) ESP8266_REG(0x000+(0xF00*(u&1))) //UART FIFO
223
#define USIR(u) ESP8266_REG(0x004+(0xF00*(u&1))) //INT_RAW
224
#define USIS(u) ESP8266_REG(0x008+(0xF00*(u&1))) //INT_STATUS
225
#define USIE(u) ESP8266_REG(0x00c+(0xF00*(u&1))) //INT_ENABLE
226
#define USIC(u) ESP8266_REG(0x010+(0xF00*(u&1))) //INT_CLEAR
227
#define USD(u) ESP8266_REG(0x014+(0xF00*(u&1))) //CLKDIV
228
#define USA(u) ESP8266_REG(0x018+(0xF00*(u&1))) //AUTOBAUD
229
#define USS(u) ESP8266_REG(0x01C+(0xF00*(u&1))) //STATUS
230
#define USC0(u) ESP8266_REG(0x020+(0xF00*(u&1))) //CONF0
231
#define USC1(u) ESP8266_REG(0x024+(0xF00*(u&1))) //CONF1
232
#define USLP(u) ESP8266_REG(0x028+(0xF00*(u&1))) //LOW_PULSE
233
#define USHP(u) ESP8266_REG(0x02C+(0xF00*(u&1))) //HIGH_PULSE
234
#define USPN(u) ESP8266_REG(0x030+(0xF00*(u&1))) //PULSE_NUM
235
#define USDT(u) ESP8266_REG(0x078+(0xF00*(u&1))) //DATE
236
#define USID(u) ESP8266_REG(0x07C+(0xF00*(u&1))) //ID
237
238
//UART INT Registers Bits
239
#define UITO 8 //RX FIFO TimeOut
240
#define UIBD 7 //Break Detected
241
#define UICTS 6 //CTS Changed
242
#define UIDSR 5 //DSR Change
243
#define UIOF 4 //RX FIFO OverFlow
244
#define UIFR 3 //Frame Error
245
#define UIPE 2 //Parity Error
246
#define UIFE 1 //TX FIFO Empty
247
#define UIFF 0 //RX FIFO Full
248
249
//UART STATUS Registers Bits
250
#define USTX 31 //TX PIN Level
251
#define USRTS 30 //RTS PIN Level
252
#define USDTR 39 //DTR PIN Level
253
#define USTXC 16 //TX FIFO COUNT (8bit)
254
#define USRXD 15 //RX PIN Level
255
#define USCTS 14 //CTS PIN Level
256
#define USDSR 13 //DSR PIN Level
257
#define USRXC 0 //RX FIFO COUNT (8bit)
258
259
//UART CONF0 Registers Bits
260
#define UCDTRI 24 //Invert DTR
261
#define UCRTSI 23 //Invert RTS
262
#define UCTXI 22 //Invert TX
263
#define UCDSRI 21 //Invert DSR
264
#define UCCTSI 20 //Invert CTS
265
#define UCRXI 19 //Invert RX
266
#define UCTXRST 18 //Reset TX FIFO
267
#define UCRXRST 17 //Reset RX FIFO
268
#define UCTXHFE 15 //TX Harware Flow Enable
269
#define UCLBE 14 //LoopBack Enable
270
#define UCBRK 8 //Send Break on the TX line
271
#define UCSWDTR 7 //Set this bit to assert DTR
272
#define UCSWRTS 6 //Set this bit to assert RTS
273
#define UCSBN 4 //StopBits Count (2bit) 0:disable, 1:1bit, 2:1.5bit, 3:2bit
274
#define UCBN 2 //DataBits Count (2bin) 0:5bit, 1:6bit, 2:7bit, 3:8bit
275
#define UCPAE 1 //Parity Enable
276
#define UCPA 0 //Parity 0:even, 1:odd
277
278
//UART CONF1 Registers Bits
279
#define UCTOE 31 //RX TimeOut Enable
280
#define UCTOT 24 //RX TimeOut Treshold (7bit)
281
#define UCRXHFE 23 //RX Harware Flow Enable
282
#define UCRXHFT 16 //RX Harware Flow Treshold (7bit)
283
#define UCFET 8 //TX FIFO Empty Treshold (7bit)
284
#define UCFFT 0 //RX FIFO Full Treshold (7bit)
285
286
//WDT Feed (the dog) Register
287
#define WDTFEED ESP8266_REG(0x914)
288
#define WDT_FEED() (WDTFEED = 0x73)
289
290
//SPI_READY
291
#define SPIRDY ESP8266_DREG(0x0C)
292
#define SPI_BUSY 9 //wait SPI idle
293
294
//SPI0 Registers (SPI0 is used for the flash)
295
#define SPI0CMD ESP8266_REG(0x200)
296
#define SPI0A ESP8266_REG(0x204)
297
#define SPI0C ESP8266_REG(0x208)
298
#define SPI0C1 ESP8266_REG(0x20C)
299
#define SPI0RS ESP8266_REG(0x210)
300
#define SPI0C2 ESP8266_REG(0x214)
301
#define SPI0CLK ESP8266_REG(0x218)
302
#define SPI0U ESP8266_REG(0x21C)
303
#define SPI0U1 ESP8266_REG(0x220)
304
#define SPI0U2 ESP8266_REG(0x224)
305
#define SPI0WS ESP8266_REG(0x228)
306
#define SPI0P ESP8266_REG(0x22C)
307
#define SPI0S ESP8266_REG(0x230)
308
#define SPI0S1 ESP8266_REG(0x234)
309
#define SPI0S2 ESP8266_REG(0x238)
310
#define SPI0S3 ESP8266_REG(0x23C)
311
#define SPI0W0 ESP8266_REG(0x240)
312
#define SPI0W1 ESP8266_REG(0x244)
313
#define SPI0W2 ESP8266_REG(0x248)
314
#define SPI0W3 ESP8266_REG(0x24C)
315
#define SPI0W4 ESP8266_REG(0x250)
316
#define SPI0W5 ESP8266_REG(0x254)
317
#define SPI0W6 ESP8266_REG(0x258)
318
#define SPI0W7 ESP8266_REG(0x25C)
319
#define SPI0W8 ESP8266_REG(0x260)
320
#define SPI0W9 ESP8266_REG(0x264)
321
#define SPI0W10 ESP8266_REG(0x268)
322
#define SPI0W11 ESP8266_REG(0x26C)
323
#define SPI0W12 ESP8266_REG(0x270)
324
#define SPI0W13 ESP8266_REG(0x274)
325
#define SPI0W14 ESP8266_REG(0x278)
326
#define SPI0W15 ESP8266_REG(0x27C)
327
#define SPI0E3 ESP8266_REG(0x2FC)
328
#define SPI0W(p) ESP8266_REG(0x240 + ((p & 0xF) * 4))
329
330
//SPI1 Registers
331
#define SPI1CMD ESP8266_REG(0x100)
332
#define SPI1A ESP8266_REG(0x104)
333
#define SPI1C ESP8266_REG(0x108)
334
#define SPI1C1 ESP8266_REG(0x10C)
335
#define SPI1RS ESP8266_REG(0x110)
336
#define SPI1C2 ESP8266_REG(0x114)
337
#define SPI1CLK ESP8266_REG(0x118)
338
#define SPI1U ESP8266_REG(0x11C)
339
#define SPI1U1 ESP8266_REG(0x120)
340
#define SPI1U2 ESP8266_REG(0x124)
341
#define SPI1WS ESP8266_REG(0x128)
342
#define SPI1P ESP8266_REG(0x12C)
343
#define SPI1S ESP8266_REG(0x130)
344
#define SPI1S1 ESP8266_REG(0x134)
345
#define SPI1S2 ESP8266_REG(0x138)
346
#define SPI1S3 ESP8266_REG(0x13C)
347
#define SPI1W0 ESP8266_REG(0x140)
348
#define SPI1W1 ESP8266_REG(0x144)
349
#define SPI1W2 ESP8266_REG(0x148)
350
#define SPI1W3 ESP8266_REG(0x14C)
351
#define SPI1W4 ESP8266_REG(0x150)
352
#define SPI1W5 ESP8266_REG(0x154)
353
#define SPI1W6 ESP8266_REG(0x158)
354
#define SPI1W7 ESP8266_REG(0x15C)
355
#define SPI1W8 ESP8266_REG(0x160)
356
#define SPI1W9 ESP8266_REG(0x164)
357
#define SPI1W10 ESP8266_REG(0x168)
358
#define SPI1W11 ESP8266_REG(0x16C)
359
#define SPI1W12 ESP8266_REG(0x170)
360
#define SPI1W13 ESP8266_REG(0x174)
361
#define SPI1W14 ESP8266_REG(0x178)
362
#define SPI1W15 ESP8266_REG(0x17C)
363
#define SPI1E0 ESP8266_REG(0x1F0)
364
#define SPI1E1 ESP8266_REG(0x1F4)
365
#define SPI1E2 ESP8266_REG(0x1F8)
366
#define SPI1E3 ESP8266_REG(0x1FC)
367
#define SPI1W(p) ESP8266_REG(0x140 + ((p & 0xF) * 4))
368
369
//SPI0, SPI1 & I2S Interupt Register
370
#define SPIIR ESP8266_DREG(0x20)
371
#define SPII0 4 //SPI0 Interrupt
372
#define SPII1 7 //SPI1 Interrupt
373
#define SPII2 9 //I2S Interrupt
374
375
//SPI CMD
376
#define SPICMDREAD (1 << 31) //SPI_FLASH_READ
377
#define SPICMDWREN (1 << 30) //SPI_FLASH_WREN
378
#define SPICMDWRDI (1 << 29) //SPI_FLASH_WRDI
379
#define SPICMDRDID (1 << 28) //SPI_FLASH_RDID
380
#define SPICMDRDSR (1 << 27) //SPI_FLASH_RDSR
381
#define SPICMDWRSR (1 << 26) //SPI_FLASH_WRSR
382
#define SPICMDPP (1 << 25) //SPI_FLASH_PP
383
#define SPICMDSE (1 << 24) //SPI_FLASH_SE
384
#define SPICMDBE (1 << 23) //SPI_FLASH_BE
385
#define SPICMDCE (1 << 22) //SPI_FLASH_CE
386
#define SPICMDDP (1 << 21) //SPI_FLASH_DP
387
#define SPICMDRES (1 << 20) //SPI_FLASH_RES
388
#define SPICMDHPM (1 << 19) //SPI_FLASH_HPM
389
#define SPICMDUSR (1 << 18) //SPI_FLASH_USR
390
#define SPIBUSY (1 << 18) //SPI_USR
391
392
//SPI CTRL (SPIxC)
393
#define SPICWBO (1 << 26) //SPI_WR_BIT_ODER
394
#define SPICRBO (1 << 25) //SPI_RD_BIT_ODER
395
#define SPICQIO (1 << 24) //SPI_QIO_MODE
396
#define SPICDIO (1 << 23) //SPI_DIO_MODE
397
#define SPIC2BSE (1 << 22) //SPI_TWO_BYTE_STATUS_EN
398
#define SPICWPR (1 << 21) //SPI_WP_REG
399
#define SPICQOUT (1 << 20) //SPI_QOUT_MODE
400
#define SPICSHARE (1 << 19) //SPI_SHARE_BUS
401
#define SPICHOLD (1 << 18) //SPI_HOLD_MODE
402
#define SPICAHB (1 << 17) //SPI_ENABLE_AHB
403
#define SPICSSTAAI (1 << 16) //SPI_SST_AAI
404
#define SPICRESANDRES (1 << 15) //SPI_RESANDRES
405
#define SPICDOUT (1 << 14) //SPI_DOUT_MODE
406
#define SPICFASTRD (1 << 13) //SPI_FASTRD_MODE
407
408
//SPI CTRL1 (SPIxC1)
409
#define SPIC1TCSH 0xF //SPI_T_CSH
410
#define SPIC1TCSH_S 28 //SPI_T_CSH_S
411
#define SPIC1TRES 0xFFF //SPI_T_RES
412
#define SPIC1TRES_S 16 //SPI_T_RES_S
413
#define SPIC1BTL 0xFFFF //SPI_BUS_TIMER_LIMIT
414
#define SPIC1BTL_S 0 //SPI_BUS_TIMER_LIMIT_S
415
416
//SPI Status (SPIxRS)
417
#define SPIRSEXT 0xFF //SPI_STATUS_EXT
418
#define SPIRSEXT_S 24 //SPI_STATUS_EXT_S
419
#define SPIRSWB 0xFF //SPI_WB_MODE
420
#define SPIRSWB_S 16 //SPI_WB_MODE_S
421
#define SPIRSSP (1 << 7) //SPI_FLASH_STATUS_PRO_FLAG
422
#define SPIRSTBP (1 << 5) //SPI_FLASH_TOP_BOT_PRO_FLAG
423
#define SPIRSBP2 (1 << 4) //SPI_FLASH_BP2
424
#define SPIRSBP1 (1 << 3) //SPI_FLASH_BP1
425
#define SPIRSBP0 (1 << 2) //SPI_FLASH_BP0
426
#define SPIRSWRE (1 << 1) //SPI_FLASH_WRENABLE_FLAG
427
#define SPIRSBUSY (1 << 0) //SPI_FLASH_BUSY_FLAG
428
429
//SPI CTRL2 (SPIxC2)
430
#define SPIC2CSDN 0xF //SPI_CS_DELAY_NUM
431
#define SPIC2CSDN_S 28 //SPI_CS_DELAY_NUM_S
432
#define SPIC2CSDM 0x3 //SPI_CS_DELAY_MODE
433
#define SPIC2CSDM_S 26 //SPI_CS_DELAY_MODE_S
434
#define SPIC2MOSIDN 0x7 //SPI_MOSI_DELAY_NUM
435
#define SPIC2MOSIDN_S 23 //SPI_MOSI_DELAY_NUM_S
436
#define SPIC2MOSIDM 0x3 //SPI_MOSI_DELAY_MODE
437
#define SPIC2MOSIDM_S 21 //SPI_MOSI_DELAY_MODE_S
438
#define SPIC2MISODN 0x7 //SPI_MISO_DELAY_NUM
439
#define SPIC2MISODN_S 18 //SPI_MISO_DELAY_NUM_S
440
#define SPIC2MISODM 0x3 //SPI_MISO_DELAY_MODE
441
#define SPIC2MISODM_S 16 //SPI_MISO_DELAY_MODE_S
442
#define SPIC2CKOHM 0xF //SPI_CK_OUT_HIGH_MODE
443
#define SPIC2CKOHM_S 12 //SPI_CK_OUT_HIGH_MODE_S
444
#define SPIC2CKOLM 0xF //SPI_CK_OUT_LOW_MODE
445
#define SPIC2CKOLM_S 8 //SPI_CK_OUT_LOW_MODE_S
446
#define SPIC2HT 0xF //SPI_HOLD_TIME
447
#define SPIC2HT_S 4 //SPI_HOLD_TIME_S
448
#define SPIC2ST 0xF //SPI_SETUP_TIME
449
#define SPIC2ST_S 0 //SPI_SETUP_TIME_S
450
451
//SPI CLK (SPIxCLK)
452
#define SPICLK_EQU_SYSCLK (1 << 31) //SPI_CLK_EQU_SYSCLK
453
#define SPICLKDIVPRE 0x1FFF //SPI_CLKDIV_PRE
454
#define SPICLKDIVPRE_S 18 //SPI_CLKDIV_PRE_S
455
#define SPICLKCN 0x3F //SPI_CLKCNT_N
456
#define SPICLKCN_S 12 //SPI_CLKCNT_N_S
457
#define SPICLKCH 0x3F //SPI_CLKCNT_H
458
#define SPICLKCH_S 6 //SPI_CLKCNT_H_S
459
#define SPICLKCL 0x3F //SPI_CLKCNT_L
460
#define SPICLKCL_S 0 //SPI_CLKCNT_L_S
461
462
//SPI Phases (SPIxU)
463
#define SPIUCOMMAND (1 << 31) //COMMAND pahse, SPI_USR_COMMAND
464
#define SPIUADDR (1 << 30) //ADDRESS phase, SPI_FLASH_USR_ADDR
465
#define SPIUDUMMY (1 << 29) //DUMMY phase, SPI_FLASH_USR_DUMMY
466
#define SPIUMISO (1 << 28) //MISO phase, SPI_FLASH_USR_DIN
467
#define SPIUMOSI (1 << 27) //MOSI phase, SPI_FLASH_DOUT
468
#define SPIUDUMMYIDLE (1 << 26) //SPI_USR_DUMMY_IDLE
469
#define SPIUMOSIH (1 << 25) //MOSI phase uses W8-W15, SPI_USR_DOUT_HIGHPART
470
#define SPIUMISOH (1 << 24) //MISO pahse uses W8-W15, SPI_USR_DIN_HIGHPART
471
#define SPIUPREPHOLD (1 << 23) //SPI_USR_PREP_HOLD
472
#define SPIUCMDHOLD (1 << 22) //SPI_USR_CMD_HOLD
473
#define SPIUADDRHOLD (1 << 21) //SPI_USR_ADDR_HOLD
474
#define SPIUDUMMYHOLD (1 << 20) //SPI_USR_DUMMY_HOLD
475
#define SPIUMISOHOLD (1 << 19) //SPI_USR_DIN_HOLD
476
#define SPIUMOSIHOLD (1 << 18) //SPI_USR_DOUT_HOLD
477
#define SPIUHOLDPOL (1 << 17) //SPI_USR_HOLD_POL
478
#define SPIUSIO (1 << 16) //SPI_SIO
479
#define SPIUFWQIO (1 << 15) //SPI_FWRITE_QIO
480
#define SPIUFWDIO (1 << 14) //SPI_FWRITE_DIO
481
#define SPIUFWQUAD (1 << 13) //SPI_FWRITE_QUAD
482
#define SPIUFWDUAL (1 << 12) //SPI_FWRITE_DUAL
483
#define SPIUWRBYO (1 << 11) //SPI_WR_BYTE_ORDER
484
#define SPIURDBYO (1 << 10) //SPI_RD_BYTE_ORDER
485
#define SPIUAHBEM 0x3 //SPI_AHB_ENDIAN_MODE
486
#define SPIUAHBEM_S 8 //SPI_AHB_ENDIAN_MODE_S
487
#define SPIUSME (1 << 7) //SPI Master Edge (0:falling, 1:rising), SPI_CK_OUT_EDGE
488
#define SPIUSSE (1 << 6) //SPI Slave Edge (0:falling, 1:rising), SPI_CK_I_EDGE
489
#define SPIUCSSETUP (1 << 5) //SPI_CS_SETUP
490
#define SPIUCSHOLD (1 << 4) //SPI_CS_HOLD
491
#define SPIUAHBUCMD (1 << 3) //SPI_AHB_USR_COMMAND
492
#define SPIUAHBUCMD4B (1 << 1) //SPI_AHB_USR_COMMAND_4BYTE
493
#define SPIUDUPLEX (1 << 0) //SPI_DOUTDIN
494
495
//SPI Phase Length Locations
496
#define SPILCOMMAND 28 //4 bit in SPIxU2 default 7 (8bit)
497
#define SPILADDR 26 //6 bit in SPIxU1 default:23 (24bit)
498
#define SPILDUMMY 0 //8 bit in SPIxU1 default:0 (0 cycles)
499
#define SPILMISO 8 //9 bit in SPIxU1 default:0 (1bit)
500
#define SPILMOSI 17 //9 bit in SPIxU1 default:0 (1bit)
501
//SPI Phase Length Masks
502
#define SPIMCOMMAND 0xF
503
#define SPIMADDR 0x3F
504
#define SPIMDUMMY 0xFF
505
#define SPIMMISO 0x1FF
506
#define SPIMMOSI 0x1FF
507
508
//SPI Slave (SPIxS)
509
#define SPISSRES (1 << 31) //SYNC RESET, SPI_SYNC_RESET
510
#define SPISE (1 << 30) //Slave Enable, SPI_SLAVE_MODE
511
#define SPISBE (1 << 29) //WR/RD BUF enable, SPI_SLV_WR_RD_BUF_EN
512
#define SPISSE (1 << 28) //STA enable, SPI_SLV_WR_RD_STA_EN
513
#define SPISCD (1 << 27) //CMD define, SPI_SLV_CMD_DEFINE
514
#define SPISTRCNT 0xF //SPI_TRANS_CNT
515
#define SPISTRCNT_S 23 //SPI_TRANS_CNT_S
516
#define SPISSLS 0x7 //SPI_SLV_LAST_STATE
517
#define SPISSLS_S 20 //SPI_SLV_LAST_STATE_S
518
#define SPISSLC 0x7 //SPI_SLV_LAST_COMMAND
519
#define SPISSLC_S 17 //SPI_SLV_LAST_COMMAND_S
520
#define SPISCSIM 0x3 //SPI_CS_I_MODE
521
#define SPIDCSIM_S 10 //SPI_CS_I_MODE_S
522
#define SPISTRIE (1 << 9) //TRANS interrupt enable
523
#define SPISWSIE (1 << 8) //WR_STA interrupt enable
524
#define SPISRSIE (1 << 7) //RD_STA interrupt enable
525
#define SPISWBIE (1 << 6) //WR_BUF interrupt enable
526
#define SPISRBIE (1 << 5) //RD_BUF interrupt enable
527
#define SPISTRIS (1 << 4) //TRANS interrupt status
528
#define SPISWSIS (1 << 3) //WR_STA interrupt status
529
#define SPISRSIS (1 << 2) //RD_STA interrupt status
530
#define SPISWBIS (1 << 1) //WR_BUF interrupt status
531
#define SPISRBIS (1 << 0) //RD_BUF interrupt status
532
533
//SPI Slave1 (SPIxS1)
534
#define SPIS1LSTA 27 //5 bit in SPIxS1 default:0 (1bit), SPI_SLV_STATUS_BITLEN
535
#define SPIS1FE (1 << 26) //SPI_SLV_STATUS_FAST_EN
536
#define SPIS1RSTA (1 << 25) //default:0 enable STA read from Master, SPI_SLV_STATUS_READBACK
537
#define SPIS1LBUF 16 //9 bit in SPIxS1 default:0 (1bit), SPI_SLV_BUF_BITLEN
538
#define SPIS1LRBA 10 //6 bit in SPIxS1 default:0 (1bit), SPI_SLV_RD_ADDR_BITLEN
539
#define SPIS1LWBA 4 //6 bit in SPIxS1 default:0 (1bit), SPI_SLV_WR_ADDR_BITLEN
540
#define SPIS1WSDE (1 << 3) //SPI_SLV_WRSTA_DUMMY_EN
541
#define SPIS1RSDE (1 << 2) //SPI_SLV_RDSTA_DUMMY_EN
542
#define SPIS1WBDE (1 << 1) //SPI_SLV_WRBUF_DUMMY_EN
543
#define SPIS1RBDE (1 << 0) //SPI_SLV_RDBUF_DUMMY_EN
544
545
//SPI Slave2 (SPIxS2)
546
#define SPIS2WBDL 0xFF //SPI_SLV_WRBUF_DUMMY_CYCLELEN
547
#define SPIS2WBDL_S 24 //SPI_SLV_WRBUF_DUMMY_CYCLELEN_S
548
#define SPIS2RBDL 0xFF //SPI_SLV_RDBUF_DUMMY_CYCLELEN
549
#define SPIS2RBDL_S 16 //SPI_SLV_RDBUF_DUMMY_CYCLELEN_S
550
#define SPIS2WSDL 0xFF //SPI_SLV_WRSTA_DUMMY_CYCLELEN
551
#define SPIS2WSDL_S 8 //SPI_SLV_WRSTA_DUMMY_CYCLELEN_S
552
#define SPIS2RSDL 0xFF //SPI_SLV_RDSTA_DUMMY_CYCLELEN
553
#define SPIS2RSDL_S 0 //SPI_SLV_RDSTA_DUMMY_CYCLELEN_S
554
555
//SPI Slave3 (SPIxS3)
556
#define SPIS3WSCV 0xFF //SPI_SLV_WRSTA_CMD_VALUE
557
#define SPIS3WSCV_S 24 //SPI_SLV_WRSTA_CMD_VALUE_S
558
#define SPIS3RSCV 0xFF //SPI_SLV_RDSTA_CMD_VALUE
559
#define SPIS3RSCV_S 16 //SPI_SLV_RDSTA_CMD_VALUE_S
560
#define SPIS3WBCV 0xFF //SPI_SLV_WRBUF_CMD_VALUE
561
#define SPIS3WBCV_S 8 //SPI_SLV_WRBUF_CMD_VALUE_S
562
#define SPIS3RBCV 0xFF //SPI_SLV_RDBUF_CMD_VALUE
563
#define SPIS3RBCV_S 0 //SPI_SLV_RDBUF_CMD_VALUE_S
564
565
//SPI EXT0 (SPIxE0)
566
#define SPIE0TPPEN (1 << 31) //SPI_T_PP_ENA
567
#define SPIE0TPPS 0xF //SPI_T_PP_SHIFT
568
#define SPIE0TPPS_S 16 //SPI_T_PP_SHIFT_S
569
#define SPIE0TPPT 0xFFF //SPI_T_PP_TIME
570
#define SPIE0TPPT_S 0 //SPI_T_PP_TIME_S
571
572
//SPI EXT1 (SPIxE1)
573
#define SPIE1TEREN (1 << 31) //SPI_T_ERASE_ENA
574
#define SPIE1TERS 0xF //SPI_T_ERASE_SHIFT
575
#define SPIE1TERS_S 16 //SPI_T_ERASE_SHIFT_S
576
#define SPIE1TERT 0xFFF //SPI_T_ERASE_TIME
577
#define SPIE1TERT_S 0 //SPI_T_ERASE_TIME_S
578
579
//SPI EXT2 (SPIxE2)
580
#define SPIE2ST 0x7 //SPI_ST
581
#define SPIE2ST_S 0 //SPI_ST_S
582
583
//SPI EXT3 (SPIxE3)
584
#define SPIE2IHEN 0x3 //SPI_INT_HOLD_ENA
585
#define SPIE2IHEN_S 0 //SPI_INT_HOLD_ENA_S
586
587
588
//SLC (DMA) Registers
589
#define SLCC0 ESP8266_REG(0xB00) //SLC_CONF0
590
#define SLCIR ESP8266_REG(0xB04) //SLC_INT_RAW
591
#define SLCIS ESP8266_REG(0xB08) //SLC_INT_STATUS
592
#define SLCIE ESP8266_REG(0xB0C) //SLC_INT_ENA
593
#define SLCIC ESP8266_REG(0xB10) //SLC_INT_CLR
594
#define SLCRXS ESP8266_REG(0xB14) //SLC_RX_STATUS
595
#define SLCRXP ESP8266_REG(0xB18) //SLC_RX_FIFO_PUSH
596
#define SLCTXS ESP8266_REG(0xB1C) //SLC_TX_STATUS
597
#define SLCTXP ESP8266_REG(0xB20) //SLC_TX_FIFO_POP
598
#define SLCRXL ESP8266_REG(0xB24) //SLC_RX_LINK
599
#define SLCTXL ESP8266_REG(0xB28) //SLC_TX_LINK
600
#define SLCIVTH ESP8266_REG(0xB2C) //SLC_INTVEC_TOHOST
601
#define SLCT0 ESP8266_REG(0xB30) //SLC_TOKEN0
602
#define SLCT1 ESP8266_REG(0xB34) //SLC_TOKEN1
603
#define SLCC1 ESP8266_REG(0xB38) //SLC_CONF1
604
#define SLCS0 ESP8266_REG(0xB3C) //SLC_STATE0
605
#define SLCS1 ESP8266_REG(0xB40) //SLC_STATE1
606
#define SLCBC ESP8266_REG(0xB44) //SLC_BRIDGE_CONF
607
#define SLCRXEDA ESP8266_REG(0xB48) //SLC_RX_EOF_DES_ADDR
608
#define SLCTXEDA ESP8266_REG(0xB4C) //SLC_TX_EOF_DES_ADDR
609
#define SLCRXEBDA ESP8266_REG(0xB50) //SLC_RX_EOF_BFR_DES_ADDR
610
#define SLCAT ESP8266_REG(0xB54) //SLC_AHB_TEST
611
#define SLCSS ESP8266_REG(0xB58) //SLC_SDIO_ST
612
#define SLCRXDC ESP8266_REG(0xB5C) //SLC_RX_DSCR_CONF
613
#define SLCTXD ESP8266_REG(0xB60) //SLC_TXLINK_DSCR
614
#define SLCTXDB0 ESP8266_REG(0xB64) //SLC_TXLINK_DSCR_BF0
615
#define SLCTXDB1 ESP8266_REG(0xB68) //SLC_TXLINK_DSCR_BF1
616
#define SLCRXD ESP8266_REG(0xB6C) //SLC_RXLINK_DSCR
617
#define SLCRXDB0 ESP8266_REG(0xB70) //SLC_RXLINK_DSCR_BF0
618
#define SLCRXDB1 ESP8266_REG(0xB74) //SLC_RXLINK_DSCR_BF1
619
#define SLCDT ESP8266_REG(0xB78) //SLC_DATE
620
#define SLCID ESP8266_REG(0xB7C) //SLC_ID
621
#define SLCHIR ESP8266_REG(0xB88) //SLC_HOST_INTR_RAW
622
#define SLCHC0 ESP8266_REG(0xB94) //SLC_HOST_CONF_W0
623
#define SLCHC1 ESP8266_REG(0xB98) //SLC_HOST_CONF_W1
624
#define SLCHIS ESP8266_REG(0xB9C) //SLC_HOST_INTR_ST
625
#define SLCHC2 ESP8266_REG(0xBA0) //SLC_HOST_CONF_W2
626
#define SLCHC3 ESP8266_REG(0xBA4) //SLC_HOST_CONF_W3
627
#define SLCHC4 ESP8266_REG(0xBA8) //SLC_HOST_CONF_W4
628
#define SLCHIC ESP8266_REG(0xBB0) //SLC_HOST_INTR_CLR
629
#define SLCHIE ESP8266_REG(0xBB4) //SLC_HOST_INTR_ENA
630
#define SLCHC5 ESP8266_REG(0xBBC) //SLC_HOST_CONF_W5
631
632
//SLC (DMA) CONF0
633
#define SLCMM (0x3) //SLC_MODE
634
#define SLCM (12) //SLC_MODE_S
635
#define SLCDTBE (1 << 9) //SLC_DATA_BURST_EN
636
#define SLCDBE (1 << 8) //SLC_DSCR_BURST_EN
637
#define SLCRXNRC (1 << 7) //SLC_RX_NO_RESTART_CLR
638
#define SLCRXAW (1 << 6) //SLC_RX_AUTO_WRBACK
639
#define SLCRXLT (1 << 5) //SLC_RX_LOOP_TEST
640
#define SLCTXLT (1 << 4) //SLC_TX_LOOP_TEST
641
#define SLCAR (1 << 3) //SLC_AHBM_RST
642
#define SLCAFR (1 << 2) //SLC_AHBM_FIFO_RST
643
#define SLCRXLR (1 << 1) //SLC_RXLINK_RST
644
#define SLCTXLR (1 << 0) //SLC_TXLINK_RST
645
646
//SLC (DMA) INT
647
#define SLCITXDE (1 << 21) //SLC_TX_DSCR_EMPTY_INT
648
#define SLCIRXDER (1 << 20) //SLC_RX_DSCR_ERR_INT
649
#define SLCITXDER (1 << 19) //SLC_TX_DSCR_ERR_INT
650
#define SLCITH (1 << 18) //SLC_TOHOST_INT
651
#define SLCIRXEOF (1 << 17) //SLC_RX_EOF_INT
652
#define SLCIRXD (1 << 16) //SLC_RX_DONE_INT
653
#define SLCITXEOF (1 << 15) //SLC_TX_EOF_INT
654
#define SLCITXD (1 << 14) //SLC_TX_DONE_INT
655
#define SLCIT0 (1 << 13) //SLC_TOKEN1_1TO0_INT
656
#define SLCIT1 (1 << 12) //SLC_TOKEN0_1TO0_INT
657
#define SLCITXO (1 << 11) //SLC_TX_OVF_INT
658
#define SLCIRXU (1 << 10) //SLC_RX_UDF_INT
659
#define SLCITXS (1 << 9) //SLC_TX_START_INT
660
#define SLCIRXS (1 << 8) //SLC_RX_START_INT
661
#define SLCIFH7 (1 << 7) //SLC_FRHOST_BIT7_INT
662
#define SLCIFH6 (1 << 6) //SLC_FRHOST_BIT6_INT
663
#define SLCIFH5 (1 << 5) //SLC_FRHOST_BIT5_INT
664
#define SLCIFH4 (1 << 4) //SLC_FRHOST_BIT4_INT
665
#define SLCIFH3 (1 << 3) //SLC_FRHOST_BIT3_INT
666
#define SLCIFH2 (1 << 2) //SLC_FRHOST_BIT2_INT
667
#define SLCIFH1 (1 << 1) //SLC_FRHOST_BIT1_INT
668
#define SLCIFH0 (1 << 0) //SLC_FRHOST_BIT0_INT
669
670
//SLC (DMA) RX_STATUS
671
#define SLCRXE (1 << 1) //SLC_RX_EMPTY
672
#define SLCRXF (1 << 0) //SLC_RX_FULL
673
674
//SLC (DMA) TX_STATUS
675
#define SLCTXE (1 << 1) //SLC_TX_EMPTY
676
#define SLCTXF (1 << 0) //SLC_TX_FULL
677
678
//SLC (DMA) RX_FIFO_PUSH
679
#define SLCRXFP (1 << 16) //SLC_RXFIFO_PUSH
680
#define SLCRXWDM (0x1FF) //SLC_RXFIFO_WDATA
681
#define SLCRXWD (0) //SLC_RXFIFO_WDATA_S
682
683
//SLC (DMA) TX_FIFO_POP
684
#define SLCTXFP (1 << 16) //SLC_TXFIFO_POP
685
#define SLCTXRDM (0x7FF) //SLC_TXFIFO_RDATA
686
#define SLCTXRD (0) //SLC_TXFIFO_RDATA_S
687
688
//SLC (DMA) RX_LINK
689
#define SLCRXLP (1 << 31) //SLC_RXLINK_PARK
690
#define SLCRXLRS (1 << 30) //SLC_RXLINK_RESTART
691
#define SLCRXLS (1 << 29) //SLC_RXLINK_START
692
#define SLCRXLE (1 << 28) //SLC_RXLINK_STOP
693
#define SLCRXLAM (0xFFFF) //SLC_RXLINK_DESCADDR_MASK
694
#define SLCRXLA (0) //SLC_RXLINK_ADDR_S
695
696
//SLC (DMA) TX_LINK
697
#define SLCTXLP (1 << 31) //SLC_TXLINK_PARK
698
#define SLCTXLRS (1 << 30) //SLC_TXLINK_RESTART
699
#define SLCTXLS (1 << 29) //SLC_TXLINK_START
700
#define SLCTXLE (1 << 28) //SLC_TXLINK_STOP
701
#define SLCTXLAM (0xFFFF) //SLC_TXLINK_DESCADDR_MASK
702
#define SLCTXLA (0) //SLC_TXLINK_ADDR_S
703
704
//SLC (DMA) TOKENx
705
#define SLCTM (0xFFF) //SLC_TOKENx_MASK
706
#define SLCTT (16) //SLC_TOKENx_S
707
#define SLCTIM (1 << 14) //SLC_TOKENx_LOCAL_INC_MORE
708
#define SLCTI (1 << 13) //SLC_TOKENx_LOCAL_INC
709
#define SLCTW (1 << 12) //SLC_TOKENx_LOCAL_WR
710
#define SLCTDM (0xFFF) //SLC_TOKENx_LOCAL_WDATA
711
#define SLCTD (0) //SLC_TOKENx_LOCAL_WDATA_S
712
713
//SLC (DMA) BRIDGE_CONF
714
#define SLCBFMEM (0xF) //SLC_FIFO_MAP_ENA
715
#define SLCBFME (8) //SLC_FIFO_MAP_ENA_S
716
#define SLCBTEEM (0x3F) //SLC_TXEOF_ENA
717
#define SLCBTEE (0) //SLC_TXEOF_ENA_S
718
719
//SLC (DMA) AHB_TEST
720
#define SLCATAM (0x3) //SLC_AHB_TESTADDR
721
#define SLCATA (4) //SLC_AHB_TESTADDR_S
722
#define SLCATMM (0x7) //SLC_AHB_TESTMODE
723
#define SLCATM (0) //SLC_AHB_TESTMODE_S
724
725
//SLC (DMA) SDIO_ST
726
#define SLCSBM (0x7) //SLC_BUS_ST
727
#define SLCSB (12) //SLC_BUS_ST_S
728
#define SLCSW (1 << 8) //SLC_SDIO_WAKEUP
729
#define SLCSFM (0xF) //SLC_FUNC_ST
730
#define SLCSF (4) //SLC_FUNC_ST_S
731
#define SLCSCM (0x7) //SLC_CMD_ST
732
#define SLCSC (0) //SLC_CMD_ST_S
733
734
//SLC (DMA) RX_DSCR_CONF
735
#define SLCBRXFE (1 << 20) //SLC_RX_FILL_EN
736
#define SLCBRXEM (1 << 19) //SLC_RX_EOF_MODE
737
#define SLCBRXFM (1 << 18) //SLC_RX_FILL_MODE
738
#define SLCBINR (1 << 17) //SLC_INFOR_NO_REPLACE
739
#define SLCBTNR (1 << 16) //SLC_TOKEN_NO_REPLACE
740
#define SLCBPICM (0xFFFF) //SLC_POP_IDLE_CNT
741
#define SLCBPIC (0) //SLC_POP_IDLE_CNT_S
742
743
744
// I2S Registers
745
#define i2c_bbpll 0x67
746
#define i2c_bbpll_hostid 4
747
#define i2c_bbpll_en_audio_clock_out 4
748
#define i2c_bbpll_en_audio_clock_out_msb 7
749
#define i2c_bbpll_en_audio_clock_out_lsb 7
750
#define I2S_CLK_ENABLE() i2c_writeReg_Mask_def(i2c_bbpll, i2c_bbpll_en_audio_clock_out, 1)
751
#define I2SBASEFREQ (12000000L)
752
753
#define I2STXF ESP8266_REG(0xe00) //I2STXFIFO (32bit)
754
#define I2SRXF ESP8266_REG(0xe04) //I2SRXFIFO (32bit)
755
#define I2SC ESP8266_REG(0xe08) //I2SCONF
756
#define I2SIR ESP8266_REG(0xe0C) //I2SINT_RAW
757
#define I2SIS ESP8266_REG(0xe10) //I2SINT_ST
758
#define I2SIE ESP8266_REG(0xe14) //I2SINT_ENA
759
#define I2SIC ESP8266_REG(0xe18) //I2SINT_CLR
760
#define I2ST ESP8266_REG(0xe1C) //I2STIMING
761
#define I2SFC ESP8266_REG(0xe20) //I2S_FIFO_CONF
762
#define I2SRXEN ESP8266_REG(0xe24) //I2SRXEOF_NUM (32bit)
763
#define I2SCSD ESP8266_REG(0xe28) //I2SCONF_SIGLE_DATA (32bit)
764
#define I2SCC ESP8266_REG(0xe2C) //I2SCONF_CHAN
765
766
// I2S CONF
767
#define I2SBDM (0x3F) //I2S_BCK_DIV_NUM
768
#define I2SBD (22) //I2S_BCK_DIV_NUM_S
769
#define I2SCDM (0x3F) //I2S_CLKM_DIV_NUM
770
#define I2SCD (16) //I2S_CLKM_DIV_NUM_S
771
#define I2SBMM (0xF) //I2S_BITS_MOD
772
#define I2SBM (12) //I2S_BITS_MOD_S
773
#define I2SRMS (1 << 11) //I2S_RECE_MSB_SHIFT
774
#define I2STMS (1 << 10) //I2S_TRANS_MSB_SHIFT
775
#define I2SRXS (1 << 9) //I2S_I2S_RX_START
776
#define I2STXS (1 << 8) //I2S_I2S_TX_START
777
#define I2SMR (1 << 7) //I2S_MSB_RIGHT
778
#define I2SRF (1 << 6) //I2S_RIGHT_FIRST
779
#define I2SRSM (1 << 5) //I2S_RECE_SLAVE_MOD
780
#define I2STSM (1 << 4) //I2S_TRANS_SLAVE_MOD
781
#define I2SRXFR (1 << 3) //I2S_I2S_RX_FIFO_RESET
782
#define I2STXFR (1 << 2) //I2S_I2S_TX_FIFO_RESET
783
#define I2SRXR (1 << 1) //I2S_I2S_RX_RESET
784
#define I2STXR (1 << 0) //I2S_I2S_TX_RESET
785
#define I2SRST (0xF) //I2S_I2S_RESET_MASK
786
787
//I2S INT
788
#define I2SITXRE (1 << 5) //I2S_I2S_TX_REMPTY_INT
789
#define I2SITXWF (1 << 4) //I2S_I2S_TX_WFULL_INT
790
#define I2SIRXRE (1 << 3) //I2S_I2S_RX_REMPTY_INT
791
#define I2SIRXWF (1 << 2) //I2S_I2S_RX_WFULL_INT
792
#define I2SITXPD (1 << 1) //I2S_I2S_TX_PUT_DATA_INT
793
#define I2SIRXTD (1 << 0) //I2S_I2S_RX_TAKE_DATA_INT
794
795
//I2S TIMING
796
#define I2STBII (1 << 22) //I2S_TRANS_BCK_IN_INV
797
#define I2SRDS (1 << 21) //I2S_RECE_DSYNC_SW
798
#define I2STDS (1 << 20) //I2S_TRANS_DSYNC_SW
799
#define I2SRBODM (0x3) //I2S_RECE_BCK_OUT_DELAY
800
#define I2SRBOD (18) //I2S_RECE_BCK_OUT_DELAY_S
801
#define I2SRWODM (0x3) //I2S_RECE_WS_OUT_DELAY
802
#define I2SRWOD (16) //I2S_RECE_WS_OUT_DELAY_S
803
#define I2STSODM (0x3) //I2S_TRANS_SD_OUT_DELAY
804
#define I2STSOD (14) //I2S_TRANS_SD_OUT_DELAY_S
805
#define I2STWODM (0x3) //I2S_TRANS_WS_OUT_DELAY
806
#define I2STWOD (12) //I2S_TRANS_WS_OUT_DELAY_S
807
#define I2STBODM (0x3) //I2S_TRANS_BCK_OUT_DELAY
808
#define I2STBOD (10) //I2S_TRANS_BCK_OUT_DELAY_S
809
#define I2SRSIDM (0x3) //I2S_RECE_SD_IN_DELAY
810
#define I2SRSID (8) //I2S_RECE_SD_IN_DELAY_S
811
#define I2SRWIDM (0x3) //I2S_RECE_WS_IN_DELAY
812
#define I2SRWID (6) //I2S_RECE_WS_IN_DELAY_S
813
#define I2SRBIDM (0x3) //I2S_RECE_BCK_IN_DELAY
814
#define I2SRBID (4) //I2S_RECE_BCK_IN_DELAY_S
815
#define I2STWIDM (0x3) //I2S_TRANS_WS_IN_DELAY
816
#define I2STWID (2) //I2S_TRANS_WS_IN_DELAY_S
817
#define I2STBIDM (0x3) //I2S_TRANS_BCK_IN_DELAY
818
#define I2STBID (0) //I2S_TRANS_BCK_IN_DELAY_S
819
820
//I2S FIFO CONF
821
#define I2SRXFMM (0x7) //I2S_I2S_RX_FIFO_MOD
822
#define I2SRXFM (16) //I2S_I2S_RX_FIFO_MOD_S
823
#define I2STXFMM (0x7) //I2S_I2S_TX_FIFO_MOD
824
#define I2STXFM (13) //I2S_I2S_TX_FIFO_MOD_S
825
#define I2SDE (1 << 12) //I2S_I2S_DSCR_EN
826
#define I2STXDNM (0x3F) //I2S_I2S_TX_DATA_NUM
827
#define I2STXDN (6) //I2S_I2S_TX_DATA_NUM_S
828
#define I2SRXDNM (0x3F) //I2S_I2S_RX_DATA_NUM
829
#define I2SRXDN (0) //I2S_I2S_RX_DATA_NUM_S
830
831
//I2S CONF CHAN
832
#define I2SRXCMM (0x3) //I2S_RX_CHAN_MOD
833
#define I2SRXCM (3) //I2S_RX_CHAN_MOD_S
834
#define I2STXCMM (0x7) //I2S_TX_CHAN_MOD
835
#define I2STXCM (0) //I2S_TX_CHAN_MOD_S
836
841
#define RANDOM_REG32 ESP8266_DREG(0x20E44)
842
843
#endif
Generated by
1.8.10