Flash spare area scheme.
This file contains definitions and functions to do NAND Flash device's spare area operations.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "nand_flash_common.h"
Data Structures | |
struct | nand_flash_spare_scheme |
Functions | |
void | nand_flash_spare_scheme_read_bad_block_marker (const struct nand_flash_spare_scheme *scheme, const uint8_t *spare, uint8_t *marker) |
Read the bad block marker inside a spare area buffer using the given scheme. More... | |
void | nand_flash_spare_scheme_read_ecc (const struct nand_flash_spare_scheme *scheme, const uint8_t *spare, uint8_t *ecc) |
Read ECC information from a spare area using the given scheme. More... | |
void | nand_flash_spare_scheme_read_extra (const struct nand_flash_spare_scheme *scheme, const uint8_t *spare, void *extra, uint8_t size, uint8_t offset) |
Read extra bytes of information from a spare area, using the given scheme. More... | |
void | nand_flash_spare_scheme_write_bad_block_marker (const struct nand_flash_spare_scheme *scheme, uint8_t *spare, uint8_t marker) |
Modify the bad block marker inside a spare area, using the given scheme. More... | |
void | nand_flash_spare_scheme_write_ecc (const struct nand_flash_spare_scheme *scheme, uint8_t *spare, const uint8_t *ecc) |
Write ECC information in a spare area, using the given scheme. More... | |
void | nand_flash_spare_scheme_write_extra (const struct nand_flash_spare_scheme *scheme, uint8_t *spare, const void *extra, uint8_t size, uint8_t offset) |
Write extra bytes of information from a spare area, using the given scheme. More... | |
void nand_flash_spare_scheme_read_bad_block_marker | ( | const struct nand_flash_spare_scheme * | scheme, |
const uint8_t * | spare, | ||
uint8_t * | marker | ||
) |
Read the bad block marker inside a spare area buffer using the given scheme.
scheme | Pointer to a nand_flash_spare_scheme instance. |
spare | Spare area buffer. |
marker | Pointer to the variable to store the bad block marker. |
References nand_flash_spare_scheme::bad_block_marker_position.
void nand_flash_spare_scheme_read_ecc | ( | const struct nand_flash_spare_scheme * | scheme, |
const uint8_t * | spare, | ||
uint8_t * | ecc | ||
) |
Read ECC information from a spare area using the given scheme.
scheme | Pointer to a nand_flash_spare_scheme instance. |
spare | Spare area buffer. |
ecc | ECC buffer. |
References nand_flash_spare_scheme::ecc_byte_number, and nand_flash_spare_scheme::ecc_bytes_positions.
Referenced by nand_flash_ecc_read_page().
void nand_flash_spare_scheme_read_extra | ( | const struct nand_flash_spare_scheme * | scheme, |
const uint8_t * | spare, | ||
void * | extra, | ||
uint8_t | size, | ||
uint8_t | offset | ||
) |
Read extra bytes of information from a spare area, using the given scheme.
scheme | Pointer to a nand_flash_spare_scheme instance. |
spare | Spare area buffer. |
extra | Extra bytes buffer. |
size | Number of extra bytes to read. |
offset | Index where to read the first extra byte. |
References Assert, nand_flash_spare_scheme::extra_byte_number, nand_flash_spare_scheme::extra_bytes_positions, and offset.
void nand_flash_spare_scheme_write_bad_block_marker | ( | const struct nand_flash_spare_scheme * | scheme, |
uint8_t * | spare, | ||
uint8_t | marker | ||
) |
Modify the bad block marker inside a spare area, using the given scheme.
scheme | Pointer to a nand_flash_spare_scheme instance. |
spare | Spare area buffer. |
marker | Bad block marker to write. |
References nand_flash_spare_scheme::bad_block_marker_position.
void nand_flash_spare_scheme_write_ecc | ( | const struct nand_flash_spare_scheme * | scheme, |
uint8_t * | spare, | ||
const uint8_t * | ecc | ||
) |
Write ECC information in a spare area, using the given scheme.
scheme | Pointer to a nand_flash_spare_scheme instance. |
spare | Spare area buffer. |
ecc | ECC buffer. |
References nand_flash_spare_scheme::ecc_byte_number, and nand_flash_spare_scheme::ecc_bytes_positions.
Referenced by nand_flash_ecc_write_page().
void nand_flash_spare_scheme_write_extra | ( | const struct nand_flash_spare_scheme * | scheme, |
uint8_t * | spare, | ||
const void * | extra, | ||
uint8_t | size, | ||
uint8_t | offset | ||
) |
Write extra bytes of information from a spare area, using the given scheme.
scheme | Pointer to a nand_flash_spare_scheme instance. |
spare | Spare area buffer. |
extra | Extra bytes buffer to write. |
size | Number of extra bytes to write. |
offset | Index where to read the first extra byte. |
References Assert, nand_flash_spare_scheme::extra_byte_number, nand_flash_spare_scheme::extra_bytes_positions, and offset.
struct nand_flash_spare_scheme nand_flash_spare_scheme_2048 |
struct nand_flash_spare_scheme nand_flash_spare_scheme_256 |
struct nand_flash_spare_scheme nand_flash_spare_scheme_4096 |
struct nand_flash_spare_scheme nand_flash_spare_scheme_512 |