RTEMS 6.1-rc1
lm3s69xx.h
Go to the documentation of this file.
1
9/*
10 * Copyright (c) 2013 Eugeniy Meshcheryakov <eugen@debian.org>
11 *
12 * Copyright (c) 2011 Sebastian Huber. All rights reserved.
13 *
14 * The license and distribution terms for this file may be
15 * found in the file LICENSE in this distribution or at
16 * http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef LIBBSP_ARM_LM3S69XX_LM3S69XX_H
20#define LIBBSP_ARM_LM3S69XX_LM3S69XX_H
21#include <bspopts.h>
22#include <bsp/utility.h>
23
32#define LM3S69XX_SYSCON_BASE 0x400fe000
33
34#define LM3S69XX_UART_0_BASE 0x4000c000
35#define LM3S69XX_UART_1_BASE 0x4000d000
36#define LM3S69XX_UART_2_BASE 0x4000e000
37
38#ifdef LM3S69XX_USE_AHB_FOR_GPIO
39#define LM3S69XX_GPIO_A_BASE 0x40058000
40#define LM3S69XX_GPIO_B_BASE 0x40059000
41#define LM3S69XX_GPIO_C_BASE 0x4005a000
42#define LM3S69XX_GPIO_D_BASE 0x4005b000
43#define LM3S69XX_GPIO_E_BASE 0x4005c000
44#define LM3S69XX_GPIO_F_BASE 0x4005d000
45#if LM3S69XX_NUM_GPIO_BLOCKS > 6
46#define LM3S69XX_GPIO_G_BASE 0x4005e000
47#if LM3S69XX_NUM_GPIO_BLOCKS > 7
48#define LM3S69XX_GPIO_H_BASE 0x4005f000
49#endif
50#endif
51
52#define LM3S69XX_GPIO(port) ((volatile lm3s69xx_gpio *)(LM3S69XX_GPIO_A_BASE + (port) * 0x1000))
53#else /* LM3S69XX_USE_AHB_FOR_GPIO */
54#define LM3S69XX_GPIO_A_BASE 0x40004000
55#define LM3S69XX_GPIO_B_BASE 0x40005000
56#define LM3S69XX_GPIO_C_BASE 0x40006000
57#define LM3S69XX_GPIO_D_BASE 0x40007000
58#define LM3S69XX_GPIO_E_BASE 0x40024000
59#define LM3S69XX_GPIO_F_BASE 0x40025000
60#if LM3S69XX_NUM_GPIO_BLOCKS > 6
61#define LM3S69XX_GPIO_G_BASE 0x40026000
62#if LM3S69XX_NUM_GPIO_BLOCKS > 7
63#define LM3S69XX_GPIO_H_BASE 0x40027000
64#endif
65#endif
66
67#define LM3S69XX_GPIO(port) ((volatile lm3s69xx_gpio *)(((port) < 4) ? \
68 (LM3S69XX_GPIO_A_BASE + (port) * 0x1000) : \
69 (LM3S69XX_GPIO_E_BASE + ((port) - 4) * 0x1000)))
70#endif /* LM3S69XX_USE_AHB_FOR_GPIO */
71
72#define LM3S69XX_SSI_0_BASE 0x40008000
73#if LM3S69XX_NUM_SSI_BLOCKS > 1
74#define LM3S69XX_SSI_1_BASE 0x40009000
75#if LM3S69XX_NUM_SSI_BLOCKS > 2
76#define LM3S69XX_SSI_2_BASE 0x4000A000
77#if LM3S69XX_NUM_SSI_BLOCKS > 3
78#define LM3S69XX_SSI_3_BASE 0x4000B000
79#endif
80#endif
81#endif
82
83#define LM3S69XX_SYSCON ((volatile lm3s69xx_syscon *)LM3S69XX_SYSCON_BASE)
84
85#define LM3S69XX_PLL_FREQUENCY 400000000U
86
87typedef struct {
88 uint32_t data[256]; /* Masked data registers are included here. */
89 uint32_t dir;
90 uint32_t is;
91 uint32_t ibe;
92 uint32_t iev;
93 uint32_t im;
94 uint32_t ris;
95 uint32_t mis;
96 uint32_t icr;
97 uint32_t afsel;
98
99 uint32_t reserved_0[55];
100
101 uint32_t dr2r;
102 uint32_t dr4r;
103 uint32_t dr8r;
104 uint32_t odr;
105 uint32_t pur;
106 uint32_t pdr;
107 uint32_t slr;
108 uint32_t den;
109 uint32_t lock;
110 uint32_t cr;
111 uint32_t amsel;
113
114typedef struct {
115 uint32_t did0;
116 uint32_t did1;
117
118 uint32_t dc0;
119 uint32_t reserved_0;
120 uint32_t dc1;
121 uint32_t dc2;
122 uint32_t dc3;
123 uint32_t dc4;
124 uint32_t dc5;
125 uint32_t dc6;
126 uint32_t dc7;
127
128 uint32_t reserved_1;
129
130#define SYSCONPBORCTL_BORIOR BSP_BIT32(1)
131 uint32_t pborctl;
132
133#define SYSCONLDOPCTL_VADJ(val) BSP_FLD32(val, 0, 5)
134#define SYSCONLDOPCTL_VADJ_MASK BSP_MSK32(0, 5)
135 uint32_t ldopctl;
136
137 uint32_t reserved_2[2];
138
139 uint32_t srcr0;
140 uint32_t srcr1;
141 uint32_t srcr2;
142
143 uint32_t reserved_3;
144
145#define SYSCONRIS_MOSCPUPRIS BSP_BIT32(8)
146#define SYSCONRIS_USBPLLRIS BSP_BIT32(7)
147#define SYSCONRIS_PLLLRIS BSP_BIT32(6)
148#define SYSCONRIS_BORRIS BSP_BIT32(1)
149 uint32_t ris;
150
151#define SYSCONIMC_MOSCPUPIM BSP_BIT32(8)
152#define SYSCONIMC_USBPLLLIM BSP_BIT32(7)
153#define SYSCONIMC_PLLLIM BSP_BIT32(6)
154#define SYSCONIMC_BORIM BSP_BIT32(1)
155 uint32_t imc;
156
157#define SYSCONMISC_MOSCPUPMIS BSP_BIT32(8)
158#define SYSCONMISC_USBPLLLMIS BSP_BIT32(7)
159#define SYSCONMISC_PLLLMIS BSP_BIT32(6)
160#define SYSCONMISC_BORMIS BSP_BIT32(1)
161 uint32_t misc;
162
163#define SYSCONRESC_MOSCFAIL BSP_BIT32(16)
164#define SYSCONRESC_SW BSP_BIT32(4)
165#define SYSCONRESC_WDT BSP_BIT32(3)
166#define SYSCONRESC_BOR BSP_BIT32(2)
167#define SYSCONRESC_POR BSP_BIT32(1)
168#define SYSCONRESC_EXT BSP_BIT32(0)
169 uint32_t resc;
170
171#define SYSCONRCC_AGC BSP_BIT32(27)
172#define SYSCONRCC_SYSDIV(val) BSP_FLD32(val, 23, 26)
173#define SYSCONRCC_SYSDIV_MSK BSP_MSK32(23, 26)
174#define SYSCONRCC_USESYSDIV BSP_BIT32(22)
175#define SYSCONRCC_USEPWMDIV BSP_BIT32(20)
176#define SYSCONRCC_PWMDIV(val) BSP_FLD32(val, 17, 19)
177#define SYSCONRCC_PWMDIV_DIV2_VAL 0
178#define SYSCONRCC_PWMDIV_DIV4_VAL 1
179#define SYSCONRCC_PWMDIV_DIV8_VAL 2
180#define SYSCONRCC_PWMDIV_DIV16_VAL 3
181#define SYSCONRCC_PWMDIV_DIV32_VAL 4
182#define SYSCONRCC_PWMDIV_DIV64_VAL 5
183#define SYSCONRCC_PWMDIV_MSK BSP_MSK32(17, 19)
184#define SYSCONRCC_PWRDN BSP_BIT32(13)
185#define SYSCONRCC_BYPASS BSP_BIT32(11)
186#define SYSCONRCC_XTAL(val) BSP_FLD32(val, 6, 10)
187#define SYSCONRCC_XTAL_MSK BSP_MSK32(6, 10)
188#define SYSCONRCC_OSCSRC(val) BSP_FLD32(val, 4, 5)
189#define SYSCONRCC_OSCSRC_MOSC SYSCONRCC_OSCSRC(0x0)
190#define SYSCONRCC_OSCSRC_IOSC SYSCONRCC_OSCSRC(0x1)
191#define SYSCONRCC_OSCSRC_IOSC_DIV_4 SYSCONRCC_OSCSRC(0x2)
192#define SYSCONRCC_OSCSRC_30KHZ SYSCONRCC_OSCSRC(0x3)
193#define SYSCONRCC_OSCSRC_MSK BSP_MSK32(4, 5)
194#define SYSCONRCC_IOSCDIS BSP_BIT32(1)
195#define SYSCONRCC_MOSCDIS BSP_BIT32(0)
196 uint32_t rcc;
197
198#define SYSCONPLLCFG_F(val) BSP_FLD32(val, 5, 13)
199#define SYSCONPLLCFG_F_MSK BSP_MSK32(5, 13)
200#define SYSCONPLLCFG_R(val) BSP_FLD32(val, 0, 4)
201#define SYSCONPLLCFG_R_MSK BSP_MSK32(0, 4)
202 uint32_t pllcfg;
203
204 uint32_t reserved_4;
205
206#define SYSCONGPIOHBCTL_PORTH BSP_BIT32(7)
207#define SYSCONGPIOHBCTL_PORTG BSP_BIT32(6)
208#define SYSCONGPIOHBCTL_PORTF BSP_BIT32(5)
209#define SYSCONGPIOHBCTL_PORTE BSP_BIT32(4)
210#define SYSCONGPIOHBCTL_PORTD BSP_BIT32(3)
211#define SYSCONGPIOHBCTL_PORTC BSP_BIT32(2)
212#define SYSCONGPIOHBCTL_PORTB BSP_BIT32(1)
213#define SYSCONGPIOHBCTL_PORTA BSP_BIT32(0)
214 uint32_t gpiohbctl;
215
216#define SYSCONRCC2_USERCC2 BSP_BIT32(31)
217#define SYSCONRCC2_DIV400 BSP_BIT32(30)
218#define SYSCONRCC2_SYSDIV2(val) BSP_FLD32(val, 23, 28)
219#define SYSCONRCC2_SYSDIV2_MSK BSP_MSK32(23, 28)
220#define SYSCONRCC2_SYSDIV2EXT(val) BSP_FLD32(val, 22, 28)
221#define SYSCONRCC2_SYSDIV2EXT_MSK BSP_MSK32(22, 28)
222#define SYSCONRCC2_USBPWRDN BSP_BIT32(14)
223#define SYSCONRCC2_PWRDN2 BSP_BIT32(13)
224#define SYSCONRCC2_BYPASS2 BSP_BIT32(11)
225#define SYSCONRCC2_OSCSRC2(val) BSP_FLD32(val, 4, 6)
226#define SYSCONRCC2_OSCSRC2_MSK BSP_MSK32(4, 6)
227 uint32_t rcc2;
228
229 uint32_t reserved_5[2];
230
231#define SYSCONMOSCCTL_CVAL BSP_BIT32(0)
232 uint32_t moscctl;
233
234 uint32_t reserved_6[32];
235
236#define SYSCONRCGC0_PWM BSP_BIT32(20)
237#define SYSCONRCGC0_ADC BSP_BIT32(16)
238#define SYSCONRCGC0_MAXADCSPD(val) BSP_FLD32(val, 8, 9)
239#define SYSCONRCGC0_MAXADCSPD_MSK BSP_MSK32(8, 9)
240#define SYSCONRCGC0_HIB BSP_BIT32(6)
241#define SYSCONRCGC0_WDT BSP_BIT32(3)
242 uint32_t rcgc0;
243
244#define SYSCONRCGC1_COMP1 BSP_BIT32(25)
245#define SYSCONRCGC1_COMP0 BSP_BIT32(24)
246#define SYSCONRCGC1_TIMER3 BSP_BIT32(19)
247#define SYSCONRCGC1_TIMER2 BSP_BIT32(18)
248#define SYSCONRCGC1_TIMER1 BSP_BIT32(17)
249#define SYSCONRCGC1_TIMER0 BSP_BIT32(16)
250#define SYSCONRCGC1_I2C1 BSP_BIT32(14)
251#define SYSCONRCGC1_I2C0 BSP_BIT32(12)
252#define SYSCONRCGC1_QEI0 BSP_BIT32(8)
253#if LM3S69XX_NUM_SSI_BLOCKS > 1
254#define SYSCONRCGC1_SSI1 BSP_BIT32(5)
255#endif
256#define SYSCONRCGC1_SSI0 BSP_BIT32(4)
257#define SYSCONRCGC1_UART2 BSP_BIT32(2)
258#define SYSCONRCGC1_UART1 BSP_BIT32(1)
259#define SYSCONRCGC1_UART0 BSP_BIT32(0)
260 uint32_t rcgc1;
261
262#define SYSCONRCGC2_USB0 BSP_BIT32(16)
263#define SYSCONRCGC2_UDMA BSP_BIT32(13)
264#if LM3S69XX_NUM_GPIO_BLOCKS > 7
265#define SYSCONRCGC2_GPIOH BSP_BIT32(7)
266#endif
267#define SYSCONRCGC2_GPIOG BSP_BIT32(6)
268#define SYSCONRCGC2_GPIOF BSP_BIT32(5)
269#define SYSCONRCGC2_GPIOE BSP_BIT32(4)
270#define SYSCONRCGC2_GPIOD BSP_BIT32(3)
271#define SYSCONRCGC2_GPIOC BSP_BIT32(2)
272#define SYSCONRCGC2_GPIOB BSP_BIT32(1)
273#define SYSCONRCGC2_GPIOA BSP_BIT32(0)
274 uint32_t rcgc2;
275
276 uint32_t reserved_7;
277
278 uint32_t scgc0;
279 uint32_t scgc1;
280 uint32_t scgc2;
281
282 uint32_t reserved_8;
283
284 uint32_t dcgc0;
285 uint32_t dcgc1;
286 uint32_t dcgc2;
287
288 uint32_t reserved_9[6];
289
290#define SYSCONDSLPCLKCFG_DSDIVORIDE(val) BSP_FLD32(val, 23, 28)
291#define SYSCONDSLPCLKCFG_DSDIVORIDE_MSK BSP_MSK32(23, 28)
292#define SYSCONDSLPCLKCFG_DSOSCSRC(val) BSP_FLD32(val, 4, 6)
293#define SYSCONDSLPCLKCFG_DSOSCSRC_MSK BSP_MSK32(4, 6)
294 uint32_t dslpclkcfg;
296
297typedef struct {
298#define UARTDR_OE BSP_BIT32(11)
299#define UARTDR_BE BSP_BIT32(10)
300#define UARTDR_PE BSP_BIT32(9)
301#define UARTDR_FE BSP_BIT32(8)
302#define UARTDR_ERROR_MSK BSP_MSK32(8, 11)
303#define UARTDR_DATA(val) BSP_FLD32(val, 0, 7)
304#define UARTDR_DATA_GET(reg) BSP_FLD32GET(reg, 0, 7)
305 uint32_t dr;
306
307 uint32_t rsr_ecr;
308 uint32_t reserved_0[4];
309
310#define UARTFR_TXFE BSP_BIT32(7)
311#define UARTFR_RXFF BSP_BIT32(6)
312#define UARTFR_TXFF BSP_BIT32(5)
313#define UARTFR_RXFE BSP_BIT32(4)
314#define UARTFR_BUSY BSP_BIT32(3)
315 uint32_t fr;
316
317 uint32_t reserved_1;
318
319 uint32_t ilpr;
320 uint32_t ibrd;
321 uint32_t fbrd;
322
323#define UARTLCRH_SPS BSP_BIT32(7)
324#define UARTLCRH_WLEN(val) BSP_FLD32(val, 5, 6)
325#define UARTLCRH_FEN BSP_BIT32(4)
326#define UARTLCRH_STP2 BSP_BIT32(3)
327#define UARTLCRH_EPS BSP_BIT32(2)
328#define UARTLCRH_PEN BSP_BIT32(1)
329#define UARTLCRH_BRK BSP_BIT32(0)
330 uint32_t lcrh;
331
332#define UARTCTL_RXE BSP_BIT32(9)
333#define UARTCTL_TXE BSP_BIT32(8)
334#define UARTCTL_LBE BSP_BIT32(7)
335#define UARTCTL_SIRLP BSP_BIT32(2)
336#define UARTCTL_SIREN BSP_BIT32(1)
337#define UARTCTL_UARTEN BSP_BIT32(0)
338 uint32_t ctl;
339
340#define UARTIFLS_RXIFLSEL(val) BSP_FLD32(val, 3, 5)
341#define UARTIFLS_TXIFLSEL(val) BSP_FLD32(val, 0, 2)
342 uint32_t ifls;
343
344#define UARTI_OE BSP_BIT32(10)
345#define UARTI_BE BSP_BIT32(9)
346#define UARTI_PE BSP_BIT32(8)
347#define UARTI_FE BSP_BIT32(7)
348#define UARTI_RT BSP_BIT32(6)
349#define UARTI_TX BSP_BIT32(5)
350#define UARTI_RX BSP_BIT32(4)
351 uint32_t im;
352 uint32_t ris;
353 uint32_t mis;
354 uint32_t icr;
355#if LM3S69XX_HAS_UDMA
356 uint32_t dmactl;
357#endif
359
360typedef struct {
361#define SSICR0_SCR(val) BSP_FLD32(val, 8, 15)
362#define SSICR0_SPH BSP_BIT32(7)
363#define SSICR0_SPO BSP_BIT32(6)
364#define SSICR0_FRF(val) BSP_FLD32(val, 4, 5)
365#define SSICR0_DSS(val) BSP_FLD32(val, 0, 3)
366 uint32_t cr0;
367
368#define SSICR1_SOD BSP_BIT32(3)
369#define SSICR1_MS BSP_BIT32(2)
370#define SSICR1_SSE BSP_BIT32(1)
371#define SSICR1_LBM BSP_BIT32(0)
372 uint32_t cr1;
373 uint32_t dr;
374
375#define SSISR_BSY BSP_BIT32(4)
376#define SSISR_RFF BSP_BIT32(3)
377#define SSISR_RNE BSP_BIT32(2)
378#define SSISR_TNF BSP_BIT32(1)
379#define SSISR_TFE BSP_BIT32(0)
380 uint32_t sr;
381
382#define SSI_CPSRDIV(val) BSP_FLD32(val, 0, 7)
383 uint32_t cpsr;
384
385#define SSII_TX BSP_BIT32(3)
386#define SSII_RX BSP_BIT32(2)
387#define SSII_RT BSP_BIT32(1)
388#define SSII_ROR BSP_BIT32(0)
389 uint32_t im;
390 uint32_t ris;
391 uint32_t mis;
392 uint32_t icr;
393
394#if LM3S69XX_HAS_UDMA
395#define SSIDMACTL_TXDMAE BSP_BIT32(1)
396#define SSIDMACTL_RXDMAE BSP_BIT32(0)
397 uint32_t dmactl;
398#endif /* LM3S69XX_HAS_UDMA */
400
401#endif /* LIBBSP_ARM_LM3S69XX_LM3S69XX_H */
This header file provides utility macros for BSPs.
Definition: lm3s69xx.h:87
Definition: lm3s69xx.h:360
Definition: lm3s69xx.h:114
Definition: lm3s69xx.h:297