*
* -->
*
- * \brief Function library for dataflash AT45DB family (interface).
+ * \brief Function library for dataflash AT45DB family.
*
* \version $Id: dataflash.h 21658 2008-06-05 16:42:54Z asterix $
*
* \author Daniele Basile <asterix@develer.com>
+ *
+ * $WIZ$ module_name = "dataflash"
+ * $WIZ$ module_depends = "kfile"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_dataflash.h"
+ * }
*/
#include <cfg/compiler.h>
#include <kern/kfile.h>
+#include <fs/battfs.h>
/**
* Type definitions for dflash memory.
/**
* Dataflash KFile context structure.
*/
-typedef struct KFileDataflash
+typedef struct DataFlash
{
KFile fd; ///< File descriptor.
KFile *channel; ///< Dataflash comm channel (usually SPI).
bool page_dirty; ///< True if current_page is dirty (needs to be flushed).
dataflash_setReset_t *setReset; ///< Callback used to set reset pin of dataflash.
dataflash_setCS_t *setCS; ///< Callback used to set CS pin of dataflash.
-} KFileDataflash;
+} DataFlash;
/**
* ID for dataflash.
#define KFT_DATAFLASH MAKE_ID('D', 'F', 'L', 'H')
/**
- * Convert + ASSERT from generic KFile to KFileDataflash.
+ * Convert + ASSERT from generic KFile to DataFlash.
*/
-INLINE KFileDataflash * KFILEDATAFLASH(KFile *fd)
+INLINE DataFlash * DATAFLASH_CAST(KFile *fd)
{
ASSERT(fd->_type == KFT_DATAFLASH);
- return (KFileDataflash *)fd;
+ return (DataFlash *)fd;
}
#define RESET_PULSE_WIDTH 10 ///< Width of reset pulse in usec.
} DataflashInfo;
-bool dataflash_init(KFileDataflash *fd, KFile *ch, DataflashType type, dataflash_setCS_t *setCS, dataflash_setReset_t *setReset);
+bool dataflash_init(DataFlash *fd, KFile *ch, DataflashType type, dataflash_setCS_t *setCS, dataflash_setReset_t *setReset);
+bool dataflash_diskInit(struct BattFsSuper *d, DataFlash *fd, pgcnt_t *page_array);
/**
* To test data falsh drive you could use
*
* (see drv/datafalsh_test.c for more detail)
*/
-int dataflash_testSetup(void);
+int dataflash_testSetUp(void);
int dataflash_testRun(void);
int dataflash_testTearDown(void);