mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-28 20:53:35 +08:00
firmware: suppress warning
This commit is contained in:
parent
1da0554a49
commit
eecd825d23
@ -47,7 +47,7 @@ fn memory_test(total: &mut usize, wrong: &mut usize) -> bool {
|
||||
MEMORY[$index:expr] = $data:expr
|
||||
}
|
||||
) => ({
|
||||
$prepare;
|
||||
$prepare
|
||||
for $i in $range {
|
||||
unsafe { ptr::write_volatile(MEMORY.offset($index as isize), $data) };
|
||||
*total += 1;
|
||||
@ -56,7 +56,7 @@ fn memory_test(total: &mut usize, wrong: &mut usize) -> bool {
|
||||
cache::flush_cpu_dcache();
|
||||
cache::flush_l2_cache();
|
||||
|
||||
$prepare;
|
||||
$prepare
|
||||
for $i in $range {
|
||||
if unsafe { ptr::read_volatile(MEMORY.offset($index as isize)) } != $data {
|
||||
*wrong += 1;
|
||||
|
@ -8,7 +8,7 @@
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
#![allow(private_no_mangle_fns, non_camel_case_types)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use core::{ptr, mem};
|
||||
use cslice::CSlice;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![feature(lang_items, llvm_asm, panic_unwind, libc, unwind_attributes,
|
||||
panic_handler, panic_info_message, nll)]
|
||||
panic_info_message, nll)]
|
||||
#![no_std]
|
||||
|
||||
extern crate libc;
|
||||
@ -204,15 +204,13 @@ fn terminate(exception: &eh_artiq::Exception, backtrace: &mut [usize]) -> ! {
|
||||
|
||||
#[unwind(aborts)]
|
||||
extern fn cache_get<'a>(ret: &'a mut CSlice<i32>, key: &CSlice<u8>) -> &'a CSlice<'a, i32> {
|
||||
unsafe {
|
||||
send(&CacheGetRequest {
|
||||
key: str::from_utf8(key.as_ref()).unwrap()
|
||||
});
|
||||
recv!(&CacheGetReply { value } => {
|
||||
*ret = value.as_c_slice();
|
||||
ret
|
||||
})
|
||||
}
|
||||
send(&CacheGetRequest {
|
||||
key: str::from_utf8(key.as_ref()).unwrap()
|
||||
});
|
||||
recv!(&CacheGetReply { value } => {
|
||||
*ret = value.as_c_slice();
|
||||
ret
|
||||
})
|
||||
}
|
||||
|
||||
#[unwind(allowed)]
|
||||
|
@ -1,12 +1,10 @@
|
||||
#![feature(asm, lang_items, never_type)]
|
||||
#![feature(lang_items, never_type)]
|
||||
#![no_std]
|
||||
|
||||
extern crate failure;
|
||||
#[cfg(has_drtio)]
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
extern crate byteorder;
|
||||
extern crate crc;
|
||||
#[macro_use]
|
||||
|
@ -77,10 +77,10 @@ mod imp {
|
||||
|
||||
mod lock {
|
||||
use core::slice;
|
||||
use core::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||
use super::Error;
|
||||
|
||||
static LOCKED: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
static LOCKED: AtomicUsize = AtomicUsize::new(0);
|
||||
|
||||
pub struct Lock;
|
||||
|
||||
@ -216,7 +216,7 @@ mod imp {
|
||||
let mut offset = 0;
|
||||
let mut iter = Iter::new(old_data);
|
||||
'iter: while let Some(result) = iter.next() {
|
||||
let (key, mut value) = result?;
|
||||
let (key, value) = result?;
|
||||
if value.is_empty() {
|
||||
// This is a removed entry, ignore it.
|
||||
continue
|
||||
|
@ -31,7 +31,7 @@ mod ddr {
|
||||
}
|
||||
|
||||
#[cfg(ddrphy_wlevel)]
|
||||
unsafe fn write_level_scan(logger: &mut Option<&mut fmt::Write>) {
|
||||
unsafe fn write_level_scan(logger: &mut Option<&mut dyn fmt::Write>) {
|
||||
#[cfg(kusddrphy)]
|
||||
log!(logger, "DQS initial delay: {} taps\n", ddrphy::wdly_dqs_taps_read());
|
||||
log!(logger, "Write leveling scan:\n");
|
||||
@ -82,7 +82,7 @@ mod ddr {
|
||||
}
|
||||
|
||||
#[cfg(ddrphy_wlevel)]
|
||||
unsafe fn write_level(logger: &mut Option<&mut fmt::Write>,
|
||||
unsafe fn write_level(logger: &mut Option<&mut dyn fmt::Write>,
|
||||
delay: &mut [u16; DQS_SIGNAL_COUNT],
|
||||
high_skew: &mut [bool; DQS_SIGNAL_COUNT]) -> bool {
|
||||
#[cfg(kusddrphy)]
|
||||
@ -172,7 +172,7 @@ mod ddr {
|
||||
}
|
||||
|
||||
#[cfg(ddrphy_wlevel)]
|
||||
unsafe fn read_bitslip(logger: &mut Option<&mut fmt::Write>,
|
||||
unsafe fn read_bitslip(logger: &mut Option<&mut dyn fmt::Write>,
|
||||
delay: &[u16; DQS_SIGNAL_COUNT],
|
||||
high_skew: &[bool; DQS_SIGNAL_COUNT]) {
|
||||
let threshold_opt = delay.iter().zip(high_skew.iter())
|
||||
@ -203,7 +203,7 @@ mod ddr {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn read_level_scan(logger: &mut Option<&mut fmt::Write>) {
|
||||
unsafe fn read_level_scan(logger: &mut Option<&mut dyn fmt::Write>) {
|
||||
log!(logger, "Read leveling scan:\n");
|
||||
|
||||
// Generate pseudo-random sequence
|
||||
@ -286,7 +286,7 @@ mod ddr {
|
||||
spin_cycles(15);
|
||||
}
|
||||
|
||||
unsafe fn read_level(logger: &mut Option<&mut fmt::Write>) -> bool {
|
||||
unsafe fn read_level(logger: &mut Option<&mut dyn fmt::Write>) -> bool {
|
||||
log!(logger, "Read leveling: ");
|
||||
|
||||
// Generate pseudo-random sequence
|
||||
@ -417,7 +417,7 @@ mod ddr {
|
||||
true
|
||||
}
|
||||
|
||||
pub unsafe fn level(logger: &mut Option<&mut fmt::Write>) -> bool {
|
||||
pub unsafe fn level(logger: &mut Option<&mut dyn fmt::Write>) -> bool {
|
||||
#[cfg(ddrphy_wlevel)]
|
||||
{
|
||||
let mut delay = [0; DQS_SIGNAL_COUNT];
|
||||
@ -442,7 +442,7 @@ use core::fmt;
|
||||
use csr;
|
||||
use sdram_phy;
|
||||
|
||||
pub unsafe fn init(mut _logger: Option<&mut fmt::Write>) -> bool {
|
||||
pub unsafe fn init(mut _logger: Option<&mut dyn fmt::Write>) -> bool {
|
||||
sdram_phy::initialize();
|
||||
|
||||
#[cfg(has_ddrphy)]
|
||||
|
@ -159,7 +159,7 @@ impl<'a> Library<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn resolve_rela(&self, rela: &Elf32_Rela, resolve: &Fn(&[u8]) -> Option<Elf32_Word>)
|
||||
fn resolve_rela(&self, rela: &Elf32_Rela, resolve: &dyn Fn(&[u8]) -> Option<Elf32_Word>)
|
||||
-> Result<(), Error<'a>> {
|
||||
let sym;
|
||||
if ELF32_R_SYM(rela.r_info) == 0 {
|
||||
@ -204,7 +204,7 @@ impl<'a> Library<'a> {
|
||||
self.update_rela(rela, value)
|
||||
}
|
||||
|
||||
pub fn load(data: &[u8], image: &'a mut [u8], resolve: &Fn(&[u8]) -> Option<Elf32_Word>)
|
||||
pub fn load(data: &[u8], image: &'a mut [u8], resolve: &dyn Fn(&[u8]) -> Option<Elf32_Word>)
|
||||
-> Result<Library<'a>, Error<'a>> {
|
||||
#![allow(unused_assignments)]
|
||||
|
||||
|
@ -14,11 +14,8 @@
|
||||
//
|
||||
// By design, this personality function is only ever called in the search phase, although
|
||||
// to keep things simple and close to upstream, it is not modified
|
||||
#![allow(private_no_mangle_fns)]
|
||||
|
||||
use unwind as uw;
|
||||
use libc::{c_int, uintptr_t};
|
||||
use cslice::AsCSlice;
|
||||
|
||||
use dwarf::{self, EHAction, EHContext};
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![no_std]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(feature = "alloc", feature(alloc))]
|
||||
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![no_std]
|
||||
#![cfg_attr(feature = "alloc", feature(alloc))]
|
||||
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
|
@ -18,7 +18,7 @@ unsafe fn align_ptr_mut<T>(ptr: *mut ()) -> *mut T {
|
||||
}
|
||||
|
||||
unsafe fn recv_value<R, E>(reader: &mut R, tag: Tag, data: &mut *mut (),
|
||||
alloc: &Fn(usize) -> Result<*mut (), E>)
|
||||
alloc: &dyn Fn(usize) -> Result<*mut (), E>)
|
||||
-> Result<(), E>
|
||||
where R: Read + ?Sized,
|
||||
E: From<Error<R::ReadError>>
|
||||
@ -63,7 +63,7 @@ unsafe fn recv_value<R, E>(reader: &mut R, tag: Tag, data: &mut *mut (),
|
||||
}
|
||||
Tag::List(it) => {
|
||||
#[repr(C)]
|
||||
struct List { elements: *mut (), length: u32 };
|
||||
struct List { elements: *mut (), length: u32 }
|
||||
consume_value!(List, |ptr| {
|
||||
(*ptr).length = reader.read_u32()?;
|
||||
let length = (*ptr).length as usize;
|
||||
@ -151,7 +151,7 @@ unsafe fn recv_value<R, E>(reader: &mut R, tag: Tag, data: &mut *mut (),
|
||||
}
|
||||
|
||||
pub fn recv_return<R, E>(reader: &mut R, tag_bytes: &[u8], data: *mut (),
|
||||
alloc: &Fn(usize) -> Result<*mut (), E>)
|
||||
alloc: &dyn Fn(usize) -> Result<*mut (), E>)
|
||||
-> Result<(), E>
|
||||
where R: Read + ?Sized,
|
||||
E: From<Error<R::ReadError>>
|
||||
@ -208,7 +208,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
|
||||
}
|
||||
Tag::List(it) => {
|
||||
#[repr(C)]
|
||||
struct List { elements: *const (), length: u32 };
|
||||
struct List { elements: *const (), length: u32 }
|
||||
consume_value!(List, |ptr| {
|
||||
let length = (*ptr).length as usize;
|
||||
writer.write_u32((*ptr).length)?;
|
||||
@ -287,7 +287,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
|
||||
}
|
||||
Tag::Keyword(it) => {
|
||||
#[repr(C)]
|
||||
struct Keyword<'a> { name: CSlice<'a, u8> };
|
||||
struct Keyword<'a> { name: CSlice<'a, u8> }
|
||||
consume_value!(Keyword, |ptr| {
|
||||
writer.write_string(str::from_utf8((*ptr).name.as_ref()).unwrap())?;
|
||||
let tag = it.clone().next().expect("truncated tag");
|
||||
@ -299,7 +299,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
|
||||
}
|
||||
Tag::Object => {
|
||||
#[repr(C)]
|
||||
struct Object { id: u32 };
|
||||
struct Object { id: u32 }
|
||||
consume_value!(*const Object, |ptr|
|
||||
writer.write_u32((**ptr).id))
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(lang_items, alloc, try_from, nonzero, asm,
|
||||
panic_handler, panic_info_message)]
|
||||
#![feature(lang_items, panic_info_message)]
|
||||
#![no_std]
|
||||
|
||||
extern crate eh;
|
||||
@ -280,32 +279,30 @@ pub struct TrapFrame {
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn exception(regs: *const TrapFrame) {
|
||||
unsafe {
|
||||
let pc = mepc::read();
|
||||
let cause = mcause::read().cause();
|
||||
match cause {
|
||||
mcause::Trap::Interrupt(source) => {
|
||||
info!("Called interrupt with {:?}", source);
|
||||
},
|
||||
mcause::Trap::Exception(e) => {
|
||||
println!("Trap frame: {:x?}", unsafe { *regs });
|
||||
let pc = mepc::read();
|
||||
let cause = mcause::read().cause();
|
||||
match cause {
|
||||
mcause::Trap::Interrupt(source) => {
|
||||
info!("Called interrupt with {:?}", source);
|
||||
},
|
||||
mcause::Trap::Exception(e) => {
|
||||
println!("Trap frame: {:x?}", unsafe { *regs });
|
||||
|
||||
fn hexdump(addr: u32) {
|
||||
let addr = (addr - addr % 4) as *const u32;
|
||||
let mut ptr = addr;
|
||||
println!("@ {:08p}", ptr);
|
||||
for _ in 0..4 {
|
||||
print!("+{:04x}: ", ptr as usize - addr as usize);
|
||||
print!("{:08x} ", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
print!("{:08x} ", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
print!("{:08x} ", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
print!("{:08x}\n", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
}
|
||||
fn hexdump(addr: u32) {
|
||||
let addr = (addr - addr % 4) as *const u32;
|
||||
let mut ptr = addr;
|
||||
println!("@ {:08p}", ptr);
|
||||
for _ in 0..4 {
|
||||
print!("+{:04x}: ", ptr as usize - addr as usize);
|
||||
print!("{:08x} ", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
print!("{:08x} ", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
print!("{:08x} ", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
print!("{:08x}\n", unsafe { *ptr }); ptr = ptr.wrapping_offset(1);
|
||||
}
|
||||
|
||||
hexdump(u32::try_from(pc).unwrap());
|
||||
panic!("exception {:?} at PC 0x{:x}", e, u32::try_from(pc).unwrap())
|
||||
}
|
||||
|
||||
hexdump(u32::try_from(pc).unwrap());
|
||||
panic!("exception {:?} at PC 0x{:x}", e, u32::try_from(pc).unwrap())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ type SocketSet = ::smoltcp::socket::SocketSet<'static, 'static, 'static>;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct WaitRequest {
|
||||
event: Option<*mut FnMut() -> bool>,
|
||||
event: Option<*mut dyn FnMut() -> bool>,
|
||||
timeout: Option<u64>
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ impl<'a> Io<'a> {
|
||||
}
|
||||
|
||||
pub fn until<F: FnMut() -> bool>(&self, mut f: F) -> Result<(), Error> {
|
||||
let f = unsafe { mem::transmute::<&mut FnMut() -> bool, *mut FnMut() -> bool>(&mut f) };
|
||||
let f = unsafe { mem::transmute::<&mut dyn FnMut() -> bool, *mut dyn FnMut() -> bool>(&mut f) };
|
||||
self.suspend(WaitRequest {
|
||||
timeout: None,
|
||||
event: Some(f)
|
||||
|
@ -539,7 +539,7 @@ pub extern fn main() -> i32 {
|
||||
}
|
||||
while !drtiosat_link_rx_up() {
|
||||
drtiosat_process_errors();
|
||||
for mut rep in repeaters.iter_mut() {
|
||||
for rep in repeaters.iter_mut() {
|
||||
rep.service(&routing_table, rank);
|
||||
}
|
||||
#[cfg(all(soc_platform = "kasli", hw_rev = "v2.0"))]
|
||||
@ -568,7 +568,7 @@ pub extern fn main() -> i32 {
|
||||
while drtiosat_link_rx_up() {
|
||||
drtiosat_process_errors();
|
||||
process_aux_packets(&mut repeaters, &mut routing_table, &mut rank);
|
||||
for mut rep in repeaters.iter_mut() {
|
||||
for rep in repeaters.iter_mut() {
|
||||
rep.service(&routing_table, rank);
|
||||
}
|
||||
#[cfg(all(soc_platform = "kasli", hw_rev = "v2.0"))]
|
||||
|
Loading…
Reference in New Issue
Block a user