Fix flash start address.
[bertos.git] / bertos / cpu / cortex-m3 / io / sam3_chipid.c
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 #include "sam3_chipid.h"
37
38 #include <cpu/types.h>
39
40 static const char _unknown[] = "unknown";
41 static const char * const chip_id_eproc_names[] =
42 {
43         _unknown,                                       // 0
44         "arm946es",                                     // 1
45         "arm7tdmi",                                     // 2
46         "cortex-m3",                            // 3
47         "arm920t",                                      // 4
48         "arm926ejs",                            // 5
49         "cortex-a5",                            // 6
50 };
51
52 const char *chipid_eproc_name(int idx)
53 {
54         if (idx <= 6)
55                 return chip_id_eproc_names[idx];
56
57         return _unknown;
58 }
59
60 #define chip_id_nvpsize2 chip_id_nvpsize                // these two tables are identical
61 static const char * const chip_id_nvpsize[] =
62 {
63         "none",                                         //  0
64         "8K bytes",                                     //  1
65         "16K bytes",                            //  2
66         "32K bytes",                            //  3
67         _unknown,                                       //  4
68         "64K bytes",                            //  5
69         _unknown,                                       //  6
70         "128K bytes",                           //  7
71         _unknown,                                       //  8
72         "256K bytes",                           //  9
73         "512K bytes",                           // 10
74         _unknown,                                       // 11
75         "1024K bytes",                          // 12
76         _unknown,                                       // 13
77         "2048K bytes",                          // 14
78         _unknown,                                       // 15
79 };
80
81 const char *chipid_nvpsize(int idx)
82 {
83         if (idx <= 15)
84                 return chip_id_nvpsize[idx];
85
86         return _unknown;
87 }
88
89
90 static const char * const chip_id_sramsize[] =
91 {
92         "48K Bytes",                            //  0
93         "1K Bytes",                                     //  1
94         "2K Bytes",                                     //  2
95         "6K Bytes",                                     //  3
96         "112K Bytes",                           //  4
97         "4K Bytes",                                     //  5
98         "80K Bytes",                            //  6
99         "160K Bytes",                           //  7
100         "8K Bytes",                                     //  8
101         "16K Bytes",                            //  9
102         "32K Bytes",                            // 10
103         "64K Bytes",                            // 11
104         "128K Bytes",                           // 12
105         "256K Bytes",                           // 13
106         "96K Bytes",                            // 14
107         "512K Bytes",                           // 15
108
109 };
110
111 const char *chipid_sramsize(int idx)
112 {
113         if (idx <= 15)
114                 return chip_id_sramsize[idx];
115
116         return _unknown;
117 }
118
119
120 static const struct archnames { unsigned value; const char *name; } chip_id_archnames[] =
121 {
122         { 0x19,  "AT91SAM9xx Series"                                            },
123         { 0x29,  "AT91SAM9XExx Series"                                          },
124         { 0x34,  "AT91x34 Series"                                                       },
125         { 0x37,  "CAP7 Series"                                                          },
126         { 0x39,  "CAP9 Series"                                                          },
127         { 0x3B,  "CAP11 Series"                                                         },
128         { 0x40,  "AT91x40 Series"                                                       },
129         { 0x42,  "AT91x42 Series"                                                       },
130         { 0x55,  "AT91x55 Series"                                                       },
131         { 0x60,  "AT91SAM7Axx Series"                                           },
132         { 0x61,  "AT91SAM7AQxx Series"                                          },
133         { 0x63,  "AT91x63 Series"                                                       },
134         { 0x70,  "AT91SAM7Sxx Series"                                           },
135         { 0x71,  "AT91SAM7XCxx Series"                                          },
136         { 0x72,  "AT91SAM7SExx Series"                                          },
137         { 0x73,  "AT91SAM7Lxx Series"                                           },
138         { 0x75,  "AT91SAM7Xxx Series"                                           },
139         { 0x76,  "AT91SAM7SLxx Series"                                          },
140         { 0x80,  "ATSAM3UxC Series (100-pin version)"           },
141         { 0x81,  "ATSAM3UxE Series (144-pin version)"           },
142         { 0x83,  "ATSAM3AxC Series (100-pin version)"           },
143         { 0x84,  "ATSAM3XxC Series (100-pin version)"           },
144         { 0x85,  "ATSAM3XxE Series (144-pin version)"           },
145         { 0x86,  "ATSAM3XxG Series (208/217-pin version)"       },
146         { 0x88,  "ATSAM3SxA Series (48-pin version)"            },
147         { 0x89,  "ATSAM3SxB Series (64-pin version)"            },
148         { 0x8A,  "ATSAM3SxC Series (100-pin version)"           },
149         { 0x92,  "AT91x92 Series"                                                       },
150         { 0x95,  "ATSAM3NxC Series (100-pin version)"           },
151         { 0xF0,  "AT75Cxx Series"                                                       },
152         { -1, NULL },
153
154 };
155
156 const char *chipid_archnames(unsigned value)
157 {
158         for (int i = 0; chip_id_archnames[i].name; i++)
159         {
160                 if (chip_id_archnames[i].value == value)
161                         return chip_id_archnames[i].name;
162         }
163
164         return _unknown;
165 }
166
167 static const char * const chip_id_nvptype[] = {
168         "rom", // 0
169         "romless or onchip flash", // 1
170         "embedded flash memory", // 2
171         "rom(nvpsiz) + embedded flash (nvpsiz2)", //3
172         "sram emulating flash", // 4
173 };
174
175 const char *chipid_nvptype(int idx)
176 {
177         if (idx <= 4)
178                 return chip_id_nvptype[idx];
179
180         return _unknown;
181 }
182