*
*/
-#include <kfile.h>
+#include <kern/kfile.h>
+#include <cfg/debug.h>
-#inclede <appconfig.h>
+#include <string.h>
/**
/**
* Test for program memory read/write.
+ * This function write and read \p test_buf long \p _size
+ * on \p fd handler. If you want not overwrite exist data
+ * you should pass an \p save_buf where test store exist data,
+ * otherwise su must pass NULL.
+ *
+ * \note some device (like flash memeory) not allow write on
+ * existing data, and so this test use ASSERT macro to warn you if
+ * you are writing on same fd.seek_pos.
+ *
*/
-bool kfile_test(uint8_t *buf, size_t _size , uint8_t *save_buf, size_t * save_buf_size)
+bool kfile_test(uint8_t *test_buf, size_t _size , uint8_t *save_buf, size_t save_buf_size)
{
KFile fd;
int32_t size = _size;
*/
int32_t len = size/2;
- /*
- * Fill in test buffer
- */
- for (int i = 0; i < size; i++)
- test_buf[i] = (i & 0xff);
-
- kprintf("Generated test string..\n");
-
/*
* Open fd handler
*/
/*
* Test flash read/write to address 0..size
*/
- if (!Kfile_rwTest(&fd, test_buf, size))
+ if (!kfile_rwTest(&fd, test_buf, size))
goto kfile_test_end;
kprintf("Test 1: ok!\n");
/*
* Test flash read/write to address FLASHEND/2 ... FLASHEND/2 + size
*/
- if (!Kfile_rwTest(&fd, test_buf, size))
+ if (!kfile_rwTest(&fd, test_buf, size))
goto kfile_test_end;
kprintf("Test 2: ok!\n");
/*
* Test flash read/write to address (FLASHEND - size) ... FLASHEND
*/
- if (!Kfile_rwTest(&fd, test_buf, size))
+ if (!kfile_rwTest(&fd, test_buf, size))
goto kfile_test_end;
kprintf("Test 3: ok !\n");
return false;
}
-#endif /* CONFIG_TEST */
\ No newline at end of file
+#endif /* CONFIG_TEST */