Merge osqzss-master into origin/master.
This commit is contained in:
commit
96faa8df9a
@ -91,7 +91,7 @@ The user motion can be specified in either dynamic or static mode:
|
|||||||
The TX port of a particular SDR platform is connected to the GPS receiver
|
The TX port of a particular SDR platform is connected to the GPS receiver
|
||||||
under test through a DC block and a fixed 50-60dB attenuator.
|
under test through a DC block and a fixed 50-60dB attenuator.
|
||||||
|
|
||||||
#### BladeRF
|
#### BladeRF:
|
||||||
|
|
||||||
The simulated GPS signal file, named "gpssim.bin", can be loaded
|
The simulated GPS signal file, named "gpssim.bin", can be loaded
|
||||||
into the bladeRF for playback as shown below:
|
into the bladeRF for playback as shown below:
|
||||||
@ -153,5 +153,5 @@ Default 3.0MHz. Applicable range 1.0MHz to 5.0MHz.
|
|||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
Copyright © 2015 Takuji Ebinuma
|
Copyright © 2015-2018 Takuji Ebinuma
|
||||||
Distributed under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
|
Distributed under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
|
||||||
|
@ -18,8 +18,8 @@ bladeplayer: bladeplayer.o $(SDR_OBJ) $(COMPAT)
|
|||||||
hackplayer: hackplayer.o $(COMPAT)
|
hackplayer: hackplayer.o $(COMPAT)
|
||||||
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(shell pkg-config --libs libhackrf)
|
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(shell pkg-config --libs libhackrf)
|
||||||
|
|
||||||
limeplayer: limeplayer.o $(COMPAT)
|
limeplayer: limeplayer.c
|
||||||
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) -lLimeSuite
|
gcc -O2 -Wall -o limeplayer limeplayer.c -lLimeSuite
|
||||||
|
|
||||||
plutoplayer: plutoplayer.o $(COMPAT)
|
plutoplayer: plutoplayer.o $(COMPAT)
|
||||||
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(shell pkg-config --libs libiio libad9361)
|
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(shell pkg-config --libs libiio libad9361)
|
||||||
|
@ -1,72 +1,49 @@
|
|||||||
## Building
|
## How to build the player software on Linux
|
||||||
|
|
||||||
Modified to build on Linux.
|
### bladeRF
|
||||||
|
|
||||||
```
|
#### Build and install libbladeRF
|
||||||
$ make all
|
|
||||||
```
|
|
||||||
Will build all players if dependencies are met.
|
|
||||||
|
|
||||||
### Dependencies - bladeRF
|
https://github.com/Nuand/bladeRF/wiki/Getting-Started:-Linux
|
||||||
#### libbladeRF
|
|
||||||
```
|
|
||||||
$ git clone https://github.com/Nuand/bladeRF.git
|
|
||||||
$ cd bladeRF
|
|
||||||
$ dpkg-buildpackage -b
|
|
||||||
```
|
|
||||||
Or Nuand has some build/install instructions including an Ubuntu PPA
|
|
||||||
at https://github.com/Nuand/bladeRF/wiki/Getting-Started:-Linux
|
|
||||||
|
|
||||||
#### Build
|
#### Build bladeplayer
|
||||||
|
|
||||||
```
|
```
|
||||||
$ make bladeplayer
|
$ make bladeplayer
|
||||||
```
|
```
|
||||||
|
|
||||||
### Dependecies - hackRF
|
### HackRF One
|
||||||
#### libhackrf
|
|
||||||
|
#### Build and install libhackrf
|
||||||
|
|
||||||
|
https://github.com/mossmann/hackrf/tree/master/host
|
||||||
|
|
||||||
|
#### Build hackplayer
|
||||||
|
|
||||||
```
|
```
|
||||||
> git clone https://github.com/mossmann/hackrf.git
|
$ make hackplayer
|
||||||
> mkdir hackrf/host/build
|
|
||||||
> cd hackrf/host/build
|
|
||||||
> cmake ..
|
|
||||||
> make
|
|
||||||
> sudo make install
|
|
||||||
> sudo ldconfig
|
|
||||||
```
|
|
||||||
Build instructions https://github.com/mossmann/hackrf/tree/master/host
|
|
||||||
|
|
||||||
#### Build
|
|
||||||
|
|
||||||
```
|
|
||||||
> make hackplayer
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Dependecies - lime
|
### LimeSDR
|
||||||
|
|
||||||
LimeSuite https://github.com/myriadrf/LimeSuite
|
#### Build and install libLimeSuite
|
||||||
|
|
||||||
Build instructions http://wiki.myriadrf.org/Lime_Suite
|
http://wiki.myriadrf.org/Lime_Suite
|
||||||
|
|
||||||
:exclamation: Build not tested.
|
#### Build limeplayer
|
||||||
|
|
||||||
### Dependecies - ADALM-Pluto
|
|
||||||
#### libiio
|
|
||||||
|
|
||||||
Use the latest version from Github.
|
|
||||||
```
|
```
|
||||||
$ git clone https://github.com/analogdevicesinc/libiio.git
|
$ make limeplayer
|
||||||
$ cd libiio
|
|
||||||
$ cmake ./
|
|
||||||
$ make all
|
|
||||||
$ sudo make install
|
|
||||||
```
|
```
|
||||||
[How to build it in detail.](https://wiki.analog.com/resources/tools-software/linux-software/libiio)
|
|
||||||
|
|
||||||
#### libad9361
|
### ADALM-Pluto
|
||||||
|
|
||||||
|
#### Build and install libiio
|
||||||
|
|
||||||
|
https://wiki.analog.com/resources/tools-software/linux-software/libiio
|
||||||
|
|
||||||
|
#### Build and insatall libad9361
|
||||||
|
|
||||||
Use of the latest Github version mandatory.
|
|
||||||
```
|
```
|
||||||
$ git clone https://github.com/analogdevicesinc/libad9361-iio.git
|
$ git clone https://github.com/analogdevicesinc/libad9361-iio.git
|
||||||
$ cd libad9361-iio
|
$ cd libad9361-iio
|
||||||
@ -75,7 +52,7 @@ $ make all
|
|||||||
$ sudo make install
|
$ sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Build
|
#### Build plutoplayer
|
||||||
|
|
||||||
```
|
```
|
||||||
$ make plutoplayer
|
$ make plutoplayer
|
||||||
|
@ -4,8 +4,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
|
#ifdef _WIN32
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
#else
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TX_FREQUENCY 1575420000
|
#define TX_FREQUENCY 1575420000
|
||||||
#define TX_SAMPLERATE 2600000
|
#define TX_SAMPLERATE 2600000
|
||||||
@ -20,7 +25,8 @@
|
|||||||
|
|
||||||
#define AMPLITUDE (1000) // Default amplitude for 12-bit I/Q
|
#define AMPLITUDE (1000) // Default amplitude for 12-bit I/Q
|
||||||
|
|
||||||
void usage(void) {
|
void usage(void)
|
||||||
|
{
|
||||||
fprintf(stderr, "Usage: bladeplayer [options]\n"
|
fprintf(stderr, "Usage: bladeplayer [options]\n"
|
||||||
" -f <tx_file> I/Q sampling data file (required)\n"
|
" -f <tx_file> I/Q sampling data file (required)\n"
|
||||||
" -b <iq_bits> I/Q data format [1/16] (default: 16)\n"
|
" -b <iq_bits> I/Q data format [1/16] (default: 16)\n"
|
||||||
@ -29,18 +35,15 @@ void usage(void) {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int main(int argc, char *argv[])
|
||||||
int main(int argc, char *argv[]) {
|
{
|
||||||
int status;
|
int status;
|
||||||
char *devstr = NULL;
|
char *devstr = NULL;
|
||||||
struct bladerf *dev = NULL;
|
struct bladerf *dev = NULL;
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int16_t *tx_buffer;
|
int16_t *tx_buffer;
|
||||||
|
enum state {INIT, READ_FILE, PAD_TRAILING, DONE};
|
||||||
enum state {
|
|
||||||
INIT, READ_FILE, PAD_TRAILING, DONE
|
|
||||||
};
|
|
||||||
enum state state = INIT;
|
enum state state = INIT;
|
||||||
|
|
||||||
int compressed = 0;
|
int compressed = 0;
|
||||||
@ -63,21 +66,26 @@ int main(int argc, char *argv[]) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((result = getopt(argc, argv, "g:b:f:")) != -1) {
|
while ((result=getopt(argc,argv,"g:b:f:"))!=-1)
|
||||||
switch (result) {
|
{
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
case 'g':
|
case 'g':
|
||||||
gain = atoi(optarg);
|
gain = atoi(optarg);
|
||||||
if (gain>-4 || gain<-35) {
|
if (gain>-4 || gain<-35)
|
||||||
|
{
|
||||||
printf("ERROR: Invalid TX VGA1 gain.\n");
|
printf("ERROR: Invalid TX VGA1 gain.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
data_format = atoi(optarg);
|
data_format = atoi(optarg);
|
||||||
if (data_format != 1 && data_format != 16) {
|
if (data_format!=1 && data_format!=16)
|
||||||
|
{
|
||||||
printf("ERROR: Invalid I/Q data format.\n");
|
printf("ERROR: Invalid I/Q data format.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else if (data_format == 1)
|
}
|
||||||
|
else if (data_format==1)
|
||||||
compressed = 1;
|
compressed = 1;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
@ -93,7 +101,8 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open TX file.
|
// Open TX file.
|
||||||
if (txfile[0] == 0) {
|
if (txfile[0]==0)
|
||||||
|
{
|
||||||
printf("ERROR: I/Q sampling data file is not specified.\n");
|
printf("ERROR: I/Q sampling data file is not specified.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -127,7 +136,8 @@ int main(int argc, char *argv[]) {
|
|||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fprintf(stderr, "Failed to set TX sample rate: %s\n", bladerf_strerror(status));
|
fprintf(stderr, "Failed to set TX sample rate: %s\n", bladerf_strerror(status));
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
printf("TX sample rate: %u sps\n", TX_SAMPLERATE);
|
printf("TX sample rate: %u sps\n", TX_SAMPLERATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +145,8 @@ int main(int argc, char *argv[]) {
|
|||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fprintf(stderr, "Failed to set TX bandwidth: %s\n", bladerf_strerror(status));
|
fprintf(stderr, "Failed to set TX bandwidth: %s\n", bladerf_strerror(status));
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
printf("TX bandwidth: %u Hz\n", TX_BANDWIDTH);
|
printf("TX bandwidth: %u Hz\n", TX_BANDWIDTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +154,8 @@ int main(int argc, char *argv[]) {
|
|||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fprintf(stderr, "Failed to set TX VGA1 gain: %s\n", bladerf_strerror(status));
|
fprintf(stderr, "Failed to set TX VGA1 gain: %s\n", bladerf_strerror(status));
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
printf("TX VGA1 gain: %d dB\n", gain);
|
printf("TX VGA1 gain: %d dB\n", gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +163,8 @@ int main(int argc, char *argv[]) {
|
|||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fprintf(stderr, "Failed to set TX VGA2 gain: %s\n", bladerf_strerror(status));
|
fprintf(stderr, "Failed to set TX VGA2 gain: %s\n", bladerf_strerror(status));
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
printf("TX VGA2 gain: %d dB\n", TX_VGA2);
|
printf("TX VGA2 gain: %d dB\n", TX_VGA2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +187,8 @@ int main(int argc, char *argv[]) {
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 256; i++) {
|
for (i=0; i<256; i++)
|
||||||
|
{
|
||||||
for (k=0; k<8; k++)
|
for (k=0; k<8; k++)
|
||||||
lut[i][k] = ((i>>(7-k))&0x1)?amp:-amp;
|
lut[i][k] = ((i>>(7-k))&0x1)?amp:-amp;
|
||||||
}
|
}
|
||||||
@ -217,7 +231,8 @@ int main(int argc, char *argv[]) {
|
|||||||
case INIT:
|
case INIT:
|
||||||
case READ_FILE:
|
case READ_FILE:
|
||||||
// Read from the input file
|
// Read from the input file
|
||||||
if (compressed) {
|
if (compressed)
|
||||||
|
{
|
||||||
int16_t *write_buffer_current = tx_buffer;
|
int16_t *write_buffer_current = tx_buffer;
|
||||||
|
|
||||||
samples_read = fread(read_buffer,
|
samples_read = fread(read_buffer,
|
||||||
@ -229,13 +244,16 @@ int main(int argc, char *argv[]) {
|
|||||||
buffer_samples_remaining = read_samples_remaining * 4;
|
buffer_samples_remaining = read_samples_remaining * 4;
|
||||||
|
|
||||||
// Expand compressed data into TX buffer
|
// Expand compressed data into TX buffer
|
||||||
for (i = 0; i < samples_read; i++) {
|
for (i=0; i<samples_read; i++)
|
||||||
|
{
|
||||||
memcpy(write_buffer_current, lut[read_buffer[i]], 8);
|
memcpy(write_buffer_current, lut[read_buffer[i]], 8);
|
||||||
|
|
||||||
// Advance the write buffer pointer
|
// Advance the write buffer pointer
|
||||||
write_buffer_current += 8;
|
write_buffer_current += 8;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
samples_populated = fread(tx_buffer_current,
|
samples_populated = fread(tx_buffer_current,
|
||||||
2 * sizeof(int16_t),
|
2 * sizeof(int16_t),
|
||||||
buffer_samples_remaining,
|
buffer_samples_remaining,
|
||||||
@ -245,7 +263,8 @@ int main(int argc, char *argv[]) {
|
|||||||
// If the end of the file was reached, pad the rest of the buffer and finish.
|
// If the end of the file was reached, pad the rest of the buffer and finish.
|
||||||
if (feof(fp)) {
|
if (feof(fp)) {
|
||||||
state = PAD_TRAILING;
|
state = PAD_TRAILING;
|
||||||
} // Check for errors
|
}
|
||||||
|
// Check for errors
|
||||||
else if (ferror(fp)) {
|
else if (ferror(fp)) {
|
||||||
status = errno;
|
status = errno;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,25 @@
|
|||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef int64_t ssize_t;
|
||||||
|
#else
|
||||||
|
typedef int32_t ssize_t;
|
||||||
|
#endif
|
||||||
|
typedef int bool;
|
||||||
|
#define true 1
|
||||||
|
#define false 0
|
||||||
|
#include "getopt.h"
|
||||||
|
#else
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <hackrf.h>
|
#endif
|
||||||
|
#include <libhackrf/hackrf.h>
|
||||||
|
|
||||||
static hackrf_device* device = NULL;
|
static hackrf_device* device = NULL;
|
||||||
|
|
||||||
@ -13,19 +28,34 @@ volatile uint32_t byte_count = 0;
|
|||||||
|
|
||||||
volatile bool do_exit = false;
|
volatile bool do_exit = false;
|
||||||
|
|
||||||
|
//static transceiver_mode_t transceiver_mode = TRANSCEIVER_MODE_TX;
|
||||||
|
|
||||||
#define FD_BUFFER_SIZE (8*1024)
|
#define FD_BUFFER_SIZE (8*1024)
|
||||||
#define FREQ_ONE_MHZ (1000000ull)
|
#define FREQ_ONE_MHZ (1000000ull)
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
BOOL WINAPI sighandler(int signum)
|
||||||
|
{
|
||||||
|
if(CTRL_C_EVENT == signum) {
|
||||||
|
fprintf(stdout, "Caught signal %d\n", signum);
|
||||||
|
do_exit = true;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
static void sighandler(int signum) {
|
static void sighandler(int signum) {
|
||||||
fprintf(stdout, "Caught signal %d\n", signum);
|
fprintf(stdout, "Caught signal %d\n", signum);
|
||||||
do_exit = true;
|
do_exit = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int tx_callback(hackrf_transfer* transfer) {
|
int tx_callback(hackrf_transfer* transfer) {
|
||||||
size_t bytes_to_read;
|
size_t bytes_to_read;
|
||||||
|
|
||||||
if (fd != NULL) {
|
if( fd != NULL )
|
||||||
size_t bytes_read;
|
{
|
||||||
|
ssize_t bytes_read;
|
||||||
byte_count += transfer->valid_length;
|
byte_count += transfer->valid_length;
|
||||||
bytes_to_read = transfer->valid_length;
|
bytes_to_read = transfer->valid_length;
|
||||||
|
|
||||||
@ -58,9 +88,11 @@ int main(int argc, char** argv) {
|
|||||||
uint64_t freq_hz = 1575420000;
|
uint64_t freq_hz = 1575420000;
|
||||||
uint32_t amp_enable = 1;
|
uint32_t amp_enable = 1;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "t:")) != EOF) {
|
while( (opt = getopt(argc, argv, "t:")) != EOF )
|
||||||
|
{
|
||||||
result = HACKRF_SUCCESS;
|
result = HACKRF_SUCCESS;
|
||||||
switch (opt) {
|
switch( opt )
|
||||||
|
{
|
||||||
case 't':
|
case 't':
|
||||||
path = optarg;
|
path = optarg;
|
||||||
break;
|
break;
|
||||||
@ -114,7 +146,11 @@ int main(int argc, char** argv) {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
|
||||||
|
#else
|
||||||
signal(SIGINT, sighandler);
|
signal(SIGINT, sighandler);
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("call hackrf_sample_rate_set(%.03f MHz)\n", ((float)sample_rate_hz/(float)FREQ_ONE_MHZ));
|
printf("call hackrf_sample_rate_set(%.03f MHz)\n", ((float)sample_rate_hz/(float)FREQ_ONE_MHZ));
|
||||||
result = hackrf_set_sample_rate_manual(device, sample_rate_hz, 1);
|
result = hackrf_set_sample_rate_manual(device, sample_rate_hz, 1);
|
||||||
@ -179,7 +215,8 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = hackrf_close(device);
|
result = hackrf_close(device);
|
||||||
if (result != HACKRF_SUCCESS) {
|
if( result != HACKRF_SUCCESS )
|
||||||
|
{
|
||||||
printf("hackrf_close() failed: %s (%d)\n", hackrf_error_name(result), result);
|
printf("hackrf_close() failed: %s (%d)\n", hackrf_error_name(result), result);
|
||||||
} else {
|
} else {
|
||||||
printf("hackrf_close() done\n");
|
printf("hackrf_close() done\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user