Microchip® Advanced Software Framework

nf.c File Reference
#include "compiler.h"
#include "conf_nf.h"
#include "nf.h"
#include "gpio.h"
#include "smc.h"

Macros

#define _NF_C_
 

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_init (U32 page_addr)
 Prepare a copy-back session. More...
 
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_protect (void)
 Protect all the flashes. More...
 
U32 nf_read_id (U8 read_id_cmd, U8 nf_num)
 Read the ID of the Nand-Flash. More...
 
void nf_reset_nands (U8 nb_dev)
 Reset all the NF devices. More...
 
void nf_unprotect (void)
 unprotect all the flashes More...
 
void nf_wait_busy (void)
 Tests the true busy. More...
 
U8 nfc_detect (void)
 Read the ID of the Nand-Flash and update the global variable. More...
 
static bool nfc_nf_is_ready (void)
 Check the status Ready/Busy of the Nand Flash. More...
 
void nfc_read_spare_byte (U8 _MEM_TYPE_SLOW_ *p_byte, U8 n_byte, U32 page_addr)
 Reads the number spare bytes specified and stores them in a array. More...
 

#define _NF_C_

static bool nfc_nf_is_ready ( void  )
static

Check the status Ready/Busy of the Nand Flash.

Returns
bool true -> The Nand Flash is ready and connected false -> The Nand Flash must be no connected (timeout)

Referenced by nfc_detect().

void nfc_read_spare_byte ( U8 _MEM_TYPE_SLOW_ p_byte,
U8  n_byte,
U32  page_addr 
)

Reads the number spare bytes specified and stores them in a array.

Parameters
p_bytepointer on the array in which are stored the spare bytes.
n_bytenumber of spare bytes to read.
page_addrabsolute page address of the block.
Precondition
nf_init() should have been called before. The NF device should have been selected before with nf_select( id ).

References i, nf_open_page_read(), nf_rd_data(), and NF_SPARE_POS.