SDDC_Driver
Loading...
Searching...
No Matches
config.h
1/*
2 * This file is part of SDDC_Driver.
3 *
4 * Copyright (C) 2020 - Oscar Steila
5 * Copyright (C) 2020 - Howard Su
6 * Copyright (C) 2021 - Hayati Ayguen
7 * Copyright (C) 2025 - RenardSpark
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef _CONFIG_H_
24#define _CONFIG_H_
25
26#include "types.h"
27#include "types_cpp.h"
28#include "../Interface.h"
29#include <math.h> // atan => PI
30#include <stdbool.h>
31#include <cstdio>
32
33//#define _DEBUG // defined in VS configuration
34#define VERBOSE_ERROR
35#define VERBOSE_WARN
36//#define VERBOSE_TRACE
37//#define VERBOSE_TRACEEXTREME
38
39// macro to call callback function with just status extHWstatusT
40#define EXTIO_STATUS_CHANGE(TAG, CB, STATUS) \
41 do { \
42 SendMessage(h_dialog, WM_USER + 1, STATUS, 0); \
43 if (CB) { \
44 DebugPrintln(TAG, "<==CALLBACK: %s", #STATUS); \
45 CB( -1, STATUS, 0, NULL );\
46 }\
47 }while(0)
48
49#ifdef VERBOSE_DEBUG
50 #define EnterFunction() \
51 DbgPrintf("==>%s\n", __FUNCDNAME__)
52
53 #define EnterFunction1(v1) \
54 DbgPrintf("==>%s(%d)\n", __FUNCDNAME__, (v1))
55#else
56 #define EnterFunction()
57 #define EnterFunction1(v1)
58#endif
59
60#ifdef VERBOSE_ERROR
61 #define ErrorPrint(tag, fmt, ...) fprintf(stderr, "[SDDC] ERROR - %s: %s (%s:%d) " fmt, tag, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__)
62 #define ErrorPrintln(tag, fmt, ...) fprintf(stderr, "[SDDC] ERROR - %s: " fmt " (%s:%d)\n", tag, ##__VA_ARGS__, __FILE__, __LINE__)
63#else
64 #define ErrorPrint(tag, fmt, ...)
65 #define ErrorPrintln(tag, fmt, ...)
66#endif
67
68#ifdef VERBOSE_WARN
69 #define WarnPrint(tag, fmt, ...) fprintf(stderr, "[SDDC] WARN - %s: " fmt, tag, ##__VA_ARGS__)
70 #define WarnPrintln(tag, fmt, ...) fprintf(stderr, "[SDDC] WARN - %s: " fmt "\n", tag, ##__VA_ARGS__)
71#else
72 #define WarnPrint(tag, fmt, ...)
73 #define WarnPrintln(tag, fmt, ...)
74#endif
75
76#ifdef _DEBUG
77 #define DebugPrint(tag, fmt, ...) fprintf(stderr, "[SDDC] DEBUG - %s: " fmt, tag, ##__VA_ARGS__)
78 #define DebugPrintln(tag, fmt, ...) fprintf(stderr, "[SDDC] DEBUG - %s: " fmt "\n", tag, ##__VA_ARGS__)
79#else
80 #define DebugPrint(tag, fmt, ...)
81 #define DebugPrintln(tag, fmt, ...)
82#endif
83
84#ifdef VERBOSE_TRACE
85 #define TracePrint(tag, fmt, ...) fprintf(stderr, "[SDDC] TRACE - %s: %d-%s(" fmt ")", tag, __LINE__, __FUNCTION__, ##__VA_ARGS__)
86 #define TracePrintln(tag, fmt, ...) fprintf(stderr, "[SDDC] TRACE - %s: %d-%s(" fmt ")\n", tag, __LINE__, __FUNCTION__, ##__VA_ARGS__)
87#else
88 #define TracePrint(tag, fmt, ...)
89 #define TracePrintln(tag, fmt, ...)
90#endif
91
92#ifdef VERBOSE_TRACEEXTREME
93 #define TraceExtremePrint(tag, fmt, ...) TracePrint(tag, fmt, ##__VA_ARGS__)
94 #define TraceExtremePrintln(tag, fmt, ...) TracePrintln(tag, fmt, ##__VA_ARGS__)
95#else
96 #define TraceExtremePrint(tag, fmt, ...)
97 #define TraceExtremePrintln(tag, fmt, ...)
98#endif
99
100#define SWVERSION "1.0.0"
101#define SWNAME "SDDC_Driver"
102
103
104#define FFTN_R_ADC (8192) // FFTN used for ADC real stream DDC tested at 2048, 8192, 32768, 131072
105
106// GAINFACTORS to be adjusted with lab reference source measured with HDSDR Smeter rms mode
107#define BBRF103_GAINFACTOR (7.8e-8f) // BBRF103
108#define HF103_GAINFACTOR (1.14e-8f) // HF103
109#define RX888_GAINFACTOR (0.695e-8f) // RX888
110#define RX888mk2_GAINFACTOR (1.08e-8f) // RX888mk2
111
112
113
114#define EXT_BLOCKLEN 512 * 64 /* 32768 only multiples of 512 */
115
116// URL definitions
117#define URL1B "16bit SDR Receiver"
118#define URL1 "<a>http://www.hdsdr.de/</a>"
119#define URL_HDSR "http://www.hdsdr.de/"
120#define URL_HDSDRA "<a>http://www.hdsdr.de/</a>"
121
122
123extern bool saveADCsamplesflag;
124
125// transferSize must be a multiple of 16 (maxBurst) * 1024 (SS packet size) = 16384
126const uint32_t transferSize = 131072;
127const uint32_t transferSamples = transferSize / sizeof(int16_t);
128const uint32_t concurrentTransfers = 16; // used to be 96, but I think it is too high
129
130const uint32_t DEFAULT_ADC_FREQ = 1000000; // ADC sampling frequency
131
132const uint32_t DEFAULT_TRANSFERS_PER_SEC = DEFAULT_ADC_FREQ / transferSamples;
133
134
135
136#define MIN_ADC_FREQ 50000000 // ADC sampling frequency minimum
137#define MAX_ADC_FREQ 140000000 // ADC sampling frequency minimum
138#define N2_BANDSWITCH 80000000 // threshold 5 or 6 SR bandwidths
139
140
141#endif // _CONFIG_H_