master
ismagom 9 years ago
commit 4380995f59

@ -91,7 +91,6 @@ IF(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
ELSE(${CMAKE_BUILD_TYPE} STREQUAL "Debug") ELSE(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
FIND_PACKAGE(SSE) FIND_PACKAGE(SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
IF(HAVE_AVX) IF(HAVE_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
ELSEIF(HAVE_SSE) ELSEIF(HAVE_SSE)

@ -170,7 +170,7 @@ int main(int argc, char **argv) {
cuhd_set_master_clock_rate(uhd, 30.72e6); cuhd_set_master_clock_rate(uhd, 30.72e6);
// Supress UHD messages // Supress UHD messages
cuhd_supress_stdout(); cuhd_suppress_stdout();
nof_freqs = srslte_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN); nof_freqs = srslte_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN);
if (nof_freqs < 0) { if (nof_freqs < 0) {

@ -35,6 +35,8 @@ extern "C" {
#include "srslte/config.h" #include "srslte/config.h"
typedef void (*cuhd_msg_handler_t)(const char*);
SRSLTE_API int cuhd_open(char *args, SRSLTE_API int cuhd_open(char *args,
void **handler); void **handler);
@ -83,7 +85,9 @@ SRSLTE_API double cuhd_get_rx_gain(void *h);
SRSLTE_API double cuhd_get_tx_gain(void *h); SRSLTE_API double cuhd_get_tx_gain(void *h);
SRSLTE_API void cuhd_supress_stdout(); SRSLTE_API void cuhd_suppress_stdout();
SRSLTE_API void cuhd_register_msg_handler(cuhd_msg_handler_t h);
SRSLTE_API double cuhd_set_rx_freq(void *h, SRSLTE_API double cuhd_set_rx_freq(void *h,
double freq); double freq);

@ -40,11 +40,19 @@
//#define HIDE_MESSAGES //#define HIDE_MESSAGES
void my_handler(uhd::msg::type_t type, const std::string & msg) cuhd_msg_handler_t msg_handler;
void suppress_handler(uhd::msg::type_t type, const std::string & msg)
{ {
//handle the message... //handle the message...
} }
void translate_handler(uhd::msg::type_t type, const std::string & msg)
{
if(msg_handler)
msg_handler(msg.c_str());
}
typedef _Complex float complex_t; typedef _Complex float complex_t;
#define SAMPLE_SZ sizeof(complex_t) #define SAMPLE_SZ sizeof(complex_t)
@ -199,8 +207,14 @@ float cuhd_get_rx_gain_offset(void *h) {
return 15; return 15;
} }
void cuhd_supress_stdout() { void cuhd_suppress_stdout() {
uhd::msg::register_handler(my_handler); uhd::msg::register_handler(suppress_handler);
}
void cuhd_register_msg_handler(cuhd_msg_handler_t h)
{
msg_handler = h;
uhd::msg::register_handler(translate_handler);
} }
int cuhd_open_(char *args, void **h, bool create_thread_gain, bool tx_gain_same_rx) int cuhd_open_(char *args, void **h, bool create_thread_gain, bool tx_gain_same_rx)

Loading…
Cancel
Save