Skip to content

Commit

Permalink
Set of changes to support new ALSA RAVENNA/AES67 device driver versio…
Browse files Browse the repository at this point in the history
…n 1.1.93

- removed changes to driver/MTAL_LKernelAPI.c in ravenna-alsa-lkm-kernel-v5.patch
- added patch ravenna-alsa-lkm-disable-ptp-checksum.patch to the driver to the disable UDP checksum verification for the incoming PTP packets
- changed build.sh script to use new driver revision and apply the new patch
- added handling of the sink status flag "all_muted" in daemon, WebUI and regression tests
- updated documentation
  • Loading branch information
bondagit committed Jun 6, 2020
1 parent 13c7078 commit 9aaa517
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 28 deletions.
19 changes: 19 additions & 0 deletions 3rdparty/patches/ravenna-alsa-lkm-disable-ptp-checksum.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/driver/PTP.c b/driver/PTP.c
--- a/driver/PTP.c
+++ b/driver/PTP.c
@@ -306,6 +306,7 @@ EDispatchResult process_PTP_packet(TClock_PTP* self, TUDPPacketBase* pUDPPacketB
}

// verify checksum
+#if 0
if (pUDPPacketBase->UDPHeader.usCheckSum != 0)
{
uint16_t ui16CheckSum = MTAL_ComputeUDPChecksum(&pPTPPacketBase->UDPHeader, MTAL_SWAP16(pUDPPacketBase->UDPHeader.usLen), (unsigned short*)&pPTPPacketBase->IPV4Header.ui32SrcIP, (unsigned short*)&pPTPPacketBase->IPV4Header.ui32DestIP);
@@ -319,6 +320,7 @@ EDispatchResult process_PTP_packet(TClock_PTP* self, TUDPPacketBase* pUDPPacketB
return DR_PACKET_ERROR;
}
}
+#endif

//DumpPTPV2MsgHeader(&pPTPPacketBase->V2MsgHeader);

25 changes: 0 additions & 25 deletions 3rdparty/patches/ravenna-alsa-lkm-kernel-v5.patch
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
diff --git a/driver/MTAL_LKernelAPI.c b/driver/MTAL_LKernelAPI.c
index 164f315..a993b41 100644
--- a/driver/MTAL_LKernelAPI.c
+++ b/driver/MTAL_LKernelAPI.c
@@ -35,7 +35,7 @@
#include <linux/spinlock.h>
#include <linux/version.h>

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)
#include <linux/timekeeping.h>
#else
#include <linux/time.h>
@@ -214,7 +214,10 @@ uint64_t MTAL_LK_GetCounterFreq(void)
uint64_t MTAL_LK_GetSystemTime(void)
{
uint64_t timeVal = 0ull;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)
+ struct timespec64 ts64;
+ ktime_get_real_ts64(&ts64);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
struct timespec64 ts64;
getnstimeofday64(&ts64);
#else
diff --git a/driver/module_timer.c b/driver/module_timer.c
index 5f64a8e..0ba770f 100644
--- a/driver/module_timer.c
Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ cd 3rdparty
if [ ! -d ravenna-alsa-lkm.git ]; then
git clone https://bitbucket.org/MergingTechnologies/ravenna-alsa-lkm.git
cd ravenna-alsa-lkm
git checkout 5a06f0d33c18e532eb5dac3ad90c0acd59fbabd7
git checkout 35c708f3747474130790cf508c064360a9589ac8
cd driver
echo "Apply patches to ravenna-alsa-lkm module ..."
git apply ../../patches/ravenna-alsa-lkm-kernel-v5.patch
git apply ../../patches/ravenna-alsa-lkm-enable-loopback.patch
git apply ../../patches/ravenna-alsa-lkm-fixes.patch
git apply ../../patches/ravenna-alsa-lkm-arm-32bit.patch
git apply ../../patches/ravenna-alsa-lkm-add-codec-am824.patch
git apply ../../patches/ravenna-alsa-lkm-disable-ptp-checksum.patch
echo "Building ravenna-alsa-lkm kernel module ..."
make
cd ../..
Expand Down
3 changes: 3 additions & 0 deletions daemon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ Example:
"rtp_sac_error": false,
"receiving_rtp_packet": false,
"some_muted": false,
"all_muted": false,
"muted": true
},
"sink_min_time": 0
Expand All @@ -447,6 +448,8 @@ where:
> - **some\_muted** JSON boolean (not used)
> - **all\_muted** JSON boolean (not used)
> - **muted** JSON boolean specifying whether the sink is currently muted.
> **sink\_min\_time** JSON number specifying the minimum source RTP packet arrival time.
Expand Down
1 change: 1 addition & 0 deletions daemon/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ std::string sink_status_to_json(const SinkStreamStatus& status) {
<< ", \n \"rtp_sac_error\": " << status.is_rtp_sac_error
<< ", \n \"receiving_rtp_packet\": " << status.is_receiving_rtp_packet
<< ", \n \"some_muted\": " << status.is_some_muted
<< ", \n \"all_muted\": " << status.is_all_muted
<< ", \n \"muted\": " << status.is_muted << "\n },"
<< "\n \"sink_min_time\": " << status.min_time << "\n}\n";
return ss.str();
Expand Down
1 change: 1 addition & 0 deletions daemon/session_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ std::error_code SessionManager::get_sink_status(
sink_status.is_receiving_rtp_packet = status.u.flags & 0x10;
sink_status.is_muted = status.u.flags & 0x20;
sink_status.is_some_muted = status.u.flags & 0x40;
sink_status.is_all_muted = status.u.flags & 0x80;
sink_status.min_time = status.sink_min_time;
}

Expand Down
1 change: 1 addition & 0 deletions daemon/session_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct SinkStreamStatus {
bool is_receiving_rtp_packet{false};
bool is_muted{false};
bool is_some_muted{false};
bool is_all_muted{false};
int min_time{0};
};

Expand Down
6 changes: 4 additions & 2 deletions daemon/tests/daemon_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,10 @@ BOOST_AUTO_TEST_CASE(sink_check_status) {
boost::property_tree::read_json(ss, pt);
//auto is_sink_muted = pt.get<bool>("sink_flags.muted");
auto is_sink_some_muted = pt.get<bool>("sink_flags.some_muted");
//BOOST_REQUIRE_MESSAGE(is_sink_muted, "sink is not receiving packets");
BOOST_REQUIRE_MESSAGE(!is_sink_some_muted, "sink is not receiving packets");
auto is_sink_all_muted = pt.get<bool>("sink_flags.all_muted");
//BOOST_REQUIRE_MESSAGE(is_sink_muted, "sink is muted");
BOOST_REQUIRE_MESSAGE(!is_sink_all_muted, "all sinks are mutes");
BOOST_REQUIRE_MESSAGE(!is_sink_some_muted, "some sinks are muted");
BOOST_REQUIRE_MESSAGE(cli.remove_sink(0), "removed sink 0");
}

Expand Down
2 changes: 2 additions & 0 deletions webui/src/Sinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class SinkEntry extends Component {
flags += 'receiving';
if (status.sink_flags._some_muted)
flags += (flags ? ',' : '') + 'some muted';
if (status.sink_flags._all_muted)
flags += (flags ? ',' : '') + 'all muted';
if (status.sink_flags._muted)
flags += (flags ? ',' : '') + 'muted';
this.setState({
Expand Down

0 comments on commit 9aaa517

Please sign in to comment.