]> git.sur5r.net Git - openocd/blob - src/flash/str9xpec.h
4e34f6c7a3fafe135e5e57022128f4bf1172da54
[openocd] / src / flash / str9xpec.h
1 /***************************************************************************
2  *   Copyright (C) 2005 by Dominic Rath                                    *
3  *   Dominic.Rath@gmx.de                                                   *
4  *                                                                         *
5  *   Copyright (C) 2008 by Spencer Oliver                                  *
6  *   spen@spen-soft.co.uk                                                  *
7  *                                                                         *
8  *   This program is free software; you can redistribute it and/or modify  *
9  *   it under the terms of the GNU General Public License as published by  *
10  *   the Free Software Foundation; either version 2 of the License, or     *
11  *   (at your option) any later version.                                   *
12  *                                                                         *
13  *   This program is distributed in the hope that it will be useful,       *
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
16  *   GNU General Public License for more details.                          *
17  *                                                                         *
18  *   You should have received a copy of the GNU General Public License     *
19  *   along with this program; if not, write to the                         *
20  *   Free Software Foundation, Inc.,                                       *
21  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
22  ***************************************************************************/
23 #ifndef STR9XPEC_H
24 #define STR9XPEC_H
25
26 #include "flash.h"
27 #include "target.h"
28 #include "jtag.h"
29
30 typedef struct str9xpec_flash_controller_s
31 {
32         u32 *sector_bits;
33         int chain_pos;
34         int isc_enable;
35         jtag_device_t* devarm;
36         u8 options[8];
37 } str9xpec_flash_controller_t;
38
39 enum str9xpec_status_codes
40 {
41         STR9XPEC_INVALID_COMMAND = 1,
42         STR9XPEC_ISC_SUCCESS = 2,
43         STR9XPEC_ISC_DISABLED = 3,
44         STR9XPEC_ISC_INTFAIL = 32,
45 };
46
47 /* ISC commands */
48
49 #define ISC_IDCODE                              0xFE
50 #define ISC_MFG_READ                    0x4C
51 #define ISC_CONFIGURATION               0x07
52 #define ISC_ENABLE                              0x0C
53 #define ISC_DISABLE                             0x0F
54 #define ISC_NOOP                                0x10
55 #define ISC_ADDRESS_SHIFT               0x11
56 #define ISC_CLR_STATUS                  0x13
57 #define ISC_PROGRAM                             0x20
58 #define ISC_PROGRAM_SECURITY    0x22
59 #define ISC_PROGRAM_UC                  0x23
60 #define ISC_ERASE                               0x30
61 #define ISC_READ                                0x50
62 #define ISC_BLANK_CHECK                 0x60
63
64 /* ISC_DEFAULT bit definitions */
65
66 #define ISC_STATUS_SECURITY             0x40
67 #define ISC_STATUS_INT_ERROR    0x30
68 #define ISC_STATUS_MODE                 0x08
69 #define ISC_STATUS_BUSY                 0x04
70 #define ISC_STATUS_ERROR                0x03
71
72 /* Option bytes definitions */
73
74 #define STR9XPEC_OPT_CSMAPBIT           48
75 #define STR9XPEC_OPT_LVDTHRESBIT        49
76 #define STR9XPEC_OPT_LVDSELBIT          50
77 #define STR9XPEC_OPT_LVDWARNBIT         51
78 #define STR9XPEC_OPT_OTPBIT                     63
79
80 #endif /* STR9XPEC_H */
81