OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | at91sam9_nand |
Private data for the controller that is stored in the NAND device structure. More... | |
struct | at91sam9_pin |
Representation of a pin on an AT91SAM9 chip. More... | |
Macros | |
#define | AT91C_ECCX_CR (0x00) |
Offset to ECC CR. More... | |
#define | AT91C_ECCX_NPR (0x10) |
Offset to ECC NPR. More... | |
#define | AT91C_ECCX_PR (0x0C) |
Offset to ECC PR. More... | |
#define | AT91C_ECCX_SR (0x08) |
Offset to ECC SR. More... | |
#define | AT91C_PIOX_CODR (0x34) |
Offset to PIO CODR. More... | |
#define | AT91C_PIOX_PDSR (0x3C) |
Offset to PIO PDSR. More... | |
#define | AT91C_PIOX_SODR (0x30) |
Offset to PIO SODR. More... | |
Functions | |
static int | at91sam9_address (struct nand_device *nand, uint8_t address) |
Send an address to the NAND device attached to an AT91SAM9 NAND controller. More... | |
static int | at91sam9_command (struct nand_device *nand, uint8_t command) |
Send a command to the NAND device. More... | |
static int | at91sam9_disable (struct nand_device *nand) |
Disable NAND device attached to a controller. More... | |
static int | at91sam9_ecc_init (struct target *target, struct at91sam9_nand *info) |
Initialize the ECC controller on the AT91SAM9. More... | |
static int | at91sam9_enable (struct nand_device *nand) |
Enable NAND device attached to a controller. More... | |
static int | at91sam9_halted (struct target *target, const char *label) |
Checks if the target is halted and prints an error message if it isn't. More... | |
static int | at91sam9_init (struct nand_device *nand) |
Initialize the AT91SAM9 NAND controller. More... | |
static int | at91sam9_nand_ready (struct nand_device *nand, int timeout) |
Determine if the NAND device is ready by looking at the ready/~busy pin. More... | |
static uint8_t * | at91sam9_oob_init (struct nand_device *nand, uint8_t *oob, uint32_t *size) |
Initialize an area for the OOB based on whether a user is requesting the OOB data. More... | |
static int | at91sam9_read_block_data (struct nand_device *nand, uint8_t *data, int size) |
Read a block of data from the NAND device attached to an AT91SAM9. More... | |
static int | at91sam9_read_data (struct nand_device *nand, void *data) |
Read data directly from the NAND device attached to an AT91SAM9 NAND controller. More... | |
static int | at91sam9_read_page (struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) |
Reads a page from an AT91SAM9 NAND controller and verifies using 1-bit ECC controller on chip. More... | |
static int | at91sam9_reset (struct nand_device *nand) |
Reset the AT91SAM9 NAND controller. More... | |
static int | at91sam9_write_block_data (struct nand_device *nand, uint8_t *data, int size) |
Write a block of data to a NAND device attached to an AT91SAM9. More... | |
static int | at91sam9_write_data (struct nand_device *nand, uint16_t data) |
Write data directly to the NAND device attached to an AT91SAM9 NAND controller. More... | |
static int | at91sam9_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 of data including 1-bit ECC information to a NAND device attached to an AT91SAM9 controller. More... | |
COMMAND_HANDLER (handle_at91sam9_ale_command) | |
Handle the AT91SAM9 ALE command for specifying the address line to use for writing addresses to the NAND device. More... | |
COMMAND_HANDLER (handle_at91sam9_ce_command) | |
Handle the AT91SAM9 CE command for specifying the pin that is used to enable or disable the NAND device. More... | |
COMMAND_HANDLER (handle_at91sam9_cle_command) | |
Handle the AT91SAM9 CLE command for specifying the address line to use for writing commands to a NAND device. More... | |
COMMAND_HANDLER (handle_at91sam9_rdy_busy_command) | |
Handle the AT91SAM9 RDY/~BUSY command for specifying the pin that watches the RDY/~BUSY line from the NAND device. More... | |
NAND_DEVICE_COMMAND_HANDLER (at91sam9_nand_device_command) | |
Handle the initial NAND device command for AT91SAM9 controllers. More... | |
Variables | |
static const struct command_registration | at91sam9_command_handler [] |
struct nand_flash_controller | at91sam9_nand_controller |
Structure representing the AT91SAM9 NAND controller. More... | |
static const struct command_registration | at91sam9_sub_command_handlers [] |
#define AT91C_ECCX_CR (0x00) |
Offset to ECC CR.
Definition at line 20 of file at91sam9.c.
#define AT91C_ECCX_NPR (0x10) |
Offset to ECC NPR.
Definition at line 23 of file at91sam9.c.
#define AT91C_ECCX_PR (0x0C) |
Offset to ECC PR.
Definition at line 22 of file at91sam9.c.
#define AT91C_ECCX_SR (0x08) |
Offset to ECC SR.
Definition at line 21 of file at91sam9.c.
#define AT91C_PIOX_CODR (0x34) |
Offset to PIO CODR.
Definition at line 18 of file at91sam9.c.
#define AT91C_PIOX_PDSR (0x3C) |
Offset to PIO PDSR.
Definition at line 19 of file at91sam9.c.
#define AT91C_PIOX_SODR (0x30) |
Offset to PIO SODR.
Definition at line 17 of file at91sam9.c.
|
static |
Send an address to the NAND device attached to an AT91SAM9 NAND controller.
nand | NAND device to send the address to. |
address | Address to be sent. |
Definition at line 163 of file at91sam9.c.
References at91sam9_halted(), nand_device::controller_priv, ERROR_NAND_OPERATION_FAILED, info, nand_device::target, and target_write_u8().
|
static |
Send a command to the NAND device.
nand | NAND device to write the command to. |
command | Command to be written. |
Definition at line 129 of file at91sam9.c.
References at91sam9_enable(), at91sam9_halted(), nand_device::controller_priv, ERROR_NAND_OPERATION_FAILED, info, nand_device::target, and target_write_u8().
|
static |
Disable NAND device attached to a controller.
nand | NAND controller information for controlling NAND device. |
Definition at line 114 of file at91sam9.c.
References AT91C_PIOX_SODR, nand_device::controller_priv, info, nand_device::target, and target_write_u32().
Referenced by at91sam9_reset().
|
static |
Initialize the ECC controller on the AT91SAM9.
target | Target to configure ECC on. |
info | NAND controller information for where the ECC is. |
Definition at line 295 of file at91sam9.c.
References AT91C_ECCX_CR, ERROR_NAND_OPERATION_FAILED, info, LOG_ERROR, and target_write_u32().
Referenced by at91sam9_read_page(), and at91sam9_write_page().
|
static |
Enable NAND device attached to a controller.
nand | NAND controller information for controlling NAND device. |
Definition at line 100 of file at91sam9.c.
References AT91C_PIOX_CODR, nand_device::controller_priv, info, nand_device::target, and target_write_u32().
Referenced by at91sam9_command().
|
static |
Checks if the target is halted and prints an error message if it isn't.
target | Target to be checked. |
label | String label for where function is called from. |
Definition at line 69 of file at91sam9.c.
References label, LOG_ERROR, target::state, and TARGET_HALTED.
Referenced by at91sam9_address(), at91sam9_command(), at91sam9_init(), at91sam9_nand_ready(), at91sam9_read_block_data(), at91sam9_read_data(), at91sam9_reset(), at91sam9_write_block_data(), and at91sam9_write_data().
|
static |
Initialize the AT91SAM9 NAND controller.
nand | NAND device the controller is attached to. |
Definition at line 84 of file at91sam9.c.
References at91sam9_halted(), ERROR_NAND_OPERATION_FAILED, ERROR_OK, and nand_device::target.
|
static |
Determine if the NAND device is ready by looking at the ready/~busy pin.
nand | NAND device to check. |
timeout | Time in milliseconds to wait for NAND to be ready. |
Definition at line 219 of file at91sam9.c.
References alive_sleep(), AT91C_PIOX_PDSR, at91sam9_halted(), nand_device::controller_priv, info, status, nand_device::target, and target_read_u32().
|
static |
Initialize an area for the OOB based on whether a user is requesting the OOB data.
This determines the size of the OOB and allocates the space in case the user has not requested the OOB data.
nand | NAND device we are creating an OOB for. |
oob | Pointer to the user supplied OOB area. |
size | Size of the OOB. |
Definition at line 316 of file at91sam9.c.
References LOG_ERROR, NULL, nand_device::page_size, and size.
Referenced by at91sam9_read_page(), and at91sam9_write_page().
|
static |
Read a block of data from the NAND device attached to an AT91SAM9.
This utilizes the ARM hosted NAND read function.
nand | NAND device to read from. |
data | Pointer to where the read data should be placed. |
size | Size of the data being read. |
Definition at line 249 of file at91sam9.c.
References arm_nandread(), at91sam9_halted(), arm_nand_data::chunk_size, nand_device::controller_priv, arm_nand_data::data, ERROR_NAND_OPERATION_FAILED, info, nand_device::page_size, size, status, and nand_device::target.
|
static |
Read data directly from the NAND device attached to an AT91SAM9 NAND controller.
nand | NAND device to read from. |
data | Pointer to where the data should be put. |
Definition at line 182 of file at91sam9.c.
References at91sam9_halted(), nand_device::controller_priv, ERROR_NAND_OPERATION_FAILED, info, nand_device::target, and target_read_u8().
|
static |
Reads a page from an AT91SAM9 NAND controller and verifies using 1-bit ECC controller on chip.
This makes an attempt to correct any errors that are encountered while reading the page of data.
nand | NAND device to read from |
page | Page to be read. |
data | Pointer to where data should be read to. |
data_size | Size of the data to be read. |
oob | Pointer to where OOB data should be read to. |
oob_size | Size of the OOB data to be read. |
Definition at line 350 of file at91sam9.c.
References AT91C_ECCX_PR, AT91C_ECCX_SR, at91sam9_ecc_init(), at91sam9_oob_init(), bit(), nand_device::controller_priv, ERROR_OK, info, LOG_ERROR, LOG_INFO, NAND_CMD_READ0, nand_page_command(), nand_read_data_page(), parity(), status, nand_device::target, and target_read_u32().
|
static |
Reset the AT91SAM9 NAND controller.
nand | NAND device to be reset. |
Definition at line 148 of file at91sam9.c.
References at91sam9_disable(), at91sam9_halted(), ERROR_NAND_OPERATION_FAILED, and nand_device::target.
|
static |
Write a block of data to a NAND device attached to an AT91SAM9.
This uses the ARM hosted write function to write the data.
nand | NAND device to write to. |
data | Data to be written to device. |
size | Size of the data being written. |
Definition at line 273 of file at91sam9.c.
References arm_nandwrite(), at91sam9_halted(), arm_nand_data::chunk_size, nand_device::controller_priv, arm_nand_data::data, ERROR_NAND_OPERATION_FAILED, info, nand_device::page_size, size, status, and nand_device::target.
|
static |
Write data directly to the NAND device attached to an AT91SAM9 NAND controller.
nand | NAND device to be written to. |
data | Data to be written. |
Definition at line 201 of file at91sam9.c.
References at91sam9_halted(), nand_device::controller_priv, ERROR_NAND_OPERATION_FAILED, info, nand_device::target, and target_write_u8().
|
static |
Write a page of data including 1-bit ECC information to a NAND device attached to an AT91SAM9 controller.
If there is OOB data to be written, this will ignore the computed ECC from the ECC controller.
nand | NAND device to write to. |
page | Page to write. |
data | Pointer to data being written. |
data_size | Size of the data being written. |
oob | Pointer to OOB data being written. |
oob_size | Size of the OOB data. |
Definition at line 425 of file at91sam9.c.
References AT91C_ECCX_NPR, AT91C_ECCX_PR, at91sam9_ecc_init(), at91sam9_oob_init(), nand_device::controller_priv, ERROR_OK, info, LOG_ERROR, NAND_CMD_SEQIN, nand_page_command(), nand_write_data_page(), nand_write_finish(), parity(), nand_device::target, and target_read_u32().
COMMAND_HANDLER | ( | handle_at91sam9_ale_command | ) |
Handle the AT91SAM9 ALE command for specifying the address line to use for writing addresses to the NAND device.
Definition at line 562 of file at91sam9.c.
References CMD, CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, command_print(), nand_device::controller_priv, ERROR_COMMAND_ARGUMENT_INVALID, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, get_nand_device_by_num(), info, and NULL.
COMMAND_HANDLER | ( | handle_at91sam9_ce_command | ) |
Handle the AT91SAM9 CE command for specifying the pin that is used to enable or disable the NAND device.
Definition at line 621 of file at91sam9.c.
COMMAND_HANDLER | ( | handle_at91sam9_cle_command | ) |
Handle the AT91SAM9 CLE command for specifying the address line to use for writing commands to a NAND device.
Definition at line 532 of file at91sam9.c.
References CMD, CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, command_print(), nand_device::controller_priv, ERROR_OK, get_nand_device_by_num(), info, and NULL.
COMMAND_HANDLER | ( | handle_at91sam9_rdy_busy_command | ) |
Handle the AT91SAM9 RDY/~BUSY command for specifying the pin that watches the RDY/~BUSY line from the NAND device.
Definition at line 590 of file at91sam9.c.
References CMD, CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, command_print(), nand_device::controller_priv, ERROR_COMMAND_ARGUMENT_INVALID, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, get_nand_device_by_num(), info, and NULL.
NAND_DEVICE_COMMAND_HANDLER | ( | at91sam9_nand_device_command | ) |
Handle the initial NAND device command for AT91SAM9 controllers.
This initializes much of the controller information struct to be ready for future reads and writes.
Definition at line 483 of file at91sam9.c.
References ARM_NAND_NONE, CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, ERROR_NAND_OPERATION_FAILED, ERROR_OK, info, LOG_DEBUG, LOG_ERROR, and NULL.
|
static |
Definition at line 621 of file at91sam9.c.
struct nand_flash_controller at91sam9_nand_controller |
Structure representing the AT91SAM9 NAND controller.
Definition at line 621 of file at91sam9.c.
|
static |
Definition at line 621 of file at91sam9.c.