flash25_hwtest.c

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