RTEMS 6.1-rc1
lpc17xx.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (c) 2011 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef LPC17XX_REGS_H
37#define LPC17XX_REGS_H
38
39#include <bsp/utility.h>
40
41#define LPC17XX_BASE 0x00
42
43typedef struct {
44#define LPC17XX_WWDT_MOD_WDEN BSP_BIT32(0)
45#define LPC17XX_WWDT_MOD_WDRESET BSP_BIT32(1)
46#define LPC17XX_WWDT_MOD_WDTOF BSP_BIT32(2)
47#define LPC17XX_WWDT_MOD_WDINT BSP_BIT32(3)
48#define LPC17XX_WWDT_MOD_WDPROTECT BSP_BIT32(4)
49 uint32_t mod;
50 uint32_t tc;
51 uint32_t feed;
52 uint32_t tv;
53 uint32_t reserved_10;
54 uint32_t warnint;
55 uint32_t window;
56 uint32_t reserved_1c;
58
59#define LPC17XX_WWDT (*(volatile lpc17xx_wwdt *) (LPC17XX_BASE + 0x40000000))
60
61typedef struct {
62#define LPC17XX_PLL_CON_PLLE BSP_BIT32(0)
63#define LPC17XX_PLL_SEL_MSEL(val) BSP_FLD32(val, 0, 4)
64#define LPC17XX_PLL_SEL_MSEL_GET(reg) BSP_FLD32GET(reg, 0, 4)
65#define LPC17XX_PLL_SEL_MSEL_SET(reg, val) BSP_FLD32SET(reg, val, 0, 4)
66#define LPC17XX_PLL_SEL_PSEL(val) BSP_FLD32(val, 5, 6)
67#define LPC17XX_PLL_SEL_PSEL_GET(reg) BSP_FLD32GET(reg, 5, 6)
68#define LPC17XX_PLL_SEL_PSEL_SET(reg, val) BSP_FLD32SET(reg, val, 5, 6)
69#define LPC17XX_PLL_STAT_PLLE BSP_BIT32(8)
70#define LPC17XX_PLL_STAT_PLOCK BSP_BIT32(10)
71 uint32_t con;
72 uint32_t cfg;
73 uint32_t stat;
74 uint32_t feed;
76
77typedef struct {
78 uint32_t flashcfg;
79#define LPC17XX_SCB_FLASHCFG_FLASHTIM(val) BSP_FLD32(val, 12, 15)
80#define LPC17XX_SCB_FLASHCFG_FLASHTIM_GET(reg) BSP_FLD32GET(reg, 12, 15)
81#define LPC17XX_SCB_FLASHCFG_FLASHTIM_SET(reg, val) BSP_FLD32SET(reg, val, 12, 15)
82 uint32_t reserved_04 [15];
83 uint32_t memmap;
84#define LPC17XX_SCB_MEMMAP_MAP BSP_BIT32(0)
85 uint32_t reserved_44 [15];
86 lpc17xx_pll pll_0;
87 uint32_t reserved_90 [4];
88 lpc17xx_pll pll_1;
89 uint32_t reserved_b0 [4];
90 uint32_t pcon;
91#define LPC17XX_SCB_PCON_PM0 BSP_BIT32(0)
92#define LPC17XX_SCB_PCON_PM1 BSP_BIT32(1)
93#define LPC17XX_SCB_PCON_BODRPM BSP_BIT32(2)
94#define LPC17XX_SCB_PCON_BOGD BSP_BIT32(3)
95#define LPC17XX_SCB_PCON_BORD BSP_BIT32(4)
96#define LPC17XX_SCB_PCON_SMFLAG BSP_BIT32(8)
97#define LPC17XX_SCB_PCON_DSFLAG BSP_BIT32(9)
98#define LPC17XX_SCB_PCON_PDFLAG BSP_BIT32(10)
99#define LPC17XX_SCB_PCON_DPDFLAG BSP_BIT32(11)
100 uint32_t pconp;
101#define LPC17XX_SCB_PCONP_LCD BSP_BIT32(0)
102#define LPC17XX_SCB_PCONP_TIMER_0 BSP_BIT32(1)
103#define LPC17XX_SCB_PCONP_TIMER_1 BSP_BIT32(2)
104#define LPC17XX_SCB_PCONP_UART_0 BSP_BIT32(3)
105#define LPC17XX_SCB_PCONP_UART_1 BSP_BIT32(4)
106#define LPC17XX_SCB_PCONP_PWM_0 BSP_BIT32(5)
107#define LPC17XX_SCB_PCONP_PWM_1 BSP_BIT32(6)
108#define LPC17XX_SCB_PCONP_I2C_0 BSP_BIT32(7)
109#define LPC17XX_SCB_PCONP_UART_4 BSP_BIT32(8)
110#define LPC17XX_SCB_PCONP_RTC BSP_BIT32(9)
111#define LPC17XX_SCB_PCONP_SSP_1 BSP_BIT32(10)
112#define LPC17XX_SCB_PCONP_EMC BSP_BIT32(11)
113#define LPC17XX_SCB_PCONP_ADC BSP_BIT32(12)
114#define LPC17XX_SCB_PCONP_CAN_0 BSP_BIT32(13)
115#define LPC17XX_SCB_PCONP_CAN_1 BSP_BIT32(14)
116#define LPC17XX_SCB_PCONP_GPIO BSP_BIT32(15)
117#define LPC17XX_SCB_PCONP_QEI BSP_BIT32(17)
118#define LPC17XX_SCB_PCONP_I2C_1 BSP_BIT32(18)
119#define LPC17XX_SCB_PCONP_SSP_2 BSP_BIT32(19)
120#define LPC17XX_SCB_PCONP_SSP_0 BSP_BIT32(20)
121#define LPC17XX_SCB_PCONP_TIMER_2 BSP_BIT32(21)
122#define LPC17XX_SCB_PCONP_TIMER_3 BSP_BIT32(22)
123#define LPC17XX_SCB_PCONP_UART_2 BSP_BIT32(23)
124#define LPC17XX_SCB_PCONP_UART_3 BSP_BIT32(24)
125#define LPC17XX_SCB_PCONP_I2C_2 BSP_BIT32(25)
126#define LPC17XX_SCB_PCONP_I2S BSP_BIT32(26)
127#define LPC17XX_SCB_PCONP_SDC BSP_BIT32(27)
128#define LPC17XX_SCB_PCONP_GPDMA BSP_BIT32(28)
129#define LPC17XX_SCB_PCONP_ENET BSP_BIT32(29)
130#define LPC17XX_SCB_PCONP_USB BSP_BIT32(30)
131#define LPC17XX_SCB_PCONP_MCPWM BSP_BIT32(31)
132 uint32_t reserved_c8 [14];
133 uint32_t emcclksel;
134#define LPC17XX_SCB_EMCCLKSEL_EMCDIV BSP_BIT32(0)
135 uint32_t cclksel;
136#define LPC17XX_SCB_CCLKSEL_CCLKDIV(val) BSP_FLD32(val, 0, 4)
137#define LPC17XX_SCB_CCLKSEL_CCLKDIV_GET(reg) BSP_FLD32GET(reg, 0, 4)
138#define LPC17XX_SCB_CCLKSEL_CCLKDIV_SET(reg, val) BSP_FLD32SET(reg, val, 0, 4)
139#define LPC17XX_SCB_CCLKSEL_CCLKSEL BSP_BIT32(8)
140 uint32_t usbclksel;
141#define LPC17XX_SCB_USBCLKSEL_USBDIV(val) BSP_FLD32(val, 0, 4)
142#define LPC17XX_SCB_USBCLKSEL_USBDIV_GET(reg) BSP_FLD32GET(reg, 0, 4)
143#define LPC17XX_SCB_USBCLKSEL_USBDIV_SET(reg, val) BSP_FLD32SET(reg, val, 0, 4)
144#define LPC17XX_SCB_USBCLKSEL_USBSEL(val) BSP_FLD32(val, 8, 9)
145#define LPC17XX_SCB_USBCLKSEL_USBSEL_GET(reg) BSP_FLD32GET(reg, 8, 9)
146#define LPC17XX_SCB_USBCLKSEL_USBSEL_SET(reg, val) BSP_FLD32SET(reg, val, 8, 9)
147 uint32_t clksrcsel;
148#define LPC17XX_SCB_CLKSRCSEL_CLKSRC BSP_BIT32(0)
149 uint32_t reserved_110 [12];
150 uint32_t extint;
151 uint32_t reserved_144;
152 uint32_t extmode;
153 uint32_t extpolar;
154 uint32_t reserved_150 [12];
155 uint32_t rsid;
156 uint32_t reserved_184 [1];
157 uint32_t matrixarb;
158 uint32_t reserved_18c [5];
159 uint32_t scs;
160#define LPC17XX_SCB_SCS_EMC_SHIFT_CTL BSP_BIT32(0)
161#define LPC17XX_SCB_SCS_EMC_RESET_DIS BSP_BIT32(1)
162#define LPC17XX_SCB_SCS_EMC_BURST_CTL BSP_BIT32(2)
163#define LPC17XX_SCB_SCS_MCIPWR BSP_BIT32(3)
164#define LPC17XX_SCB_SCS_OSC_RANGE_SEL BSP_BIT32(4)
165#define LPC17XX_SCB_SCS_OSC_ENABLE BSP_BIT32(5)
166#define LPC17XX_SCB_SCS_OSC_STATUS BSP_BIT32(6)
167 uint32_t reserved_1a4;
168 uint32_t pclksel;
169#define LPC17XX_SCB_PCLKSEL_PCLKDIV(val) BSP_FLD32(val, 0, 4)
170#define LPC17XX_SCB_PCLKSEL_PCLKDIV_GET(reg) BSP_FLD32GET(reg, 0, 4)
171#define LPC17XX_SCB_PCLKSEL_PCLKDIV_SET(reg, val) BSP_FLD32SET(reg, val, 0, 4)
172 uint32_t reserved_1ac;
173 uint32_t pboost;
174#define LPC17XX_SCB_PBOOST_BOOST BSP_BIT32(0)
175 uint32_t reserved_1b4 [5];
176 uint32_t clkoutcfg;
177#define LPC17XX_SCB_CLKOUTCFG_CLKOUTSEL(val) BSP_FLD32(val, 3, 0)
178#define LPC17XX_SCB_CLKOUTCFG_CLKOUTSEL_GET(reg) BSP_FLD32GET(reg, 3, 0)
179#define LPC17XX_SCB_CLKOUTCFG_CLKOUTSEL_SET(reg, val) BSP_FLD32SET(reg, val, 3, 0)
180#define LPC17XX_SCB_CLKOUTCFG_CLKOUTDIV(val) BSP_FLD32(val, 7, 4)
181#define LPC17XX_SCB_CLKOUTCFG_CLKOUTDIV_GET(reg) BSP_FLD32GET(reg, 7, 4)
182#define LPC17XX_SCB_CLKOUTCFG_CLKOUTDIV_SET(reg, val) BSP_FLD32SET(reg, val, 7, 4)
183#define LPC17XX_SCB_CLKOUTCFG_CLKOUT_EN BSP_BIT32(8)
184#define LPC17XX_SCB_CLKOUTCFG_CLKOUT_ACT BSP_BIT32(9)
185 uint32_t rstcon0;
186 uint32_t rstcon1;
187 uint32_t reserved_1d4 [2];
188 uint32_t emcdlyctl;
189#define LPC17XX_SCB_EMCDLYCTL_CMDDLY(val) BSP_FLD32(val, 0, 4)
190#define LPC17XX_SCB_EMCDLYCTL_CMDDLY_GET(reg) BSP_FLD32GET(reg, 0, 4)
191#define LPC17XX_SCB_EMCDLYCTL_CMDDLY_SET(reg, val) BSP_FLD32SET(reg, val, 0, 4)
192#define LPC17XX_SCB_EMCDLYCTL_FBCLKDLY(val) BSP_FLD32(val, 8, 12)
193#define LPC17XX_SCB_EMCDLYCTL_FBCLKDLY_GET(reg) BSP_FLD32GET(reg, 8, 12)
194#define LPC17XX_SCB_EMCDLYCTL_FBCLKDLY_SET(reg, val) BSP_FLD32SET(reg, val, 8, 12)
195#define LPC17XX_SCB_EMCDLYCTL_CLKOUT0DLY(val) BSP_FLD32(val, 16, 20)
196#define LPC17XX_SCB_EMCDLYCTL_CLKOUT0DLY_GET(reg) BSP_FLD32GET(reg, 16, 20)
197#define LPC17XX_SCB_EMCDLYCTL_CLKOUT0DLY_SET(reg, val) BSP_FLD32SET(reg, val, 16, 20)
198#define LPC17XX_SCB_EMCDLYCTL_CLKOUT1DLY(val) BSP_FLD32(val, 24, 28)
199#define LPC17XX_SCB_EMCDLYCTL_CLKOUT1DLY_GET(reg) BSP_FLD32GET(reg, 24, 28)
200#define LPC17XX_SCB_EMCDLYCTL_CLKOUT1DLY_SET(reg, val) BSP_FLD32SET(reg, val, 24, 28)
201 uint32_t emccal;
202#define LPC17XX_SCB_EMCCAL_CALVALUE(val) BSP_FLD32(val, 0, 7)
203#define LPC17XX_SCB_EMCCAL_CALVALUE_GET(reg) BSP_FLD32GET(reg, 0, 7)
204#define LPC17XX_SCB_EMCCAL_CALVALUE_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
205#define LPC17XX_SCB_EMCCAL_START BSP_BIT32(14)
206#define LPC17XX_SCB_EMCCAL_DONE BSP_BIT32(15)
208
209#define LPC17XX_SCB (*(volatile lpc17xx_scb *) (LPC17XX_BASE + 0x400fc000))
210
211typedef struct {
212 uint32_t reserved_00 [268435456];
213 lpc17xx_wwdt wwdt;
214 uint32_t reserved_40000020 [258040];
215 lpc17xx_scb scb;
216} lpc17xx;
217
218#define LPC17XX (*(volatile lpc17xx *) (LPC17XX_BASE))
219
220#endif /* LPC17XX_REGS_H */
This header file provides utility macros for BSPs.
Definition: lpc17xx.h:61
Definition: lpc17xx.h:77
Definition: lpc17xx.h:43
Definition: lpc17xx.h:211