From b9e03cf2517bea0d3621b84439e70f80194f5f65 Mon Sep 17 00:00:00 2001
From: Laurent <laurent.thomas@open-cells.com>
Date: Thu, 9 Feb 2017 19:17:28 +0100
Subject: [PATCH] fix usrp thread priority

---
 common/utils/T/T.h                           | 12 ++++++++++++
 targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/common/utils/T/T.h b/common/utils/T/T.h
index bd090ac221..819615131e 100644
--- a/common/utils/T/T.h
+++ b/common/utils/T/T.h
@@ -188,6 +188,12 @@ extern T_cache_t *T_cache;
 
 #define T_HEADER(x) \
   do { \
+    if (!__builtin_types_compatible_p(typeof(x), struct T_header *)) { \
+      printf("%s:%d:%s: " \
+             "bad use of T, pass a message ID as first parameter\n", \
+             __FILE__, __LINE__, __FUNCTION__); \
+      abort(); \
+    } \
     struct timespec T_HEADER_time; \
     if (clock_gettime(CLOCK_REALTIME, &T_HEADER_time)) abort(); \
     memcpy(T_LOCAL_buf, &T_HEADER_time, sizeof(struct timespec)); \
@@ -199,6 +205,12 @@ extern T_cache_t *T_cache;
 
 #define T_HEADER(x) \
   do { \
+    if (!__builtin_types_compatible_p(typeof(x), struct T_header *)) { \
+      printf("%s:%d:%s: " \
+             "bad use of T, pass a message ID as first parameter\n", \
+             __FILE__, __LINE__, __FUNCTION__); \
+      abort(); \
+    } \
     T_PUT_int(1, (int)(uintptr_t)(x)); \
   } while (0)
 
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index 00db1f46c6..2ac70b2d82 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -469,7 +469,7 @@ extern "C" {
          * \param openair0_cfg RF frontend parameters set by application
          */
     int device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
-        //uhd::set_thread_priority_safe(1.0);
+        uhd::set_thread_priority_safe(1.0);
         usrp_state_t *s = (usrp_state_t*)calloc(sizeof(usrp_state_t),1);
         // Initialize USRP device
         device->openair0_cfg = openair0_cfg;
-- 
GitLab