f57f36ec8cc156b6cd32f248eedf01d5716bdc35
[openocd.git] / src / flash / at91sam7.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Magnus Lundin *
3 * lundin@mlu.mine.nu *
4 * *
5 * Copyright (C) 2006 by Gheorghe Guran (atlas) *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
22
23 #ifndef AT91SAM7_H
24 #define AT91SAM7_H
25
26 #include "flash.h"
27 #include "target.h"
28
29 typedef struct at91sam7_flash_bank_s
30 {
31 /* chip id register */
32 u32 cidr;
33 u16 cidr_ext;
34 u16 cidr_nvptyp;
35 u16 cidr_arch;
36 u16 cidr_sramsiz;
37 u16 cidr_nvpsiz;
38 u16 cidr_nvpsiz2;
39 u16 cidr_eproc;
40 u16 cidr_version;
41 char *target_name;
42
43 /* flash auto-detection */
44 u8 flash_autodetection;
45
46 /* flash geometry */
47 u16 pages_per_sector;
48 u16 pagesize;
49 u16 pages_in_lockregion;
50
51 /* nv memory bits */
52 u16 num_lockbits_on;
53 u16 lockbits;
54 u16 num_nvmbits;
55 u16 num_nvmbits_on;
56 u16 nvmbits;
57 u8 securitybit;
58
59 /* 0: not init
60 * 1: fmcn for nvbits (1uS)
61 * 2: fmcn for flash (1.5uS) */
62 u8 flashmode;
63
64 /* main clock status */
65 u8 mck_valid;
66 u32 mck_freq;
67
68 /* external clock frequency */
69 u32 ext_freq;
70
71 } at91sam7_flash_bank_t;
72
73
74 /* AT91SAM7 control registers */
75 #define DBGU_CIDR 0xFFFFF240
76 #define CKGR_MCFR 0xFFFFFC24
77 #define CKGR_MOR 0xFFFFFC20
78 #define CKGR_MCFR_MAINRDY 0x10000
79 #define CKGR_PLLR 0xFFFFFC2c
80 #define CKGR_PLLR_DIV 0xff
81 #define CKGR_PLLR_MUL 0x07ff0000
82 #define PMC_MCKR 0xFFFFFC30
83 #define PMC_MCKR_CSS 0x03
84 #define PMC_MCKR_PRES 0x1c
85
86 /* Flash Controller Commands */
87 #define WP 0x01
88 #define SLB 0x02
89 #define WPL 0x03
90 #define CLB 0x04
91 #define EA 0x08
92 #define SGPB 0x0B
93 #define CGPB 0x0D
94 #define SSB 0x0F
95
96 /* MC_FSR bit definitions */
97 #define MC_FSR_FRDY 1
98 #define MC_FSR_EOL 2
99
100 /* AT91SAM7 constants */
101 #define RC_FREQ 32000
102
103 /* Flash timing modes */
104 #define FMR_TIMING_NONE 0
105 #define FMR_TIMING_NVBITS 1
106 #define FMR_TIMING_FLASH 2
107
108 /* Flash size constants */
109 #define FLASH_SIZE_8KB 1
110 #define FLASH_SIZE_16KB 2
111 #define FLASH_SIZE_32KB 3
112 #define FLASH_SIZE_64KB 5
113 #define FLASH_SIZE_128KB 7
114 #define FLASH_SIZE_256KB 9
115 #define FLASH_SIZE_512KB 10
116 #define FLASH_SIZE_1024KB 12
117 #define FLASH_SIZE_2048KB 14
118
119 #endif /* AT91SAM7_H */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)