LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sysctl_17xx_40xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC17xx/40xx System and Control driver
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_17XX_40XX_H_
33 #define _SYSCTL_17XX_40XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
47 typedef struct {
52  uint32_t RESERVED1[4];
54 
58 typedef enum {
62 
66 typedef struct {
68  uint32_t RESERVED0[15];
70  uint32_t RESERVED1[15];
72  __IO uint32_t PCON;
73  __IO uint32_t PCONP;
74 #if defined(CHIP_LPC175X_6X)
75  uint32_t RESERVED2[15];
76 #elif defined(CHIP_LPC177X_8X)
77  uint32_t RESERVED2[14];
78  __IO uint32_t EMCCLKSEL;
79 #else
81  uint32_t RESERVED2[13];
83 #endif
85  __IO uint32_t USBCLKSEL;
89  uint32_t RESERVED3[10];
94  uint32_t RESERVED5[12];
95  __IO uint32_t RSID;
96 #if defined(CHIP_LPC175X_6X) || defined(CHIP_LPC407X_8X)
97  uint32_t RESERVED6[7];
98 #elif defined(CHIP_LPC177X_8X)
99  uint32_t RESERVED6;
100  uint32_t MATRIXARB;
101  uint32_t RESERVED6A[5];
102 #endif
103  __IO uint32_t SCS;
105 #if defined(CHIP_LPC175X_6X)
106  __IO uint32_t PCLKSEL[2];
107  uint32_t RESERVED8[4];
108 #else
115 #endif
119 #if defined(CHIP_LPC175X_6X)
120  uint32_t RESERVED11[6];
121 #else
122  __IO uint32_t RSTCON[2];
123  uint32_t RESERVED11[2];
126 #endif
127 } LPC_SYSCTL_T;
128 
132 typedef enum CHIP_SYSCTL_BOOT_MODE_REMAP {
136 
143 {
144  LPC_SYSCTL->MEMMAP = (uint32_t) remap;
145 }
146 
150 #define SYSCTL_RST_POR (1 << 0)
151 #define SYSCTL_RST_EXTRST (1 << 1)
152 #define SYSCTL_RST_WDT (1 << 2)
153 #define SYSCTL_RST_BOD (1 << 3)
154 #if defined(CHIP_LPC177X_8X) || defined(CHIP_LPC407X_8X)
155 #define SYSCTL_RST_SYSRST (1 << 4)
156 #define SYSCTL_RST_LOCKUP (1 << 5)
157 #endif
158 
165 {
166  return LPC_SYSCTL->RSID;
167 }
168 
175 {
176  LPC_SYSCTL->RSID = reset;
177 }
178 
184 {
185  LPC_SYSCTL->PCON |= (1 << 3);
186 }
187 
193 {
194  LPC_SYSCTL->PCON &= ~(1 << 3);
195 }
196 
202 {
203  LPC_SYSCTL->PCON |= (1 << 4);
204 }
205 
211 {
212  LPC_SYSCTL->PCON &= ~(1 << 4);
213 }
214 
220 {
221  LPC_SYSCTL->PCON |= (1 << 5);
222 }
223 
229 {
230  LPC_SYSCTL->PCON &= ~(1 << 5);
231 }
232 
233 #define SYSCTL_PD_SMFLAG (1 << 8)
234 #define SYSCTL_PD_DSFLAG (1 << 9)
235 #define SYSCTL_PD_PDFLAG (1 << 10)
236 #define SYSCTL_PD_DPDFLAG (1 << 11)
245 uint32_t Chip_SYSCTL_GetClrSleepFlags(uint32_t flags);
246 
247 #if !defined(CHIP_LPC175X_6X)
248 
253 {
254  LPC_SYSCTL->PBOOST = 0x3;
255 }
256 
262 {
263  LPC_SYSCTL->PBOOST = 0x0;
264 }
265 
266 #endif
267 
268 #if !defined(CHIP_LPC175X_6X)
269 
273 typedef enum {
310 
317 
318 #endif
319 
324 #ifdef __cplusplus
325 }
326 #endif
327 
328 #endif /* _SYSCTL_17XX_40XX_H_ */