14 changed files with 111 additions and 312 deletions
@ -1,90 +0,0 @@
@@ -1,90 +0,0 @@
|
||||
/* channel.h
|
||||
|
||||
This file is part of a program that implements a Software-Defined Radio. |
||||
|
||||
Copyright (C) 2013 Warren Pratt, NR0V |
||||
Copyright (C) 2024 Edouard Griffiths, F4EXB Adapted to SDRangel |
||||
|
||||
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 |
||||
of the License, 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; if not, write to the Free Software |
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
|
||||
The author can be reached by email at |
||||
|
||||
warren@wpratt.com |
||||
|
||||
*/ |
||||
|
||||
#ifndef wdsp_channel_h |
||||
#define wdsp_channel_h |
||||
|
||||
#include <QThread> |
||||
|
||||
#include "export.h" |
||||
|
||||
class WDSP_API Channel |
||||
{ |
||||
public: |
||||
int type; |
||||
bool run; // thread running
|
||||
int in_rate; // input samplerate
|
||||
int out_rate; // output samplerate
|
||||
int in_size; // input buffsize (complex samples) in a fexchange() operation
|
||||
int dsp_rate; // sample rate for mainstream dsp processing
|
||||
int dsp_size; // number complex samples processed per buffer in mainstream dsp processing
|
||||
int dsp_insize; // size (complex samples) of the output of the r1 (input) buffer
|
||||
int dsp_outsize; // size (complex samples) of the input of the r2 (output) buffer
|
||||
int out_size; // output buffsize (complex samples) in a fexchange() operation
|
||||
int state; // 0 for channel OFF; 1 for channel ON
|
||||
float tdelayup; |
||||
float tslewup; |
||||
float tdelaydown; |
||||
float tslewdown; |
||||
int bfo; // 'block_for_output', block fexchange until output is available
|
||||
volatile long flushflag; |
||||
QThread channelThread; |
||||
long upslew; |
||||
// struct //io buffers
|
||||
// {
|
||||
// IOB pc, pd, pe, pf; // copies for console calls, dsp, exchange, and flush thread
|
||||
// volatile long ch_upslew;
|
||||
// } iob;
|
||||
|
||||
static void create_channel ( |
||||
int channel, |
||||
int in_size, |
||||
int dsp_size, |
||||
int input_samplerate, |
||||
int dsp_rate, |
||||
int output_samplerate, |
||||
int type, |
||||
int state, |
||||
float tdelayup, |
||||
float tslewup, |
||||
float tdelaydown, |
||||
float tslewdown, |
||||
int bfo |
||||
); |
||||
static void destroy_channel (int channel); |
||||
static void flush_channel (int channel); |
||||
// static void set_type (int channel, int type);
|
||||
// static void SetInputBuffsize (int channel, int in_size);
|
||||
// static void SetDSPBuffsize (int channel, int dsp_size);
|
||||
// static void SetInputSamplerate (int channel, int samplerate);
|
||||
// static void SetDSPSamplerate (int channel, int samplerate);
|
||||
// static void SetOutputSamplerate (int channel, int samplerate);
|
||||
// static void SetAllRates (int channel, int in_rate, int dsp_rate, int out_rate);
|
||||
// static int SetChannelState (int channel, int state, int dmode);
|
||||
}; |
||||
|
||||
#endif |
||||
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* make_calculus |
||||
* |
||||
* This program reads the contents of the binary WDSP file "calculus" |
||||
* and dumps the data as two arrays of floating-point numbers |
||||
* |
||||
* The output is intended to be part of the file "calculus.c" which |
||||
* initializes these arrays (static data) for use with "memcpy" |
||||
* in emnr.c. |
||||
* |
||||
* Should the WDSP file "calculus" be changed, "calculus.c" should |
||||
* be re-generated using this program. |
||||
* |
||||
* return values of main() |
||||
* |
||||
* 0 all OK |
||||
* -1 sizeof(float) is not 8 |
||||
* -2 error opening file "calculus" |
||||
* -3 read error |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
#include <unistd.h> |
||||
#include <fcntl.h> |
||||
|
||||
int main() { |
||||
int fd; |
||||
int i,j; |
||||
float d; |
||||
|
||||
if (sizeof(float) != 8) { |
||||
printf("Data type DOUBLE is not 8-byte. Please check!\n"); |
||||
return -1; |
||||
} |
||||
fd=open ("calculus", O_RDONLY); |
||||
if (fd < 0) { |
||||
printf("Could not open file 'calculus'\n"); |
||||
return -2; |
||||
} |
||||
|
||||
for (j=0; j<2; j++) { |
||||
switch (j) { |
||||
case 0: |
||||
printf("float GG[241*241]={\n"); |
||||
break; |
||||
case 1: |
||||
printf("float GGS[241*241]={\n"); |
||||
break; |
||||
} |
||||
for (i=0; i< 241*241; i++) { |
||||
if (read(fd, &d, 8) != 8) { |
||||
printf("READ ERROR\n"); |
||||
return -3; |
||||
} |
||||
if (i == 241*241 -1) { |
||||
printf("%30.25f};\n", d); |
||||
} else { |
||||
printf("%30.25f,\n", d); |
||||
} |
||||
} |
||||
return 0; |
||||
} |
||||
} |
||||
@ -1,101 +0,0 @@
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
The purpose of this file is to extract interfaces from the WDSP source code. |
||||
The interfaces have the following form: |
||||
|
||||
PORT blabla |
||||
firstline |
||||
secondline |
||||
{ |
||||
|
||||
where there may be an arbitrary number of lines between the line |
||||
containing "PORT" and the line starting with "{". This has to be |
||||
converted to |
||||
|
||||
extern blabla firstline |
||||
secondline; |
||||
|
||||
That is, the first line is prepended by "extern", and the last line is closed |
||||
with a semicolon. Comments starting with '//' are omitted, and lines starting
|
||||
with '//' are ignored.
|
||||
*/ |
||||
|
||||
|
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
|
||||
void trimm(char *line, size_t maxlen); |
||||
|
||||
int main(int argc, char **argv) |
||||
{ |
||||
FILE *infile; |
||||
int i; |
||||
int first_in_file; |
||||
int first_in_decl; |
||||
char line[1000]; |
||||
size_t linesize=999; |
||||
char *buffer=line; |
||||
|
||||
for (i=1; i<argc; i++) { |
||||
infile=fopen(argv[i],"r"); |
||||
if (infile == NULL) continue; |
||||
first_in_file=1; |
||||
for (;;) { |
||||
if (getline(&buffer, &linesize, infile) < 0) break; |
||||
trimm(line, linesize); |
||||
if (strncmp(line,"PORT", 4) != 0) continue; |
||||
// found an interface
|
||||
if (first_in_file) { |
||||
printf("\n//\n// Interfaces from %s\n//\n\n", argv[i]); |
||||
first_in_file=0; |
||||
} |
||||
if (strlen(line) >4) { |
||||
printf("extern %s ", line+4); |
||||
} else { |
||||
printf("extern "); |
||||
} |
||||
first_in_decl=1; |
||||
|
||||
for (;;) { |
||||
if (getline(&buffer, &linesize, infile) < 0) { |
||||
fprintf(stderr,"! Found a PORT but found EOF while scanning interface.\n"); |
||||
return 8; |
||||
} |
||||
trimm(line, linesize); |
||||
if (line[0] == 0) continue; |
||||
if (line[0] == '{') { |
||||
printf(";\n"); |
||||
break; |
||||
} else { |
||||
if (first_in_decl) { |
||||
printf("%s", line); |
||||
first_in_decl=0; |
||||
} else { |
||||
printf("\n%s", line); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
fclose(infile); |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
void trimm(char *line, size_t maxlen) { |
||||
int len; |
||||
|
||||
//
|
||||
// Remove comments starting with '//'
|
||||
//
|
||||
len=strnlen(line,maxlen); |
||||
for (int i=0; i< len-1; i++) { |
||||
if (line[i] == '/' && line[i+1] == '/') line[i]=0; |
||||
} |
||||
|
||||
//
|
||||
// Remove trailing white space and newlines
|
||||
//
|
||||
len=strnlen(line,maxlen); |
||||
line[len--]=0; |
||||
while (len >= 0 && (line[len] == ' ' || line[len] == '\t' || line[len]== '\n')) line[len--]=0; |
||||
} |
||||
Loading…
Reference in new issue