From bea543269eeae84dd56aff7a77c7728fa461a625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Wed, 26 Feb 2020 23:51:51 +0100 Subject: [PATCH] Add write test --- main.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/main.c b/main.c index 95eb545..715369a 100644 --- a/main.c +++ b/main.c @@ -22,11 +22,15 @@ volatile uint32_t sdio_wait; int initreq = 0xFF; -int main() { - char buff[1024]; +//const char *write_string = "This is a write test. Okay... Writing seems to work. Let's close the file\n"; + +char buff[8192*6]; + +int main() +{ + int i; char *name; FILINFO fno; - char *write_string = "This is a write test. Okay... Writing seems to work. Let's close the file\n"; RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN; __DSB(); @@ -41,24 +45,17 @@ int main() { initreq = f_mount(&SDfs, "0:/", 1); while(initreq); - initreq = f_opendir(&root, "/"); - if (initreq == FR_OK) { - if (!f_readdir(&root, &fno)) - { - name = fno.fname; - initreq = f_open(&file, name, FA_READ); - if (initreq == FR_OK) { - f_gets(buff, sizeof(buff), &file); - printf("%s:\r\n%s\r\n",name, buff); - f_close(&file); - } - - } - } + for (i = 0; i < 8192*6; i++) + buff[i] = 'A'; initreq = f_open(&file, "foo.txt", FA_OPEN_APPEND | FA_WRITE); if (initreq == FR_OK) { - initreq = f_write(&file, write_string, strlen(write_string), NULL); + for (i = 0; i < 100; i++) { + initreq = f_write(&file, buff, 8192*6, NULL); + if (initreq) { + initreq++; + } + } initreq = f_close(&file); }