* we use a kfile_test module that perform some generic test.
*
*
- * \version $Id$
* \author Daniele Basile <asterix@develer.com>
*/
#include "hw/hw_dataflash.h"
#include "cfg/cfg_dataflash.h"
-#include "cfg/cfg_kern.h"
+#include "cfg/cfg_proc.h"
#include <cfg/test.h>
#include <cfg/debug.h>
#include <drv/dataflash.h>
#include <kern/proc.h>
-#include <kern/kfile.h>
+#include <io/kfile.h>
#include <string.h>
#define DATAFLASH_MEM_MODEL DFT_AT45DB642D
// Function to set CS, this is typically implement in hw/hw_dataflash.{c, h}
-#define DATAFLASH_FUNC_CS_SET &dataflash_hw_setCS
+#define DATAFLASH_FUNC_CS_SET dataflash_hw_setCS
// Function to reset memery, this is typically implement in hw/hw_dataflash.{c, h}
#define DATAFLASH_FUNC_RESET NULL
* Setup all needed to test dataflash memory
*
*/
-int dataflash_testSetUp(void)
+int dataflash_testSetup(void)
{
- kfile_testSetUp();
+ kfile_testSetup();
LOG_INFO("KFILE setup..ok\n");
LOG_INFO("Check if kernel is enable (if enable you should see the assert message.)\n");
* Init SPI module and dataflash driver.
*/
// Open SPI comunication channel
- spimaster_init(&spi_fd, CONFIG_SPI_PORT);
+ spimaster_init(&spi_fd, 0);
LOG_INFO("SPI0 init..ok\n");
- ser_setbaudrate(&spi_fd, CONFIG_SPI_BAUDRATE);
+ ser_setbaudrate(&spi_fd, 5000000UL);
LOG_INFO("SPI0 set baudrate..ok\n");
//Init dataflash memory
LOG_INFO("Run KFILE test.\n");
SILENT_ASSERT("bertos/drv/dataflash.c:405: Assertion failed: fd->fd.seek_pos + size <= fd->fd.size");
- if (kfile_testRun(&dflash_fd.fd, test_buf, save_buf, sizeof(test_buf)) != EOF)
+ if (kfile_testRunGeneric(&dflash_fd.fd, test_buf, save_buf, sizeof(test_buf)) != EOF)
{
LOG_INFO("KFILE test..ok\n");
}
#if 0
int main(void)
{
- IRQ_ENABLE;
+ IRQ_ENABLE;
kdbg_init();
#if CONFIG_KERN
- proc_init();
- #endif
-
- if (!dataflash_testSetUp())
- {
- LOG_INFO("DATAFLASH setup..ok\n");
- }
- else
- {
- LOG_ERR("DATAFLASH setup..fail!\n");
- return EOF;
- }
-
- dataflash_testRun();
-
- for(;;)
- {
- }
-
+ proc_init();
+ #endif
+
+ if (!dataflash_testSetup())
+ {
+ LOG_INFO("DATAFLASH setup..ok\n");
+ }
+ else
+ {
+ LOG_ERR("DATAFLASH setup..fail!\n");
+ return EOF;
+ }
+
+ dataflash_testRun();
+
+ for(;;)
+ {
+ }
}
#endif