LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
chip.h
Go to the documentation of this file.
1 /*
2  * @brief LPC11xx basic chip inclusion file
3  *
4  * Copyright(C) NXP Semiconductors, 2012
5  * All rights reserved.
6  *
7  * Software that is described herein is for illustrative purposes only
8  * which provides customers with programming information regarding the
9  * LPC products. This software is supplied "AS IS" without any warranties of
10  * any kind, and NXP Semiconductors and its licensor disclaim any and
11  * all warranties, express or implied, including all implied warranties of
12  * merchantability, fitness for a particular purpose and non-infringement of
13  * intellectual property rights. NXP Semiconductors assumes no responsibility
14  * or liability for the use of the software, conveys no license or rights under any
15  * patent, copyright, mask work right, or any other intellectual property rights in
16  * or to any products. NXP Semiconductors reserves the right to make changes
17  * in the software without notification. NXP Semiconductors also makes no
18  * representation or warranty that such application will be suitable for the
19  * specified use without further testing or modification.
20  *
21  * Permission to use, copy, modify, and distribute this software and its
22  * documentation is hereby granted, under NXP Semiconductors' and its
23  * licensor's relevant copyrights in the software, without fee, provided that it
24  * is used in conjunction with NXP Semiconductors microcontrollers. This
25  * copyright, permission, and disclaimer notice must appear in all copies of
26  * this code.
27  */
28 
29 #ifndef __CHIP_H_
30 #define __CHIP_H_
31 
32 #include "lpc_types.h"
33 #include "sys_config.h"
34 #include "cmsis.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #ifndef CORE_M0
41 #error CORE_M0 is not defined for the LPC11xx architecture
42 #error CORE_M0 should be defined as part of your compiler define list
43 #endif
44 
45 #if !defined(CHIP_LPC110X) && !defined(CHIP_LPC11XXLV) && !defined(CHIP_LPC11AXX) && \
46  !defined(CHIP_LPC11CXX) && !defined(CHIP_LPC11EXX) && !defined(CHIP_LPC11UXX)
47 #error CHIP_LPC110x/CHIP_LPC11XXLV/CHIP_LPC11AXX/CHIP_LPC11CXX/CHIP_LPC11EXX/CHIP_LPC11UXX is not defined!
48 #endif
49 
50 #if !defined (ENABLE_UNTESTED_CODE)
51 #if defined(CHIP_LPC110X)
52 #error The LCP110X code has not been tested with a platform. This code should \
53 build without errors but may not work correctly for the device. To disable this \
54 error message, define ENABLE_UNTESTED_CODE.
55 #endif
56 #if defined(CHIP_LPC11XXLV)
57 #error The LPC11XXLV code has not been tested with a platform. This code should \
58 build without errors but may not work correctly for the device. To disable this \
59 error message, define ENABLE_UNTESTED_CODE.
60 #endif
61 #if defined(CHIP_LPC11AXX)
62 #error The LPC11AXX code has not been tested with a platform. This code should \
63 build without errors but may not work correctly for the device. To disable this \
64 error message, define ENABLE_UNTESTED_CODE.
65 #endif
66 #if defined(CHIP_LPC11EXX)
67 #error The LPC11EXX code has not been tested with a platform. This code should \
68 build without errors but may not work correctly for the device. To disable this \
69 error message, define ENABLE_UNTESTED_CODE.
70 #endif
71 #endif
72 
182 /* Peripheral mapping per device
183  Peripheral Device(s)
184  ---------------------------- ------------------------------------------------------------------------------
185  I2C(40000000) CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
186  WDT(40004000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
187  UART(40008000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX
188  USART/SMARTCARD(40008000) CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
189  TIMER0_16(4000C000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
190  TIMER1_16(40010000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
191  TIMER0_32(40014000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
192  TIMER1_32(40018000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
193  ADC(4001C000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
194  DAC(40024000) CHIP_LPC11AXX
195  ACMP(40028000) CHIP_LPC11AXX
196  PMU(40038000) CHIP_LPC110x/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX
197  FLASH_CTRL(4003C000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX
198  FLASH_EEPROM(4003C000) CHIP_LPC11EXX/ CHIP_LPC11AXX
199  SPI0(40040000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX
200  SSP0(40040000) CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
201  IOCONF(40044000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
202  SYSCON(40048000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX/ CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
203  GPIOINTS(4004C000) CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
204  USB(40080000) CHIP_LPC11UXX
205  CCAN(40050000) CHIP_LPC11CXX
206  SPI1(40058000) CHIP_LPC11CXX
207  SSP1(40058000) CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
208  GPIO_GRP0_INT(4005C000) CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
209  GPIO_GRP1_INT(40060000) CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
210  GPIO_PORT(50000000) CHIP_LPC11UXX/ CHIP_LPC11EXX/ CHIP_LPC11AXX
211  GPIO_PIO0(50000000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX
212  GPIO_PIO1(50010000) CHIP_LPC110x/ CHIP_LPC11XXLV/ CHIP_LPC11CXX
213  GPIO_PIO2(50020000) CHIP_LPC11XXLV/ CHIP_LPC11CXX
214  GPIO_PIO3(50030000) CHIP_LPC11XXLV/ CHIP_LPC11CXX
215  */
216 #if defined(CHIP_LPC11AXX)
217 #include "acmp_001.h"
218 #include "dac_001.h"
219 #endif
220 
221 #include "adc_001.h"
222 #include "ssp_001.h"
223 
224 #if defined(CHIP_LPC11UXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11AXX)
225 #include "gpio_001.h"
226 #include "gpiogrpint_001.h"
227 #include "gpiopinint_001.h"
228 #else
229 #include "gpio_003.h"
230 #endif
231 #if !defined(CHIP_LPC110x)
232 #include "i2c_001.h"
233 #endif
234 
235 #include "timer_001.h"
236 #include "usart_004.h"
237 #include "wwdt_001.h"
238 
244 #define LPC_I2C_BASE 0x40000000
245 #define LPC_WWDT_BASE 0x40004000
246 #define LPC_USART_BASE 0x40008000
247 #define LPC_TIMER16_0_BASE 0x4000C000
248 #define LPC_TIMER16_1_BASE 0x40010000
249 #define LPC_TIMER32_0_BASE 0x40014000
250 #define LPC_TIMER32_1_BASE 0x40018000
251 #define LPC_ADC_BASE 0x4001C000
252 #define LPC_DAC_BASE 0x40024000
253 #define LPC_ACMP_BASE 0x40028000
254 #define LPC_PMU_BASE 0x40038000
255 #define LPC_FLASH_BASE 0x4003C000
256 #define LPC_SSP0_BASE 0x40040000
257 #define LPC_IOCON_BASE 0x40044000
258 #define LPC_SYSCTL_BASE 0x40048000
259 #define LPC_GPIO_PIN_INT_BASE 0x4004C000
260 #define LPC_USB0_BASE 0x40080000
261 #define LPC_CAN0_BASE 0x40050000
262 #define LPC_SSP1_BASE 0x40058000
263 #if defined(CHIP_LPC11UXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11AXX)
264 #define LPC_GPIO_GROUP_INT0_BASE 0x4005C000
265 #define LPC_GPIO_GROUP_INT1_BASE 0x40060000
266 #define LPC_GPIO_PORT_BASE 0x50000000
267 #else
268 #define LPC_GPIO_PORT0_BASE 0x50000000
269 #define LPC_GPIO_PORT1_BASE 0x50010000
270 #endif
271 #if defined(CHIP_LPC11XXLV) || defined(CHIP_LPC11CXX)
272 #define LPC_GPIO_PORT2_BASE 0x50020000
273 #define LPC_GPIO_PORT3_BASE 0x50030000
274 #endif
275 
276 /* Normalize types */
282 
283 #if !defined(CHIP_LPC110x)
285 #endif
286 
287 #if defined(CHIP_LPC11UXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11AXX)
288 typedef IP_GPIO_001_T LPC_GPIO_T;
290 #else
292 #endif
293 
294 #if defined(CHIP_LPC11AXX)
295 typedef ACMP_001_T LPC_CMP_T;
296 typedef IP_DAC_001_T LPC_DAC_T;
297 #endif
298 
299 #if !defined(CHIP_LPC110x)
300 #define LPC_I2C ((IP_I2C_001_T *) LPC_I2C_BASE)
301 #endif
302 
303 #define LPC_WWDT ((IP_WWDT_001_T *) LPC_WWDT_BASE)
304 #define LPC_USART ((IP_USART_001_T *) LPC_USART_BASE)
305 #define LPC_TIMER16_0 ((IP_TIMER_001_T *) LPC_TIMER16_0_BASE)
306 #define LPC_TIMER16_1 ((IP_TIMER_001_T *) LPC_TIMER16_1_BASE)
307 #define LPC_TIMER32_0 ((IP_TIMER_001_T *) LPC_TIMER32_0_BASE)
308 #define LPC_TIMER32_1 ((IP_TIMER_001_T *) LPC_TIMER32_1_BASE)
309 #define LPC_ADC ((IP_ADC_001_T *) LPC_ADC_BASE)
310 
311 #if defined(CHIP_LPC11AXX)
312 #define LPC_DAC ((IP_DAC_001_T *) LPC_DAC_BASE)
313 #define LPC_CMP ((LPC_CMP_T *) LPC_ACMP_BASE)
314 #endif
315 
316 #define LPC_PMU ((LPC_PMU_T *) LPC_PMU_BASE)
317 #define LPC_FMC ((LPC_FMC_T *) LPC_FLASH_BASE)
318 #define LPC_SSP0 ((IP_SSP_001_T *) LPC_SSP0_BASE)
319 #define LPC_IOCON ((LPC_IOCON_T *) LPC_IOCON_BASE)
320 #define LPC_SYSCTL ((LPC_SYSCTL_T *) LPC_SYSCTL_BASE)
321 #define LPC_GPIO_PIN_INT ((IP_GPIOPININT_001_T *) LPC_GPIO_PIN_INT_BASE)
322 #if defined(CHIP_LPC11CXX) || defined(CHIP_LPC11UXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11AXX)
323 #define LPC_SSP1 ((IP_SSP_001_T *) LPC_SSP1_BASE)
324 #endif
325 #if defined(CHIP_LPC11UXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11AXX)
326 #define LPC_GPIO_GROUP_INT0 ((IP_GPIOGROUPINT_001_T *) LPC_GPIO_GROUP_INT0_BASE)
327 #define LPC_GPIO_GROUP_INT1 ((IP_GPIOGROUPINT_001_T *) LPC_GPIO_GROUP_INT1_BASE)
328 #define LPC_GPIO_PORT ((IP_GPIO_001_T *) LPC_GPIO_PORT_BASE)
329 #else
330 #define LPC_GPIO_PORT ((IP_GPIO_003_T *) LPC_GPIO_PORT0_BASE)
331 #endif
332 #define LPC_USB ((LPC_USB_T *) LPC_USB0_BASE)
333 
338 #include "ring_buffer.h"
339 #include "adc_11xx.h"
340 #include "fmc_11xx.h"
341 #include "sysctl_11xx.h"
342 #include "clock_11xx.h"
343 #include "iocon_11xx.h"
344 #include "pmu_11xx.h"
345 #include "gpio_11xx.h"
346 #include "timer_11xx.h"
347 #include "uart_11xx.h"
348 #include "wwdt_11xx.h"
349 #include "acmp_11xx.h"
350 #include "ssp_11xx.h"
351 #include "i2c_11xx.h"
352 #include "usbd_11xx.h"
353 #if defined(CHIP_LPC11CXX)
354 #include "ccand_11xx.h"
355 #endif
356 
357 #ifdef __cplusplus
358 }
359 #endif
360 
361 #endif /* __CHIP_H_ */