#include "conf_nf.h"
#include "board.h"
#include "gpio.h"
#include "ecchrs.h"
#include "nf.h"
#include "nf_512B.h"
#include "nf_2KB.h"
Data Structures | |
struct | St_nf_conf |
struct | St_nf_id |
struct | St_nf_link_id_block |
Macros | |
#define | _GLOBEXT_ extern |
#define | AVR32_EBI_NAND_FLASH_ADDRESS AVR32_EBI_CS3_ADDRESS |
#define | G_CACHE_PROG (NF_CACHE_PROGRAM) |
#define | G_CE_LOW (NF_CE_LOW) |
#define | G_CLK_DFC_NFC (CLK_DFC_NFC) |
#define | G_COPY_BACK_CONT (NF_COPYBACK_CONT) |
#define | G_COPY_BACK_DISCONT (NF_COPYBACK_DISCONT) |
#define | G_DEV_ID (NF_DEV_ID) |
#define | G_DEV_MAKER (NF_DEV_MAKER) |
#define | G_N_BLOCKS (NF_N_BLOCKS) |
#define | G_N_ROW_CYCLES (NF_N_ROW_CYCLES) |
#define | G_N_ZONES (NF_N_ZONES) |
#define | G_OFST_BLK_STATUS 0 |
#define | G_PROTECT_DEV (NF_PROTECTED_DEVICES) |
#define | G_SHIFT_BLOCK_PAGE (NF_SHIFT_BLOCK_PAGE) |
#define | G_SHIFT_PAGE_BYTE (NF_SHIFT_PAGE_BYTE) |
#define | Is_nf_2k() ( true ) |
#define | Is_nf_512() ( false ) |
#define | Is_not_nf_2k() ( false ) |
#define | Is_not_nf_512() ( true ) |
#define | M_ID_HYNIX 0xAD |
#define | M_ID_INFINEON 0xC1 |
#define | M_ID_MICRON 0x2C |
Resets the configuration state machine of the NFC. More... | |
#define | M_ID_SAMSUNG 0xEC |
#define | M_ID_SANDISK 0x98 |
#define | M_ID_ST 0x20 |
#define | M_ID_TOSHIBA 0x98 |
#define | M_ID_TOSHIBA96 0x96 |
#define | NF_BAD_CONFIG false |
#define | NF_BLOCK_ERASE_CMD 0x60 |
Erase command. More... | |
#define | NF_BLOCK_ERASE_CONFIRM_CMD 0xD0 |
Confirm erase command. More... | |
#define | NF_CACHE_PROGRAM_CMD 0x15 |
Cache program (fast) command (2KB) More... | |
#define | NF_COPY_BACK_CMD 0x35 |
Copy-back command (2KB) More... | |
#define | NF_DETECTION_ID (DISABLE) |
#define | nf_force_CE() |
#define | NF_GENERIC_DRIVER false |
#define | NF_MASK_STATUS_FAIL (1<<0) |
Fail. More... | |
#define | NF_MASK_STATUS_READY (1<<6) |
Ready. More... | |
#define | NF_MASK_STATUS_T_RDY_2KB (1<<5) |
True Ready. More... | |
#define | NF_MASK_STATUS_T_RDY_512B (1<<6) |
True Ready. More... | |
#define | NF_MAX_DEVICES 4 |
#define | NF_N_GOOD_STATIC_BLOCK 32 |
#define | Nf_open_page_read(page_addr, byte_addr) |
Opens a page for read. More... | |
#define | Nf_open_page_write(page_addr, byte_addr) |
Opens a page for write. More... | |
#define | NF_PAGE_PROGRAM_CMD 0x10 |
Page Program command. More... | |
#define | NF_RANDOM_DATA_INPUT_CMD 0x85 |
Random data input command (2KB) More... | |
#define | NF_RANDOM_READ_CMD_C1 0x05 |
Random read Command (2KB) More... | |
#define | NF_RANDOM_READ_CMD_C2 0xE0 |
Confirm random read Command (2KB) More... | |
#define | NF_READ_A_AREA_CMD 0x00 |
Read Command of zone A (512B) More... | |
#define | NF_READ_B_AREA_CMD 0x01 |
Read Command of zone B (512B) More... | |
#define | NF_READ_C_AREA_CMD 0x50 |
Read Command of zone C (spare) (512B) More... | |
#define | NF_READ_CMD 0x00 |
Read Command (2KB) More... | |
#define | NF_READ_CMD2 0x30 |
Confirm read Command (2KB) More... | |
#define | NF_READ_ID2_CMD 0x91 |
Read ID 2 Command. More... | |
#define | NF_READ_ID_CMD 0x90 |
Read ID Command. More... | |
#define | NF_READ_STATUS_CMD 0x70 |
Read Status command. More... | |
#define | NF_RESET_CMD 0xff |
Reset command. More... | |
#define | NF_SEQUENTIAL_DATA_INPUT_CMD 0x80 |
Sequential data input command. More... | |
#define | NF_SHIFT_SECTOR_BYTE 9 |
#define | NF_SPARE_POS 2048 |
#define | nf_unforce_CE() |
#define | Nf_wait_cache_busy() |
Macro that tests the cache busy. More... | |
#define | NFC_BLK_ID_DATA 0xFF |
#define | NFC_BLK_ID_FBB 0xB4 |
#define | NFC_BLK_ID_QUARANTINE 0x8D |
#define | NFC_BLK_ID_RCV 0x72 |
#define | NFC_BLK_ID_SUBLUT 0xE8 |
#define | NFC_BLK_ID_SYSTEM 0x39 |
#define | NFC_OFST_3_DATA_DST 0xFF |
#define | NFC_OFST_3_DATA_SRC 0x00 |
#define | NFC_OFST_4_FBB_DRIVER_RELEASE 0x01 |
#define | NFC_OFST_6_FBB_INVALID 0 |
#define | NFC_OFST_6_FBB_VALID 0xFF |
#define | NFC_SPARE_DATA_INVALID 0 |
#define | NFC_SPARE_DATA_VALID 0xFF |
#define | NFC_SPARE_OFST_1_BLK_ID 1 |
#define | NFC_SPARE_OFST_2_BYTE_2 2 |
#define | NFC_SPARE_OFST_3_BYTE_3 3 |
#define | NFC_SPARE_OFST_4_BYTE_4 4 |
#define | NFC_SPARE_OFST_6_LBA 6 |
#define | NFC_SPARE_OFST_ECC1 13 |
#define | NFC_SPARE_OFST_ECC2 8 |
#define | NFC_SPARE_OFST_EXPORT 11 |
#define | SIZE_BLOCK_PAGE ((U8)1<<G_SHIFT_BLOCK_PAGE) |
#define | SIZE_PAGE_BYTE ((U16)1<<G_SHIFT_PAGE_BYTE) |
#define | SIZE_PAGE_SECTOR ((U8)1<<(G_SHIFT_PAGE_BYTE - S_SHIFT_SECTOR_BYTE)) |
#define | SIZE_SECTOR_BYTE ((U16)1<<S_SHIFT_SECTOR_BYTE) |
Functions | |
bool | nf_check_status (void) |
Check the status of the selected device. More... | |
U8 | nf_check_type (U8 nb_dev) |
Tests the Nand Flash configuration. More... | |
void | nf_copy_back_conf (U32 page_addr) |
void | nf_copy_back_init (U32 page_addr) |
Prepare a copy-back session. More... | |
U8 | nf_detect (void) |
void | nf_erase_block (U32 page_addr, U8 force_erase) |
Erases a block. More... | |
U8 | nf_get_freq (void) |
returns the frequency supported by the selected NF. More... | |
void | nf_init (U32 hsb_f_hz) |
Initializes the Nand Flash Controller and low level driver. More... | |
void | nf_mark_bad_block (U32 page_addr) |
Mark a block as 'invalid' by clearing it entirely. More... | |
void | nf_open_page_read (U32 page_addr, U16 byte_addr) |
Opens a page for read. More... | |
void | nf_open_page_write (U32 page_addr, U16 byte_addr) |
Opens a page for write. More... | |
void | nf_print_block (U16 block_addr, U8 dev_id) |
void | nf_protect (void) |
Protect all the flashes. More... | |
static __always_inline U8 | nf_rd_data (void) |
Read a data byte from the Nand Flash. More... | |
U32 | nf_read_id (U8 read_id_cmd, U8 nf_num) |
Read the ID of the Nand-Flash. More... | |
void | nf_read_spare_byte (U8 _MEM_TYPE_SLOW_ *p_byte, U8 n_byte, U32 page_addr) |
void | nf_reset_nands (U8 nb_dev) |
Reset all the NF devices. More... | |
static __always_inline void | nf_select (U8 dev) |
Send a command cycle on the last selected Nand Flash. More... | |
static __always_inline void | nf_send_nop (void) |
Ensure that both CLE and ALE are not asserted. More... | |
void | nf_unprotect (void) |
unprotect all the flashes More... | |
void | nf_wait_busy (void) |
Tests the true busy. More... | |
static __always_inline void | nf_wr_addr (U8 addr) |
Send an address cycle on the last selected Nand Flash. More... | |
static __always_inline void | nf_wr_cmd (U8 cmd) |
Send a command cycle on the last selected Nand Flash. More... | |
static __always_inline void | nf_wr_data (U8 data) |
Write a data byte to the Nand Flash. More... | |