1use core::ffi::c_char;
4
5#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)]
6#[repr(transparent)]
7pub struct FRESULT(pub core::ffi::c_uchar);
8
9impl FRESULT {
10 pub const FR_OK: Self = Self(0);
11 pub const FR_DISK_ERR: Self = Self(1);
12 pub const FR_INT_ERR: Self = Self(2);
13 pub const FR_NOT_READY: Self = Self(3);
14 pub const FR_NO_FILE: Self = Self(4);
15 pub const FR_NO_PATH: Self = Self(5);
16 pub const FR_INVALID_NAME: Self = Self(6);
17 pub const FR_DENIED: Self = Self(7);
18 pub const FR_EXIST: Self = Self(8);
19 pub const FR_INVALID_OBJECT: Self = Self(9);
20 pub const FR_WRITE_PROTECTED: Self = Self(10);
21 pub const FR_INVALID_DRIVE: Self = Self(11);
22 pub const FR_NOT_ENABLED: Self = Self(12);
23 pub const FR_NO_FILESYSTEM: Self = Self(13);
24 pub const FR_MKFS_ABORTED: Self = Self(14);
25 pub const FR_TIMEOUT: Self = Self(15);
26 pub const FR_LOCKED: Self = Self(16);
27 pub const FR_NOT_ENOUGH_CORE: Self = Self(17);
28 pub const FR_TOO_MANY_OPEN_FILES: Self = Self(18);
29 pub const FR_INVALID_PARAMETER: Self = Self(19);
30}
31pub type FIL = core::ffi::c_void;
32
33unsafe extern "system" {
34 pub fn vexFileMountSD() -> FRESULT;
35 pub fn vexFileDirectoryGet(path: *const c_char, buffer: *mut c_char, len: u32) -> FRESULT;
36 pub fn vexFileOpen(filename: *const c_char, mode: *const c_char) -> *mut FIL;
37 pub fn vexFileOpenWrite(filename: *const c_char) -> *mut FIL;
38 pub fn vexFileOpenCreate(filename: *const c_char) -> *mut FIL;
39 pub fn vexFileClose(fdp: *mut FIL);
40 pub fn vexFileWrite(buf: *mut c_char, size: u32, nItems: u32, fdp: *mut FIL) -> i32;
41 pub fn vexFileSize(fdp: *mut FIL) -> i32;
42 pub fn vexFileSeek(fdp: *mut FIL, offset: u32, whence: i32) -> FRESULT;
43 pub fn vexFileRead(buf: *mut c_char, size: u32, nItems: u32, fdp: *mut FIL) -> i32;
44 pub fn vexFileDriveStatus(drive: u32) -> bool;
45 pub fn vexFileTell(fdp: *mut FIL) -> i32;
46 pub fn vexFileSync(fdp: *mut FIL);
47 pub fn vexFileStatus(filename: *const c_char) -> u32;
48}