SDR: Allow direct IQ TX and RX instead of fm modulating a list of channels
This is performed by reading and writing IQ data to "sample" pointer with channel number set to 0.
This commit is contained in:
parent
65694f3b80
commit
fbdb9ece01
|
@ -305,17 +305,19 @@ void sdr_close(void *inst)
|
|||
int sdr_write(void *inst, sample_t **samples, int num, enum paging_signal __attribute__((unused)) *paging_signal, int *on, int channels)
|
||||
{
|
||||
sdr_t *sdr = (sdr_t *)inst;
|
||||
float buff[num * 2];
|
||||
float buffer[num * 2], *buff = NULL;
|
||||
int c, s, ss;
|
||||
int sent = 0;
|
||||
|
||||
if (channels != sdr->channels) {
|
||||
if (channels != sdr->channels && channels != 0) {
|
||||
PDEBUG(DSDR, DEBUG_ERROR, "Invalid number of channels, please fix!\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
/* process all channels */
|
||||
memset(buff, 0, sizeof(buff));
|
||||
if (channels) {
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
buff = buffer;
|
||||
for (c = 0; c < channels; c++) {
|
||||
/* switch to paging channel, if requested */
|
||||
if (on[c] && sdr->paging_channel)
|
||||
|
@ -323,6 +325,9 @@ int sdr_write(void *inst, sample_t **samples, int num, enum paging_signal __attr
|
|||
else
|
||||
fm_modulate(&sdr->chan[c].mod, samples[c], num, buff);
|
||||
}
|
||||
} else {
|
||||
buff = (float *)samples;
|
||||
}
|
||||
|
||||
if (sdr->wave_tx_rec.fp) {
|
||||
sample_t spl[2][num], *spl_list[2] = { spl[0], spl[1] };
|
||||
|
@ -358,10 +363,16 @@ int sdr_write(void *inst, sample_t **samples, int num, enum paging_signal __attr
|
|||
int sdr_read(void *inst, sample_t **samples, int num, int channels)
|
||||
{
|
||||
sdr_t *sdr = (sdr_t *)inst;
|
||||
float buff[num * 2];
|
||||
float buffer[num * 2], *buff = NULL;
|
||||
int count = 0;
|
||||
int c, s, ss;
|
||||
|
||||
if (channels) {
|
||||
buff = buffer;
|
||||
} else {
|
||||
buff = (float *)samples;
|
||||
}
|
||||
|
||||
#ifdef HAVE_UHD
|
||||
if (sdr_use_uhd)
|
||||
count = uhd_receive(buff, num);
|
||||
|
@ -392,7 +403,8 @@ int sdr_read(void *inst, sample_t **samples, int num, int channels)
|
|||
display_iq(buff, count);
|
||||
display_spectrum(buff, count);
|
||||
|
||||
for (c = 0; c < channels; c++) {
|
||||
if (channels) {
|
||||
for (c = 0; c < channels; c++)
|
||||
fm_demodulate(&sdr->chan[c].demod, samples[c], count, buff);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue