bfsAddNorVol()
PROTOTYPE
#include <bfs.h>
void bfsAddNorVol(BfsNorCfg *bfs_cfg);
DESCRIPTION
bfsAddNorVol() registers a NOR volume with TargetBFS. bfs_cfg points to an BfsNorCfg structure that defines the volume to TargetBFS. This structure is defined in “bfs.h” and reproduced below:
typedef struct
{
int (*write_page)(ui32 addr, void *src, void *dev);
int (*read_page)(ui32 addr, void *dst, void *dev);
int (*erase_block)(ui32 addr, void *dev);
void *dev;
} BfsNorCfg;
This structure must be initialized before calling bfsAddNorVol(). write_page, read_page, and erase_block are pointers to three callback functions provided by the driver. These routines are documented elsewhere on this site.
dev is a driver-specific data pointer. The value assigned by the driver is passed back as the last parameter of each driver callback function. It can be used in any way that is convenient for the driver implementation.
EXAMPLE
/***********************************************************************/
/* bfsDriver: TargetBFS-NOR driver */
/* */
/***********************************************************************/
void bfsDriver(void)
{
BfsNorCfg vol;
vol.write_page = write_page;
vol.read_page = read_page;
vol.erase_block = erase_block;
vol.dev = NULL;
bfsAddNorVol(&vol);
}