Description
Source
Call Graph
Start Line: 149
int main(void)
{
EmbeddedFileSystem efs;
EmbeddedFile file_r;
EmbeddedFile file_w;
unsigned short e;
char buf[512];
unsigned int i;
unsigned int status;
DirList list;
TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK);
printf("-- Basic Fat EFSL Project %s --\n\r", SOFTPACK_VERSION);
printf("-- %s\n\r", BOARD_NAME);
printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
printf("-I- FAT init\n\r");
if( efs_init(&efs, 0) != 0 ){
printf("-I- Could not init filesystem.\n\r");
fs_initCurrentDir(&efs.myFs);
printf("-I- creating an empty filesystem\n\r");
if( mkfs_makevfat(&efs.myPart) == 0 ) {
printf("-I- Filesystem is created\n\r");
}
else {
printf("-E- Problem for creating filesystem\n\r");
}
}
printf("-I- creating a file\n\r");
for( i=0; i<512; i++) {
buf[i]=i;
}
status = file_fwrite((File *)"orig.txt", 0, 512, buf);
printf("-I- Bytes actually written = %d\n\r", status);
if( file_fopen( &file_r, &efs.myFs, "orig.txt", 'r' ) != 0 ) {
printf("-E- Could not open file orig.txt\n\r");
while(1);
}
if( file_fopen( &file_w, &efs.myFs, "copy.txt", 'w' ) != 0 ) {
printf("-E- Could not open file copy.txt\n\r");
while(1);
}
e = 0x1;
while( e != 0 ) {
e = file_read( &file_r, 512, (euint8*)buf );
file_write( &file_w, e, (euint8*)buf );
}
file_fclose(&file_r);
file_fclose(&file_w);
fs_umount(&efs.myFs);
printf("End test\n\r");
return 0;
}