2016-10-17 00:24:25 +08:00
|
|
|
#![allow(dead_code)]
|
2016-10-01 12:20:27 +08:00
|
|
|
|
2016-10-17 00:24:25 +08:00
|
|
|
use core::marker::PhantomData;
|
|
|
|
use core::fmt;
|
|
|
|
|
2016-11-01 02:13:15 +08:00
|
|
|
pub const KERNELCPU_EXEC_ADDRESS: usize = 0x40800000;
|
2016-10-30 05:34:25 +08:00
|
|
|
pub const KERNELCPU_PAYLOAD_ADDRESS: usize = 0x40840000;
|
2016-10-17 00:24:25 +08:00
|
|
|
pub const KERNELCPU_LAST_ADDRESS: usize = 0x4fffffff;
|
|
|
|
pub const KSUPPORT_HEADER_SIZE: usize = 0x80;
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
#[derive(Debug, Clone)]
|
2016-10-01 12:20:27 +08:00
|
|
|
pub struct Exception<'a> {
|
2016-10-17 00:24:25 +08:00
|
|
|
pub name: *const u8,
|
|
|
|
pub file: *const u8,
|
2016-10-01 12:20:27 +08:00
|
|
|
pub line: u32,
|
|
|
|
pub column: u32,
|
2016-10-17 00:24:25 +08:00
|
|
|
pub function: *const u8,
|
|
|
|
pub message: *const u8,
|
2016-11-22 01:09:58 +08:00
|
|
|
pub param: [i64; 3],
|
2016-10-17 00:24:25 +08:00
|
|
|
pub phantom: PhantomData<&'a str>
|
2016-10-01 12:20:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum Message<'a> {
|
|
|
|
LoadRequest(&'a [u8]),
|
2016-10-17 00:24:25 +08:00
|
|
|
LoadReply(Result<(), &'a str>),
|
2016-10-01 12:20:27 +08:00
|
|
|
|
|
|
|
NowInitRequest,
|
|
|
|
NowInitReply(u64),
|
|
|
|
NowSave(u64),
|
|
|
|
|
2016-12-09 14:16:55 +08:00
|
|
|
RTIOInitRequest,
|
|
|
|
|
2017-01-09 05:06:14 +08:00
|
|
|
DRTIOChannelStateRequest { channel: u32 },
|
|
|
|
DRTIOChannelStateReply { fifo_space: u16, last_timestamp: u64 },
|
|
|
|
DRTIOResetChannelStateRequest { channel: u32 },
|
|
|
|
DRTIOGetFIFOSpaceRequest { channel: u32 },
|
|
|
|
DRTIOPacketCountRequest,
|
|
|
|
DRTIOPacketCountReply { tx_cnt: u32, rx_cnt: u32 },
|
2017-01-12 03:48:14 +08:00
|
|
|
DRTIOFIFOSpaceReqCountRequest,
|
|
|
|
DRTIOFIFOSpaceReqCountReply { cnt: u32 },
|
2017-01-09 05:06:14 +08:00
|
|
|
|
2016-10-01 12:20:27 +08:00
|
|
|
RunFinished,
|
|
|
|
RunException {
|
|
|
|
exception: Exception<'a>,
|
2016-10-06 21:42:35 +08:00
|
|
|
backtrace: &'a [usize]
|
2016-10-01 12:20:27 +08:00
|
|
|
},
|
2016-10-17 00:24:25 +08:00
|
|
|
RunAborted,
|
2016-10-01 12:20:27 +08:00
|
|
|
|
|
|
|
WatchdogSetRequest { ms: u64 },
|
|
|
|
WatchdogSetReply { id: usize },
|
|
|
|
WatchdogClear { id: usize },
|
|
|
|
|
|
|
|
RpcSend {
|
2016-10-30 05:34:25 +08:00
|
|
|
async: bool,
|
2016-10-01 12:20:27 +08:00
|
|
|
service: u32,
|
|
|
|
tag: &'a [u8],
|
|
|
|
data: *const *const ()
|
|
|
|
},
|
2016-10-17 00:24:25 +08:00
|
|
|
RpcRecvRequest(*mut ()),
|
|
|
|
RpcRecvReply(Result<usize, Exception<'a>>),
|
2016-10-01 12:20:27 +08:00
|
|
|
|
|
|
|
CacheGetRequest { key: &'a str },
|
2016-11-24 00:28:05 +08:00
|
|
|
CacheGetReply { value: &'static [i32] },
|
|
|
|
CachePutRequest { key: &'a str, value: &'a [i32] },
|
2016-10-01 12:20:27 +08:00
|
|
|
CachePutReply { succeeded: bool },
|
|
|
|
|
2017-01-05 21:54:48 +08:00
|
|
|
I2CStartRequest { busno: u8 },
|
|
|
|
I2CStopRequest { busno: u8 },
|
|
|
|
I2CWriteRequest { busno: u8, data: u8 },
|
2017-01-05 04:04:38 +08:00
|
|
|
I2CWriteReply { ack: bool },
|
2017-01-05 21:54:48 +08:00
|
|
|
I2CReadRequest { busno: u8, ack: bool },
|
2017-01-05 04:04:38 +08:00
|
|
|
I2CReadReply { data: u8 },
|
|
|
|
|
2016-10-17 00:24:25 +08:00
|
|
|
Log(fmt::Arguments<'a>),
|
|
|
|
LogSlice(&'a str)
|
2016-10-01 12:20:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
pub use self::Message::*;
|