OpenOCD
nand/driver.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de> *
5  * Copyright (C) 2007,2008 Øyvind Harboe <oyvind.harboe@zylin.com> *
6  * Copyright (C) 2008 by Spencer Oliver <spen@spen-soft.co.uk> *
7  * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
8  ***************************************************************************/
9 
10 #ifndef OPENOCD_FLASH_NAND_DRIVER_H
11 #define OPENOCD_FLASH_NAND_DRIVER_H
12 
13 struct nand_device;
14 
15 #define __NAND_DEVICE_COMMAND(name) \
16  COMMAND_HELPER(name, struct nand_device *nand)
17 
25  const char *name;
26 
28  const char *usage;
29 
31 
33  __NAND_DEVICE_COMMAND((*nand_device_command));
34 
36  int (*init)(struct nand_device *nand);
37 
39  int (*reset)(struct nand_device *nand);
40 
42  int (*command)(struct nand_device *nand, uint8_t command);
43 
45  int (*address)(struct nand_device *nand, uint8_t address);
46 
48  int (*write_data)(struct nand_device *nand, uint16_t data);
49 
51  int (*read_data)(struct nand_device *nand, void *data);
52 
54  int (*write_block_data)(struct nand_device *nand, uint8_t *data, int size);
55 
57  int (*read_block_data)(struct nand_device *nand, uint8_t *data, int size);
58 
60  int (*write_page)(struct nand_device *nand, uint32_t page, uint8_t *data,
61  uint32_t data_size, uint8_t *oob, uint32_t oob_size);
62 
64  int (*read_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size,
65  uint8_t *oob, uint32_t oob_size);
66 
68  int (*nand_ready)(struct nand_device *nand, int timeout);
69 };
70 
71 #define NAND_DEVICE_COMMAND_HANDLER(name) static __NAND_DEVICE_COMMAND(name)
72 
79 
81 typedef int (*nand_driver_walker_t)(struct nand_flash_controller *c, void *);
91 
92 #endif /* OPENOCD_FLASH_NAND_DRIVER_H */
const char * name
Definition: armv4_5.c:76
int(* nand_driver_walker_t)(struct nand_flash_controller *c, void *)
Signature for callback functions passed to nand_driver_walk.
Definition: nand/driver.h:81
int nand_driver_walk(nand_driver_walker_t f, void *x)
Walk the list of drivers, encapsulating the data structure type.
struct nand_flash_controller * nand_driver_find_by_name(const char *name)
Find a NAND flash controller by name.
size_t size
Size of the control block search area.
Definition: rtt/rtt.c:30
Interface for NAND flash controllers.
Definition: nand/driver.h:23
int(* read_data)(struct nand_device *nand, void *data)
Read word of data from the NAND device.
Definition: nand/driver.h:51
__NAND_DEVICE_COMMAND((*nand_device_command))
NAND device command called when driver is instantiated during configuration.
const char * usage
Usage of flash command registration.
Definition: nand/driver.h:28
int(* nand_ready)(struct nand_device *nand, int timeout)
Check if the NAND device is ready for more instructions with timeout.
Definition: nand/driver.h:68
const struct command_registration * commands
Definition: nand/driver.h:30
int(* write_block_data)(struct nand_device *nand, uint8_t *data, int size)
Write a block of data to the NAND device.
Definition: nand/driver.h:54
int(* read_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
Read a page from the NAND device.
Definition: nand/driver.h:64
int(* write_data)(struct nand_device *nand, uint16_t data)
Write word of data to the NAND device.
Definition: nand/driver.h:48
const char * name
Driver name that is used to select it from configuration files.
Definition: nand/driver.h:25
int(* command)(struct nand_device *nand, uint8_t command)
Issue a command to the NAND device.
Definition: nand/driver.h:42
int(* read_block_data)(struct nand_device *nand, uint8_t *data, int size)
Read a block of data from the NAND device.
Definition: nand/driver.h:57
int(* address)(struct nand_device *nand, uint8_t address)
Write an address to the NAND device.
Definition: nand/driver.h:45
int(* init)(struct nand_device *nand)
Initialize the NAND device.
Definition: nand/driver.h:36
int(* reset)(struct nand_device *nand)
Reset the NAND device.
Definition: nand/driver.h:39
int(* write_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
Write a page to the NAND device.
Definition: nand/driver.h:60
Definition: psoc6.c:84