forked from M-Labs/artiq-zynq
Compare commits
3 Commits
dd32b6fe3f
...
5f5b714838
Author | SHA1 | Date |
---|---|---|
occheung | 5f5b714838 | |
occheung | 48f9ff49e3 | |
occheung | 735aaacb52 |
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"target": "kasli_soc",
|
||||
"variant": "bare_zynq",
|
||||
"hw_rev": "v1.1",
|
||||
"drtio_role": "standalone",
|
||||
"core_addr": "192.168.1.200",
|
||||
"peripherals": []
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"target": "kasli_soc",
|
||||
"variant": "bare_zynq_master",
|
||||
"hw_rev": "v1.1",
|
||||
"drtio_role": "master",
|
||||
"core_addr": "192.168.1.200",
|
||||
"peripherals": []
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"target": "kasli_soc",
|
||||
"variant": "bare_zynq_sat1",
|
||||
"hw_rev": "v1.1",
|
||||
"drtio_role": "satellite",
|
||||
"peripherals": []
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"target": "kasli_soc",
|
||||
"variant": "bare_zynq_sat2",
|
||||
"hw_rev": "v1.1",
|
||||
"drtio_role": "satellite",
|
||||
"peripherals": []
|
||||
}
|
39
flake.lock
39
flake.lock
|
@ -11,16 +11,17 @@
|
|||
"src-pythonparser": "src-pythonparser"
|
||||
},
|
||||
"locked": {
|
||||
"dirtyRev": "378d962edb37a7c2a94e963251822246be009b0e-dirty",
|
||||
"dirtyShortRev": "378d962ed-dirty",
|
||||
"lastModified": 1721962540,
|
||||
"narHash": "sha256-BJG4l1V7kJXBWgBkfYKq8xW8rCfc7fnjCSp5xMiGvsU=",
|
||||
"lastModified": 1722417433,
|
||||
"narHash": "sha256-QEbcVdL1sUQEbMCvCUvPM8DKqwOth3gJpdiLTf4hPN8=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "0623480c82c28d57e14dc4f363374758a52284d3",
|
||||
"revCount": 8952,
|
||||
"type": "git",
|
||||
"url": "file:///home/occheung/artiq"
|
||||
"url": "https://github.com/m-labs/artiq.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "file:///home/occheung/artiq"
|
||||
"url": "https://github.com/m-labs/artiq.git"
|
||||
}
|
||||
},
|
||||
"artiq-comtools": {
|
||||
|
@ -36,11 +37,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717637438,
|
||||
"narHash": "sha256-BXFidNm3Em8iChPGu1L0s2bY+f2yQ0VVid4MuOoTehw=",
|
||||
"lastModified": 1720768567,
|
||||
"narHash": "sha256-3VoK7o5MtHtbHLrc6Pv+eQWFtaz5Gd/YWyV5TD3c5Ss=",
|
||||
"owner": "m-labs",
|
||||
"repo": "artiq-comtools",
|
||||
"rev": "78d27026efe76a13f7b4698a554f55811369ec4d",
|
||||
"rev": "f93570d8f2ed5a3cfb3e1c16ab00f2540551e994",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -101,16 +102,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1720386169,
|
||||
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||
"lastModified": 1721924956,
|
||||
"narHash": "sha256-Sb1jlyRO+N8jBXEX9Pg9Z1Qb8Bw9QyOgLDNMEpmjZ2M=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||
"rev": "5ad6a14c6bf098e98800b091668718c336effc95",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -130,11 +131,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1720491570,
|
||||
"narHash": "sha256-PHS2BcQ9kxBpu9GKlDg3uAlrX/ahQOoAiVmwGl6BjD4=",
|
||||
"lastModified": 1722046723,
|
||||
"narHash": "sha256-G7/gHz8ORRvHd1/RIURrdcswKRPe9K0FsIYR4v5jSWo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "b970af40fdc4bd80fd764796c5f97c15e2b564eb",
|
||||
"rev": "56baac5e6b2743d4730e664ea64f6d8a2aad0fbb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -167,11 +168,11 @@
|
|||
"src-migen": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1720332047,
|
||||
"narHash": "sha256-FdYVEHVtXHrzPhBqpXOTo9uHQAtuCsDPmAPY8JrfHOY=",
|
||||
"lastModified": 1721561053,
|
||||
"narHash": "sha256-z3LRhNmKZrjr6rFD0yxtccSa/SWvFIYmb+G/D5d2Jd8=",
|
||||
"owner": "m-labs",
|
||||
"repo": "migen",
|
||||
"rev": "60739a161e64630ce7ba62d1a5bac1252b66c3b9",
|
||||
"rev": "9279e8623f8433bc4f23ac51e5e2331bfe544417",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
description = "ARTIQ port to the Zynq-7000 platform";
|
||||
|
||||
# inputs.artiq.url = git+https://github.com/m-labs/artiq.git;
|
||||
inputs.artiq.url = git+file:///home/occheung/artiq;
|
||||
inputs.artiq.url = git+https://github.com/m-labs/artiq.git;
|
||||
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
||||
inputs.zynq-rs.url = git+https://git.m-labs.hk/m-labs/zynq-rs;
|
||||
inputs.zynq-rs.inputs.nixpkgs.follows = "artiq/nixpkgs";
|
||||
|
@ -110,7 +109,7 @@
|
|||
fsblTargets = ["zc702" "zc706" "zed"];
|
||||
sat_variants = [
|
||||
# kasli-soc satellite variants
|
||||
"satellite" "bare_zynq_sat1" "bare_zynq_sat2"
|
||||
"satellite"
|
||||
# zc706 satellite variants
|
||||
"nist_clock_satellite" "nist_qc2_satellite" "acpki_nist_clock_satellite" "acpki_nist_qc2_satellite"
|
||||
"nist_clock_satellite_100mhz" "nist_qc2_satellite_100mhz" "acpki_nist_clock_satellite_100mhz" "acpki_nist_qc2_satellite_100mhz"
|
||||
|
@ -365,10 +364,6 @@
|
|||
(board-package-set { target = "zc706"; variant = "acpki_nist_qc2_satellite_100mhz"; }) //
|
||||
(board-package-set { target = "kasli_soc"; variant = "demo"; json = ./demo.json; }) //
|
||||
(board-package-set { target = "kasli_soc"; variant = "master"; json = ./kasli-soc-master.json; }) //
|
||||
(board-package-set { target = "kasli_soc"; variant = "bare_zynq"; json = ./bare_zynq.json; }) //
|
||||
(board-package-set { target = "kasli_soc"; variant = "bare_zynq_master"; json = ./bare_zynq_master.json; }) //
|
||||
(board-package-set { target = "kasli_soc"; variant = "bare_zynq_sat1"; json = ./bare_zynq_sat1.json; }) //
|
||||
(board-package-set { target = "kasli_soc"; variant = "bare_zynq_sat2"; json = ./bare_zynq_sat2.json; }) //
|
||||
(board-package-set { target = "kasli_soc"; variant = "satellite"; json = ./kasli-soc-satellite.json; });
|
||||
|
||||
hydraJobs = packages.x86_64-linux // { inherit zc706-hitl-tests; inherit gateware-sim; inherit fmt-check; };
|
||||
|
|
|
@ -2,15 +2,6 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.4"
|
||||
|
@ -255,10 +246,10 @@ dependencies = [
|
|||
"libsupport_zynq",
|
||||
"log",
|
||||
"log_buffer",
|
||||
"nalgebra",
|
||||
"nb 0.1.3",
|
||||
"unwind",
|
||||
"vcell",
|
||||
"nalgebra",
|
||||
"void",
|
||||
]
|
||||
|
||||
|
@ -392,19 +383,6 @@ version = "0.7.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577"
|
||||
|
||||
[[package]]
|
||||
name = "nalgebra"
|
||||
version = "0.32.6"
|
||||
source = "git+https://git.m-labs.hk/M-labs/nalgebra?rev=dd00f9b#dd00f9b46046e0b931d1b470166db02fd29591be"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"num-complex",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"simba",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nb"
|
||||
version = "0.1.3"
|
||||
|
@ -420,15 +398,6 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.3.3"
|
||||
|
@ -440,26 +409,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
|
@ -467,15 +416,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.9"
|
||||
|
@ -559,7 +501,6 @@ name = "satman"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"build_zynq",
|
||||
"byteorder",
|
||||
"core_io",
|
||||
"cslice",
|
||||
"embedded-hal",
|
||||
|
@ -574,8 +515,6 @@ dependencies = [
|
|||
"libregister",
|
||||
"libsupport_zynq",
|
||||
"log",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"unwind",
|
||||
]
|
||||
|
||||
|
@ -585,18 +524,6 @@ version = "0.1.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
|
||||
|
||||
[[package]]
|
||||
name = "simba"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50582927ed6f77e4ac020c057f37a268fc6aebc29225050365aacbb9deeeddc4"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"num-complex",
|
||||
"num-traits",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smoltcp"
|
||||
version = "0.7.5"
|
||||
|
@ -629,12 +556,6 @@ dependencies = [
|
|||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.5"
|
||||
|
@ -651,6 +572,147 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nalgebra"
|
||||
version = "0.32.6"
|
||||
source = "git+https://git.m-labs.hk/M-labs/nalgebra?rev=dd00f9b#dd00f9b46046e0b931d1b470166db02fd29591be"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"matrixmultiply",
|
||||
"nalgebra-macros",
|
||||
"num-complex",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"simba",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matrixmultiply"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"rawpointer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nalgebra-macros"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simba"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50582927ed6f77e4ac020c057f37a268fc6aebc29225050365aacbb9deeeddc4"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"num-complex",
|
||||
"num-traits",
|
||||
"paste",
|
||||
"wide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
|
||||
[[package]]
|
||||
name = "rawpointer"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e0d047c1062aa51e256408c560894e5251f08925980e53cf1aa5bd00eec6512"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "wide"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd89cf484471f953ee84f07c0dff0ea20e9ddf976f03cabdf5dda48b221f22e7"
|
||||
features = ["no_std"]
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"safe_arch",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
|
||||
|
||||
[[package]]
|
||||
name = "safe_arch"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "794821e4ccb0d9f979512f9c1973480123f9bd62a90d74ab0f9426fcf8f4a529"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcell"
|
||||
version = "0.1.3"
|
||||
|
|
|
@ -783,7 +783,7 @@ pub fn main(timer: GlobalTimer, cfg: Config) {
|
|||
}
|
||||
}
|
||||
|
||||
mgmt::start(cfg, &aux_mutex, &drtio_routing_table, timer);
|
||||
mgmt::start(cfg, Some((&aux_mutex, &drtio_routing_table, timer)));
|
||||
|
||||
task::spawn(async move {
|
||||
let connection = Rc::new(Semaphore::new(1, 1));
|
||||
|
@ -886,7 +886,7 @@ pub fn soft_panic_main(timer: GlobalTimer, cfg: Config) -> ! {
|
|||
|
||||
Sockets::init(32);
|
||||
|
||||
// mgmt::start(cfg);
|
||||
mgmt::start(cfg, None);
|
||||
|
||||
// getting eth settings disables the LED as it resets GPIO
|
||||
// need to re-enable it here
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use alloc::{rc::Rc, string::String, vec::Vec};
|
||||
use core::cell::RefCell;
|
||||
use core::{cell::RefCell, ops::Deref};
|
||||
|
||||
use futures::{future::poll_fn, task::Poll};
|
||||
use libasync::{smoltcp::TcpStream, task};
|
||||
|
@ -81,24 +81,18 @@ pub enum Reply {
|
|||
ConfigData = 7,
|
||||
}
|
||||
|
||||
pub fn byte_to_level_filter(level_byte: u8) -> Result<log::LevelFilter> {
|
||||
Ok(match level_byte {
|
||||
async fn read_log_level_filter(stream: &mut TcpStream) -> Result<log::LevelFilter> {
|
||||
Ok(match read_i8(stream).await? {
|
||||
0 => log::LevelFilter::Off,
|
||||
1 => log::LevelFilter::Error,
|
||||
2 => log::LevelFilter::Warn,
|
||||
3 => log::LevelFilter::Info,
|
||||
4 => log::LevelFilter::Debug,
|
||||
5 => log::LevelFilter::Trace,
|
||||
lv => return Err(Error::UnknownLogLevel(lv)),
|
||||
lv => return Err(Error::UnknownLogLevel(lv as u8)),
|
||||
})
|
||||
}
|
||||
|
||||
async fn read_log_level_filter(stream: &mut TcpStream) -> Result<log::LevelFilter> {
|
||||
let level_byte = read_i8(stream).await? as u8;
|
||||
|
||||
byte_to_level_filter(level_byte)
|
||||
}
|
||||
|
||||
async fn get_logger_buffer_pred<F>(f: F) -> LogBufferRef<'static>
|
||||
where F: Fn(&LogBufferRef) -> bool {
|
||||
poll_fn(|ctx| {
|
||||
|
@ -744,19 +738,23 @@ mod local_coremgmt {
|
|||
|
||||
#[cfg(has_drtio)]
|
||||
macro_rules! process {
|
||||
($stream: ident, $timer:ident, $aux_mutex:ident, $routing_table:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{
|
||||
($stream: ident, $drtio_tuple:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{
|
||||
if $destination == 0 {
|
||||
local_coremgmt::$func($stream, $($param, )*).await
|
||||
} else if let Some((aux_mutex, routing_table, timer)) = $drtio_tuple {
|
||||
let linkno = routing_table.0[$destination as usize][0] - 1 as u8;
|
||||
remote_coremgmt::$func($stream, aux_mutex, routing_table, timer, linkno, $destination, $($param, )*).await
|
||||
} else {
|
||||
let linkno = $routing_table.0[$destination as usize][0] - 1 as u8;
|
||||
remote_coremgmt::$func($stream, $aux_mutex, $routing_table, $timer, linkno, $destination, $($param, )*).await
|
||||
error!("coremgmt-over-drtio not supported for panicked device, please reboot");
|
||||
write_i8($stream, Reply::Error as i8).await?;
|
||||
Err(drtio::Error::LinkDown.into())
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
||||
#[cfg(not(has_drtio))]
|
||||
macro_rules! process {
|
||||
($stream: ident, $timer:ident, $aux_mutex:ident, $routing_table:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{
|
||||
($stream: ident, $drtio_tuple:ident, $destination:expr, $func:ident $(, $param:expr)*) => {{
|
||||
local_coremgmt::$func($stream, $($param, )*).await
|
||||
}}
|
||||
}
|
||||
|
@ -765,9 +763,7 @@ async fn handle_connection(
|
|||
stream: &mut TcpStream,
|
||||
pull_id: Rc<RefCell<u32>>,
|
||||
cfg: Rc<Config>,
|
||||
_aux_mutex: &Rc<Mutex<bool>>,
|
||||
_routing_table: &RoutingTable,
|
||||
_timer: GlobalTimer,
|
||||
_drtio_tuple: Option<(&Rc<Mutex<bool>>, &RoutingTable, GlobalTimer)>,
|
||||
) -> Result<()> {
|
||||
if !expect(&stream, b"ARTIQ management\n").await? {
|
||||
return Err(Error::UnexpectedPattern);
|
||||
|
@ -783,13 +779,11 @@ async fn handle_connection(
|
|||
}
|
||||
let msg: Request = FromPrimitive::from_i8(msg?).ok_or(Error::UnrecognizedPacket)?;
|
||||
match msg {
|
||||
Request::GetLog => process!(stream, _timer, _aux_mutex, _routing_table, _destination, get_log),
|
||||
Request::ClearLog => process!(stream, _timer, _aux_mutex, _routing_table, _destination, clear_log),
|
||||
Request::GetLog => process!(stream, _drtio_tuple, _destination, get_log),
|
||||
Request::ClearLog => process!(stream, _drtio_tuple, _destination, clear_log),
|
||||
Request::PullLog => process!(
|
||||
stream,
|
||||
_timer,
|
||||
_aux_mutex,
|
||||
_routing_table,
|
||||
_drtio_tuple,
|
||||
_destination,
|
||||
pull_log,
|
||||
&pull_id
|
||||
|
@ -798,9 +792,7 @@ async fn handle_connection(
|
|||
let lvl = read_log_level_filter(stream).await?;
|
||||
process!(
|
||||
stream,
|
||||
_timer,
|
||||
_aux_mutex,
|
||||
_routing_table,
|
||||
_drtio_tuple,
|
||||
_destination,
|
||||
set_log_filter,
|
||||
lvl
|
||||
|
@ -810,9 +802,7 @@ async fn handle_connection(
|
|||
let lvl = read_log_level_filter(stream).await?;
|
||||
process!(
|
||||
stream,
|
||||
_timer,
|
||||
_aux_mutex,
|
||||
_routing_table,
|
||||
_drtio_tuple,
|
||||
_destination,
|
||||
set_uart_log_filter,
|
||||
lvl
|
||||
|
@ -822,9 +812,7 @@ async fn handle_connection(
|
|||
let key = read_key(stream).await?;
|
||||
process!(
|
||||
stream,
|
||||
_timer,
|
||||
_aux_mutex,
|
||||
_routing_table,
|
||||
_drtio_tuple,
|
||||
_destination,
|
||||
config_read,
|
||||
&cfg,
|
||||
|
@ -842,9 +830,7 @@ async fn handle_connection(
|
|||
read_chunk(stream, &mut buffer).await?;
|
||||
process!(
|
||||
stream,
|
||||
_timer,
|
||||
_aux_mutex,
|
||||
_routing_table,
|
||||
_drtio_tuple,
|
||||
_destination,
|
||||
config_write,
|
||||
&cfg,
|
||||
|
@ -856,9 +842,7 @@ async fn handle_connection(
|
|||
let key = read_key(stream).await?;
|
||||
process!(
|
||||
stream,
|
||||
_timer,
|
||||
_aux_mutex,
|
||||
_routing_table,
|
||||
_drtio_tuple,
|
||||
_destination,
|
||||
config_remove,
|
||||
&cfg,
|
||||
|
@ -866,17 +850,15 @@ async fn handle_connection(
|
|||
)
|
||||
}
|
||||
Request::Reboot => {
|
||||
process!(stream, _timer, _aux_mutex, _routing_table, _destination, reboot)
|
||||
process!(stream, _drtio_tuple, _destination, reboot)
|
||||
}
|
||||
Request::ConfigErase => {
|
||||
process!(stream, _timer, _aux_mutex, _routing_table, _destination, config_erase)
|
||||
process!(stream, _drtio_tuple, _destination, config_erase)
|
||||
}
|
||||
Request::DebugAllocator => {
|
||||
process!(
|
||||
stream,
|
||||
_timer,
|
||||
_aux_mutex,
|
||||
_routing_table,
|
||||
_drtio_tuple,
|
||||
_destination,
|
||||
debug_allocator
|
||||
)
|
||||
|
@ -887,12 +869,15 @@ async fn handle_connection(
|
|||
|
||||
pub fn start(
|
||||
cfg: Config,
|
||||
aux_mutex: &Rc<Mutex<bool>>,
|
||||
routing_table: &Rc<RefCell<drtio_routing::RoutingTable>>,
|
||||
timer: GlobalTimer,
|
||||
drtio_tuple: Option<(
|
||||
&Rc<Mutex<bool>>,
|
||||
&Rc<RefCell<drtio_routing::RoutingTable>>,
|
||||
GlobalTimer,
|
||||
)>,
|
||||
) {
|
||||
let aux_mutex = aux_mutex.clone();
|
||||
let routing_table = routing_table.clone();
|
||||
let drtio_tuple = drtio_tuple.map(
|
||||
|(aux_mutex, routing_table, timer)| (aux_mutex.clone(), routing_table.clone(), timer)
|
||||
);
|
||||
task::spawn(async move {
|
||||
let pull_id = Rc::new(RefCell::new(0u32));
|
||||
let cfg = Rc::new(cfg);
|
||||
|
@ -900,12 +885,19 @@ pub fn start(
|
|||
let mut stream = TcpStream::accept(1380, 2048, 2048).await.unwrap();
|
||||
let pull_id = pull_id.clone();
|
||||
let cfg = cfg.clone();
|
||||
let aux_mutex = aux_mutex.clone();
|
||||
let routing_table = routing_table.clone();
|
||||
|
||||
let drtio_tuple = drtio_tuple.clone();
|
||||
task::spawn(async move {
|
||||
info!("received connection");
|
||||
let routing_table = routing_table.borrow();
|
||||
let _ = handle_connection(&mut stream, pull_id, cfg, &aux_mutex, &routing_table, timer)
|
||||
// Avoid consuming the tuple
|
||||
// Keep the borrowed value on stack
|
||||
let drtio_tuple = drtio_tuple.as_ref().map(
|
||||
|(aux_mutex, routing_table, timer)| (aux_mutex, routing_table.borrow(), *timer)
|
||||
);
|
||||
let drtio_tuple = drtio_tuple.as_ref().map(
|
||||
|(aux_mutex, routing_table, timer)| (*aux_mutex, routing_table.deref(), *timer)
|
||||
);
|
||||
let _ = handle_connection(&mut stream, pull_id, cfg, drtio_tuple)
|
||||
.await
|
||||
.map_err(|e| warn!("connection terminated: {:?}", e));
|
||||
let _ = stream.flush().await;
|
||||
|
|
|
@ -540,7 +540,7 @@ pub mod drtio {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn partition_data<PacketF, HandlerF, E>(
|
||||
pub async fn partition_data<PacketF, HandlerF>(
|
||||
linkno: u8,
|
||||
aux_mutex: &Rc<Mutex<bool>>,
|
||||
routing_table: &RoutingTable,
|
||||
|
@ -548,11 +548,10 @@ pub mod drtio {
|
|||
data: &[u8],
|
||||
packet_f: PacketF,
|
||||
reply_handler_f: HandlerF,
|
||||
) -> Result<(), E>
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
PacketF: Fn(&[u8; MASTER_PAYLOAD_MAX_SIZE], PayloadStatus, usize) -> Packet,
|
||||
HandlerF: Fn(&Packet) -> Result<(), E>,
|
||||
E: From<Error>,
|
||||
HandlerF: Fn(&Packet) -> Result<(), Error>,
|
||||
{
|
||||
let mut i = 0;
|
||||
while i < data.len() {
|
||||
|
@ -888,363 +887,6 @@ pub mod drtio {
|
|||
)
|
||||
.await
|
||||
}
|
||||
|
||||
// pub async fn destination_get_log(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// ) -> Result<Vec<u8>, Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let mut remote_log: Vec<u8> = Vec::new();
|
||||
// loop {
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationGetLogRequest {
|
||||
// destination: destination,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationGetLogReply {
|
||||
// last,
|
||||
// length,
|
||||
// data,
|
||||
// } => {
|
||||
// remote_log.extend(&data[0..length as usize]);
|
||||
// if last {
|
||||
// return Ok(remote_log);
|
||||
// }
|
||||
// }
|
||||
// _ => return Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_clear_log(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationClearLogRequest {
|
||||
// destination: destination,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: false,
|
||||
// } => return Err(Error::ClearLogFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_pull_log(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// ) -> Result<Vec<u8>, Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let mut remote_log: Vec<u8> = Vec::new();
|
||||
// loop {
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationPullLogRequest {
|
||||
// destination: destination,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationPullLogReply {
|
||||
// destination: 0,
|
||||
// last,
|
||||
// length,
|
||||
// data,
|
||||
// } => {
|
||||
// remote_log.extend(&data[0..length as usize]);
|
||||
// if last {
|
||||
// return Ok(remote_log);
|
||||
// }
|
||||
// }
|
||||
// _ => return Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_set_log_level(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// log_level: log::LevelFilter,
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationSetLogLevelRequest {
|
||||
// destination: destination,
|
||||
// log_level: log_level as u8,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: false,
|
||||
// } => return Err(Error::SetLogLevelFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_set_uart_log_level(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// log_level: log::LevelFilter,
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationSetUartLogLevelRequest {
|
||||
// destination: destination,
|
||||
// log_level: log_level as u8,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: false,
|
||||
// } => return Err(Error::SetUartLogLevelFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_read_config(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// key: &[u8],
|
||||
// ) -> Result<Vec<u8>, Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let length = key.len();
|
||||
// // Assume key and value can fit within a DRTIO AUX packet together
|
||||
// let mut key_slice: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
|
||||
// key_slice[..length].clone_from_slice(key);
|
||||
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationConfigReadRequest {
|
||||
// destination: destination,
|
||||
// length: length as u16,
|
||||
// key: key_slice,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationConfigReadReply {
|
||||
// destination: 0,
|
||||
// succeeded: true,
|
||||
// length,
|
||||
// value,
|
||||
// } => Ok(Vec::from(&value[..length as usize])),
|
||||
// Packet::DestinationConfigReadReply {
|
||||
// destination: 0,
|
||||
// succeeded: false,
|
||||
// ..
|
||||
// } => Err(Error::ReadConfigFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_write_config(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// key: &str,
|
||||
// value: &[u8],
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
|
||||
// let total_len = 4 + key.len() + 4 + value.len();
|
||||
// let mut payload = Cursor::new(Vec::with_capacity(total_len));
|
||||
|
||||
// payload.write_string(key).unwrap();
|
||||
// payload.write_bytes(value).unwrap();
|
||||
// assert_eq!(value[value.len()-1], payload.get_ref()[total_len-1]);
|
||||
|
||||
// partition_data(
|
||||
// linkno,
|
||||
// aux_mutex,
|
||||
// routing_table,
|
||||
// timer,
|
||||
// &payload.get_ref(),
|
||||
// |slice, status, len| Packet::DestinationConfigWriteRequest {
|
||||
// destination: destination,
|
||||
// length: len as u16,
|
||||
// last: status.is_last(),
|
||||
// data: *slice,
|
||||
// },
|
||||
// |reply| match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: false,
|
||||
// } => Err(Error::WriteConfigFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// },
|
||||
// ).await
|
||||
// }
|
||||
|
||||
// pub async fn destination_remove_config(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// key: &[u8],
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let length = key.len();
|
||||
// let mut key_slice: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
|
||||
// key_slice[..length].clone_from_slice(key);
|
||||
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationConfigRemoveRequest {
|
||||
// destination: destination,
|
||||
// length: length as u16,
|
||||
// key: key_slice,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: false,
|
||||
// } => Err(Error::RemoveConfigFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_erase_config(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationConfigEraseRequest {
|
||||
// destination: destination,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: false,
|
||||
// } => Err(Error::EraseConfigFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_reboot(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationRebootRequest {
|
||||
// destination: destination,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: false,
|
||||
// } => Err(Error::RebootFail(destination)),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
|
||||
// pub async fn destination_allocator_debug(
|
||||
// aux_mutex: &Rc<Mutex<bool>>,
|
||||
// routing_table: &RoutingTable,
|
||||
// timer: GlobalTimer,
|
||||
// destination: u8,
|
||||
// ) -> Result<(), Error> {
|
||||
// let linkno = routing_table.0[destination as usize][0] - 1;
|
||||
// let reply = aux_transact(
|
||||
// aux_mutex,
|
||||
// linkno,
|
||||
// routing_table,
|
||||
// &Packet::DestinationAllocatorDebugRequest {
|
||||
// destination: destination,
|
||||
// },
|
||||
// timer,
|
||||
// )
|
||||
// .await?;
|
||||
// match reply {
|
||||
// Packet::DestinationMgmtAck {
|
||||
// succeeded: true,
|
||||
// } => Ok(()),
|
||||
// _ => Err(Error::UnexpectedReply),
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
#[cfg(not(has_drtio))]
|
||||
|
|
|
@ -14,11 +14,8 @@ default = ["target_zc706", ]
|
|||
build_zynq = { path = "../libbuild_zynq" }
|
||||
|
||||
[dependencies]
|
||||
num-traits = { version = "0.2", default-features = false }
|
||||
num-derive = "0.3"
|
||||
log = { version = "0.4", default-features = false }
|
||||
core_io = { version = "0.1", features = ["collections"] }
|
||||
byteorder = { version = "1.3", default-features = false }
|
||||
cslice = "0.3"
|
||||
embedded-hal = "0.2"
|
||||
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate byteorder;
|
||||
extern crate core_io;
|
||||
extern crate cslice;
|
||||
extern crate embedded_hal;
|
||||
extern crate num_derive;
|
||||
extern crate num_traits;
|
||||
|
||||
extern crate io;
|
||||
extern crate ksupport;
|
||||
|
|
Loading…
Reference in New Issue