BeRTOS
flash25_hwtest.c
Go to the documentation of this file.
00001 
00045 #include <io/kfile.h>
00046 
00047 #include <drv/flash25.h>
00048 
00049 #include <cfg/debug.h>
00050 
00051 #warning FIXME:Review and refactor this test..
00052 
00053 bool flash25_test(KFile *channel)
00054 {
00055     Flash25 fd;
00056     uint8_t test_buf[256];
00057 
00058     /*
00059      * Init a spi kfile interface and
00060      * flash driver.
00061      */
00062     flash25_init(&fd, channel);
00063 
00064     kprintf("Init serial flash\n");
00065 
00066     flash25_chipErase(&fd);
00067 
00068     flash25_sectorErase(&fd, FLASH25_SECT1);
00069     flash25_sectorErase(&fd, FLASH25_SECT2);
00070     flash25_sectorErase(&fd, FLASH25_SECT3);
00071     flash25_sectorErase(&fd, FLASH25_SECT4);
00072 
00073     /*
00074      * Launche a kfile test interface.
00075      */
00076     kprintf("Kfile test start..\n");
00077     if (!kfile_testRunGeneric(&fd.fd, test_buf, NULL, sizeof(test_buf)))
00078         return false;
00079 
00080     return true;
00081 }
00082 
00083