forked from M-Labs/artiq-zynq
Compare commits
2 Commits
5d030b1bcc
...
bc53d87539
Author | SHA1 | Date |
---|---|---|
Simon Renblad | bc53d87539 | |
Simon Renblad | 343831f438 |
15
flake.lock
15
flake.lock
|
@ -240,18 +240,17 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729480300,
|
||||
"narHash": "sha256-L4cG552B4l7et2m5yVOHhfA9S3jsuS9OP2y23bHN8cI=",
|
||||
"ref": "bump_to_latest",
|
||||
"rev": "60aa4ce9bcbde154826647cd278cc66302d49d0d",
|
||||
"revCount": 679,
|
||||
"lastModified": 1728110308,
|
||||
"narHash": "sha256-MAoFbcDgr+ZjptFCWfthK+tTnR1NcfuO6tvYhNM2Pwo=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "cc20478d91e30e1448a4304df7003caed2981b71",
|
||||
"revCount": 651,
|
||||
"type": "git",
|
||||
"url": "https://git.m-labs.hk/srenblad/zynq-rs/"
|
||||
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
|
||||
},
|
||||
"original": {
|
||||
"ref": "bump_to_latest",
|
||||
"type": "git",
|
||||
"url": "https://git.m-labs.hk/srenblad/zynq-rs/"
|
||||
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
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/srenblad/zynq-rs/?ref=bump_to_latest;
|
||||
inputs.zynq-rs.url = git+https://git.m-labs.hk/m-labs/zynq-rs;
|
||||
inputs.zynq-rs.inputs.nixpkgs.follows = "artiq/nixpkgs";
|
||||
|
||||
outputs = { self, mozilla-overlay, zynq-rs, artiq }:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#![no_std]
|
||||
#![feature(c_variadic)]
|
||||
#![feature(const_btree_len)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(const_btree_len)]
|
||||
#![feature(generic_const_exprs)]
|
||||
#![feature(naked_functions)]
|
||||
#![allow(unexpected_cfgs)]
|
||||
|
||||
|
@ -35,7 +36,6 @@ pub mod rtio;
|
|||
#[rustfmt::skip]
|
||||
#[path = "../../../build/pl.rs"]
|
||||
pub mod pl;
|
||||
use core::ptr::addr_of;
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -116,7 +116,6 @@ 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();
|
||||
|
||||
fn read_device_map(cfg: &Config) -> BTreeMap<u32, String> {
|
||||
|
@ -148,16 +147,17 @@ fn read_device_map(cfg: &Config) -> BTreeMap<u32, String> {
|
|||
device_map
|
||||
}
|
||||
|
||||
pub fn resolve_channel_name(channel: u32) -> String {
|
||||
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"),
|
||||
}
|
||||
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 {
|
||||
_resolve_channel_name(channel, unsafe { &RTIO_DEVICE_MAP })
|
||||
}
|
||||
|
||||
pub fn setup_device_map(cfg: &Config) {
|
||||
unsafe {
|
||||
RTIO_DEVICE_MAP = read_device_map(cfg);
|
||||
|
|
Loading…
Reference in New Issue