Merge pull request #51 from TitanMKD/master

Updated cmake script to find libhackrf, updated hackrf (host&firmware) frequency range from 5MHz to 6800MHz
This commit is contained in:
Michael Ossmann
2013-05-18 07:35:00 -07:00
5 changed files with 82 additions and 27 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright 2012 Jared Boone
* Copyright 2013 Benjamin Vernoux
*
* This file is part of HackRF.
*
@ -79,20 +80,20 @@ void update_switches(void)
#define FREQ_ONE_MHZ (1000*1000)
#define MIN_LP_FREQ_MHZ (30)
#define MIN_LP_FREQ_MHZ (5)
#define MAX_LP_FREQ_MHZ (2300)
#define MIN_BYPASS_FREQ_MHZ (2300)
#define MAX_BYPASS_FREQ_MHZ (2700)
#define MIN_HP_FREQ_MHZ (2700)
#define MAX_HP_FREQ_MHZ (6000)
#define MAX_HP_FREQ_MHZ (6800)
#define MAX2837_FREQ_NOMINAL_HZ (2600000000)
#define MAX2837_FREQ_NOMINAL_MHZ (MAX2837_FREQ_NOMINAL_HZ / FREQ_ONE_MHZ)
/*
* Set freq/tuning between 30MHz to 6000 MHz (less than 16bits really used)
* Set freq/tuning between 5MHz to 6800 MHz (less than 16bits really used)
* hz between 0 to 999999 Hz (not checked)
* return false on error or true if success.
*/

View File

@ -1,4 +1,5 @@
# Copyright 2012 Jared Boone
# Copyright 2013 Benjamin Vernoux
#
# This file is part of HackRF.
#
@ -37,7 +38,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
find_package(USB1 REQUIRED)
include_directories(${LIBUSB_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/../libhackrf/src)
link_directories(${CMAKE_SOURCE_DIR}/../libhackrf/src)
find_package(LIBHACKRF REQUIRED)
include_directories(${LIBHACKRF_INCLUDE_DIR})
add_subdirectory(src)

View File

@ -0,0 +1,55 @@
# - Try to find the libhackrf library
# Once done this defines
#
# LIBHACKRF_FOUND - system has libhackrf
# LIBHACKRF_INCLUDE_DIR - the libhackrf include directory
# LIBHACKRF_LIBRARIES - Link these to use libhackrf
# Copyright (c) 2013 Benjamin Vernoux
#
if (LIBHACKRF_INCLUDE_DIR AND LIBHACKRF_LIBRARIES)
# in cache already
set(LIBHACKRF_FOUND TRUE)
else (LIBHACKRF_INCLUDE_DIR AND LIBHACKRF_LIBRARIES)
IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PC_LIBHACKRF QUIET libhackrf)
ENDIF(NOT WIN32)
FIND_PATH(LIBHACKRF_INCLUDE_DIR
NAMES hackrf.h
HINTS $ENV{LIBHACKRF_DIR}/include ${PC_LIBHACKRF_INCLUDEDIR}
PATHS /usr/local/include/libhackrf /usr/local/include
/usr/include ${CMAKE_SOURCE_DIR}/../libhackrf/src
/opt/local/include/libhackrf
${LIBHACKRF_INCLUDE_DIR}
)
set(libhackrf_library_names hackrf)
FIND_LIBRARY(LIBHACKRF_LIBRARIES
NAMES ${libhackrf_library_names}
HINTS $ENV{LIBHACKRF_DIR}/lib ${PC_LIBHACKRF_LIBDIR}
PATHS /usr/local/lib /usr/lib /opt/local/lib ${PC_LIBHACKRF_LIBDIR} ${PC_LIBHACKRF_LIBRARY_DIRS} ${CMAKE_SOURCE_DIR}/../libhackrf/src
)
if(LIBHACKRF_INCLUDE_DIR)
set(CMAKE_REQUIRED_INCLUDES ${LIBHACKRF_INCLUDE_DIR})
endif()
if(LIBHACKRF_LIBRARIES)
set(CMAKE_REQUIRED_LIBRARIES ${LIBHACKRF_LIBRARIES})
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBHACKRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBHACKRF_INCLUDE_DIR LIBHACKRF_LIBRARIES)
endif (LIBHACKRF_INCLUDE_DIR AND LIBHACKRF_LIBRARIES)

View File

@ -21,24 +21,22 @@
# Based heavily upon the libftdi cmake setup.
option(EXAMPLES "Build example programs" ON)
add_executable(hackrf_max2837 hackrf_max2837.c)
add_executable(hackrf_si5351c hackrf_si5351c.c)
add_executable(hackrf_transfer hackrf_transfer.c)
add_executable(hackrf_rffc5071 hackrf_rffc5071.c)
add_executable(hackrf_spiflash hackrf_spiflash.c)
add_executable(hackrf_cpldjtag hackrf_cpldjtag.c)
add_executable(hackrf_info hackrf_info.c)
include_directories(${LIBHACKRF_INCLUDE_DIR})
target_link_libraries(hackrf_max2837 ${LIBHACKRF_LIBRARIES})
target_link_libraries(hackrf_si5351c ${LIBHACKRF_LIBRARIES})
target_link_libraries(hackrf_transfer ${LIBHACKRF_LIBRARIES})
target_link_libraries(hackrf_rffc5071 ${LIBHACKRF_LIBRARIES})
target_link_libraries(hackrf_spiflash ${LIBHACKRF_LIBRARIES})
target_link_libraries(hackrf_cpldjtag ${LIBHACKRF_LIBRARIES})
target_link_libraries(hackrf_info ${LIBHACKRF_LIBRARIES})
IF( EXAMPLES )
add_executable(hackrf_max2837 hackrf_max2837.c)
add_executable(hackrf_si5351c hackrf_si5351c.c)
add_executable(hackrf_transfer hackrf_transfer.c)
add_executable(hackrf_rffc5071 hackrf_rffc5071.c)
add_executable(hackrf_spiflash hackrf_spiflash.c)
add_executable(hackrf_cpldjtag hackrf_cpldjtag.c)
add_executable(hackrf_info hackrf_info.c)
target_link_libraries(hackrf_max2837 hackrf)
target_link_libraries(hackrf_si5351c hackrf)
target_link_libraries(hackrf_transfer hackrf)
target_link_libraries(hackrf_rffc5071 hackrf)
target_link_libraries(hackrf_spiflash hackrf)
target_link_libraries(hackrf_cpldjtag hackrf)
target_link_libraries(hackrf_info hackrf)
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/../libhackrf/src)
endif(EXAMPLES)

View File

@ -48,8 +48,8 @@
#define FREQ_ONE_MHZ (1000000ull)
#define DEFAULT_FREQ_HZ (900000000ull) /* 900MHz */
#define FREQ_MIN_HZ (30000000ull) /* 30MHz */
#define FREQ_MAX_HZ (6000000000ull) /* 6000MHz */
#define FREQ_MIN_HZ (5000000ull) /* 5MHz */
#define FREQ_MAX_HZ (6800000000ull) /* 6800MHz */
#define DEFAULT_SAMPLE_RATE_HZ (10000000) /* 10MHz default sample rate */