diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-12-04 19:28:18 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-12-04 21:41:23 -0800 |
commit | 747d6f22868dd87cb54341cc22d9eb3687039735 (patch) | |
tree | d842966bd99593ffcbff2338517275ff9e408c12 /src/flash/nand/fileio.h | |
parent | a7fd30c07fb9c2b7662ffaa48287b1997dc60796 (diff) |
split nand.c into nand/{core,fileio,tcl}.c
Moves commands into nand/tcl.c and core implementation to 'nand/core.c'
and 'nand/fileio.c'. Eliminates 'flash/nand.c'.
Adds 'nand/imp.h' to share routines between TCL commands and core.
Diffstat (limited to 'src/flash/nand/fileio.h')
-rw-r--r-- | src/flash/nand/fileio.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/flash/nand/fileio.h b/src/flash/nand/fileio.h new file mode 100644 index 00000000..78554311 --- /dev/null +++ b/src/flash/nand/fileio.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> * + * * + * 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 * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef FLASH_NAND_FILEIO_H +#define FLASH_NAND_FILEIO_H + +#include <helper/time_support.h> +#include <helper/fileio.h> + +struct nand_fileio_state { + uint32_t address; + uint32_t size; + + uint8_t *page; + uint32_t page_size; + + enum oob_formats oob_format; + uint8_t *oob; + uint32_t oob_size; + + const int *eccpos; + + bool file_opened; + struct fileio fileio; + + struct duration bench; +}; + +void nand_fileio_init(struct nand_fileio_state *state); +int nand_fileio_start(struct command_context *cmd_ctx, + struct nand_device *nand, const char *filename, int filemode, + struct nand_fileio_state *state); +int nand_fileio_cleanup(struct nand_fileio_state *state); +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 nand_fileio_read(struct nand_device *nand, struct nand_fileio_state *s); + +#endif // FLASH_NAND_FILEIO_H |