20 .eccpos = {0, 1, 2, 3, 6, 7},
30 40, 41, 42, 43, 44, 45, 46, 47,
31 48, 49, 50, 51, 52, 53, 54, 55,
32 56, 57, 58, 59, 60, 61, 62, 63
47 struct nand_device *nand,
const char *filename,
int filemode,
60 const char *msg = (filemode ==
FILEIO_READ) ?
"read" :
"write";
65 state->file_opened =
true;
88 if (
state->file_opened)
106 bool need_size,
bool sw_ecc)
110 unsigned int minargs = need_size ? 4 : 3;
134 for (
unsigned int i = minargs; i <
CMD_ARGC; i++) {
135 if (!strcmp(
CMD_ARGV[i],
"oob_raw"))
137 else if (!strcmp(
CMD_ARGV[i],
"oob_only"))
139 else if (sw_ecc && !strcmp(
CMD_ARGV[i],
"oob_softecc"))
141 else if (sw_ecc && !strcmp(
CMD_ARGV[i],
"oob_softecc_kw"))
159 state->size = filesize;
173 size_t total_read = 0;
180 total_read += one_read;
186 for (uint32_t i = 0, j = 0; i < s->
page_size; i += 256) {
201 for (uint32_t i = 0; i < s->
page_size; i += 512) {
207 if (one_read < s->oob_size)
208 memset(s->
oob + one_read, 0xff, s->
oob_size - one_read);
209 total_read += one_read;
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CALL_COMMAND_HANDLER(name, extra ...)
Use this to macro to call a command helper (or a nested handler).
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
int nand_fileio_cleanup(struct nand_fileio_state *state)
int nand_fileio_start(struct command_invocation *cmd, struct nand_device *nand, const char *filename, int filemode, struct nand_fileio_state *state)
void nand_fileio_init(struct nand_fileio_state *state)
static struct nand_ecclayout nand_oob_16
static struct nand_ecclayout nand_oob_64
int nand_fileio_read(struct nand_device *nand, struct nand_fileio_state *s)
int nand_fileio_finish(struct nand_fileio_state *state)
COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state, struct nand_device **dev, enum fileio_access filemode, bool need_size, bool sw_ecc)
int fileio_read(struct fileio *fileio, size_t size, void *buffer, size_t *size_read)
int fileio_close(struct fileio *fileio)
int fileio_size(struct fileio *fileio, size_t *size)
FIX!!!!
int fileio_open(struct fileio **fileio, const char *url, enum fileio_access access_type, enum fileio_type type)
int nand_calculate_ecc_kw(struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code)
#define ERROR_NAND_DEVICE_NOT_PROBED
int nand_calculate_ecc(struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code)
Upper level NOR flash interfaces.
When run_command is called, a new instance will be created on the stack, filled with the proper value...
struct nand_info * device
enum oob_formats oob_format
int duration_measure(struct duration *duration)
Update the duration->elapsed field to finish the duration measurement.
int duration_start(struct duration *duration)
Update the duration->start field to start the duration measurement.