diff --git a/firmware/filesystem/Makefile b/firmware/filesystem/Makefile index 20e6137..76b2d19 100644 --- a/firmware/filesystem/Makefile +++ b/firmware/filesystem/Makefile @@ -12,7 +12,6 @@ OBJS += at45db041d.o OBJS += util.o OBJS += select.o OBJS += execute.o -OBJS += format.o LIBNAME=fat diff --git a/firmware/filesystem/format.c b/firmware/filesystem/format.c deleted file mode 100644 index 7535b51..0000000 --- a/firmware/filesystem/format.c +++ /dev/null @@ -1,55 +0,0 @@ -#include - -#include "basic/basic.h" -#include "basic/config.h" - -#include "usb/usbmsc.h" - -#include "lcd/print.h" - -#include "funk/nrf24l01p.h" -#include "funk/mesh.h" -#include "filesystem/at45db041d.h" - -uint8_t init1[] = {0xeb, 0xfe, 0x90, 0x4d, 0x53, 0x44, 0x4f, 0x53, - 0x35, 0x2e, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00, - 0x01, 0x00, 0x02, 0x00, 0x04, 0xf0, 0x04, 0x00, - 0x3f, 0x00, 0xff}; - -uint8_t init2[] = {0x80, 0x00, 0x29, 0x37, - 0x4b, 0x55, 0x33, 0x4e, 0x4f, 0x20, 0x4e, 0x41, - 0x4d, 0x45, 0x20, 0x20, 0x20, 0x20, 0x46, 0x41, - 0x54, 0x20, 0x20, 0x20, 0x20, 0x20}; - - - -void format_formatDF(void) -{ - int i; - char buf[512]; - - //dataflash_initialize(); - //delayms(100); - - for(i=0; i< 512; i++) buf[i] = 0x00; - - //for(i=0; i<1024; i++) - // dataflash_write(buf, i, 1); - memcpy(buf, init1, sizeof(init1)); - memcpy(buf+0x24, init2, sizeof(init2)); - - buf[510] = 0x55; - buf[511] = 0xaa; - //memcpy(buf+510, "\x55\xaa", 2); - - dataflash_write(buf, 0, 1); - - for(i=0; i< 512; i++) buf[i] = 0x00; - - buf[0] = 0xf0; - buf[1] = 0xff; - buf[2] = 0xff; - dataflash_write(buf, 1, 1); - -} - diff --git a/firmware/filesystem/format.h b/firmware/filesystem/format.h deleted file mode 100644 index 902f57a..0000000 --- a/firmware/filesystem/format.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __FORMAT_H_ -#define __FORMAT_H_ - -void format_formatDF(void); - -#endif diff --git a/firmware/filesystem/util.c b/firmware/filesystem/util.c index b8d0ee9..52529a4 100644 --- a/firmware/filesystem/util.c +++ b/firmware/filesystem/util.c @@ -19,6 +19,35 @@ const char* f_get_rc_string (FRESULT rc) { return p; } +const uint8_t init1[] = {0xeb, 0xfe, 0x90, 0x4d, 0x53, 0x44, 0x4f, 0x53, + 0x35, 0x2e, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x04, 0xf0, 0x04, 0x00, + 0x3f, 0x00, 0xff}; + +const uint8_t init2[] = {0x80, 0x00, 0x29, 0x37, + 0x4b, 0x55, 0x33, 0x4e, 0x4f, 0x20, 0x4e, 0x41, + 0x4d, 0x45, 0x20, 0x20, 0x20, 0x20, 0x46, 0x41, + 0x54, 0x20, 0x20, 0x20, 0x20, 0x20}; + +inline void format_formatDF(void) +{ + int i; + char buf[512]; + + memset(buf, 0, 512); + memcpy(buf, init1, sizeof(init1)); + memcpy(buf+0x24, init2, sizeof(init2)); + buf[510] = 0x55; + buf[511] = 0xaa; + dataflash_write(buf, 0, 1); + + for(i=0; i< 512; i++) buf[i] = 0x00; + buf[0] = 0xf0; + buf[1] = 0xff; + buf[2] = 0xff; + dataflash_write(buf, 1, 1); +} + void fsInit(){ FRESULT i;