Add write test
This commit is contained in:
parent
a2256acd94
commit
bea543269e
33
main.c
33
main.c
@ -22,11 +22,15 @@ volatile uint32_t sdio_wait;
|
|||||||
|
|
||||||
int initreq = 0xFF;
|
int initreq = 0xFF;
|
||||||
|
|
||||||
int main() {
|
//const char *write_string = "This is a write test. Okay... Writing seems to work. Let's close the file\n";
|
||||||
char buff[1024];
|
|
||||||
|
char buff[8192*6];
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
FILINFO fno;
|
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;
|
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
||||||
__DSB();
|
__DSB();
|
||||||
@ -41,24 +45,17 @@ int main() {
|
|||||||
initreq = f_mount(&SDfs, "0:/", 1);
|
initreq = f_mount(&SDfs, "0:/", 1);
|
||||||
while(initreq);
|
while(initreq);
|
||||||
|
|
||||||
initreq = f_opendir(&root, "/");
|
for (i = 0; i < 8192*6; i++)
|
||||||
if (initreq == FR_OK) {
|
buff[i] = 'A';
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
initreq = f_open(&file, "foo.txt", FA_OPEN_APPEND | FA_WRITE);
|
initreq = f_open(&file, "foo.txt", FA_OPEN_APPEND | FA_WRITE);
|
||||||
if (initreq == FR_OK) {
|
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);
|
initreq = f_close(&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user