]> git.sur5r.net Git - openocd/blob - src/flash/str7x.h
- renamed M5960 USB JTAG to "flyswatter"
[openocd] / src / flash / str7x.h
1 /***************************************************************************
2  *   Copyright (C) 2005 by Dominic Rath                                    *
3  *   Dominic.Rath@gmx.de                                                   *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20 #ifndef STR7X_H
21 #define STR7X_H
22
23 #include "flash.h"
24 #include "target.h"
25
26 typedef struct str7x_flash_bank_s
27 {
28         int bank1;
29         u32 *sector_bank;
30         u32 *sector_bits;
31         working_area_t *write_algorithm;
32 } str7x_flash_bank_t;
33
34 enum str7x_status_codes
35 {
36         STR7X_CMD_SUCCESS = 0,
37         STR7X_INVALID_COMMAND = 1,
38         STR7X_SRC_ADDR_ERROR = 2,
39         STR7X_DST_ADDR_ERROR = 3,
40         STR7X_SRC_ADDR_NOT_MAPPED = 4,
41         STR7X_DST_ADDR_NOT_MAPPED = 5,
42         STR7X_COUNT_ERROR = 6,
43         STR7X_INVALID_SECTOR = 7,
44         STR7X_SECTOR_NOT_BLANK = 8,
45         STR7X_SECTOR_NOT_PREPARED = 9,
46         STR7X_COMPARE_ERROR = 10,
47         STR7X_BUSY = 11
48 };
49
50 /*  Flash registers */
51
52 #define FLASH_CR0               0x00100000
53 #define FLASH_CR1               0x00100004
54 #define FLASH_DR0               0x00100008
55 #define FLASH_DR1               0x0010000C
56 #define FLASH_AR                0x00100010
57 #define FLASH_ER                0x00100014
58 #define FLASH_NVWPAR    0x0010DFB0
59 #define FLASH_NVAPR0    0x0010DFB8
60 #define FLASH_NVAPR1    0x0010DFBC
61
62 /* FLASH_CR0 register bits */
63
64 #define FLASH_WMS               0x80000000
65 #define FLASH_SUSP              0x40000000
66 #define FLASH_WPG       0x20000000
67 #define FLASH_DWPG              0x10000000
68 #define FLASH_SER               0x08000000
69 #define FLASH_SPR               0x01000000
70 #define FLASH_BER               0x04000000
71 #define FLASH_MER               0x02000000
72 #define FLASH_BSYA1             0x00000002
73 #define FLASH_BSYA2             0x00000004
74
75 /* FLASH_CR1 regsiter bits */
76
77 #define FLASH_B1S               0x02000000
78 #define FLASH_B0S               0x01000000
79 #define FLASH_B1F1              0x00020000
80 #define FLASH_B1F0              0x00010000
81 #define FLASH_B0F7              0x00000080
82 #define FLASH_B0F6              0x00000040
83 #define FLASH_B0F5              0x00000020
84 #define FLASH_B0F4              0x00000010
85 #define FLASH_B0F3              0x00000008
86 #define FLASH_B0F2              0x00000004
87 #define FLASH_B0F1              0x00000002
88 #define FLASH_B0F0              0x00000001
89
90 /* FLASH_ER register bits */
91
92 #define FLASH_WPF               0x00000100
93 #define FLASH_RESER             0x00000080
94 #define FLASH_SEQER             0x00000040
95 #define FLASH_10ER              0x00000008
96 #define FLASH_PGER              0x00000004
97 #define FLASH_ERER              0x00000002
98 #define FLASH_ERR               0x00000001
99
100 typedef struct str7x_mem_layout_s {
101         u32 sector_start;
102         u32 sector_size;
103         u32 sector_bit;
104 } str7x_mem_layout_t;
105
106 #endif /* STR7X_H */
107