merged upstream master

This commit is contained in:
pca006132 2020-06-12 10:36:22 +08:00
commit 8bed799b72
4 changed files with 102 additions and 34 deletions

View File

@ -15,7 +15,7 @@ let
version = "0.1.0";
src = ./src;
cargoSha256 = "03ax0bzkn7w0bxvq99n1h5b7x4vs1xk7z5r1701c6dz27qg78fn1";
cargoSha256 = "0iaw4zgyajyy6swk9jlq2ky1g4ffj2230j6vli7cjl2spzkhi4sz";
nativeBuildInputs = [
pkgs.gnumake

34
src/Cargo.lock generated
View File

@ -184,7 +184,7 @@ dependencies = [
[[package]]
name = "libasync"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#074b3547de2754279a7df9de3b13a8757c9272ef"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#d3b488bfb35f752dd93d316fba6d54ce1a71e398"
dependencies = [
"embedded-hal",
"libcortex_a9",
@ -196,7 +196,7 @@ dependencies = [
[[package]]
name = "libboard_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#074b3547de2754279a7df9de3b13a8757c9272ef"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#d3b488bfb35f752dd93d316fba6d54ce1a71e398"
dependencies = [
"bit_field",
"embedded-hal",
@ -212,7 +212,7 @@ dependencies = [
[[package]]
name = "libcortex_a9"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#074b3547de2754279a7df9de3b13a8757c9272ef"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#d3b488bfb35f752dd93d316fba6d54ce1a71e398"
dependencies = [
"bit_field",
"libregister",
@ -221,7 +221,7 @@ dependencies = [
[[package]]
name = "libregister"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#074b3547de2754279a7df9de3b13a8757c9272ef"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#d3b488bfb35f752dd93d316fba6d54ce1a71e398"
dependencies = [
"bit_field",
"vcell",
@ -231,7 +231,7 @@ dependencies = [
[[package]]
name = "libsupport_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#074b3547de2754279a7df9de3b13a8757c9272ef"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#d3b488bfb35f752dd93d316fba6d54ce1a71e398"
dependencies = [
"compiler_builtins",
"libboard_zynq",
@ -258,9 +258,9 @@ dependencies = [
[[package]]
name = "managed"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6"
checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577"
[[package]]
name = "memchr"
@ -296,18 +296,18 @@ dependencies = [
[[package]]
name = "pin-project"
version = "0.4.19"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a1acf4a3e70849f8a673497ef984f043f95d2d8252dcdf74d54e6a1e47e8a"
checksum = "e75373ff9037d112bb19bc61333a06a159eaeb217660dcfbea7d88e1db823919"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.19"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194e88048b71a3e02eb4ee36a6995fed9b8236c11a7bb9f7247a9d9835b3f265"
checksum = "10b4b44893d3c370407a1d6a5cfde7c41ae0478e31c516c85f67eb3adc51be6d"
dependencies = [
"proc-macro2",
"quote",
@ -328,9 +328,9 @@ checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
[[package]]
name = "proc-macro-nested"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
checksum = "0afe1bd463b9e9ed51d0e0f0b50b6b146aec855c56fd182bb242388710a9b6de"
[[package]]
name = "proc-macro2"
@ -343,9 +343,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.6"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [
"proc-macro2",
]
@ -390,9 +390,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.30"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93a56fabc59dce20fe48b6c832cc249c713e7ed88fa28b0ee0a3bfcaae5fe4e2"
checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6"
dependencies = [
"proc-macro2",
"quote",

View File

@ -1,4 +1,3 @@
use core::mem::transmute;
use core::fmt;
use core::cell::RefCell;
use core::str::Utf8Error;
@ -249,25 +248,13 @@ const IPADDR: IpAddress = IpAddress::Ipv4(Ipv4Address([192, 168, 1, 52]));
pub fn main(timer: GlobalTimer) {
let eth = zynq::eth::Eth::default(HWADDR.clone());
const RX_LEN: usize = 8;
let mut rx_descs = (0..RX_LEN)
.map(|_| zynq::eth::rx::DescEntry::zeroed())
.collect::<Vec<_>>();
let mut rx_buffers = vec![zynq::eth::Buffer::new(); RX_LEN];
// Number of transmission buffers (minimum is two because with
// one, duplicate packet transmission occurs)
const TX_LEN: usize = 8;
let mut tx_descs = (0..TX_LEN)
.map(|_| zynq::eth::tx::DescEntry::zeroed())
.collect::<Vec<_>>();
let mut tx_buffers = vec![zynq::eth::Buffer::new(); TX_LEN];
let eth = eth.start_rx(&mut rx_descs, &mut rx_buffers);
let mut eth = eth.start_tx(
// HACK
unsafe { transmute(tx_descs.as_mut_slice()) },
unsafe { transmute(tx_buffers.as_mut_slice()) },
);
let ethernet_addr = EthernetAddress(HWADDR);
let eth = eth.start_rx(RX_LEN);
let mut eth = eth.start_tx(TX_LEN);
let ethernet_addr = EthernetAddress(HWADDR);
let mut ip_addrs = [IpCidr::new(IPADDR, 24)];
let mut routes_storage = vec![None; 4];
let routes = Routes::new(&mut routes_storage[..]);

View File

@ -152,14 +152,17 @@ macro_rules! api {
fn resolve(required: &[u8]) -> Option<u32> {
let api = &[
// timing
api!(now_mu = rtio::now_mu),
api!(at_mu = rtio::at_mu),
api!(delay_mu = rtio::delay_mu),
// rpc
api!(rpc_send = rpc_send),
api!(rpc_send_async = rpc_send_async),
api!(rpc_recv = rpc_recv),
// rtio
api!(rtio_init = rtio::init),
api!(rtio_get_destination_status = rtio::get_destination_status),
api!(rtio_get_counter = rtio::get_counter),
@ -169,8 +172,86 @@ fn resolve(required: &[u8]) -> Option<u32> {
api!(rtio_input_data = rtio::input_data),
api!(rtio_input_timestamped_data = rtio::input_timestamped_data),
// Double-precision floating-point arithmetic helper functions
// RTABI chapter 4.1.2, Table 2
api!(__aeabi_dadd),
api!(__aeabi_ddiv),
api!(__aeabi_dmul),
api!(__aeabi_dsub),
// Double-precision floating-point comparison helper functions
// RTABI chapter 4.1.2, Table 3
api!(__aeabi_dcmpeq),
api!(__aeabi_dcmpeq),
api!(__aeabi_dcmplt),
api!(__aeabi_dcmple),
api!(__aeabi_dcmpge),
api!(__aeabi_dcmpgt),
api!(__aeabi_dcmpun),
// Single-precision floating-point arithmetic helper functions
// RTABI chapter 4.1.2, Table 4
api!(__aeabi_fadd),
api!(__aeabi_fdiv),
api!(__aeabi_fmul),
api!(__aeabi_fsub),
// Single-precision floating-point comparison helper functions
// RTABI chapter 4.1.2, Table 5
api!(__aeabi_fcmpeq),
api!(__aeabi_fcmpeq),
api!(__aeabi_fcmplt),
api!(__aeabi_fcmple),
api!(__aeabi_fcmpge),
api!(__aeabi_fcmpgt),
api!(__aeabi_fcmpun),
// Floating-point to integer conversions.
// RTABI chapter 4.1.2, Table 6
api!(__aeabi_d2iz),
api!(__aeabi_d2uiz),
api!(__aeabi_d2lz),
api!(__aeabi_d2ulz),
api!(__aeabi_f2iz),
api!(__aeabi_f2uiz),
api!(__aeabi_f2lz),
api!(__aeabi_f2ulz),
// Conversions between floating types.
// RTABI chapter 4.1.2, Table 7
api!(__aeabi_f2d),
// Integer to floating-point conversions.
// RTABI chapter 4.1.2, Table 8
api!(__aeabi_i2d),
api!(__aeabi_ui2d),
api!(__aeabi_l2d),
api!(__aeabi_ul2d),
api!(__aeabi_i2f),
api!(__aeabi_ui2f),
api!(__aeabi_l2f),
api!(__aeabi_ul2f),
// Long long helper functions
// RTABI chapter 4.2, Table 9
api!(__aeabi_lmul),
api!(__aeabi_llsl),
api!(__aeabi_llsr),
api!(__aeabi_lasr),
// Integer division functions
// RTABI chapter 4.3.1
api!(__aeabi_idiv),
api!(__aeabi_ldivmod),
api!(__aeabi_uidiv),
api!(__aeabi_uldivmod),
// 4.3.4 Memory copying, clearing, and setting
api!(__aeabi_memcpy8),
api!(__aeabi_memcpy4),
api!(__aeabi_memcpy),
api!(__aeabi_memmove8),
api!(__aeabi_memmove4),
api!(__aeabi_memmove),
api!(__aeabi_memset8),
api!(__aeabi_memset4),
api!(__aeabi_memset),
api!(__aeabi_memclr8),
api!(__aeabi_memclr4),
api!(__aeabi_memclr),
// ARTIQ
api!(_Unwind_Resume = exception_unimplemented),
api!(__artiq_personality = exception_unimplemented),
api!(__artiq_raise = exception_unimplemented),