30be3048222e7bf9871e91705836ddd6bcfa96b9
[fw/openocd] / src / flash / nor / lpc2000.h
1 /***************************************************************************
2  *   Copyright (C) 2005 by Dominic Rath                                    *
3  *   Dominic.Rath@gmx.de                                                   *
4  *                                                                         *
5  *   LPC1700 support Copyright (C) 2009 by Audrius Urmanavicius            *
6  *   didele.deze@gmail.com                                                 *
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 LPC2000_H
24 #define LPC2000_H
25
26 #include <flash/flash.h>
27
28 typedef enum
29 {
30         lpc2000_v1,
31         lpc2000_v2,
32         lpc1700
33 } lpc2000_variant;
34
35 struct lpc2000_flash_bank
36 {
37         lpc2000_variant variant;
38         struct working_area *iap_working_area;
39         uint32_t cclk;
40         int cmd51_dst_boundary;
41         int cmd51_can_256b;
42         int cmd51_can_8192b;
43         int calc_checksum;
44         uint32_t cmd51_max_buffer;
45         int checksum_vector;
46 };
47
48 enum lpc2000_status_codes
49 {
50         LPC2000_CMD_SUCCESS = 0,
51         LPC2000_INVALID_COMMAND = 1,
52         LPC2000_SRC_ADDR_ERROR = 2,
53         LPC2000_DST_ADDR_ERROR = 3,
54         LPC2000_SRC_ADDR_NOT_MAPPED = 4,
55         LPC2000_DST_ADDR_NOT_MAPPED = 5,
56         LPC2000_COUNT_ERROR = 6,
57         LPC2000_INVALID_SECTOR = 7,
58         LPC2000_SECTOR_NOT_BLANK = 8,
59         LPC2000_SECTOR_NOT_PREPARED = 9,
60         LPC2000_COMPARE_ERROR = 10,
61         LPC2000_BUSY = 11,
62         LPC2000_PARAM_ERROR = 12,
63         LPC2000_ADDR_ERROR = 13,
64         LPC2000_ADDR_NOT_MAPPED = 14,
65         LPC2000_CMD_NOT_LOCKED = 15,
66         LPC2000_INVALID_CODE = 16,
67         LPC2000_INVALID_BAUD_RATE = 17,
68         LPC2000_INVALID_STOP_BIT = 18,
69         LPC2000_CRP_ENABLED = 19
70
71 };
72
73 #endif /* LPC2000_H */