Skip to content

Commit

Permalink
Merge pull request #1 from trondeau/uhd_mods
Browse files Browse the repository at this point in the history
UHD mods
  • Loading branch information
Ismael Gómez-Miguelez committed May 2, 2014
2 parents 587ff2c + 8bb3d75 commit b91082d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
12 changes: 5 additions & 7 deletions cuhd/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,17 @@ IF(UHD_FOUND)

ADD_LIBRARY(cuhd cuhd_imp.cpp cuhd_utils.c)
INCLUDE_DIRECTORIES(${UHD_INCLUDE_DIRS})
LINK_DIRECTORIES(${UHD_LIBRARY_DIRS})
TARGET_LINK_LIBRARIES(cuhd ${UHD_LIBRARIES})

LIBLTE_SET_PIC(cuhd)
APPEND_INTERNAL_LIST(OPTIONAL_LIBS cuhd)
INSTALL(TARGETS cuhd DESTINATION ${LIBRARY_DIR})

MESSAGE(STATUS " cuhd UHD C wrapper will be installed.")

ELSE(UHD_FOUND)

MESSAGE(STATUS " UHD driver not found. CUHD library is not generated")
MESSAGE(STATUS " UHD driver not found. CUHD library is not generated")

ENDIF(UHD_FOUND)



14 changes: 12 additions & 2 deletions cuhd/lib/cuhd_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,18 @@ typedef _Complex float complex_t;
bool isLocked(void *h)
{
cuhd_handler* handler = static_cast<cuhd_handler*>(h);
return handler->usrp->get_rx_sensor("lo_locked", 0).to_bool();
std::vector<std::string> mb_sensors = handler->usrp->get_mboard_sensor_names();
std::vector<std::string> rx_sensors = handler->usrp->get_rx_sensor_names(0);
if(std::find(rx_sensors.begin(), rx_sensors.end(), "lo_locked") != rx_sensors.end()) {
return handler->usrp->get_rx_sensor("lo_locked", 0).to_bool();
}
else if(std::find(mb_sensors.begin(), mb_sensors.end(), "ref_locked") != mb_sensors.end()) {
return handler->usrp->get_mboard_sensor("ref_locked", 0).to_bool();
}
else {
usleep(500);
return true;
}
}

bool cuhd_rx_wait_lo_locked(void *h)
Expand Down Expand Up @@ -190,4 +201,3 @@ int cuhd_send(void *h, void *data, int nsamples, int blocking) {
return handler->tx_stream->send(data, nsamples, md, 0.0);
}
}

14 changes: 7 additions & 7 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ target_link_libraries(ll_example lte)
add_executable(synch_file synch_file.c)
target_link_libraries(synch_file lte)

LINK_DIRECTORIES(${UHD_LIBRARY_DIRS})

#################################################################
# Check if UHD C-API and Graphics library are available
Expand All @@ -59,8 +60,8 @@ target_link_libraries(pbch_enodeb lte)
IF(${CUHD_FIND} EQUAL -1)
SET_TARGET_PROPERTIES(pbch_ue PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD")
SET_TARGET_PROPERTIES(pbch_enodeb PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD")
ELSE(${CUHD_FIND} EQUAL -1)
target_link_libraries(pbch_ue cuhd)
ELSE(${CUHD_FIND} EQUAL -1)
target_link_libraries(pbch_ue cuhd)
target_link_libraries(pbch_enodeb cuhd)
ENDIF(${CUHD_FIND} EQUAL -1)

Expand All @@ -79,19 +80,18 @@ ENDIF(${GRAPHICS_FIND} EQUAL -1)
#################################################################

IF(${CUHD_FIND} GREATER -1)

add_executable(scan_rssi scan_rssi.c)
target_link_libraries(scan_rssi lte cuhd )

add_executable(scan_pss scan_pss.c)
target_link_libraries(scan_pss lte cuhd )

add_executable(scan_mib scan_mib.c)
target_link_libraries(scan_mib lte cuhd )

MESSAGE(STATUS " UHD examples will be installed.")

ELSE(${CUHD_FIND} GREATER -1)
MESSAGE(STATUS " UHD examples NOT INSTALLED: CUHD library not compiled.")
ENDIF(${CUHD_FIND} GREATER -1)

ENDIF(${CUHD_FIND} GREATER -1)

0 comments on commit b91082d

Please sign in to comment.