1
0
mirror of https://github.com/marqs85/ossc.git synced 2024-05-28 21:41:30 +00:00
ossc/software/sys_controller/memory/flash.h

42 lines
1.4 KiB
C
Raw Normal View History

2016-02-22 23:03:50 +00:00
//
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
2016-02-22 23:03:50 +00:00
//
// This file is part of Open Source Scan Converter project.
//
// 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 3 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
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
2016-05-24 21:04:46 +00:00
#ifndef FLASH_H_
#define FLASH_H_
#include "alt_types.h"
#include "sysconfig.h"
#include "altera_epcq_controller_mod.h"
// EPCS16 pagesize is 256 bytes
// Flash is split 50-50 to FW and userdata, 1MB each
#define PAGESIZE 256
2016-12-29 22:14:12 +00:00
#define PAGES_PER_SECTOR 256 //EPCS "sector" corresponds to "block" on Spansion flash
#define SECTORSIZE (PAGESIZE*PAGES_PER_SECTOR)
2016-05-24 21:04:46 +00:00
#define USERDATA_OFFSET 0x100000
2016-12-29 22:14:12 +00:00
#define MAX_USERDATA_ENTRY 15 // 16 sectors for userdata
2016-05-24 21:04:46 +00:00
#define FLASH_VERIFY_ERROR 204
2020-10-05 20:05:43 +00:00
int init_flash();
2016-05-24 21:04:46 +00:00
int verify_flash(alt_u32 offset, alt_u32 length, alt_u32 golden_crc, alt_u8 *tmpbuf);
#endif /* FLASH_H_ */