LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
syscon_8xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC8xx System & Control driver inclusion file
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __SYSCTL_8XX_H_
33 #define __SYSCTL_8XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
47 #define SYSCTL_RST_POR (1 << 0)
48 #define SYSCTL_RST_EXTRST (1 << 1)
49 #define SYSCTL_RST_WDT (1 << 2)
50 #define SYSCTL_RST_BOD (1 << 3)
51 #define SYSCTL_RST_SYSRST (1 << 4)
56 #define SYSCTL_WAKEUP_SPI0TINT (1 << 0)
57 #define SYSCTL_WAKEUP_SPI1INT (1 << 1)
58 #define SYSCTL_WAKEUP_USART0INT (1 << 3)
59 #define SYSCTL_WAKEUP_USART1INT (1 << 4)
60 #define SYSCTL_WAKEUP_USART2INT (1 << 5)
61 #define SYSCTL_WAKEUP_I2CINT (1 << 8)
62 #define SYSCTL_WAKEUP_WWDTINT (1 << 12)
63 #define SYSCTL_WAKEUP_BODINT (1 << 13)
64 #define SYSCTL_WAKEUP_WKTINT (1 << 15)
69 #define SYSCTL_DEEPSLP_BOD_PD (1 << 3)
70 #define SYSCTL_DEEPSLP_WDTOSC_PD (1 << 6)
75 #define SYSCTL_SLPWAKE_IRCOUT_PD (1 << 0)
76 #define SYSCTL_SLPWAKE_IRC_PD (1 << 1)
77 #define SYSCTL_SLPWAKE_FLASH_PD (1 << 2)
78 #define SYSCTL_SLPWAKE_BOD_PD (1 << 3)
79 #define SYSCTL_SLPWAKE_SYSOSC_PD (1 << 5)
80 #define SYSCTL_SLPWAKE_WDTOSC_PD (1 << 6)
81 #define SYSCTL_SLPWAKE_SYSPLL_PD (1 << 7)
82 #define SYSCTL_SLPWAKE_ACMP_PD (1 << 15)
87 #define SYSCTL_NMISRC_ENABLE ((uint32_t) 1 << 31)
92 typedef struct {
93  __IO uint32_t SYSMEMREMAP;
94  __IO uint32_t PRESETCTRL;
95  __IO uint32_t SYSPLLCTRL;
97  uint32_t RESERVED0[4];
98  __IO uint32_t SYSOSCCTRL;
99  __IO uint32_t WDTOSCCTRL;
100  uint32_t RESERVED1[2];
101  __IO uint32_t SYSRSTSTAT;
102  uint32_t RESERVED2[3];
103  __IO uint32_t SYSPLLCLKSEL;
104  __IO uint32_t SYSPLLCLKUEN;
105  uint32_t RESERVED3[10];
106  __IO uint32_t MAINCLKSEL;
107  __IO uint32_t MAINCLKUEN;
108  __IO uint32_t SYSAHBCLKDIV;
109  uint32_t RESERVED4[1];
110  __IO uint32_t SYSAHBCLKCTRL;
111  uint32_t RESERVED5[4];
113  uint32_t RESERVED6[18];
114  __IO uint32_t CLKOUTSEL;
115  __IO uint32_t CLKOUTUEN;
116  __IO uint32_t CLKOUTDIV;
120  uint32_t RESERVED8[1];
123  uint32_t RESERVED9[12];
124  __IO uint32_t IOCONCLKDIV[7];
125  __IO uint32_t BODCTRL;
126  __IO uint32_t SYSTCKCAL;
127  uint32_t RESERVED10[6];
128  __IO uint32_t IRQLATENCY;
129  __IO uint32_t NMISRC;
130  __IO uint32_t PINTSEL[8];
131  uint32_t RESERVED11[27];
132  __IO uint32_t STARTERP0;
133  uint32_t RESERVED12[3];
134  __IO uint32_t STARTERP1;
135  uint32_t RESERVED13[6];
136  __IO uint32_t PDSLEEPCFG;
138  __IO uint32_t PDRUNCFG;
139  uint32_t RESERVED14[110];
140  __I uint32_t DEVICEID;
141 } LPC_SYSCTL_T;
142 
146 typedef enum CHIP_SYSCTL_BOOT_MODE_REMAP {
151 
155 typedef enum {
170 
174 typedef enum CHIP_SYSCTL_BODRSTLVL {
180 
184 typedef enum CHIP_SYSCTL_BODRINTVAL {
185  SYSCTL_BODINTVAL_LVL0, /* Brown-out interrupt at 1.65 ~ 1.80v */
186  SYSCTL_BODINTVAL_LVL1, /* Brown-out interrupt at 2.22v ~ 2.35v*/
187  SYSCTL_BODINTVAL_LVL2, /* Brown-out interrupt at 2.52v ~ 2.66v */
188  SYSCTL_BODINTVAL_LVL3, /* Brown-out interrupt at 2.80v ~ 2.90v */
190 
197 {
198  LPC_SYSCTL->SYSMEMREMAP = (uint32_t) remap;
199 }
200 
209 {
210  LPC_SYSCTL->PRESETCTRL &= ~(1 << (uint32_t) periph);
211 }
212 
219 {
220  LPC_SYSCTL->PRESETCTRL |= (1 << (uint32_t) periph);
221 }
222 
229 {
232 }
233 
240 {
241  return LPC_SYSCTL->SYSRSTSTAT;
242 }
243 
251 {
252  LPC_SYSCTL->SYSRSTSTAT = reset;
253 }
254 
261 {
262  return LPC_SYSCTL->PIOPORCAP0;
263 }
264 
275 {
276  LPC_SYSCTL->BODCTRL = ((uint32_t) rstlvl) | (((uint32_t) intlvl) << 2);
277 }
278 
284 {
285  LPC_SYSCTL->BODCTRL |= (1 << 4);
286 }
287 
293 {
294  LPC_SYSCTL->BODCTRL &= ~(1 << 4);
295 }
296 
303 {
304  LPC_SYSCTL->SYSTCKCAL = sysCalVal;
305 }
306 
315 {
316  LPC_SYSCTL->IRQLATENCY = latency;
317 }
318 
324 {
325  return LPC_SYSCTL->IRQLATENCY;
326 }
327 
336 {
337  LPC_SYSCTL->NMISRC = intsrc;
338 }
339 
345 {
346  LPC_SYSCTL->NMISRC |= SYSCTL_NMISRC_ENABLE;
347 }
348 
354 {
355  LPC_SYSCTL->NMISRC &= ~(SYSCTL_NMISRC_ENABLE);
356 }
357 
368 {
369  LPC_SYSCTL->PINTSEL[intno] = (uint32_t) pin;
370 }
371 
380 {
381  LPC_SYSCTL->STARTERP0 |= (1 << pin);
382 }
383 
391 {
392  LPC_SYSCTL->STARTERP0 &= ~(1 << pin);
393 }
394 
401 {
402  LPC_SYSCTL->STARTERP1 |= periphmask;
403 }
404 
411 {
412  LPC_SYSCTL->STARTERP1 &= ~periphmask;
413 }
414 
421 {
422  return LPC_SYSCTL->PDSLEEPCFG;
423 }
424 
431 {
432  return LPC_SYSCTL->PDAWAKECFG;
433 }
434 
441 {
442  return LPC_SYSCTL->PDRUNCFG;
443 }
444 
450 {
451  return LPC_SYSCTL->DEVICEID;
452 }
453 
460 {
461  LPC_SYSCTL->UARTFRGDIV = (uint32_t) div;
462 }
463 
469 {
470  return LPC_SYSCTL->UARTFRGDIV;
471 }
472 
479 {
480  LPC_SYSCTL->UARTFRGMULT = (uint32_t) mult;
481 }
482 
488 {
489  return LPC_SYSCTL->UARTFRGMULT;
490 }
491 
502 void Chip_SYSCTL_SetDeepSleepPD(uint32_t sleepmask);
503 
514 void Chip_SYSCTL_SetWakeup(uint32_t wakeupmask);
515 
521 void Chip_SYSCTL_PowerDown(uint32_t powerdownmask);
522 
528 void Chip_SYSCTL_PowerUp(uint32_t powerupmask);
529 
534 #ifdef __cplusplus
535 }
536 #endif
537 
538 #endif /* __SYSCTL_8XX_H_ */