-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathvdlm2.h
134 lines (107 loc) · 3 KB
/
vdlm2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* Copyright (c) 2016 Thierry Leconte
*
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2
* published by the Free Software Foundation.
*
* 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <pthread.h>
#include <complex.h>
#include <stdint.h>
#include <sys/time.h>
#define VDLM2DEC_VERSION "2.3"
#define MAXNBCHANNELS 8
#define MAX_ID_LEN 48
extern unsigned int SDRINRATE;
extern unsigned int SDRCLK;
#define STEPRATE 25000
#define RTLINBUFSZ (16*4096)
#define MFLTLEN 65
#define MBUFLEN 17
typedef struct mskblk_s {
struct mskblk_s *prev;
int chn;
int Fr;
struct timeval tv;
float ppm;
int nbrow, nlbyte;
unsigned char data[65][255];
} msgblk_t;
typedef struct {
int chn;
int Fr,Fo;
} thread_param_t;
#define NBPH 17
#define D8DWN 4
typedef struct {
complex float Inbuff[MBUFLEN];
float Ph[NBPH * D8DWN];
int chn;
int Fr;
int ink, Phidx;
float df;
int clk;
float p2err, perr;
float pfr;
float P1;
unsigned int scrambler;
unsigned int nbits;
unsigned int nbyte;
unsigned int nrow, nbrow;
unsigned int nlbyte;
unsigned char bits;
enum { WSYNC, GETHEAD, GETDATA, GETFEC } state;
msgblk_t *blk;
} channel_t;
#define JSONBUFLEN 50000
#define OUTBUFLEN 50000
extern unsigned int Fc;
extern pthread_barrier_t Bar1, Bar2;
#ifdef WITH_RTL
extern int ppm;
extern complex float Cbuff[RTLINBUFSZ / 2];
#endif
#ifdef WITH_AIR
extern float Cbuff[RTLINBUFSZ / 2];
#endif
extern int grndmess;
extern int emptymess;
extern int undecmess;
extern FILE *logfd;
#ifdef WITH_RTL
extern int initRtl(char **argv, int optind, thread_param_t * param);
extern int runRtlSample(void);
#endif
#ifdef WITH_AIR
extern int initAirspy(char **argv, int optind, thread_param_t * param);
extern int runAirspySample(void);
#endif
extern int initFile(char *file);
extern int runFileSample(void);
extern int initD8psk(channel_t * ch);
extern void *rcv_thread(void *arg);
extern int initVdlm2(channel_t * ch);
extern void stopVdlm2(void);
extern void decodeVdlm2(channel_t * ch);
extern void init_crc_tab(void);
extern unsigned short update_crc(const unsigned short crc,
const unsigned char c);
extern void viterbi_init(void);
extern void viterbi_add(float V, int n);
extern float viterbi_end(unsigned int *bits);
extern unsigned int reversebits(const unsigned int bits, const int n);
extern unsigned short pppfcs16(unsigned char *cp, int len);
extern int rs(unsigned char *data, int *eras_pos, int no_eras);
extern void vout(char *format, ...);
extern void out(msgblk_t * blk, unsigned char *hdata, int l);