flash/nor/at91samd: Use 32-bit register writes for ST-Link compat
[fw/openocd] / src / flash / nand / fileio.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /***************************************************************************
4  *   Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net>             *
5  ***************************************************************************/
6
7 #ifndef OPENOCD_FLASH_NAND_FILEIO_H
8 #define OPENOCD_FLASH_NAND_FILEIO_H
9
10 #include <helper/time_support.h>
11 #include <helper/fileio.h>
12
13 struct nand_fileio_state {
14         uint32_t address;
15         uint32_t size;
16
17         uint8_t *page;
18         uint32_t page_size;
19
20         enum oob_formats oob_format;
21         uint8_t *oob;
22         uint32_t oob_size;
23
24         const int *eccpos;
25
26         bool file_opened;
27         struct fileio *fileio;
28
29         struct duration bench;
30 };
31
32 void nand_fileio_init(struct nand_fileio_state *state);
33 int nand_fileio_start(struct command_invocation *cmd,
34                 struct nand_device *nand, const char *filename, int filemode,
35                 struct nand_fileio_state *state);
36 int nand_fileio_cleanup(struct nand_fileio_state *state);
37 int nand_fileio_finish(struct nand_fileio_state *state);
38
39 COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
40         struct nand_device **dev, enum fileio_access filemode,
41         bool need_size, bool sw_ecc);
42
43 int nand_fileio_read(struct nand_device *nand, struct nand_fileio_state *s);
44
45 #endif /* OPENOCD_FLASH_NAND_FILEIO_H */