kopia lustrzana https://github.com/pabr/leansdr
Porównaj commity
4 Commity
9b552f6f3f
...
84c59e1c7a
Autor | SHA1 | Data |
---|---|---|
pabr | 84c59e1c7a | |
pabr | 9dd4060f06 | |
pabr | fe17e97b97 | |
pabr | 06d80520bd |
|
@ -47,7 +47,7 @@ struct config {
|
||||||
bool highspeed; // Demodulate raw u8 I/Q without preprocessing
|
bool highspeed; // Demodulate raw u8 I/Q without preprocessing
|
||||||
enum {
|
enum {
|
||||||
INPUT_U8, INPUT_S8,
|
INPUT_U8, INPUT_S8,
|
||||||
INPUT_S12, INPUT_S16,
|
INPUT_S12, INPUT_S16, INPUT_S32,
|
||||||
INPUT_F32, INPUT_F64
|
INPUT_F32, INPUT_F64
|
||||||
} input_format;
|
} input_format;
|
||||||
float float_scale; // Scaling factor for float data.
|
float float_scale; // Scaling factor for float data.
|
||||||
|
@ -61,6 +61,8 @@ struct config {
|
||||||
bool cnr; // Measure CNR
|
bool cnr; // Measure CNR
|
||||||
unsigned int decim; // Decimation, 0=auto
|
unsigned int decim; // Decimation, 0=auto
|
||||||
int fd_pp; // FD for preprocessed data, or -1
|
int fd_pp; // FD for preprocessed data, or -1
|
||||||
|
int fd_bbf; // FD for DVB-S2 bbframes, or -1
|
||||||
|
bool bbf_l3sync; // Output l3sync headers to fd_bbf
|
||||||
int fd_gse; // FD for DVB-S2 Generic streams, or -1
|
int fd_gse; // FD for DVB-S2 Generic streams, or -1
|
||||||
int fd_iqsymbols; // FD for sampled symbols, or -1
|
int fd_iqsymbols; // FD for sampled symbols, or -1
|
||||||
float awgn; // Standard deviation of noise
|
float awgn; // Standard deviation of noise
|
||||||
|
@ -120,7 +122,7 @@ struct config {
|
||||||
cnr(false),
|
cnr(false),
|
||||||
decim(0),
|
decim(0),
|
||||||
fd_pp(-1),
|
fd_pp(-1),
|
||||||
fd_gse(-1),
|
fd_bbf(-1), bbf_l3sync(false), fd_gse(-1),
|
||||||
fd_iqsymbols(-1),
|
fd_iqsymbols(-1),
|
||||||
awgn(0),
|
awgn(0),
|
||||||
Fm(2e6),
|
Fm(2e6),
|
||||||
|
@ -320,6 +322,17 @@ struct runtime_common {
|
||||||
amp = (cfg.input_format==config::INPUT_S12 ? 2048 : 32768);
|
amp = (cfg.input_format==config::INPUT_S12 ? 2048 : 32768);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case config::INPUT_S32: {
|
||||||
|
pipebuf<cs32> *p_stdin =
|
||||||
|
new pipebuf<cs32>(sch, "stdin", BUF_BASEBAND+cfg.input_buffer);
|
||||||
|
file_reader<cs32> *r_stdin =
|
||||||
|
new file_reader<cs32>(sch, 0, *p_stdin);
|
||||||
|
r_stdin->loop = cfg.loop_input;
|
||||||
|
cconverter<int32_t,0, f32,0, 1,1> *r_convert =
|
||||||
|
new cconverter<int32_t,0, f32,0, 1,1>(sch, *p_stdin, *p_rawiq);
|
||||||
|
amp = 5000000; // sdriq TBD
|
||||||
|
break;
|
||||||
|
}
|
||||||
case config::INPUT_F32: {
|
case config::INPUT_F32: {
|
||||||
pipebuf<cf32> *p_stdin =
|
pipebuf<cf32> *p_stdin =
|
||||||
new pipebuf<cf32>(sch, "stdin", BUF_BASEBAND+cfg.input_buffer);
|
new pipebuf<cf32>(sch, "stdin", BUF_BASEBAND+cfg.input_buffer);
|
||||||
|
@ -763,6 +776,8 @@ int run_dvbs2(config &cfg) {
|
||||||
// Deframe BB frames to TS packets
|
// Deframe BB frames to TS packets
|
||||||
s2_deframer deframer(run.sch, p_bbframes, *run.p_tspackets,
|
s2_deframer deframer(run.sch, p_bbframes, *run.p_tspackets,
|
||||||
run.p_lock, run.p_locktime);
|
run.p_lock, run.p_locktime);
|
||||||
|
if ( cfg.fd_bbf >= 0 ) deframer.fd_bbf = cfg.fd_bbf;
|
||||||
|
deframer.bbf_l3sync = cfg.bbf_l3sync;
|
||||||
if ( cfg.fd_gse >= 0 ) deframer.fd_gse = cfg.fd_gse;
|
if ( cfg.fd_gse >= 0 ) deframer.fd_gse = cfg.fd_gse;
|
||||||
|
|
||||||
if ( cfg.debug )
|
if ( cfg.debug )
|
||||||
|
@ -778,6 +793,8 @@ int run_dvbs2(config &cfg) {
|
||||||
run.sch->shutdown();
|
run.sch->shutdown();
|
||||||
if ( cfg.debug ) run.sch->dump();
|
if ( cfg.debug ) run.sch->dump();
|
||||||
|
|
||||||
|
if ( cfg.gui && cfg.linger ) while ( 1 ) { run.sch->run(); usleep(10000); }
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} // run_dvbs2
|
} // run_dvbs2
|
||||||
#endif // LEANSDR_EXTENSIONS
|
#endif // LEANSDR_EXTENSIONS
|
||||||
|
@ -1378,6 +1395,7 @@ void usage(const char *name, FILE *f, int c, const char *info=NULL) {
|
||||||
" --u8 Input format is 8-bit unsigned (rtl_sdr, default)\n"
|
" --u8 Input format is 8-bit unsigned (rtl_sdr, default)\n"
|
||||||
" --s12 Input format is 12/16-bit signed (PlutoSDR, LimeSDR)\n"
|
" --s12 Input format is 12/16-bit signed (PlutoSDR, LimeSDR)\n"
|
||||||
" --s16 Input format is 16-bit signed\n"
|
" --s16 Input format is 16-bit signed\n"
|
||||||
|
" --s32 Input format is 32-bit signed\n"
|
||||||
" --f32 Input format is 32-bit float (gqrx)\n"
|
" --f32 Input format is 32-bit float (gqrx)\n"
|
||||||
" --f64 Input format is 64-bit float\n"
|
" --f64 Input format is 64-bit float\n"
|
||||||
" -f HZ Input sample rate (Hz, default: 2.4e6)\n"
|
" -f HZ Input sample rate (Hz, default: 2.4e6)\n"
|
||||||
|
@ -1468,6 +1486,8 @@ void usage(const char *name, FILE *f, int c, const char *info=NULL) {
|
||||||
(f, "\nTesting options:\n"
|
(f, "\nTesting options:\n"
|
||||||
" --fd-pp FDNUM Dump preprocessed IQ data to file descriptor\n"
|
" --fd-pp FDNUM Dump preprocessed IQ data to file descriptor\n"
|
||||||
" --fd-iqsymbols FDNUM Dump sampled IQ symbols to file descriptor\n"
|
" --fd-iqsymbols FDNUM Dump sampled IQ symbols to file descriptor\n"
|
||||||
|
" --fd-bbf FDNUM Dump raw DVB-S2 bbframes to this FD\n"
|
||||||
|
" --bbf-l3sync Output 0xb8 headers (with --fd-bbf)\n"
|
||||||
" --fd-gse FDNUM Dump DVB-S2 generic streams to this FD\n"
|
" --fd-gse FDNUM Dump DVB-S2 generic streams to this FD\n"
|
||||||
" --awgn FLOAT Add white gaussian noise stddev (slow)\n"
|
" --awgn FLOAT Add white gaussian noise stddev (slow)\n"
|
||||||
);
|
);
|
||||||
|
@ -1608,6 +1628,8 @@ int main(int argc, const char *argv[]) {
|
||||||
cfg.input_format = config::INPUT_S12;
|
cfg.input_format = config::INPUT_S12;
|
||||||
else if ( ! strcmp(argv[i], "--s16") )
|
else if ( ! strcmp(argv[i], "--s16") )
|
||||||
cfg.input_format = config::INPUT_S16;
|
cfg.input_format = config::INPUT_S16;
|
||||||
|
else if ( ! strcmp(argv[i], "--s32") )
|
||||||
|
cfg.input_format = config::INPUT_S32;
|
||||||
else if ( ! strcmp(argv[i], "--f32") )
|
else if ( ! strcmp(argv[i], "--f32") )
|
||||||
cfg.input_format = config::INPUT_F32;
|
cfg.input_format = config::INPUT_F32;
|
||||||
else if ( ! strcmp(argv[i], "--f64") )
|
else if ( ! strcmp(argv[i], "--f64") )
|
||||||
|
@ -1626,6 +1648,10 @@ int main(int argc, const char *argv[]) {
|
||||||
cfg.Fderot = atof(argv[++i]);
|
cfg.Fderot = atof(argv[++i]);
|
||||||
else if ( ! strcmp(argv[i], "--fd-pp") && i+1<argc )
|
else if ( ! strcmp(argv[i], "--fd-pp") && i+1<argc )
|
||||||
cfg.fd_pp = atoi(argv[++i]);
|
cfg.fd_pp = atoi(argv[++i]);
|
||||||
|
else if ( ! strcmp(argv[i], "--fd-bbf") && i+1<argc )
|
||||||
|
cfg.fd_bbf = atoi(argv[++i]);
|
||||||
|
else if ( ! strcmp(argv[i], "--bbf-l3sync") )
|
||||||
|
cfg.bbf_l3sync = true;
|
||||||
else if ( ! strcmp(argv[i], "--fd-gse") && i+1<argc )
|
else if ( ! strcmp(argv[i], "--fd-gse") && i+1<argc )
|
||||||
cfg.fd_gse = atoi(argv[++i]);
|
cfg.fd_gse = atoi(argv[++i]);
|
||||||
else if ( ! strcmp(argv[i], "--awgn") && i+1<argc )
|
else if ( ! strcmp(argv[i], "--awgn") && i+1<argc )
|
||||||
|
|
|
@ -940,6 +940,7 @@ namespace leansdr {
|
||||||
|
|
||||||
if ( ss.fw16<min_freqw16 || ss.fw16>max_freqw16 ) {
|
if ( ss.fw16<min_freqw16 || ss.fw16>max_freqw16 ) {
|
||||||
if ( sch->debug ) fprintf(stderr, "Carrier out of bounds\n");
|
if ( sch->debug ) fprintf(stderr, "Carrier out of bounds\n");
|
||||||
|
in.read(ss.p-in.rd());
|
||||||
enter_frame_detect();
|
enter_frame_detect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2482,12 +2483,14 @@ namespace leansdr {
|
||||||
// EN 302 307-1 section 5.1 Mode adaptation
|
// EN 302 307-1 section 5.1 Mode adaptation
|
||||||
|
|
||||||
struct s2_deframer : runnable {
|
struct s2_deframer : runnable {
|
||||||
|
int fd_bbf; // FD for raw BB frames, or -1
|
||||||
|
bool bbf_l3sync; // Output 0xb8 headers to fd_bbf
|
||||||
int fd_gse; // FD for generic streams, or -1
|
int fd_gse; // FD for generic streams, or -1
|
||||||
s2_deframer(scheduler *sch, pipebuf<bbframe> &_in, pipebuf<tspacket> &_out,
|
s2_deframer(scheduler *sch, pipebuf<bbframe> &_in, pipebuf<tspacket> &_out,
|
||||||
pipebuf<int> *_state_out=NULL,
|
pipebuf<int> *_state_out=NULL,
|
||||||
pipebuf<unsigned long> *_locktime_out=NULL)
|
pipebuf<unsigned long> *_locktime_out=NULL)
|
||||||
: runnable(sch, "S2 deframer"),
|
: runnable(sch, "S2 deframer"),
|
||||||
fd_gse(-1),
|
fd_bbf(-1), bbf_l3sync(false), fd_gse(-1),
|
||||||
nleftover(-1),
|
nleftover(-1),
|
||||||
in(_in), out(_out,MAX_TS_PER_BBFRAME),
|
in(_in), out(_out,MAX_TS_PER_BBFRAME),
|
||||||
current_state(false),
|
current_state(false),
|
||||||
|
@ -2552,6 +2555,17 @@ namespace leansdr {
|
||||||
info_unlocked();
|
info_unlocked();
|
||||||
return; // Max one state_out per loop
|
return; // Max one state_out per loop
|
||||||
}
|
}
|
||||||
|
if ( fd_bbf >= 0 ) {
|
||||||
|
if ( bbf_l3sync ) {
|
||||||
|
uint8_t l3sync = 0xb8;
|
||||||
|
ssize_t nw = write(fd_bbf, &l3sync, 1);
|
||||||
|
if ( nw != 1 ) fatal("write(l3sync)");
|
||||||
|
}
|
||||||
|
size_t n = 10 + dfl/8;
|
||||||
|
ssize_t nw = write(fd_bbf, bbh, n);
|
||||||
|
if ( nw < 0 ) fatal("write(bbf)");
|
||||||
|
if ( nw != n ) fail("partial write(bbf)");
|
||||||
|
}
|
||||||
if ( streamtype==3 && upl==188*8 && sync==0x47 && syncd<=dfl)
|
if ( streamtype==3 && upl==188*8 && sync==0x47 && syncd<=dfl)
|
||||||
handle_ts(data, dfl, syncd, sync);
|
handle_ts(data, dfl, syncd, sync);
|
||||||
else if ( streamtype == 1 ) {
|
else if ( streamtype == 1 ) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace leansdr {
|
||||||
typedef complex<s8> cs8;
|
typedef complex<s8> cs8;
|
||||||
typedef complex<u16> cu16;
|
typedef complex<u16> cu16;
|
||||||
typedef complex<s16> cs16;
|
typedef complex<s16> cs16;
|
||||||
|
typedef complex<int32_t> cs32;
|
||||||
typedef complex<f32> cf32;
|
typedef complex<f32> cf32;
|
||||||
typedef complex<float> cf64;
|
typedef complex<float> cf64;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue