1use core::mem::size_of;
2
3#[allow(non_snake_case, missing_docs)]
5#[repr(C)]
6pub struct Table {
7 pub identifier: usize,
8 pub delayNop: extern "C" fn(u32),
9 pub getInput: extern "C" fn() -> u8,
10 pub getInputRaw: extern "C" fn() -> u8,
11 pub getInputWait: extern "C" fn() -> u8,
12 pub getInputWaitRelease: extern "C" fn(),
13 pub gpio_clear: extern "C" fn(u32, u32),
14 pub gpio_set: extern "C" fn(u32, u32),
15 pub gpio_toggle: extern "C" fn(u32, u32),
16 pub IntToStr: extern "C" fn(isize, usize, u8) -> *const u8,
17 pub lcdDisplay: extern "C" fn(),
18 pub lcdNl: extern "C" fn(),
19 pub lcdPrint: extern "C" fn(*const u8),
20 pub lcdPrintln: extern "C" fn(*const u8),
21 pub lcdSetCrsr: extern "C" fn(isize, isize),
22 pub _timectr: *mut u32,
23 pub lcdFill: extern "C" fn(u8),
24 pub getInputWaitTimeout: extern "C" fn(i32) -> u8,
25 pub font_dev: *mut (),
26 pub setIntFont: extern "C" fn(*const ()),
27 pub lcdSetPixel: extern "C" fn(u8, u8, u8),
28 pub DoChar: extern "C" fn(isize, isize, isize) -> isize,
29 pub setTextColor: extern "C" fn(u8, u8),
30 pub lcdShift: extern "C" fn(isize, isize, isize),
31 nickname: *mut u8,
32 nickfont: *mut u8,
33 pub lcdClear: extern "C" fn(),
34 pub setExtFont: extern "C" fn(*const u8),
35 pub DoString: extern "C" fn(isize, isize, *const u8) -> isize,
36 pub getFontHeight: extern "C" fn() -> isize,
37 pub lcdGetPixel: extern "C" fn(u8, u8) -> u8,
38 pub delayms: extern "C" fn(u32),
39 pub delayms_queue: extern "C" fn(u32),
40 pub getRandom: extern "C" fn() -> u32,
41 pub delayms_queue_plus: extern "C" fn(u32, u8) -> u8,
42 pub cdesc: *mut (),
43 pub lcdShowAnim: extern "C" fn(*const u8) -> u8,
44 pub lcdShowImageFile: extern "C" fn(*const u8) -> u8,
45 pub f_read: extern "C" fn(),
46 pub f_write: extern "C" fn(),
47 pub f_open: extern "C" fn(),
48 pub f_lseek: extern "C" fn(),
49 pub lcd_select: extern "C" fn(),
50 pub lcd_deselect: extern "C" fn(),
51 pub lcdWrite: extern "C" fn(u8, u8),
52 pub ws2812_sendarray: extern "C" fn(u8, isize),
53 pub batteryCharging: extern "C" fn() -> bool,
54 pub batteryGetVoltage: extern "C" fn() -> u32,
55 pub drawHLine: extern "C" fn(isize, isize, isize, u8),
56 pub drawVLine: extern "C" fn(isize, isize, isize, u8),
57 pub drawRectFill: extern "C" fn(isize, isize, isize, isize, u8),
58 pub readTextFile: extern "C" fn(*const u8, *const u8, isize) -> isize,
59 pub writeFile: extern "C" fn(*const u8, *const (), isize) -> isize,
60 pub drawLine: extern "C" fn(isize, isize, isize, isize, u8, isize),
61 pub fsInfo: extern "C" fn(*const ()) -> isize,
62 pub fsUsage: extern "C" fn(*const (), *const ()) -> isize,
63 pub lcdGetCrsrY: extern "C" fn() -> isize,
64 pub lcdMoveCrsr: extern "C" fn(isize, isize),
65 pub DoRect: extern "C" fn(isize, isize, isize, isize),
66 pub DoLine: extern "C" fn(isize, isize, isize, isize),
67 pub DoCube: extern "C" fn(*const isize, isize, *const f32),
68 pub DoMesh: extern "C" fn(*const f32, isize, *const isize, isize, *const f32, *const isize, isize),
69 pub getMeshSizes: extern "C" fn(*const u8, *const isize, *const isize) -> u8,
70 pub getMesh: extern "C" fn(*const u8, *const f32, isize, *const isize, isize) -> u8,
71 pub readFile: extern "C" fn(*const u8, *const (), isize) -> isize,
72 pub work_queue: extern "C" fn(),
73}
74
75const JUMP_TABLE_SIZE: usize = size_of::<Table>();
76
77#[no_mangle]
78#[link_section = ".jump"]
79pub static JumpTable: [u8; JUMP_TABLE_SIZE] = [0u8; JUMP_TABLE_SIZE];
80
81pub fn table() -> &'static Table {
87 let jump_table = 0x10000114 as *const Table;
88 unsafe { &*jump_table }
89}