1
0
Fork 0

Compare commits

..

7 Commits

Author SHA1 Message Date
Simon Renblad 5d030b1bcc up LLVM version 2024-10-21 14:45:21 +08:00
Simon Renblad 7a2a527916 cleaning up RTIO_DEVICE_MAP 2024-10-18 18:07:07 +08:00
Simon Renblad 15f9d1a9e5 fix warnings 2024-10-18 14:19:06 +08:00
Simon Renblad ee03879620 fix satman error traits 2024-10-18 14:16:48 +08:00
Simon Renblad 79d965d551 up flake 2024-10-17 14:35:55 +08:00
Simon Renblad fb013c2c5a added eh_rust 2024-10-17 14:35:55 +08:00
Simon Renblad c7387441f3 fix misc errors 2024-10-17 14:35:37 +08:00
3 changed files with 19 additions and 18 deletions

View File

@ -240,17 +240,18 @@
]
},
"locked": {
"lastModified": 1728110308,
"narHash": "sha256-MAoFbcDgr+ZjptFCWfthK+tTnR1NcfuO6tvYhNM2Pwo=",
"ref": "refs/heads/master",
"rev": "cc20478d91e30e1448a4304df7003caed2981b71",
"revCount": 651,
"lastModified": 1729480300,
"narHash": "sha256-L4cG552B4l7et2m5yVOHhfA9S3jsuS9OP2y23bHN8cI=",
"ref": "bump_to_latest",
"rev": "60aa4ce9bcbde154826647cd278cc66302d49d0d",
"revCount": 679,
"type": "git",
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
"url": "https://git.m-labs.hk/srenblad/zynq-rs/"
},
"original": {
"ref": "bump_to_latest",
"type": "git",
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
"url": "https://git.m-labs.hk/srenblad/zynq-rs/"
}
}
},

View File

@ -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/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";
outputs = { self, mozilla-overlay, zynq-rs, artiq }:

View File

@ -1,8 +1,7 @@
#![no_std]
#![feature(c_variadic)]
#![feature(lang_items)]
#![feature(const_btree_len)]
#![feature(generic_const_exprs)]
#![feature(lang_items)]
#![feature(naked_functions)]
#![allow(unexpected_cfgs)]
@ -36,6 +35,7 @@ pub mod rtio;
#[rustfmt::skip]
#[path = "../../../build/pl.rs"]
pub mod pl;
use core::ptr::addr_of;
#[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();
fn read_device_map(cfg: &Config) -> BTreeMap<u32, String> {
@ -147,15 +148,14 @@ fn read_device_map(cfg: &Config) -> BTreeMap<u32, String> {
device_map
}
fn _resolve_channel_name(channel: u32, device_map: &BTreeMap<u32, String>) -> String {
match device_map.get(&channel) {
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"),
}
}
pub fn resolve_channel_name(channel: u32) -> String {
_resolve_channel_name(channel, unsafe { &RTIO_DEVICE_MAP })
}
}
pub fn setup_device_map(cfg: &Config) {