Trailing whitespace
[bertos.git] / bertos / cpu / cortex-m3 / io / sam3_chipid.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 2011 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \brief CHIP ID SAM3 definitions.
34  */
35
36 #ifndef SAM3_CHIPID_H
37 #define SAM3_CHIPID_H
38
39 /**
40  * CHIP ID base registers addresses.
41  */
42 #define CHIPID_CIDR      (*((reg32_t *)(0x400E0940)))
43
44 #define CHIPID_VERSION_MASK     0x1F
45 #define CHIPID_VERSION()        ((CHIPID_CIDR) & CHIPID_VERSION_MASK) ///< Current version of the device.
46
47 #define CHIPID_EPRCOC_SHIFT     5
48 #define CHIPID_EPRCOC_MASK      0xE0
49 #define CHIPID_EPRCOC()      (((CHIPID_CIDR) & CHIPID_EPRCOC_MASK) >>  CHIPID_EPRCOC_SHIFT)    ///< Embedded processor.
50
51 #define CHIPID_NVPSIZ_SHIFT      8
52 #define CHIPID_NVPSIZ_MASK      0xF00      ///< Nonvolatile program memory size.
53 #define CHIPID_NVPSIZ()      (((CHIPID_CIDR) & CHIPID_NVPSIZ_MASK) >>  CHIPID_NVPSIZ_SHIFT) ///< Nonvolatile program memory size.
54
55 #define CHIPID_NVPSIZ2_SHIFT     12
56 #define CHIPID_NVPSIZ2_MASK     0xF000     ///< Second nonvolatile program memory size.
57 #define CHIPID_NVPSIZ2()      (((CHIPID_CIDR) & CHIPID_NVPSIZ2_MASK) >>  CHIPID_NVPSIZ2_SHIFT) ///< Second nonvolatile program memory size.
58
59 #define CHIPID_SRAMSIZ_SHIFT     16
60 #define CHIPID_SRAMSIZ_MASK     0xF0000    ///< Internal SRAM size.
61 #define CHIPID_SRAMSIZ()      (((CHIPID_CIDR) & CHIPID_SRAMSIZ_MASK) >>  CHIPID_SRAMSIZ_SHIFT) ///< Internal SRAM size.
62
63 #define CHIPID_ARCH_SHIFT        20
64 #define CHIPID_ARCH_MASK        0xFF00000  ///< Architecture identifier.
65 #define CHIPID_ARCH()      (((CHIPID_CIDR) & CHIPID_ARCH_MASK) >>  CHIPID_ARCH_SHIFT) ///< Architecture identifier.
66
67 #define CHIPID_NVTYP_SHIFT       28
68 #define CHIPID_NVTYP_MASK       0x70000000 ///< Nonvolatile program memory type.
69 #define CHIPID_NVTYP()      (((CHIPID_CIDR) & CHIPID_NVTYP_MASK) >>  CHIPID_NVTYP_SHIFT) ///< Nonvolatile program memory type.
70
71
72 const char *chipid_eproc_name(int idx);
73 const char *chipid_nvpsize(int idx);
74 const char *chipid_sramsize(int idx);
75 const char *chipid_archnames(unsigned value);
76 const char *chipid_nvptype(int idx);
77
78 #endif /* SAM3_CHIPID_H */