18973a70d847d092d3520f3465a8cefde49398e2
[fw/openocd] / contrib / loaders / flash / at91sam7x / samflash.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Pavel Chromy                                    *
3  *   chromy@asix.cz                                                        *
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, see <http://www.gnu.org/licenses/>. *
17  ***************************************************************************/
18 #ifndef samflashH
19 #define samflashH
20
21 #include "platform.h"
22
23 #define FLASH_AREA_ADDR 0x100000
24
25 #define FLASH_STAT_OK 0
26 #define FLASH_STAT_PROGE 1
27 #define FLASH_STAT_LOCKE 2
28 #define FLASH_STAT_VERIFE 3
29 #define FLASH_STAT_INITE 4
30
31 extern unsigned int flash_page_count;
32 extern unsigned int flash_page_size; /* words */
33
34 /* detect chip and set loader parameters */
35 int flash_init(void);
36
37 /* program single flash page */
38 int flash_page_program(uint32 *data, int page_num);
39
40 /* erase whole chip */
41 int flash_erase_all(void);
42
43 /* verify written data */
44 int flash_verify(uint32 adr, unsigned int len, uint8 *src);
45
46 #endif