artiq/artiq/firmware/libproto/kernel_proto.rs

92 lines
2.2 KiB
Rust
Raw Normal View History

2016-10-17 00:24:25 +08:00
use core::fmt;
use dyld;
2016-10-17 00:24:25 +08:00
pub const KERNELCPU_EXEC_ADDRESS: usize = 0x40800000;
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)]
pub struct Exception<'a> {
pub name: &'a str,
pub file: &'a str,
pub line: u32,
pub column: u32,
pub function: &'a str,
pub message: &'a str,
pub param: [i64; 3]
}
#[derive(Debug)]
pub enum Message<'a> {
LoadRequest(&'a [u8]),
LoadReply(Result<(), dyld::Error<'a>>),
NowInitRequest,
NowInitReply(u64),
NowSave(u64),
RtioInitRequest,
2016-12-09 14:16:55 +08:00
DmaRecordStart,
DmaRecordAppend {
timestamp: u64,
channel: u32,
address: u32,
data: &'a [u32]
},
DmaRecordStop(&'a str),
2017-03-01 05:28:27 +08:00
DmaEraseRequest(&'a str),
DmaPlaybackRequest(&'a str),
DmaPlaybackReply(Option<&'a [u8]>),
DrtioChannelStateRequest { channel: u32 },
DrtioChannelStateReply { fifo_space: u16, last_timestamp: u64 },
DrtioResetChannelStateRequest { channel: u32 },
DrtioGetFifoSpaceRequest { channel: u32 },
DrtioPacketCountRequest,
DrtioPacketCountReply { tx_cnt: u32, rx_cnt: u32 },
DrtioFifoSpaceReqCountRequest,
DrtioFifoSpaceReqCountReply { cnt: u32 },
2017-01-09 05:06:14 +08:00
RunFinished,
RunException {
exception: Exception<'a>,
backtrace: &'a [usize]
},
2016-10-17 00:24:25 +08:00
RunAborted,
WatchdogSetRequest { ms: u64 },
WatchdogSetReply { id: usize },
WatchdogClear { id: usize },
RpcSend {
async: bool,
service: u32,
tag: &'a [u8],
data: *const *const ()
},
2016-10-17 00:24:25 +08:00
RpcRecvRequest(*mut ()),
RpcRecvReply(Result<usize, Exception<'a>>),
CacheGetRequest { key: &'a str },
CacheGetReply { value: &'static [i32] },
CachePutRequest { key: &'a str, value: &'a [i32] },
CachePutReply { succeeded: bool },
I2cStartRequest { busno: u8 },
I2cStopRequest { busno: u8 },
I2cWriteRequest { busno: u8, data: u8 },
I2cWriteReply { ack: bool },
I2cReadRequest { busno: u8, ack: bool },
I2cReadReply { data: u8 },
2016-10-17 00:24:25 +08:00
Log(fmt::Arguments<'a>),
LogSlice(&'a str)
}
pub use self::Message::*;