Merge pull request #50 from TitanMKD/master
New license BSD 3-Clause License for libhackrf and moved examples to hackrf-tools
This commit is contained in:
43
host/hackrf-tools/CMakeLists.txt
Normal file
43
host/hackrf-tools/CMakeLists.txt
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Copyright 2012 Jared Boone
|
||||||
|
#
|
||||||
|
# This file is part of HackRF.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Based heavily upon the libftdi cmake setup.
|
||||||
|
|
||||||
|
project(hackrf-tools)
|
||||||
|
set(MAJOR_VERSION 0)
|
||||||
|
set(MINOR_VERSION 1)
|
||||||
|
set(PACKAGE hackrf-tools)
|
||||||
|
set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
|
||||||
|
set(VERSION ${VERSION_STRING})
|
||||||
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
add_definitions(-Wall)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
||||||
|
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)
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
38
host/hackrf-tools/FindUSB1.cmake
Normal file
38
host/hackrf-tools/FindUSB1.cmake
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# - Try to find the freetype library
|
||||||
|
# Once done this defines
|
||||||
|
#
|
||||||
|
# LIBUSB_FOUND - system has libusb
|
||||||
|
# LIBUSB_INCLUDE_DIR - the libusb include directory
|
||||||
|
# LIBUSB_LIBRARIES - Link these to use libusb
|
||||||
|
|
||||||
|
# Copyright (c) 2006, 2008 Laurent Montel, <montel@kde.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
|
||||||
|
if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||||
|
|
||||||
|
# in cache already
|
||||||
|
set(LIBUSB_FOUND TRUE)
|
||||||
|
|
||||||
|
else (LIBUSB_INCLUDE_DIR AND LIBUSB_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_LIBUSB libusb-1.0)
|
||||||
|
ENDIF(NOT WIN32)
|
||||||
|
|
||||||
|
FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
|
||||||
|
PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0
|
||||||
|
PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
|
||||||
|
|
||||||
|
endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
34
host/hackrf-tools/Readme.md
Normal file
34
host/hackrf-tools/Readme.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
This repository contains hardware designs and software for HackRF, a project to
|
||||||
|
produce a low cost, open source software radio platform.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
How to build host software on Windows:
|
||||||
|
prerequisite for cygwin or mingw:
|
||||||
|
* cmake-2.8.10.2 or more see http://www.cmake.org/cmake/resources/software.html
|
||||||
|
* libusbx-1.0.14 or more see http://sourceforge.net/projects/libusbx/files/latest/download?source=files
|
||||||
|
* Install Windows driver for HackRF hardware or use Zadig see http://sourceforge.net/projects/libwdi/files/zadig
|
||||||
|
- If you want to use Zadig select HackRF USB device and just install/replace it with WinUSB driver.
|
||||||
|
* Build libhackrf before to build this library, see host/libhackrf/Readme.md.
|
||||||
|
|
||||||
|
For Cygwin:
|
||||||
|
cmake -G "Unix Makefiles" -DCMAKE_LEGACY_CYGWIN_WIN32=1 -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
For Mingw:
|
||||||
|
#normal version
|
||||||
|
cmake -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/
|
||||||
|
#debug version
|
||||||
|
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DLIBUSB_INCLUDE_DIR=/usr/local/include/libusb-1.0/
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
How to build host software on Linux:
|
||||||
|
cmake ./
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
principal author: Michael Ossmann <mike@ossmann.com>
|
||||||
|
|
||||||
|
http://greatscottgadgets.com/hackrf/
|
@ -1,44 +1,44 @@
|
|||||||
# Copyright 2012 Jared Boone
|
# Copyright 2012 Jared Boone
|
||||||
# Copyright 2013 Benjamin Vernoux
|
# Copyright 2013 Benjamin Vernoux
|
||||||
#
|
#
|
||||||
# This file is part of HackRF.
|
# This file is part of HackRF.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
# any later version.
|
# any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; see the file COPYING. If not, write to
|
# along with this program; see the file COPYING. If not, write to
|
||||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Based heavily upon the libftdi cmake setup.
|
# Based heavily upon the libftdi cmake setup.
|
||||||
|
|
||||||
option(EXAMPLES "Build example programs" ON)
|
option(EXAMPLES "Build example programs" ON)
|
||||||
|
|
||||||
IF( EXAMPLES )
|
IF( EXAMPLES )
|
||||||
add_executable(hackrf_max2837 hackrf_max2837.c)
|
add_executable(hackrf_max2837 hackrf_max2837.c)
|
||||||
add_executable(hackrf_si5351c hackrf_si5351c.c)
|
add_executable(hackrf_si5351c hackrf_si5351c.c)
|
||||||
add_executable(hackrf_transfer hackrf_transfer.c)
|
add_executable(hackrf_transfer hackrf_transfer.c)
|
||||||
add_executable(hackrf_rffc5071 hackrf_rffc5071.c)
|
add_executable(hackrf_rffc5071 hackrf_rffc5071.c)
|
||||||
add_executable(hackrf_spiflash hackrf_spiflash.c)
|
add_executable(hackrf_spiflash hackrf_spiflash.c)
|
||||||
add_executable(hackrf_cpldjtag hackrf_cpldjtag.c)
|
add_executable(hackrf_cpldjtag hackrf_cpldjtag.c)
|
||||||
add_executable(hackrf_info hackrf_info.c)
|
add_executable(hackrf_info hackrf_info.c)
|
||||||
|
|
||||||
target_link_libraries(hackrf_max2837 hackrf)
|
target_link_libraries(hackrf_max2837 hackrf)
|
||||||
target_link_libraries(hackrf_si5351c hackrf)
|
target_link_libraries(hackrf_si5351c hackrf)
|
||||||
target_link_libraries(hackrf_transfer hackrf)
|
target_link_libraries(hackrf_transfer hackrf)
|
||||||
target_link_libraries(hackrf_rffc5071 hackrf)
|
target_link_libraries(hackrf_rffc5071 hackrf)
|
||||||
target_link_libraries(hackrf_spiflash hackrf)
|
target_link_libraries(hackrf_spiflash hackrf)
|
||||||
target_link_libraries(hackrf_cpldjtag hackrf)
|
target_link_libraries(hackrf_cpldjtag hackrf)
|
||||||
target_link_libraries(hackrf_info hackrf)
|
target_link_libraries(hackrf_info hackrf)
|
||||||
|
|
||||||
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src)
|
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/../libhackrf/src)
|
||||||
endif(EXAMPLES)
|
endif(EXAMPLES)
|
@ -1,178 +1,178 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 Jared Boone <jared@sharebrained.com>
|
* Copyright 2012 Jared Boone <jared@sharebrained.com>
|
||||||
* Copyright 2013 Benjamin Vernoux <titanmkd@gmail.com>
|
* Copyright 2013 Benjamin Vernoux <titanmkd@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of HackRF.
|
* This file is part of HackRF.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
* any later version.
|
* any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; see the file COPYING. If not, write to
|
* along with this program; see the file COPYING. If not, write to
|
||||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <hackrf.h>
|
#include <hackrf.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
static void usage() {
|
static void usage() {
|
||||||
printf("\nUsage:\n");
|
printf("\nUsage:\n");
|
||||||
printf("\t-n, --register <n>: set register number for subsequent read/write operations\n");
|
printf("\t-n, --register <n>: set register number for subsequent read/write operations\n");
|
||||||
printf("\t-r, --read: read register specified by last -n argument, or all registers\n");
|
printf("\t-r, --read: read register specified by last -n argument, or all registers\n");
|
||||||
printf("\t-w, --write <v>: write register specified by last -n argument with value <v>\n");
|
printf("\t-w, --write <v>: write register specified by last -n argument with value <v>\n");
|
||||||
printf("\nExamples:\n");
|
printf("\nExamples:\n");
|
||||||
printf("\t<command> -n 12 -r # reads from register 12\n");
|
printf("\t<command> -n 12 -r # reads from register 12\n");
|
||||||
printf("\t<command> -r # reads all registers\n");
|
printf("\t<command> -r # reads all registers\n");
|
||||||
printf("\t<command> -n 10 -w 514 # writes register 10 with 514 decimal\n");
|
printf("\t<command> -n 10 -w 514 # writes register 10 with 514 decimal\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{ "register", required_argument, 0, 'n' },
|
{ "register", required_argument, 0, 'n' },
|
||||||
{ "write", required_argument, 0, 'w' },
|
{ "write", required_argument, 0, 'w' },
|
||||||
{ "read", no_argument, 0, 'r' },
|
{ "read", no_argument, 0, 'r' },
|
||||||
{ 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
int parse_int(char* s, uint16_t* const value) {
|
int parse_int(char* s, uint16_t* const value) {
|
||||||
uint_fast8_t base = 10;
|
uint_fast8_t base = 10;
|
||||||
if( strlen(s) > 2 ) {
|
if( strlen(s) > 2 ) {
|
||||||
if( s[0] == '0' ) {
|
if( s[0] == '0' ) {
|
||||||
if( (s[1] == 'x') || (s[1] == 'X') ) {
|
if( (s[1] == 'x') || (s[1] == 'X') ) {
|
||||||
base = 16;
|
base = 16;
|
||||||
s += 2;
|
s += 2;
|
||||||
} else if( (s[1] == 'b') || (s[1] == 'B') ) {
|
} else if( (s[1] == 'b') || (s[1] == 'B') ) {
|
||||||
base = 2;
|
base = 2;
|
||||||
s += 2;
|
s += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* s_end = s;
|
char* s_end = s;
|
||||||
const long long_value = strtol(s, &s_end, base);
|
const long long_value = strtol(s, &s_end, base);
|
||||||
if( (s != s_end) && (*s_end == 0) ) {
|
if( (s != s_end) && (*s_end == 0) ) {
|
||||||
*value = long_value;
|
*value = long_value;
|
||||||
return HACKRF_SUCCESS;
|
return HACKRF_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
return HACKRF_ERROR_INVALID_PARAM;
|
return HACKRF_ERROR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int dump_register(hackrf_device* device, const uint16_t register_number) {
|
int dump_register(hackrf_device* device, const uint16_t register_number) {
|
||||||
uint16_t register_value;
|
uint16_t register_value;
|
||||||
int result = hackrf_rffc5071_read(device, register_number, ®ister_value);
|
int result = hackrf_rffc5071_read(device, register_number, ®ister_value);
|
||||||
|
|
||||||
if( result == HACKRF_SUCCESS ) {
|
if( result == HACKRF_SUCCESS ) {
|
||||||
printf("[%2d] -> 0x%03x\n", register_number, register_value);
|
printf("[%2d] -> 0x%03x\n", register_number, register_value);
|
||||||
} else {
|
} else {
|
||||||
printf("hackrf_rffc5071_read() failed: %s (%d)\n", hackrf_error_name(result), result);
|
printf("hackrf_rffc5071_read() failed: %s (%d)\n", hackrf_error_name(result), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dump_registers(hackrf_device* device) {
|
int dump_registers(hackrf_device* device) {
|
||||||
uint16_t register_number;
|
uint16_t register_number;
|
||||||
int result = HACKRF_SUCCESS;
|
int result = HACKRF_SUCCESS;
|
||||||
|
|
||||||
for(register_number=0; register_number<31; register_number++) {
|
for(register_number=0; register_number<31; register_number++) {
|
||||||
result = dump_register(device, register_number);
|
result = dump_register(device, register_number);
|
||||||
if( result != HACKRF_SUCCESS ) {
|
if( result != HACKRF_SUCCESS ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_register(
|
int write_register(
|
||||||
hackrf_device* device,
|
hackrf_device* device,
|
||||||
const uint16_t register_number,
|
const uint16_t register_number,
|
||||||
const uint16_t register_value
|
const uint16_t register_value
|
||||||
) {
|
) {
|
||||||
int result = HACKRF_SUCCESS;
|
int result = HACKRF_SUCCESS;
|
||||||
result = hackrf_rffc5071_write(device, register_number, register_value);
|
result = hackrf_rffc5071_write(device, register_number, register_value);
|
||||||
|
|
||||||
if( result == HACKRF_SUCCESS ) {
|
if( result == HACKRF_SUCCESS ) {
|
||||||
printf("0x%03x -> [%2d]\n", register_value, register_number);
|
printf("0x%03x -> [%2d]\n", register_value, register_number);
|
||||||
} else {
|
} else {
|
||||||
printf("hackrf_rffc5071_write() failed: %s (%d)\n", hackrf_error_name(result), result);
|
printf("hackrf_rffc5071_write() failed: %s (%d)\n", hackrf_error_name(result), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REGISTER_INVALID 32767
|
#define REGISTER_INVALID 32767
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
int opt;
|
int opt;
|
||||||
uint16_t register_number = REGISTER_INVALID;
|
uint16_t register_number = REGISTER_INVALID;
|
||||||
uint16_t register_value;
|
uint16_t register_value;
|
||||||
|
|
||||||
int result = hackrf_init();
|
int result = hackrf_init();
|
||||||
if( result ) {
|
if( result ) {
|
||||||
printf("hackrf_init() failed: %s (%d)\n", hackrf_error_name(result), result);
|
printf("hackrf_init() failed: %s (%d)\n", hackrf_error_name(result), result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hackrf_device* device = NULL;
|
hackrf_device* device = NULL;
|
||||||
result = hackrf_open(&device);
|
result = hackrf_open(&device);
|
||||||
if( result ) {
|
if( result ) {
|
||||||
printf("hackrf_open() failed: %s (%d)\n", hackrf_error_name(result), result);
|
printf("hackrf_open() failed: %s (%d)\n", hackrf_error_name(result), result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
while( (opt = getopt_long(argc, argv, "n:rw:", long_options, &option_index)) != EOF ) {
|
while( (opt = getopt_long(argc, argv, "n:rw:", long_options, &option_index)) != EOF ) {
|
||||||
switch( opt ) {
|
switch( opt ) {
|
||||||
case 'n':
|
case 'n':
|
||||||
result = parse_int(optarg, ®ister_number);
|
result = parse_int(optarg, ®ister_number);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
result = parse_int(optarg, ®ister_value);
|
result = parse_int(optarg, ®ister_value);
|
||||||
if( result == HACKRF_SUCCESS ) {
|
if( result == HACKRF_SUCCESS ) {
|
||||||
result = write_register(device, register_number, register_value);
|
result = write_register(device, register_number, register_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
if( register_number == REGISTER_INVALID ) {
|
if( register_number == REGISTER_INVALID ) {
|
||||||
result = dump_registers(device);
|
result = dump_registers(device);
|
||||||
} else {
|
} else {
|
||||||
result = dump_register(device, register_number);
|
result = dump_register(device, register_number);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( result != HACKRF_SUCCESS ) {
|
if( result != HACKRF_SUCCESS ) {
|
||||||
printf("argument error: %s (%d)\n", hackrf_error_name(result), result);
|
printf("argument error: %s (%d)\n", hackrf_error_name(result), result);
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = hackrf_close(device);
|
result = hackrf_close(device);
|
||||||
if( result ) {
|
if( result ) {
|
||||||
printf("hackrf_close() failed: %s (%d)\n", hackrf_error_name(result), result);
|
printf("hackrf_close() failed: %s (%d)\n", hackrf_error_name(result), result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hackrf_exit();
|
hackrf_exit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -1,42 +1,41 @@
|
|||||||
# Copyright 2012 Jared Boone
|
# Copyright 2012 Jared Boone
|
||||||
#
|
#
|
||||||
# This file is part of HackRF.
|
# This file is part of HackRF.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
# any later version.
|
# any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; see the file COPYING. If not, write to
|
# along with this program; see the file COPYING. If not, write to
|
||||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Based heavily upon the libftdi cmake setup.
|
# Based heavily upon the libftdi cmake setup.
|
||||||
|
|
||||||
project(libhackrf)
|
project(libhackrf)
|
||||||
set(MAJOR_VERSION 0)
|
set(MAJOR_VERSION 0)
|
||||||
set(MINOR_VERSION 1)
|
set(MINOR_VERSION 1)
|
||||||
set(PACKAGE libhackrf)
|
set(PACKAGE libhackrf)
|
||||||
set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
|
set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
|
||||||
set(VERSION ${VERSION_STRING})
|
set(VERSION ${VERSION_STRING})
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
add_definitions(-Wall)
|
add_definitions(-Wall)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
|
||||||
|
|
||||||
find_package(USB1 REQUIRED)
|
find_package(USB1 REQUIRED)
|
||||||
include_directories(${LIBUSB_INCLUDE_DIR})
|
include_directories(${LIBUSB_INCLUDE_DIR})
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(examples)
|
|
||||||
|
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
# Copyright 2012 Jared Boone
|
|
||||||
# Copyright 2013 Benjamin Vernoux
|
|
||||||
#
|
#
|
||||||
# This file is part of HackRF.
|
# Copyright (c) 2012, Jared Boone <jared@sharebrained.com>
|
||||||
|
# Copyright (c) 2013, Benjamin Vernoux <titanmkd@gmail.com>
|
||||||
|
# Copyright (c) 2013, Michael Ossmann <mike@ossmann.com>
|
||||||
|
#
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
# Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# Neither the name of Great Scott Gadgets nor the names of its contributors may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING. If not, write to
|
|
||||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Based heavily upon the libftdi cmake setup.
|
# Based heavily upon the libftdi cmake setup.
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 Jared Boone <jared@sharebrained.com>
|
Copyright (c) 2012, Jared Boone <jared@sharebrained.com>
|
||||||
* Copyright 2013 Benjamin Vernoux <titanmkd@gmail.com>
|
Copyright (c) 2013, Benjamin Vernoux <titanmkd@gmail.com>
|
||||||
*
|
Copyright (c) 2013, Michael Ossmann <mike@ossmann.com>
|
||||||
* This file is part of HackRF.
|
|
||||||
*
|
All rights reserved.
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
* any later version.
|
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
*
|
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||||
* This program is distributed in the hope that it will be useful,
|
documentation and/or other materials provided with the distribution.
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Neither the name of Great Scott Gadgets nor the names of its contributors may be used to endorse or promote products derived from this software
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
without specific prior written permission.
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
* You should have received a copy of the GNU General Public License
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
* along with this program; see the file COPYING. If not, write to
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* Boston, MA 02110-1301, USA.
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
*/
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "hackrf.h"
|
#include "hackrf.h"
|
||||||
|
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 Jared Boone <jared@sharebrained.com>
|
Copyright (c) 2012, Jared Boone <jared@sharebrained.com>
|
||||||
* Copyright 2013 Benjamin Vernoux <titanmkd@gmail.com>
|
Copyright (c) 2013, Benjamin Vernoux <titanmkd@gmail.com>
|
||||||
*
|
Copyright (c) 2013, Michael Ossmann <mike@ossmann.com>
|
||||||
* This file is part of HackRF.
|
|
||||||
*
|
All rights reserved.
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
* any later version.
|
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
*
|
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||||
* This program is distributed in the hope that it will be useful,
|
documentation and/or other materials provided with the distribution.
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Neither the name of Great Scott Gadgets nor the names of its contributors may be used to endorse or promote products derived from this software
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
without specific prior written permission.
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
* You should have received a copy of the GNU General Public License
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
* along with this program; see the file COPYING. If not, write to
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* Boston, MA 02110-1301, USA.
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
*/
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __HACKRF_H__
|
#ifndef __HACKRF_H__
|
||||||
#define __HACKRF_H__
|
#define __HACKRF_H__
|
||||||
|
Reference in New Issue
Block a user