forked from M-Labs/nix-scripts
Compare commits
No commits in common. "ff8f09f7aacf9da25fda589a7c8955f13376379c" and "c7cafe6e61846a24646fdca31ec8ce844e715cdb" have entirely different histories.
ff8f09f7aa
...
c7cafe6e61
|
@ -58,12 +58,12 @@ in
|
||||||
src = <mirnySrc>;
|
src = <mirnySrc>;
|
||||||
};
|
};
|
||||||
mirny-cpld-release = buildMirnyCpld rec {
|
mirny-cpld-release = buildMirnyCpld rec {
|
||||||
version = "0.3.1";
|
version = "0.3";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "quartiq";
|
owner = "quartiq";
|
||||||
repo = "mirny";
|
repo = "mirny";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-FbPUgXcUByEnczbnDCh8wYPO+rpSZSAabG1rtvA7mIs=";
|
sha256 = "sha256-u1iXcbGX6JkVgfpnCbkyTOVoMYnYcSufLBb6OBAeu8c=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mirny-cpld-legacy-almazny = buildMirnyCpld rec {
|
mirny-cpld-legacy-almazny = buildMirnyCpld rec {
|
||||||
|
@ -76,6 +76,16 @@ in
|
||||||
};
|
};
|
||||||
patchPhase = "patch -p1 < ${./mirny-legacy-almazny.diff}";
|
patchPhase = "patch -p1 < ${./mirny-legacy-almazny.diff}";
|
||||||
};
|
};
|
||||||
|
mirny-cpld-almazny = buildMirnyCpld rec {
|
||||||
|
version = "0.3";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "quartiq";
|
||||||
|
repo = "mirny";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-u1iXcbGX6JkVgfpnCbkyTOVoMYnYcSufLBb6OBAeu8c=";
|
||||||
|
};
|
||||||
|
patchPhase = "patch -p1 < ${./mirny-almazny.diff}";
|
||||||
|
};
|
||||||
fastino-fpga = pkgs.stdenv.mkDerivation {
|
fastino-fpga = pkgs.stdenv.mkDerivation {
|
||||||
name = "fastino-fpga";
|
name = "fastino-fpga";
|
||||||
src = <fastinoSrc>;
|
src = <fastinoSrc>;
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
diff --git a/mirny.py b/mirny.py
|
||||||
|
index 6c041de..73991b1 100644
|
||||||
|
--- a/mirny.py
|
||||||
|
+++ b/mirny.py
|
||||||
|
@@ -135,7 +135,7 @@ class SR(Module):
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
- def connect_ext(self, ext, adr, mask):
|
||||||
|
+ def connect_ext(self, ext, adr, mask, sdi_passthrough=False):
|
||||||
|
adr &= mask
|
||||||
|
self._check_intersection(adr, mask)
|
||||||
|
self._slaves.append((ext, adr, mask))
|
||||||
|
@@ -146,12 +146,16 @@ class SR(Module):
|
||||||
|
stb.ce.eq(self.bus.re),
|
||||||
|
# don't glitch with &stb.o
|
||||||
|
ext.sck.eq(self.ext.sck),
|
||||||
|
- ext.sdi.eq(self.ext.sdi & stb.o),
|
||||||
|
ext.cs.eq(stb.o),
|
||||||
|
If(stb.o,
|
||||||
|
self.ext.sdo.eq(ext.sdo),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
+ # Almazny shares one SDI with 4 devices, it cannot be masked by stb
|
||||||
|
+ if sdi_passthrough:
|
||||||
|
+ self.comb += ext.sdi.eq(self.ext.sdi)
|
||||||
|
+ else:
|
||||||
|
+ self.comb += ext.sdi.eq(self.ext.sdi & stb.o),
|
||||||
|
|
||||||
|
|
||||||
|
def intersection(a, b):
|
||||||
|
@@ -360,7 +364,7 @@ class Mirny(Module):
|
||||||
|
]
|
||||||
|
|
||||||
|
ext = Record(ext_layout)
|
||||||
|
- self.sr.connect_ext(ext, adr=i + 12, mask=mask)
|
||||||
|
+ self.sr.connect_ext(ext, adr=i + 12, mask=mask, sdi_passthrough=True)
|
||||||
|
self.comb += [
|
||||||
|
mezz[i + 3].oe.eq(1),
|
||||||
|
mezz[i + 3].o.eq(~ext.cs), # Almazny REG_LATCH
|
|
@ -24,12 +24,12 @@ let
|
||||||
cargo = rust;
|
cargo = rust;
|
||||||
});
|
});
|
||||||
|
|
||||||
buildStm32Firmware = { name, src, cargoDepsName ? name, patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", doCheck ? true, binaryName ? name, extraCargoBuildArgs ? "", outputHashes ? {} }:
|
buildStm32Firmware = { name, src, cargoDepsName ? name, cargoPatches ? [], patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", doCheck ? true, binaryName ? name, extraCargoBuildArgs ? "", outputHashes ? {} }:
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
inherit name cargoDepsName;
|
inherit name cargoDepsName;
|
||||||
version = "0.0.0";
|
version = "0.0.0";
|
||||||
|
|
||||||
inherit src;
|
inherit src cargoPatches;
|
||||||
|
|
||||||
cargoLock = { lockFile = "${src}/Cargo.lock"; inherit outputHashes; };
|
cargoLock = { lockFile = "${src}/Cargo.lock"; inherit outputHashes; };
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ in
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
patch -p1 < ${./pounder-725.diff}
|
patch -p1 < ${./pounder-725.diff}
|
||||||
'';
|
'';
|
||||||
|
cargoPatches = [
|
||||||
|
./pounder-cargo-patch.diff
|
||||||
|
];
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
outputHashes = {
|
|
||||||
"menu-0.6.0" = "sha256-Zilj27J4a/T/Je2qJr6igFj2OEw0/4fU4f0t+afm4TY=";
|
|
||||||
};
|
|
||||||
} // value))) {
|
} // value))) {
|
||||||
dual-iir = {};
|
dual-iir = {};
|
||||||
dual-iir-pounder_v1_0 = {
|
dual-iir-pounder_v1_0 = {
|
||||||
|
|
|
@ -216,18 +216,9 @@ index 025f7d4f..59578cce 100644
|
||||||
fn add_write(&mut self, register: Register, value: &[u8]) {
|
fn add_write(&mut self, register: Register, value: &[u8]) {
|
||||||
let data = &mut self.data[self.index..];
|
let data = &mut self.data[self.index..];
|
||||||
diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs
|
diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs
|
||||||
index ea566e14..84bde34a 100644
|
index a4a04be8..83dcdefb 100644
|
||||||
--- a/src/bin/dual-iir.rs
|
--- a/src/bin/dual-iir.rs
|
||||||
+++ b/src/bin/dual-iir.rs
|
+++ b/src/bin/dual-iir.rs
|
||||||
@@ -28,7 +28,7 @@
|
|
||||||
#![no_std]
|
|
||||||
#![no_main]
|
|
||||||
|
|
||||||
-use core::mem::MaybeUninit;
|
|
||||||
+use core::mem::{MaybeUninit, size_of};
|
|
||||||
use core::sync::atomic::{fence, Ordering};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
@@ -47,6 +47,8 @@ use stabilizer::{
|
@@ -47,6 +47,8 @@ use stabilizer::{
|
||||||
dac::{Dac0Output, Dac1Output, DacCode},
|
dac::{Dac0Output, Dac1Output, DacCode},
|
||||||
hal,
|
hal,
|
||||||
|
@ -240,7 +231,7 @@ index ea566e14..84bde34a 100644
|
||||||
@@ -179,6 +181,16 @@ pub struct DualIir {
|
@@ -179,6 +181,16 @@ pub struct DualIir {
|
||||||
/// See [signal_generator::BasicConfig#miniconf]
|
/// See [signal_generator::BasicConfig#miniconf]
|
||||||
#[tree(depth = 2)]
|
#[tree(depth = 2)]
|
||||||
source: [signal_generator::BasicConfig; 2],
|
signal_generator: [signal_generator::BasicConfig; 2],
|
||||||
+
|
+
|
||||||
+ /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations
|
+ /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations
|
||||||
+ ///
|
+ ///
|
||||||
|
@ -255,9 +246,9 @@ index ea566e14..84bde34a 100644
|
||||||
|
|
||||||
impl Default for DualIir {
|
impl Default for DualIir {
|
||||||
@@ -206,6 +218,8 @@ impl Default for DualIir {
|
@@ -206,6 +218,8 @@ impl Default for DualIir {
|
||||||
source: Default::default(),
|
signal_generator: [signal_generator::BasicConfig::default(); 2],
|
||||||
|
|
||||||
stream: Default::default(),
|
stream_target: StreamTarget::default(),
|
||||||
+
|
+
|
||||||
+ pounder: None.into(),
|
+ pounder: None.into(),
|
||||||
}
|
}
|
||||||
|
@ -266,7 +257,7 @@ index ea566e14..84bde34a 100644
|
||||||
@@ -222,6 +236,7 @@ mod app {
|
@@ -222,6 +236,7 @@ mod app {
|
||||||
active_settings: DualIir,
|
active_settings: DualIir,
|
||||||
telemetry: TelemetryBuffer,
|
telemetry: TelemetryBuffer,
|
||||||
source: [SignalGenerator; 2],
|
signal_generator: [SignalGenerator; 2],
|
||||||
+ pounder: Option<Pounder>,
|
+ pounder: Option<Pounder>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,12 +313,12 @@ index ea566e14..84bde34a 100644
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- #[task(priority = 1, local=[afes], shared=[network, settings, active_settings, source])]
|
- #[task(priority = 1, local=[afes], shared=[network, settings, active_settings, signal_generator])]
|
||||||
+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, source, pounder])]
|
+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, signal_generator, pounder])]
|
||||||
async fn settings_update(mut c: settings_update::Context) {
|
async fn settings_update(mut c: settings_update::Context) {
|
||||||
c.shared.settings.lock(|settings| {
|
c.shared.settings.lock(|settings| {
|
||||||
c.local.afes.0.set_gain(settings.dual_iir.afe[0]);
|
c.local.afes.0.set_gain(settings.dual_iir.afe[0]);
|
||||||
@@ -480,6 +505,17 @@ mod app {
|
@@ -482,6 +507,17 @@ mod app {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,9 +334,9 @@ index ea566e14..84bde34a 100644
|
||||||
+ }
|
+ }
|
||||||
+ });
|
+ });
|
||||||
|
|
||||||
c.shared
|
let target = settings.dual_iir.stream_target.into();
|
||||||
.network
|
c.shared.network.lock(|net| net.direct_stream(target));
|
||||||
@@ -491,21 +527,30 @@ mod app {
|
@@ -492,22 +528,31 @@ mod app {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +344,8 @@ index ea566e14..84bde34a 100644
|
||||||
+ #[task(priority = 1, shared=[network, settings, telemetry, pounder], local=[cpu_temp_sensor])]
|
+ #[task(priority = 1, shared=[network, settings, telemetry, pounder], local=[cpu_temp_sensor])]
|
||||||
async fn telemetry(mut c: telemetry::Context) {
|
async fn telemetry(mut c: telemetry::Context) {
|
||||||
loop {
|
loop {
|
||||||
let telemetry = c.shared.telemetry.lock(|telemetry| *telemetry);
|
let telemetry: TelemetryBuffer =
|
||||||
|
c.shared.telemetry.lock(|telemetry| *telemetry);
|
||||||
|
|
||||||
- let (gains, telemetry_period) =
|
- let (gains, telemetry_period) =
|
||||||
+ let (gains, telemetry_period, pounder_config) =
|
+ let (gains, telemetry_period, pounder_config) =
|
||||||
|
@ -380,19 +372,10 @@ index ea566e14..84bde34a 100644
|
||||||
});
|
});
|
||||||
|
|
||||||
diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs
|
diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs
|
||||||
index 3ddecd7c..77a7474b 100644
|
index e0cfb58f..c9b26831 100644
|
||||||
--- a/src/bin/lockin.rs
|
--- a/src/bin/lockin.rs
|
||||||
+++ b/src/bin/lockin.rs
|
+++ b/src/bin/lockin.rs
|
||||||
@@ -29,7 +29,7 @@
|
@@ -551,6 +551,7 @@ mod app {
|
||||||
|
|
||||||
use core::{
|
|
||||||
convert::TryFrom,
|
|
||||||
- mem::MaybeUninit,
|
|
||||||
+ mem::{MaybeUninit, size_of},
|
|
||||||
sync::atomic::{fence, Ordering},
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -547,6 +547,7 @@ mod app {
|
|
||||||
gains[0],
|
gains[0],
|
||||||
gains[1],
|
gains[1],
|
||||||
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
||||||
|
@ -708,24 +691,11 @@ index 5bc7e9ff..5b8d5d30 100644
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/net/data_stream.rs b/src/net/data_stream.rs
|
|
||||||
index 714ec57f..d442f197 100644
|
|
||||||
--- a/src/net/data_stream.rs
|
|
||||||
+++ b/src/net/data_stream.rs
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
|
|
||||||
#![allow(non_camel_case_types)] // https://github.com/rust-embedded/heapless/issues/411
|
|
||||||
|
|
||||||
-use core::{fmt::Write, mem::MaybeUninit};
|
|
||||||
+use core::{fmt::Write, mem::{MaybeUninit, size_of_val}};
|
|
||||||
use heapless::{
|
|
||||||
box_pool,
|
|
||||||
pool::boxed::{Box, BoxBlock},
|
|
||||||
diff --git a/src/net/mod.rs b/src/net/mod.rs
|
diff --git a/src/net/mod.rs b/src/net/mod.rs
|
||||||
index 43733fa8..a8b90f86 100644
|
index a10b7cdb..efa2b8c8 100644
|
||||||
--- a/src/net/mod.rs
|
--- a/src/net/mod.rs
|
||||||
+++ b/src/net/mod.rs
|
+++ b/src/net/mod.rs
|
||||||
@@ -32,14 +32,14 @@ pub type NetworkReference =
|
@@ -33,14 +33,14 @@ pub type NetworkReference =
|
||||||
|
|
||||||
pub struct MqttStorage {
|
pub struct MqttStorage {
|
||||||
telemetry: [u8; 2048],
|
telemetry: [u8; 2048],
|
||||||
|
@ -743,7 +713,7 @@ index 43733fa8..a8b90f86 100644
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs
|
diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs
|
||||||
index c8eb536b..116382a3 100644
|
index 4aa82601..3dc3086c 100644
|
||||||
--- a/src/net/telemetry.rs
|
--- a/src/net/telemetry.rs
|
||||||
+++ b/src/net/telemetry.rs
|
+++ b/src/net/telemetry.rs
|
||||||
@@ -16,7 +16,7 @@ use minimq::{DeferredPublication, Publication};
|
@@ -16,7 +16,7 @@ use minimq::{DeferredPublication, Publication};
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
diff --git a/Cargo.lock b/Cargo.lock
|
||||||
|
index 7c796acf..cee5ba60 100644
|
||||||
|
--- a/Cargo.lock
|
||||||
|
+++ b/Cargo.lock
|
||||||
|
@@ -983,9 +983,9 @@ dependencies = [
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
-version = "1.0.203"
|
||||||
|
+version = "1.0.202"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
-checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
||||||
|
+checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
@@ -1003,9 +1003,9 @@ dependencies = [
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
-version = "1.0.203"
|
||||||
|
+version = "1.0.202"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
-checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
||||||
|
+checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
2
web.nix
2
web.nix
|
@ -8,7 +8,7 @@ in
|
||||||
web-intl = pkgs.runCommand "web-intl" {}
|
web-intl = pkgs.runCommand "web-intl" {}
|
||||||
''
|
''
|
||||||
cd ${web-src}
|
cd ${web-src}
|
||||||
DOMAINNAME=m-labs-intl.com ${pkgs.zola}/bin/zola build -o $out -u https://m-labs-intl.com
|
DOMAINNAME=m-labs.hk ${pkgs.zola}/bin/zola build -o $out
|
||||||
'';
|
'';
|
||||||
sphinxcontrib-platformpicker = pkgs.python3Packages.buildPythonPackage rec {
|
sphinxcontrib-platformpicker = pkgs.python3Packages.buildPythonPackage rec {
|
||||||
pname = "sphinxcontrib-platformpicker";
|
pname = "sphinxcontrib-platformpicker";
|
||||||
|
|
Loading…
Reference in New Issue