forked from g0orx/wdsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iobuffs.h
95 lines (73 loc) · 3.39 KB
/
iobuffs.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
/* iobuffs.h
This file is part of a program that implements a Software-Defined Radio.
Copyright (C) 2013 Warren Pratt, NR0V
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
*/
#ifndef _iobuffs_h
#define _iobuffs_h
#include "comm.h"
typedef struct _iob
{
int channel;
int in_size; // input number of complex samples in a fexchange call
int out_size; // output number of complex samples in a fexchange call
int r1_outsize; // number of complex samples taken out of the input-pseudo-ring for processing
int r2_insize; // number of processed complex samples returned into the output-pseudo-ring
int r1_size; // size of a single maximum sized transfer
int r2_size; // size of a single maximum sized transfer
int r1_active_buffsize; // size of input pseudo-ring (in complex samples)
int r2_active_buffsize; // size of output pseudo-ring (in complex samples)
double* r1_baseptr; // pointer to input pseudo-ring
int r1_inidx; // in 'double', actual index into the buffer is 2 times this
int r1_outidx; // in 'double', actual index into the buffer is 2 times this
int r1_unqueuedsamps; // number of input samples not yet queued/released for execution
double* r2_baseptr; // pointer to output pseudo-ring
int r2_inidx; // in 'double', actual index into the buffer is 2 times this
int r2_outidx; // in 'double', actual index into the buffer is 2 times this
int r2_havesamps; // number of processed samples in output pseudo-ring
int r2_unqueuedsamps; // number of output samples not yet queued / released for output
CRITICAL_SECTION r2_ControlSection;
int bfo; // block_for_output, wait until output is available before proceeding
HANDLE Sem_OutReady; // count = number of 'out_size' buffers processed and available for output
HANDLE Sem_BuffReady; // count = number of 'dsp_size' buffers queued for processing
volatile long exec_bypass;
struct
{
int ustate;
int dstate;
int ucount;
int dcount;
int ndelup;
int ntup;
double* cup;
int ndeldown;
int ntdown;
double* cdown;
volatile long upflag;
volatile long downflag;
} slew;
} iob, *IOB;
extern void create_slews (IOB a);
extern void destroy_slews (IOB a);
extern void flush_slews (IOB a);
extern void create_iobuffs (int channel);
extern void destroy_iobuffs (int channel);
extern void flush_iobuffs (int channel);
PORT // double, interleaved I/Q
void fexchange0 (int channel, double* in, double* out, int* error);
PORT // separate I/Q buffers
extern void fexchange2 (int channel, INREAL *Iin, INREAL *Qin, OUTREAL *Iout, OUTREAL *Qout, int* error);
extern void dexchange (int channel, double* in, double* out);
#endif