X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fdataflash.h;h=90dac59c52768bee88394ec12804fdc375556d75;hb=00a373a2b0382bcf9fe234db2964eb75a0cd2a5d;hp=923b9ec3bd3329d7c04ab2c231b184afe2e90b9d;hpb=a625fd2523a0c960351f124baa7cd5c3c69c3272;p=bertos.git diff --git a/bertos/drv/dataflash.h b/bertos/drv/dataflash.h index 923b9ec3..90dac59c 100644 --- a/bertos/drv/dataflash.h +++ b/bertos/drv/dataflash.h @@ -30,11 +30,15 @@ * * --> * - * \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 + * + * $WIZ$ module_name = "dataflash" + * $WIZ$ module_depends = "kfile" + * $WIZ$ module_configuration = "bertos/cfg/cfg_dataflash.h" + * $WIZ$ module_hw = "bertos/hw/hw_dataflash.h", "bertos/hw/hw_dataflash.c" */ @@ -43,7 +47,8 @@ #include -#include +#include +#include /** * Type definitions for dflash memory. @@ -81,7 +86,7 @@ typedef enum DataflashType /** * Dataflash KFile context structure. */ -typedef struct KFileDataflash +typedef struct DataFlash { KFile fd; ///< File descriptor. KFile *channel; ///< Dataflash comm channel (usually SPI). @@ -90,7 +95,7 @@ typedef struct KFileDataflash 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. @@ -98,12 +103,12 @@ typedef struct KFileDataflash #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. @@ -181,7 +186,8 @@ typedef struct DataflashInfo } 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 @@ -191,6 +197,8 @@ bool dataflash_init(KFileDataflash *fd, KFile *ch, DataflashType type, dataflash * (see drv/datafalsh_test.c for more detail) */ int dataflash_testSetup(void); +/* For backward compatibility */ +#define dataflash_testSetUp() dataflash_testSetup() int dataflash_testRun(void); int dataflash_testTearDown(void);