1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/*
* Copyright (C) 2018-2021 McMCC <mcmcc@mail.ru>
* flashcmd_api.c
*
* 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.
*/
#include <stdio.h>
#include "flashcmd_api.h"
#ifdef EEPROM_SUPPORT
#define __EEPROM___ "or EEPROM"
extern int eepromsize;
extern int mw_eepromsize;
extern int seepromsize;
#else
#define __EEPROM___ ""
#endif
/*long flash_cmd_init(struct flash_cmd *cmd)
{
long flen = -1;
#ifdef EEPROM_SUPPORT
if ((eepromsize <= 0) && (mw_eepromsize <= 0) && (seepromsize <= 0)) {
#endif
if ((flen = snand_init()) > 0) {
cmd->flash_erase = snand_erase;
cmd->flash_write = snand_write;
cmd->flash_read = snand_read;
} else if ((flen = snor_init()) > 0) {
cmd->flash_erase = snor_erase;
cmd->flash_write = snor_write;
cmd->flash_read = snor_read;
}
#ifdef EEPROM_SUPPORT
} else if ((eepromsize > 0) || (mw_eepromsize > 0) || (seepromsize > 0)) {
if ((eepromsize > 0) && (flen = i2c_init()) > 0) {
cmd->flash_erase = i2c_eeprom_erase;
cmd->flash_write = i2c_eeprom_write;
cmd->flash_read = i2c_eeprom_read;
} else if ((mw_eepromsize > 0) && (flen = mw_init()) > 0) {
cmd->flash_erase = mw_eeprom_erase;
cmd->flash_write = mw_eeprom_write;
cmd->flash_read = mw_eeprom_read;
} else if ((seepromsize > 0) && (flen = spi_eeprom_init()) > 0) {
cmd->flash_erase = spi_eeprom_erase;
cmd->flash_write = spi_eeprom_write;
cmd->flash_read = spi_eeprom_read;
}
}
#endif
else
printf("\nFlash" __EEPROM___ " not found!!!!\n\n");
return flen;
}
*/
/*void support_flash_list(void)
{
support_snand_list();
printf("\n");
support_snor_list();
#ifdef EEPROM_SUPPORT
printf("\n");
support_i2c_eeprom_list();
printf("\n");
support_mw_eeprom_list();
printf("\n");
support_spi_eeprom_list();
#endif
}
*/
/* End of [flashcmd.c] package */
|