This commit is contained in:
ismagom 2015-10-28 19:11:38 +01:00
commit 4380995f59
4 changed files with 25 additions and 8 deletions

View file

@ -91,9 +91,8 @@ IF(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
ELSE(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
FIND_PACKAGE(SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
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)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
ENDIF(HAVE_AVX)

View file

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

View file

@ -35,6 +35,8 @@ extern "C" {
#include "srslte/config.h"
typedef void (*cuhd_msg_handler_t)(const char*);
SRSLTE_API int cuhd_open(char *args,
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 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,
double freq);
@ -159,4 +163,4 @@ SRSLTE_API int cuhd_send_timed2(void *h,
#ifdef __cplusplus
}
#endif
#endif

View file

@ -40,11 +40,19 @@
//#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...
}
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;
#define SAMPLE_SZ sizeof(complex_t)
@ -199,8 +207,14 @@ float cuhd_get_rx_gain_offset(void *h) {
return 15;
}
void cuhd_supress_stdout() {
uhd::msg::register_handler(my_handler);
void cuhd_suppress_stdout() {
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)