Skip to content
File

Blob: archive/fft-benchmark/firmware/crates/esp32-radio/src/platform/ffi.rs

rust53 lines
1//! Hand-written declarations for our small private C ABI, not vendor layouts.
2//! Keep signatures in sync with platform/include/radio_bridge.h.
3use std::ffi::{c_char, c_void};
4 
5unsafe extern "C" {
6 pub(super) fn radio_board_init() -> i32;
7 pub(super) fn radio_clock_sync() -> i32;
8 pub(super) fn radio_now_us() -> u64;
9 pub(super) fn radio_random() -> u32;
10 pub(super) fn radio_heap_free() -> u32;
11 pub(super) fn radio_stack_free() -> u32;
12 pub(super) fn radio_rssi() -> i32;
13 pub(super) fn radio_led(r: u8, g: u8, b: u8) -> i32;
14 pub(super) fn radio_console_byte() -> i32;
15 pub(super) fn radio_log(message: *const c_char);
16 pub(super) fn radio_recovery_attempt(reset: i32) -> u32;
17 pub(super) fn radio_restart() -> !;
18 pub(super) fn radio_music_load(length: *mut usize) -> *mut u8;
19 pub(super) fn radio_music_free(bytes: *mut u8);
20 pub(super) fn radio_peer_open() -> *mut c_void;
21 pub(super) fn radio_peer_poll(peer: *mut c_void) -> i32;
22 pub(super) fn radio_peer_offer(peer: *mut c_void, out: *mut u8, capacity: usize) -> i32;
23 pub(super) fn radio_peer_answer(peer: *mut c_void, bytes: *const u8, length: usize) -> i32;
24 pub(super) fn radio_peer_state(peer: *mut c_void) -> i32;
25 pub(super) fn radio_peer_channels(peer: *mut c_void) -> i32;
26 pub(super) fn radio_peer_command(peer: *mut c_void, out: *mut u8, capacity: usize) -> i32;
27 pub(super) fn radio_peer_dropped(peer: *mut c_void) -> u32;
28 pub(super) fn radio_peer_audio(
29 peer: *mut c_void,
30 pts: u32,
31 bytes: *const u8,
32 length: usize,
33 ) -> i32;
34 pub(super) fn radio_peer_data(
35 peer: *mut c_void,
36 stream: u16,
37 binary: i32,
38 bytes: *const u8,
39 length: usize,
40 ) -> i32;
41 pub(super) fn radio_http_open() -> *mut c_void;
42 pub(super) fn radio_http_post(
43 http: *mut c_void,
44 path: *const c_char,
45 body: *const u8,
46 length: usize,
47 out: *mut u8,
48 capacity: usize,
49 used: *mut usize,
50 ) -> i32;
51 pub(super) fn radio_http_free(http: *mut c_void);
52}