Add system controller register and clean-up PMC headers
[bertos.git] / bertos / cpu / cortex-m3 / io / sam3_sysctl.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \brief ATSAM3 system controller registers.
34  */
35
36 #ifndef SAM3_SYSCTL_H
37 #define SAM3_SYSCTL_H
38
39 /**
40  * Supply controller registers.
41  */
42 /*\{*/
43 #define SUPC_CR_R   (*((reg32_t *)0x400E1410))   ///< Supply Controller Control
44 #define SUPC_SMMR_R (*((reg32_t *)0x400E1414))   ///< Supply Controller Supply Monitor Mode
45 #define SUPC_MR_R   (*((reg32_t *)0x400E1418))   ///< Supply Controller Mode
46 #define SUPC_WUMR_R (*((reg32_t *)0x400E141C))   ///< Supply Controller Wake Up Mode
47 #define SUPC_WUIR_R (*((reg32_t *)0x400E1420))   ///< Supply Controller Wake Up Inputs
48 #define SUPC_SR_R   (*((reg32_t *)0x400E1424))   ///< Supply Controller Status
49 /*\}*/
50
51 /**
52  * Supply controller addresses.
53  */
54 /*\{*/
55 #define SUPC_CR   0x400E1410   ///< Supply Controller Control
56 #define SUPC_SMMR 0x400E1414   ///< Supply Controller Supply Monitor Mode
57 #define SUPC_MR   0x400E1418   ///< Supply Controller Mode
58 #define SUPC_WUMR 0x400E141C   ///< Supply Controller Wake Up Mode
59 #define SUPC_WUIR 0x400E1420   ///< Supply Controller Wake Up Inputs #define SUPC_SR   0x400E1424   ///< Supply Controller Status
60 /*\}*/
61
62 /**
63  * Defines for bit fields in SUPC_CR register.
64  */
65 /*\{*/
66 #define SUPC_CR_VROFF       BV(2)                     ///< Voltage Regulator Off
67 #define SUPC_CR_XTALSEL     BV(3)                     ///< Crystal Oscillator Select
68 #define SUPC_CR_KEY_P       24
69 #define SUPC_CR_KEY_M       (0xff << SUPC_CR_KEY_P)   ///< SUPC_CR key
70 #define SUPC_CR_KEY(value)  (SUPC_CR_KEY_M & ((value) << SUPC_CR_KEY_P))
71 /*\}*/
72
73 /**
74  * Defines for bit fields in SUPC_SR register.
75  */
76 /*\{*/
77 #define SUPC_SR_WKUPS     BV(1)   ///< WKUP Wake Up Status
78 #define SUPC_SR_SMWS      BV(2)   ///< Supply Monitor Detection Wake Up Status
79 #define SUPC_SR_BODRSTS   BV(3)   ///< Brownout Detector Reset Status
80 #define SUPC_SR_SMRSTS    BV(4)   ///< Supply Monitor Reset Status
81 #define SUPC_SR_SMS       BV(5)   ///< Supply Monitor Status
82 #define SUPC_SR_SMOS      BV(6)   ///< Supply Monitor Output Status
83 #define SUPC_SR_OSCSEL    BV(7)   ///< 32-kHz Oscillator Selection Status
84 #define SUPC_SR_WKUPIS0   BV(16)  ///< WKUP Input Status 0
85 #define SUPC_SR_WKUPIS1   BV(17)  ///< WKUP Input Status 1
86 #define SUPC_SR_WKUPIS2   BV(18)  ///< WKUP Input Status 2
87 #define SUPC_SR_WKUPIS3   BV(19)  ///< WKUP Input Status 3
88 #define SUPC_SR_WKUPIS4   BV(20)  ///< WKUP Input Status 4
89 #define SUPC_SR_WKUPIS5   BV(21)  ///< WKUP Input Status 5
90 #define SUPC_SR_WKUPIS6   BV(22)  ///< WKUP Input Status 6
91 #define SUPC_SR_WKUPIS7   BV(23)  ///< WKUP Input Status 7
92 #define SUPC_SR_WKUPIS8   BV(24)  ///< WKUP Input Status 8
93 #define SUPC_SR_WKUPIS9   BV(25)  ///< WKUP Input Status 9
94 #define SUPC_SR_WKUPIS10  BV(26)  ///< WKUP Input Status 10
95 #define SUPC_SR_WKUPIS11  BV(27)  ///< WKUP Input Status 11
96 #define SUPC_SR_WKUPIS12  BV(28)  ///< WKUP Input Status 12
97 #define SUPC_SR_WKUPIS13  BV(29)  ///< WKUP Input Status 13
98 #define SUPC_SR_WKUPIS14  BV(30)  ///< WKUP Input Status 14
99 #define SUPC_SR_WKUPIS15  BV(31)  ///< WKUP Input Status 15
100 /*\}*/
101
102 #endif /* SAM3_SYSCTL_H */