2008-04-24 06:09:28 -05:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2007 by Pavel Chromy *
|
|
|
|
* chromy@asix.cz *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
2018-06-11 14:47:52 -05:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
2008-04-24 06:09:28 -05:00
|
|
|
***************************************************************************/
|
|
|
|
#ifndef samflashH
|
|
|
|
#define samflashH
|
|
|
|
|
|
|
|
#include "platform.h"
|
|
|
|
|
|
|
|
#define FLASH_AREA_ADDR 0x100000
|
|
|
|
|
|
|
|
#define FLASH_STAT_OK 0
|
|
|
|
#define FLASH_STAT_PROGE 1
|
|
|
|
#define FLASH_STAT_LOCKE 2
|
|
|
|
#define FLASH_STAT_VERIFE 3
|
|
|
|
#define FLASH_STAT_INITE 4
|
|
|
|
|
|
|
|
extern unsigned int flash_page_count;
|
|
|
|
extern unsigned int flash_page_size; /* words */
|
|
|
|
|
|
|
|
/* detect chip and set loader parameters */
|
2009-11-09 05:10:11 -06:00
|
|
|
int flash_init(void);
|
2008-04-24 06:09:28 -05:00
|
|
|
|
|
|
|
/* program single flash page */
|
2009-11-09 05:10:11 -06:00
|
|
|
int flash_page_program(uint32 *data, int page_num);
|
2008-04-24 06:09:28 -05:00
|
|
|
|
|
|
|
/* erase whole chip */
|
2009-11-09 05:10:11 -06:00
|
|
|
int flash_erase_all(void);
|
2008-04-24 06:09:28 -05:00
|
|
|
|
|
|
|
/* verify written data */
|
2009-11-09 05:10:11 -06:00
|
|
|
int flash_verify(uint32 adr, unsigned int len, uint8 *src);
|
2008-04-24 06:09:28 -05:00
|
|
|
|
|
|
|
#endif
|