Change filename and macros from AT91SAM3.. to SAM3.. to conform to Atmel's official...
[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 Atmel SAM3 system controller registers.
34  */
35
36 #ifndef SAM3_SYSCTL_H
37 #define SAM3_SYSCTL_H
38
39 /** Supply controller base */
40 #define SUPC_BASE  0x400E1410
41
42 /**
43  * Supply controller offsets.
44  */
45 /*\{*/
46 #define SUPC_CR_OFF    0x0   ///< Supply Controller Control
47 #define SUPC_SMMR_OFF  0x4   ///< Supply Controller Supply Monitor Mode
48 #define SUPC_MR_OFF    0x8   ///< Supply Controller Mode
49 #define SUPC_WUMR_OFF  0xC   ///< Supply Controller Wake Up Mode
50 #define SUPC_WUIR_OFF  0x10  ///< Supply Controller Wake Up Inputs
51 #define SUPC_SR_OFF    0x14  ///< Supply Controller Status
52 /*\}*/
53
54 /**
55  * Supply controller registers.
56  */
57 /*\{*/
58 #define SUPC_CR   (*((reg32_t *)(SUPC_BASE + SUPC_CR_OFF  )))  ///< Supply Controller Control
59 #define SUPC_SMMR (*((reg32_t *)(SUPC_BASE + SUPC_SMMR_OFF)))  ///< Supply Controller Supply Monitor Mode
60 #define SUPC_MR   (*((reg32_t *)(SUPC_BASE + SUPC_MR_OFF  )))  ///< Supply Controller Mode
61 #define SUPC_WUMR (*((reg32_t *)(SUPC_BASE + SUPC_WUMR_OFF)))  ///< Supply Controller Wake Up Mode
62 #define SUPC_WUIR (*((reg32_t *)(SUPC_BASE + SUPC_WUIR_OFF)))  ///< Supply Controller Wake Up Inputs
63 #define SUPC_SR   (*((reg32_t *)(SUPC_BASE + SUPC_SR_OFF  )))  ///< Supply Controller Status
64 /*\}*/
65
66 /**
67  * Defines for bit fields in SUPC_CR register.
68  */
69 /*\{*/
70 #define SUPC_CR_VROFF       2                     ///< Voltage Regulator Off
71 #define SUPC_CR_XTALSEL     3                     ///< Crystal Oscillator Select
72 #define SUPC_CR_KEY_P       24
73 #define SUPC_CR_KEY_MASK    (0xff << SUPC_CR_KEY_P)   ///< SUPC_CR key
74 #define SUPC_CR_KEY(value)  (SUPC_CR_KEY_MASK & ((value) << SUPC_CR_KEY_P))
75 /*\}*/
76
77 /**
78  * Defines for bit fields in SUPC_SR register.
79  */
80 /*\{*/
81 #define SUPC_SR_WKUPS     1   ///< WKUP Wake Up Status
82 #define SUPC_SR_SMWS      2   ///< Supply Monitor Detection Wake Up Status
83 #define SUPC_SR_BODRSTS   3   ///< Brownout Detector Reset Status
84 #define SUPC_SR_SMRSTS    4   ///< Supply Monitor Reset Status
85 #define SUPC_SR_SMS       5   ///< Supply Monitor Status
86 #define SUPC_SR_SMOS      6   ///< Supply Monitor Output Status
87 #define SUPC_SR_OSCSEL    7   ///< 32-kHz Oscillator Selection Status
88 #define SUPC_SR_WKUPIS0   16  ///< WKUP Input Status 0
89 #define SUPC_SR_WKUPIS1   17  ///< WKUP Input Status 1
90 #define SUPC_SR_WKUPIS2   18  ///< WKUP Input Status 2
91 #define SUPC_SR_WKUPIS3   19  ///< WKUP Input Status 3
92 #define SUPC_SR_WKUPIS4   20  ///< WKUP Input Status 4
93 #define SUPC_SR_WKUPIS5   21  ///< WKUP Input Status 5
94 #define SUPC_SR_WKUPIS6   22  ///< WKUP Input Status 6
95 #define SUPC_SR_WKUPIS7   23  ///< WKUP Input Status 7
96 #define SUPC_SR_WKUPIS8   24  ///< WKUP Input Status 8
97 #define SUPC_SR_WKUPIS9   25  ///< WKUP Input Status 9
98 #define SUPC_SR_WKUPIS10  26  ///< WKUP Input Status 10
99 #define SUPC_SR_WKUPIS11  27  ///< WKUP Input Status 11
100 #define SUPC_SR_WKUPIS12  28  ///< WKUP Input Status 12
101 #define SUPC_SR_WKUPIS13  29  ///< WKUP Input Status 13
102 #define SUPC_SR_WKUPIS14  30  ///< WKUP Input Status 14
103 #define SUPC_SR_WKUPIS15  31  ///< WKUP Input Status 15
104 /*\}*/
105
106 #endif /* SAM3_SYSCTL_H */