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