EFR32 Mighty Gecko 13 Software Documentation  efr32mg13-doc-5.1.2
nandflash.h
Go to the documentation of this file.
1 /**************************************************************************/
17 #ifndef __NANDFLASH_H
18 #define __NANDFLASH_H
19 
20 /***************************************************************************/
25 /***************************************************************************/
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define NAND256W3A_SPARESIZE 16
36 /* "Standard" byte positions in the spare area. */
37 #define NAND_SPARE_BADBLOCK_POS 5
38 #define NAND_SPARE_ECC0_POS 6
39 #define NAND_SPARE_ECC1_POS 7
40 #define NAND_SPARE_ECC2_POS 8
43 typedef enum
44 {
54 
56 typedef struct
57 {
58  uint32_t baseAddress;
59  uint8_t manufacturerCode;
60  uint8_t deviceCode;
61  uint32_t deviceSize;
62  uint32_t pageSize;
63  uint32_t spareSize;
64  uint32_t blockSize;
65  uint32_t ecc;
66  uint8_t spare[ NAND256W3A_SPARESIZE ];
67  int dmaCh;
69 
70 bool NANDFLASH_AddressValid(uint32_t addr);
71 int NANDFLASH_CopyPage(uint32_t dstAddr, uint32_t srcAddr);
74 int NANDFLASH_EccCorrect(uint32_t generatedEcc, uint32_t readEcc, uint8_t *data);
75 int NANDFLASH_EraseBlock(uint32_t address);
76 int NANDFLASH_Init(int dmaCh);
77 int NANDFLASH_MarkBadBlock(uint32_t address);
78 int NANDFLASH_ReadPage(uint32_t address, uint8_t *buffer);
79 int NANDFLASH_ReadSpare(uint32_t address, uint8_t *buffer);
80 int NANDFLASH_WritePage(uint32_t address, uint8_t *buffer);
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
89 #endif /* __NANDFLASH_H */
int NANDFLASH_WritePage(uint32_t address, uint8_t *buffer)
Write a page in nand device. The ECC generated while writing the page data is written in the spare ar...
Definition: nandflash.c:646
int NANDFLASH_MarkBadBlock(uint32_t address)
Mark a block as bad.
Definition: nandflash.c:442
uint8_t manufacturerCode
Definition: nandflash.h:59
int NANDFLASH_CopyPage(uint32_t dstAddr, uint32_t srcAddr)
Copy a page within the device to a new location.
Definition: nandflash.c:188
int NANDFLASH_ReadSpare(uint32_t address, uint8_t *buffer)
Read the spare area content of a page.
Definition: nandflash.c:581
int NANDFLASH_Init(int dmaCh)
Initialize the NANDFLASH module.
Definition: nandflash.c:407
int NANDFLASH_EccCorrect(uint32_t generatedEcc, uint32_t readEcc, uint8_t *data)
Check generated ECC against ECC read from device and correct data if possible.
Definition: nandflash.c:275
NANDFLASH_Info_TypeDef * NANDFLASH_DeviceInfo(void)
Return a pointer to a NANDFLASH_Info_TypeDef structure, which contain vital nand flash device informa...
Definition: nandflash.c:248
NANDFLASH device information structure.
Definition: nandflash.h:56
NANDFLASH_Status_TypeDef
NANDFLASH status enumerator.
Definition: nandflash.h:43
#define NAND256W3A_SPARESIZE
Definition: nandflash.h:34
int NANDFLASH_ReadPage(uint32_t address, uint8_t *buffer)
Read a page from nand device. Ecc errors will be detected and corrected if possible. NANDFLASH_Info_TypeDef::ecc will be set to the ecc generated while reading the page data. NANDFLASH_Info_TypeDef::spare will be set to the content of the page spare area.
Definition: nandflash.c:500
int NANDFLASH_EraseBlock(uint32_t address)
Erase a block in the nand flash.
Definition: nandflash.c:353
bool NANDFLASH_AddressValid(uint32_t addr)
Check if an address is valid for the nand flash device.
Definition: nandflash.c:156