Microchip® Advanced Software Framework

nand_flash_spare_scheme.c File Reference

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.

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...
 

Variables

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
 

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.

Parameters
schemePointer to a nand_flash_spare_scheme instance.
spareSpare area buffer.
markerPointer 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.

Parameters
schemePointer to a nand_flash_spare_scheme instance.
spareSpare area buffer.
eccECC 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.

Parameters
schemePointer to a nand_flash_spare_scheme instance.
spareSpare area buffer.
extraExtra bytes buffer.
sizeNumber of extra bytes to read.
offsetIndex where to read the first extra byte.

References Assert, nand_flash_spare_scheme::extra_byte_number, and nand_flash_spare_scheme::extra_bytes_positions.

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.

Parameters
schemePointer to a nand_flash_spare_scheme instance.
spareSpare area buffer.
markerBad 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.

Parameters
schemePointer to a nand_flash_spare_scheme instance.
spareSpare area buffer.
eccECC 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.

Parameters
schemePointer to a nand_flash_spare_scheme instance.
spareSpare area buffer.
extraExtra bytes buffer to write.
sizeNumber of extra bytes to write.
offsetIndex where to read the first extra byte.

References Assert, nand_flash_spare_scheme::extra_byte_number, and nand_flash_spare_scheme::extra_bytes_positions.

struct nand_flash_spare_scheme nand_flash_spare_scheme_2048
Initial value:
= {
0,
24,
{40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63},
38,
{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}
}
struct nand_flash_spare_scheme nand_flash_spare_scheme_256
Initial value:
= {
5,
3,
{0, 1, 2},
4,
{3, 4, 6, 7}
}
struct nand_flash_spare_scheme nand_flash_spare_scheme_4096
Initial value:
= {
0,
48,
{80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
127},
78,
{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79}
}
struct nand_flash_spare_scheme nand_flash_spare_scheme_512
Initial value:
= {
5,
6,
{0, 1, 2, 3, 6, 7},
8,
{8, 9, 10, 11, 12, 13, 14, 15}
}