sam3: add register definitions for RSTC and EMAC
[bertos.git] / bertos / cpu / cortex-m3 / io / sam3_rstc.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 2007,2011 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  *
34  * \author Francesco Sacchi <batt@develer.com>
35  *
36  * SAM3 reset controller.
37  * This file is based on NUT/OS implementation. See license below.
38  */
39
40 /*
41  * Copyright (C) 2005-2006 by egnite Software GmbH. All rights reserved.
42  *
43  * Redistribution and use in source and binary forms, with or without
44  * modification, are permitted provided that the following conditions
45  * are met:
46  *
47  * 1. Redistributions of source code must retain the above copyright
48  *    notice, this list of conditions and the following disclaimer.
49  * 2. Redistributions in binary form must reproduce the above copyright
50  *    notice, this list of conditions and the following disclaimer in the
51  *    documentation and/or other materials provided with the distribution.
52  * 3. Neither the name of the copyright holders nor the names of
53  *    contributors may be used to endorse or promote products derived
54  *    from this software without specific prior written permission.
55  *
56  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
57  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
59  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
60  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
61  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
62  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
63  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
64  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
65  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
66  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67  * SUCH DAMAGE.
68  *
69  * For additional information see http://www.ethernut.de/
70  */
71
72 #ifndef SAM3_RTSC_H
73 #define SAM3_RTSC_H
74
75 #define RSTC_BASE  0x400E1A00
76
77 /** Reset Controller Control Register */
78 /*\{*/
79 #define RSTC_CR         (*((reg32_t *)(RSTC_BASE + 0x00)))      ///< Reset controller control register address.
80 #define RSTC_PROCRST                     0  ///< Processor reset.
81 #define RSTC_PERRST                      2  ///< Peripheral reset.
82 #define RSTC_EXTRST                      3  ///< External reset.
83 #define RSTC_KEY                0xA5000000  ///< Password.
84 /*\}*/
85
86 /** Reset Controller Status Register */
87 /*\{*/
88 #define RSTC_SR         (*((reg32_t *)(RSTC_BASE + 0x04)))      ///< Reset controller status register address.
89 #define RSTC_URSTS                       0  ///< User reset status.
90 #define RSTC_BODSTS                      1  ///< Brownout detection status.
91 #define RSTC_RSTTYP_MASK        0x00000700  ///< Reset type.
92 #define RSTC_RSTTYP_POWERUP     0x00000000  ///< Power-up reset.
93 //#define RSTC_RSTTYP_WAKEUP      0x00000100      ///< VDDCORE rising.
94 #define RSTC_RSTTYP_WATCHDOG    0x00000200  ///< Watchdog reset.
95 #define RSTC_RSTTYP_SOFTWARE    0x00000300  ///< Software reset.
96 #define RSTC_RSTTYP_USER        0x00000400  ///< User reset.
97 #define RSTC_RSTTYP_BROWNOUT    0x00000500  ///< Brownout reset.
98 #define RSTC_NRSTL                      16  ///< NRST pin level.
99 #define RSTC_SRCMP                      17  ///< Software reset command in progress.
100 /*\}*/
101
102 /** Reset Controller Mode Register */
103 /*\{*/
104 #define RSTC_MR         (*((reg32_t *)(RSTC_BASE + 0x08)))      ///< Reset controller mode register address.
105 #define RSTC_URSTEN                      0  ///< User reset enable.
106 #define RSTC_URSTIEN                     4  ///< User reset interrupt enable.
107 #define RSTC_ERSTL_MASK         0x00000F00  ///< External reset length.
108 #define RSTC_ERSTL_SHIFT                 8  ///< Least significant bit of external reset length.
109 #define RSTC_BODIEN                     16  ///< Brown-out detection interrupt enable.
110 /*\}*/
111
112
113 #endif /* SAM3_RTSC_H */