Initial Commit

This commit is contained in:
ikari
2009-07-02 11:14:04 +02:00
commit e121b34cf4
60 changed files with 9256 additions and 0 deletions

31
src/fileops.c Normal file
View File

@@ -0,0 +1,31 @@
// insert cool lenghty disclaimer here
// fileops.c: fatfs wrapping for convenience
#include "config.h"
#include "uart.h"
#include "ff.h"
#include "fileops.h"
void file_init() {
f_mount(0, &fatfs);
}
void file_open(char* filename, BYTE flags) {
file_res = f_open(&file_handle, filename, flags);
}
void file_close() {
file_res = f_close(&file_handle);
}
UINT file_read() {
UINT bytes_read;
file_res = f_read(&file_handle, file_buf, sizeof(file_buf), &bytes_read);
return bytes_read;
}
UINT file_write() {
UINT bytes_written;
file_res = f_write(&file_handle, file_buf, sizeof(file_buf), &bytes_written);
return bytes_written;
}