// // Copyright (C) 2015-2016 Markus Hiienkari // // 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 . // #include #include #include "system.h" #include "flash.h" #include "utils.h" // save some code space #define SINGLE_FLASH_INSTANCE alt_flash_dev *epcq_dev; int init_flash() { #ifdef SINGLE_FLASH_INSTANCE extern alt_llist alt_flash_dev_list; epcq_dev = (alt_flash_dev*)alt_flash_dev_list.next; #else epcq_dev = alt_flash_open_dev(EPCQ_CONTROLLER_0_AVL_MEM_NAME); #endif if (epcq_dev == NULL) return -1; return 0; } int verify_flash(alt_u32 offset, alt_u32 length, alt_u32 golden_crc, alt_u8 *tmpbuf) { alt_u32 crcval=0, i, bytes_to_read; int retval; for (i=0; i