From a9762e048aa0d453f5dc5dcb2f22d562a05d3d12 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Thu, 2 May 2024 16:30:00 +0100 Subject: [PATCH] Support SMUX in clockgen software PLL updates --- CHANGELOG.rst | 1 + lib_xua/src/core/clocking/clockgen.xc | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 70ee36c7..94b39cda 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ UNRELEASED ---------- * FIXED: Device fails to enumerate when ADAT and S/PDIF transmit are enabled + * FIXED: Update software PLL at the correct rate for ADAT SMUX * CHANGED: Enable only the minimum number of ADAT input formats based for the supported sample frequencies diff --git a/lib_xua/src/core/clocking/clockgen.xc b/lib_xua/src/core/clocking/clockgen.xc index eda5d79f..c75f56e4 100644 --- a/lib_xua/src/core/clocking/clockgen.xc +++ b/lib_xua/src/core/clocking/clockgen.xc @@ -723,7 +723,14 @@ void clockGen ( streaming chanend ?c_spdif_rx, } } } - if(adatChannel == 4 || adatChannel == 8) + + /* An edge needs to be recorded/toggled in the following cases: + * smux = 0: adatChannel = 4, 8 + * smux = 1: adatChannel = 2, 4, 6, 8 + * smux = 2: adatChannel = 1, 2, 3, 4, 5, 6, 7, 8 + * This is simplified to a shift-and-mask in the if-condition below. + */ + if ((adatChannel != 0) && ((adatChannel << smux) & 3) == 0) { adatCounters.samples += 1; @@ -764,7 +771,7 @@ void clockGen ( streaming chanend ?c_spdif_rx, adatChannel = 0; } break; -#endif +#endif // XUA_ADAT_RX_EN #if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) /* AudioHub requests data */