forked from M-Labs/artiq-zynq
Compare commits
7 Commits
bc53d87539
...
5d030b1bcc
Author | SHA1 | Date |
---|---|---|
Simon Renblad | 5d030b1bcc | |
Simon Renblad | 7a2a527916 | |
Simon Renblad | 15f9d1a9e5 | |
Simon Renblad | ee03879620 | |
Simon Renblad | 79d965d551 | |
Simon Renblad | fb013c2c5a | |
Simon Renblad | c7387441f3 |
15
flake.lock
15
flake.lock
|
@ -240,17 +240,18 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1728110308,
|
"lastModified": 1729480300,
|
||||||
"narHash": "sha256-MAoFbcDgr+ZjptFCWfthK+tTnR1NcfuO6tvYhNM2Pwo=",
|
"narHash": "sha256-L4cG552B4l7et2m5yVOHhfA9S3jsuS9OP2y23bHN8cI=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "bump_to_latest",
|
||||||
"rev": "cc20478d91e30e1448a4304df7003caed2981b71",
|
"rev": "60aa4ce9bcbde154826647cd278cc66302d49d0d",
|
||||||
"revCount": 651,
|
"revCount": 679,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
|
"url": "https://git.m-labs.hk/srenblad/zynq-rs/"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
"ref": "bump_to_latest",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
|
"url": "https://git.m-labs.hk/srenblad/zynq-rs/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
inputs.artiq.url = git+https://github.com/m-labs/artiq.git;
|
inputs.artiq.url = git+https://github.com/m-labs/artiq.git;
|
||||||
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
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.url = git+https://git.m-labs.hk/srenblad/zynq-rs/?ref=bump_to_latest;
|
||||||
inputs.zynq-rs.inputs.nixpkgs.follows = "artiq/nixpkgs";
|
inputs.zynq-rs.inputs.nixpkgs.follows = "artiq/nixpkgs";
|
||||||
|
|
||||||
outputs = { self, mozilla-overlay, zynq-rs, artiq }:
|
outputs = { self, mozilla-overlay, zynq-rs, artiq }:
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![feature(c_variadic)]
|
#![feature(c_variadic)]
|
||||||
#![feature(lang_items)]
|
|
||||||
#![feature(const_btree_len)]
|
#![feature(const_btree_len)]
|
||||||
#![feature(generic_const_exprs)]
|
#![feature(lang_items)]
|
||||||
#![feature(naked_functions)]
|
#![feature(naked_functions)]
|
||||||
#![allow(unexpected_cfgs)]
|
#![allow(unexpected_cfgs)]
|
||||||
|
|
||||||
|
@ -36,6 +35,7 @@ pub mod rtio;
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[path = "../../../build/pl.rs"]
|
#[path = "../../../build/pl.rs"]
|
||||||
pub mod pl;
|
pub mod pl;
|
||||||
|
use core::ptr::addr_of;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -116,6 +116,7 @@ pub async fn report_async_rtio_errors() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use interior mutability -> no need for this to be a static mut (no volatile r/ws or FFI)
|
||||||
static mut RTIO_DEVICE_MAP: BTreeMap<u32, String> = BTreeMap::new();
|
static mut RTIO_DEVICE_MAP: BTreeMap<u32, String> = BTreeMap::new();
|
||||||
|
|
||||||
fn read_device_map(cfg: &Config) -> BTreeMap<u32, String> {
|
fn read_device_map(cfg: &Config) -> BTreeMap<u32, String> {
|
||||||
|
@ -147,15 +148,14 @@ fn read_device_map(cfg: &Config) -> BTreeMap<u32, String> {
|
||||||
device_map
|
device_map
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _resolve_channel_name(channel: u32, device_map: &BTreeMap<u32, String>) -> String {
|
|
||||||
match device_map.get(&channel) {
|
|
||||||
Some(val) => val.clone(),
|
|
||||||
None => String::from("unknown"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn resolve_channel_name(channel: u32) -> String {
|
pub fn resolve_channel_name(channel: u32) -> String {
|
||||||
_resolve_channel_name(channel, unsafe { &RTIO_DEVICE_MAP })
|
unsafe {
|
||||||
|
let ptr: *const BTreeMap<u32, String> = addr_of!(RTIO_DEVICE_MAP);
|
||||||
|
match ptr.as_ref().unwrap().get(&channel) {
|
||||||
|
Some(val) => val.clone(),
|
||||||
|
None => String::from("unknown"),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup_device_map(cfg: &Config) {
|
pub fn setup_device_map(cfg: &Config) {
|
||||||
|
|
Loading…
Reference in New Issue