Fixed compilation for different boards

master
Ismael Gomez 9 years ago
parent d68520446c
commit 350842062a

@ -4,7 +4,7 @@ IF(NOT UHD_FOUND)
FIND_PATH( FIND_PATH(
UHD_INCLUDE_DIRS UHD_INCLUDE_DIRS
NAMES uhd/config.hpp NAMES uhd.h
HINTS $ENV{UHD_DIR}/include HINTS $ENV{UHD_DIR}/include
PATHS /usr/local/include PATHS /usr/local/include
/usr/include /usr/include

@ -70,20 +70,24 @@ ADD_LIBRARY(srslte SHARED ${SOURCES_ALL})
TARGET_LINK_LIBRARIES(srslte m ${FFTW3F_LIBRARIES}) TARGET_LINK_LIBRARIES(srslte m ${FFTW3F_LIBRARIES})
IF(RF_FOUND) IF(RF_FOUND)
# Include common RF files
SET(SOURCES_RF "")
LIST(APPEND SOURCES_RF "rf/src/rf_imp.c" "rf/src/rf_utils.c")
IF (UHD_FOUND) IF (UHD_FOUND)
INCLUDE_DIRECTORIES(${UHD_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${UHD_INCLUDE_DIRS})
LINK_DIRECTORIES(${UHD_LIBRARY_DIRS}) LINK_DIRECTORIES(${UHD_LIBRARY_DIRS})
add_definitions(-DENABLE_UHD) add_definitions(-DENABLE_UHD)
LIST(APPEND SOURCES_RF "rf/src/rf_uhd_imp.c" "rf/src/uhd_c_api.cpp")
ENDIF (UHD_FOUND) ENDIF (UHD_FOUND)
IF (BLADERF_FOUND) IF (BLADERF_FOUND)
INCLUDE_DIRECTORIES(${BLADERF_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${BLADERF_INCLUDE_DIRS})
add_definitions(-DENABLE_BLADERF) add_definitions(-DENABLE_BLADERF)
LIST(APPEND SOURCES_RF "rf/src/rf_blade_imp.c")
ENDIF (BLADERF_FOUND) ENDIF (BLADERF_FOUND)
FILE(GLOB_RECURSE cfiles "rf/src/*.c") ADD_LIBRARY(srslte_rf SHARED ${SOURCES_RF})
FILE(GLOB_RECURSE cppfiles "rf/src/*.cpp")
ADD_LIBRARY(srslte_rf SHARED ${cfiles} ${cppfiles})
IF (UHD_FOUND) IF (UHD_FOUND)
TARGET_LINK_LIBRARIES(srslte_rf ${UHD_LIBRARIES}) TARGET_LINK_LIBRARIES(srslte_rf ${UHD_LIBRARIES})

@ -230,8 +230,6 @@ static void* thread_gain_fcn(void *h) {
return NULL; return NULL;
} }
static char uhd_args[1024];
int rf_uhd_open(char *args, void **h, bool create_thread_gain, bool tx_gain_same_rx) int rf_uhd_open(char *args, void **h, bool create_thread_gain, bool tx_gain_same_rx)
{ {
*h = NULL; *h = NULL;
@ -252,19 +250,16 @@ int rf_uhd_open(char *args, void **h, bool create_thread_gain, bool tx_gain_same
uhd_usrp_find("", &devices_str); uhd_usrp_find("", &devices_str);
/* If device type or name not given in args, choose a B200 */ /* If device type or name not given in args, choose a B200 */
if (!strstr(args, "type") && !strstr(args, "name")) { if (args[0]=='\0') {
// If B200 is available, use it // If B200 is available, use it
if (find_string(devices_str, "type=b200") && !strstr(args, "recv_frame_size")) { if (find_string(devices_str, "type=b200") && !strstr(args, "recv_frame_size")) {
snprintf(uhd_args, 1024, "type=b200,recv_frame_size=9232,num_recv_frames=64,send_frame_size=9232,num_send_frames=64,%s", args); args = "type=b200,recv_frame_size=9232,num_recv_frames=64,send_frame_size=9232,num_send_frames=64";
} }
// If we explicitly define a B200 but do not give frame arguments, define them
} else if (strstr(args, "type=b200") && !strstr(args, "recv_frame_size")) {
snprintf(uhd_args, 1024, "recv_frame_size=9232,num_recv_frames=64,send_frame_size=9232,num_send_frames=64,%s", args);
} }
/* Create UHD handler */ /* Create UHD handler */
printf("Opening USRP with args: %s\n", uhd_args); printf("Opening USRP with args: %s\n", args);
uhd_error error = uhd_usrp_make(&handler->usrp, uhd_args); uhd_error error = uhd_usrp_make(&handler->usrp, args);
if (error) { if (error) {
fprintf(stderr, "Error opening UHD: code %d\n", error); fprintf(stderr, "Error opening UHD: code %d\n", error);
return -1; return -1;

Loading…
Cancel
Save