bump rustfmt, fix formatting #349
@ -5,7 +5,8 @@ pub const MAX_PACKET: usize = 1024;
|
||||
|
||||
// maximum size of arbitrary payloads
|
||||
// used by satellite -> master analyzer, subkernel exceptions
|
||||
pub const SAT_PAYLOAD_MAX_SIZE: usize = /*max size*/MAX_PACKET - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2;
|
||||
pub const SAT_PAYLOAD_MAX_SIZE: usize = /*max size*/
|
||||
MAX_PACKET - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2;
|
||||
// used by DDMA, subkernel program data (need to provide extra ID and destination)
|
||||
pub const MASTER_PAYLOAD_MAX_SIZE: usize = SAT_PAYLOAD_MAX_SIZE - /*source*/1 - /*destination*/1 - /*ID*/4;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#[cfg(feature = "alloc")]
|
||||
use alloc::vec::Vec;
|
||||
use core::arch::asm;
|
||||
|
||||
use core_io::{Error as IoError, Read, Write};
|
||||
use core::arch::asm;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Cursor<T> {
|
||||
@ -48,7 +48,9 @@ impl<T: AsRef<[u8]>> Read for Cursor<T> {
|
||||
let len = buf.len().min(data.len());
|
||||
// ``copy_from_slice`` generates AXI bursts, use a regular loop instead
|
||||
for i in 0..len {
|
||||
unsafe { asm!("", options(preserves_flags, nostack, readonly)); }
|
||||
unsafe {
|
||||
asm!("", options(preserves_flags, nostack, readonly));
|
||||
}
|
||||
buf[i] = data[i];
|
||||
}
|
||||
self.pos += len;
|
||||
@ -61,7 +63,9 @@ impl Write for Cursor<&mut [u8]> {
|
||||
let data = &mut self.inner[self.pos..];
|
||||
let len = buf.len().min(data.len());
|
||||
for i in 0..len {
|
||||
unsafe { asm!("", options(preserves_flags, nostack, readonly)); }
|
||||
unsafe {
|
||||
asm!("", options(preserves_flags, nostack, readonly));
|
||||
}
|
||||
data[i] = buf[i];
|
||||
}
|
||||
self.pos += len;
|
||||
|
@ -96,30 +96,36 @@ struct ExceptionBuffer {
|
||||
}
|
||||
|
||||
static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer {
|
||||
uw_exceptions: [const { uw::_Unwind_Exception {
|
||||
uw_exceptions: [const {
|
||||
uw::_Unwind_Exception {
|
||||
exception_class: EXCEPTION_CLASS,
|
||||
exception_cleanup: cleanup,
|
||||
private: [0; uw::unwinder_private_data_size],
|
||||
}}; MAX_INFLIGHT_EXCEPTIONS],
|
||||
}
|
||||
}; MAX_INFLIGHT_EXCEPTIONS],
|
||||
exceptions: [None; MAX_INFLIGHT_EXCEPTIONS + 1],
|
||||
exception_stack: [-1; MAX_INFLIGHT_EXCEPTIONS + 1],
|
||||
backtrace: [(0, 0); MAX_BACKTRACE_SIZE],
|
||||
backtrace_size: 0,
|
||||
stack_pointers: [const { StackPointerBacktrace {
|
||||
stack_pointers: [const {
|
||||
StackPointerBacktrace {
|
||||
stack_pointer: 0,
|
||||
initial_backtrace_size: 0,
|
||||
current_backtrace_size: 0,
|
||||
}}; MAX_INFLIGHT_EXCEPTIONS + 1],
|
||||
}
|
||||
}; MAX_INFLIGHT_EXCEPTIONS + 1],
|
||||
exception_count: 0,
|
||||
};
|
||||
|
||||
pub unsafe extern "C" fn reset_exception_buffer() {
|
||||
trace!("reset exception buffer");
|
||||
EXCEPTION_BUFFER.uw_exceptions = [const { uw::_Unwind_Exception {
|
||||
EXCEPTION_BUFFER.uw_exceptions = [const {
|
||||
uw::_Unwind_Exception {
|
||||
exception_class: EXCEPTION_CLASS,
|
||||
exception_cleanup: cleanup,
|
||||
private: [0; uw::unwinder_private_data_size],
|
||||
}}; MAX_INFLIGHT_EXCEPTIONS];
|
||||
}
|
||||
}; MAX_INFLIGHT_EXCEPTIONS];
|
||||
EXCEPTION_BUFFER.exceptions = [None; MAX_INFLIGHT_EXCEPTIONS + 1];
|
||||
EXCEPTION_BUFFER.exception_stack = [-1; MAX_INFLIGHT_EXCEPTIONS + 1];
|
||||
EXCEPTION_BUFFER.backtrace_size = 0;
|
||||
|
@ -82,7 +82,7 @@ pub extern "C" fn dma_record_stop(duration: i64, enable_ddma: bool) {
|
||||
#[inline(always)]
|
||||
unsafe fn dma_record_output_prepare(timestamp: i64, target: i32, words: usize) {
|
||||
// See gateware/rtio/dma.py.
|
||||
const HEADER_LENGTH: usize = /*length*/1 + /*channel*/3 + /*timestamp*/8 + /*address*/1;
|
||||
const HEADER_LENGTH: usize = /*length*/ 1 + /*channel*/3 + /*timestamp*/8 + /*address*/1;
|
||||
let length = HEADER_LENGTH + /*data*/words * 4;
|
||||
|
||||
let buffer = &mut RECORDER.as_mut().unwrap().buffer;
|
||||
|
@ -396,9 +396,13 @@ impl<'a> Manager<'_> {
|
||||
self.session = Session::new(id);
|
||||
self.control.restart();
|
||||
|
||||
self.control
|
||||
.tx
|
||||
.send(kernel::Message::LoadRequest(self.kernels.get(&id).ok_or_else(|| Error::KernelNotFound)?.library.clone()));
|
||||
self.control.tx.send(kernel::Message::LoadRequest(
|
||||
self.kernels
|
||||
.get(&id)
|
||||
.ok_or_else(|| Error::KernelNotFound)?
|
||||
.library
|
||||
.clone(),
|
||||
));
|
||||
let reply = self.control.rx.recv();
|
||||
match reply {
|
||||
kernel::Message::LoadCompleted => Ok(()),
|
||||
|
Loading…
Reference in New Issue
Block a user