LPCOpen Platform
v1.03
LPCOpen Platform for NXP LPC Microcontrollers
Main Page
Modules
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
sysctl_13xx.c
Go to the documentation of this file.
1
/*
2
* @brief LPC13XX System Control functions
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
#include "
chip.h
"
30
31
/*****************************************************************************
32
* Private types/enumerations/variables
33
****************************************************************************/
34
35
/* PDSLEEPCFG register mask */
36
#if defined(CHIP_LPC1343)
37
#if defined(CHIP_LPC1300L)
38
#define PDSLEEPUSEMASK 0x000018B7
/* For CHIP_LPC1300L only */
39
#else
40
#define PDSLEEPUSEMASK 0x00000FB7
41
#endif
/* defined (CHIP_LPC1300L) */
42
#else
43
#define PDSLEEPUSEMASK 0x00000007
44
#endif
/* defined(CHIP_LPC1343) */
45
#define PDSLEEPMASKTMP (SYSCTL_DEEPSLP_BOD_PD | SYSCTL_DEEPSLP_WDTOSC_PD)
46
#define PDSLEEPMASK ((PDSLEEPUSEMASK) &~(PDSLEEPMASKTMP))
47
48
/* PDWAKECFG register mask */
49
#if defined(CHIP_LPC1347)
50
#define PDWAKEUPUSEMASK 0x00000800
51
#else
52
#define PDWAKEUPUSEMASK 0x0000F800
53
#endif
54
#define PDWAKEUPMASKTMP 0x000005FF
55
56
/* PDRUNCFG register mask */
57
#if defined(CHIP_LPC1347)
58
#define PDRUNCFGUSEMASK 0x0000E800
59
#else
60
#define PDRUNCFGUSEMASK 0x0000F800
61
#endif
62
#define PDRUNCFGMASKTMP 0x000005FF
63
64
/*****************************************************************************
65
* Public types/enumerations/variables
66
****************************************************************************/
67
68
/*****************************************************************************
69
* Private functions
70
****************************************************************************/
71
72
/*****************************************************************************
73
* Public functions
74
****************************************************************************/
75
76
/* Setup deep sleep behaviour for power down */
77
void
Chip_SYSCTL_SetDeepSleepPD
(
uint32_t
sleepmask)
78
{
79
/* Update new value */
80
LPC_SYSCTL
->PDSLEEPCFG =
PDSLEEPMASK
| (sleepmask &
PDSLEEPMASKTMP
);
81
}
82
83
/* Setup wakeup behaviour from deep sleep */
84
void
Chip_SYSCTL_SetWakeup
(
uint32_t
wakeupmask)
85
{
86
/* Update new value */
87
LPC_SYSCTL
->PDWAKECFG =
PDWAKEUPUSEMASK
| (wakeupmask &
PDWAKEUPMASKTMP
);
88
}
89
90
/* Power down one or more blocks or peripherals */
91
void
Chip_SYSCTL_PowerDown
(
uint32_t
powerdownmask)
92
{
93
uint32_t
pdrun;
94
95
pdrun =
LPC_SYSCTL
->PDRUNCFG &
PDRUNCFGMASKTMP
;
96
pdrun |= (powerdownmask &
PDRUNCFGMASKTMP
);
97
98
LPC_SYSCTL
->PDRUNCFG = (pdrun |
PDRUNCFGUSEMASK
);
99
}
100
101
/* Power up one or more blocks or peripherals */
102
void
Chip_SYSCTL_PowerUp
(
uint32_t
powerupmask)
103
{
104
uint32_t
pdrun;
105
106
pdrun =
LPC_SYSCTL
->PDRUNCFG &
PDRUNCFGMASKTMP
;
107
pdrun &= ~(powerupmask &
PDRUNCFGMASKTMP
);
108
109
LPC_SYSCTL
->PDRUNCFG = (pdrun |
PDRUNCFGUSEMASK
);
110
}
software
lpc_core
lpc_chip
chip_13xx
sysctl_13xx.c
Generated on Fri May 10 2013 10:42:13 for LPCOpen Platform by
1.8.2