From 759859b8d15ce3731a6ffea1c5e985bb1819a4d8 Mon Sep 17 00:00:00 2001 From: My Name Date: Tue, 19 Nov 2019 10:56:51 -0600 Subject: [PATCH] v2.6.8 --- .../ChannelMaster/ChannelMaster.vcxproj | 19 +- .../ChannelMaster.vcxproj.filters | 292 +++--- Project Files/Source/ChannelMaster/aamix.c | 7 +- Project Files/Source/ChannelMaster/aamix.h | 1 + Project Files/Source/ChannelMaster/cmaster.c | 92 +- Project Files/Source/ChannelMaster/cmaster.h | 4 +- Project Files/Source/ChannelMaster/cmbuffs.c | 7 +- Project Files/Source/ChannelMaster/cmcomm.h | 1 + Project Files/Source/ChannelMaster/ivac.c | 22 +- Project Files/Source/ChannelMaster/ivac.h | 3 +- .../Source/ChannelMaster/netInterface.c | 298 +++--- Project Files/Source/ChannelMaster/network.c | 860 ++++++++++++---- Project Files/Source/ChannelMaster/network.h | 940 +++++++++--------- Project Files/Source/ChannelMaster/obbuffs.c | 7 +- Project Files/Source/ChannelMaster/obbuffs.h | 1 + Project Files/Source/ChannelMaster/pipe.c | 10 +- Project Files/Source/ChannelMaster/pipe.h | 4 + .../RawInput/bin/x86/Debug/RawInput.dll | Bin 30208 -> 30208 bytes .../RawInput/bin/x86/Debug/RawInput.pdb | Bin 56832 -> 56832 bytes .../RawInput/bin/x86/Release/RawInput.dll | Bin 27136 -> 27136 bytes .../RawInput/bin/x86/Release/RawInput.pdb | Bin 52736 -> 52736 bytes .../RawInput.csproj.FileListAbsolute.txt | 5 - .../RawInput.csprojAssemblyReference.cache | Bin 424 -> 424 bytes .../RawInput/obj/x86/Debug/RawInput.dll | Bin 30208 -> 30208 bytes .../RawInput/obj/x86/Debug/RawInput.pdb | Bin 56832 -> 56832 bytes .../RawInput.csproj.FileListAbsolute.txt | 3 +- .../RawInput.csprojAssemblyReference.cache | Bin 1265 -> 5292 bytes .../RawInput/obj/x86/Release/RawInput.dll | Bin 27136 -> 27136 bytes .../RawInput/obj/x86/Release/RawInput.pdb | Bin 52736 -> 52736 bytes 29 files changed, 1601 insertions(+), 975 deletions(-) diff --git a/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj b/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj index acdef0f2..d24d896c 100644 --- a/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj +++ b/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj @@ -22,33 +22,34 @@ {8E5759EA-1D4E-46DA-9B3C-3577A98301C1} Win32Proj ChannelMaster + 10.0.18362.0 DynamicLibrary true Unicode - v120 + v142 DynamicLibrary true Unicode - v120 + v142 DynamicLibrary false true Unicode - v120 + v142 DynamicLibrary false true Unicode - v120 + v142 @@ -111,7 +112,7 @@ true $(SolutionDir)..\bin\$(HPSDR_PLATFORM)\$(Configuration)\ChannelMaster.dll $(SolutionDir)..\build\$(HPSDR_PLATFORM)\$(Configuration)\; - wdsp.lib;pa19.lib;dfc.lib; + wdsp.lib;pa19.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;avrt.lib;%(AdditionalDependencies) @@ -135,7 +136,7 @@ true $(SolutionDir)..\bin\$(HPSDR_PLATFORM)\$(Configuration)\ChannelMaster.dll $(SolutionDir)..\build\$(HPSDR_PLATFORM)\$(Configuration)\; - wdsp.lib;pa19.lib;dfc.lib; + wdsp.lib;pa19.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) @@ -163,7 +164,7 @@ true $(SolutionDir)..\bin\$(HPSDR_PLATFORM)\$(Configuration)\ChannelMaster.dll $(SolutionDir)..\build\$(HPSDR_PLATFORM)\$(Configuration)\; - wdsp.lib;pa19.lib;dfc.lib; + wdsp.lib;pa19.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;avrt.lib;%(AdditionalDependencies) false @@ -194,7 +195,7 @@ true $(SolutionDir)..\bin\$(HPSDR_PLATFORM)\$(Configuration)\ChannelMaster.dll $(SolutionDir)..\build\$(HPSDR_PLATFORM)\$(Configuration)\; - wdsp.lib;pa19.lib;dfc.lib; + wdsp.lib;pa19.lib;%(AdditionalDependencies) QueueForNextLogin @@ -216,7 +217,6 @@ - @@ -239,7 +239,6 @@ - diff --git a/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj.filters b/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj.filters index c175e1405..10ed8494 100644 --- a/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj.filters +++ b/Project Files/Source/ChannelMaster/ChannelMaster.vcxproj.filters @@ -1,150 +1,144 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/Project Files/Source/ChannelMaster/aamix.c b/Project Files/Source/ChannelMaster/aamix.c index 86fe5e5c..397a502d 100644 --- a/Project Files/Source/ChannelMaster/aamix.c +++ b/Project Files/Source/ChannelMaster/aamix.c @@ -31,6 +31,11 @@ __declspec (align (16)) AAMIX paamix[MAX_EXT_AAMIX]; // array of pointers for A void mix_main (void *pargs) { + DWORD taskIndex = 0; + HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex); + if (hTask != 0) AvSetMmThreadPriority(hTask, 2); + else SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + AAMIX a = (AAMIX) pargs; while (_InterlockedAnd (&a->run, 1)) @@ -46,7 +51,7 @@ void mix_main (void *pargs) void start_mixthread (AAMIX a) { HANDLE handle = (HANDLE) _beginthread(mix_main, 0, (void *)a); - SetThreadPriority (handle, THREAD_PRIORITY_HIGHEST); + //SetThreadPriority (handle, THREAD_PRIORITY_HIGHEST); } enum _slew diff --git a/Project Files/Source/ChannelMaster/aamix.h b/Project Files/Source/ChannelMaster/aamix.h index 5b259b8e..684bb6de 100644 --- a/Project Files/Source/ChannelMaster/aamix.h +++ b/Project Files/Source/ChannelMaster/aamix.h @@ -113,6 +113,7 @@ extern void SetAAudioMixOutputPointer(void* ptr, int id, void (*Outbound)(int id extern __declspec (dllexport) void SetAAudioMixVolume (void* ptr, int id, double volume); extern __declspec (dllexport) void SetAAudioMixState (void* ptr, int id, int stream, int state); +extern __declspec (dllexport) void SetAAudioMixStates (void* ptr, int id, int streams, int states); extern __declspec (dllexport) void SetAAudioMixWhat (void* ptr, int id, int stream, int state); extern void SetAAudioRingInsize (void* ptr, int id, int size); extern void SetAAudioRingOutsize (void* ptr, int id, int size); diff --git a/Project Files/Source/ChannelMaster/cmaster.c b/Project Files/Source/ChannelMaster/cmaster.c index 20135485..f2a989b5 100644 --- a/Project Files/Source/ChannelMaster/cmaster.c +++ b/Project Files/Source/ChannelMaster/cmaster.c @@ -2,7 +2,7 @@ This file is part of a program that implements a Software-Defined Radio. -Copyright (C) 2014 Warren Pratt, NR0V +Copyright (C) 2014-2019 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 @@ -112,20 +112,63 @@ void destroy_rcvr() void create_xmtr() { int i, j, rc; + int avoxmix_inrates[cmMAXrcvr * cmMAXSubRcvr]; // anti-vox mixer inrates + for (i = 0; i < pcm->cmRCVR; i++) + for (j = 0; j < pcm->cmSubRCVR; j++) + avoxmix_inrates[pcm->cmSubRCVR * i + j] = pcm->rcvr[i].ch_outrate; for (i = 0; i < pcm->cmXMTR; i++) { int in_id = inid (1, i); // output buffers (two because of EER) for (j = 0; j < 2; j++) pcm->xmtr[i].out[j] = (double *) malloc0 (getbuffsize (pcm->cmMAXTxOutRate) * sizeof (complex)); - //vox - pcm->xmtr[i].pvox = create_vox ( - i, // id - 0, // run + // dexp - vox + create_dexp ( + i, // transmitter id, txid + 0, // dexp initially set to OFF pcm->xcm_insize[in_id], // input buffer size pcm->in[in_id], // input buffer - 0, // mode - 0.001); // threshold + pcm->in[in_id], // output buffer + pcm->xcm_inrate[in_id], // sample-rate + 0.01, // detector smoothing time-constant + 0.025, // attack time + 0.100, // release time + 1.000, // hold time + 4.000, // expansion ratio + 0.750, // hysteresis ratio + 0.050, // attack threshold + 256, // 256 taps for side-channel filter + 0, // BH-4 window for side-channel filter + 1000.0, // low-cut for side-channel filter + 2000.0, // high-cut for side-channel filter + 0, // side-channel filter initially set to OFF + 1, // VOX initially set to ON + 1, // audio delay initially set to ON + 0.060, // audio delay set to 60ms + pcm->xmtr[i].pushvox, // pointer to VOX callback + 0, // anti-vox 'run' flag + pcm->audio_outsize, // anti-vox data buffer size (complex samples) + pcm->audio_outrate, // anti-vox data sample-rate + 0.01, // anti-vox gain + 0.01); // anti-vox smoothing time-constant + // anti-vox mixer + pcm->xmtr[i].pavoxmix = (AAMIX) create_aamix ( + -1, // no id, return a pointer + i, // outbound id to use when calling dexp-vox + pcm->audio_outsize, // aamix ring_insize (after aamix resamplers) + pcm->audio_outsize, // outsize (use audio size) + pcm->cmRCVR * pcm->cmSubRCVR, // maximum number of inputs + 0, // 'active' inputs (data must flow for each) + (1<<(pcm->cmRCVR*pcm->cmSubRCVR))-1,// inputs to currently mix ('what' variable) + 1.0, // volume + 4096, // ring buffer size + avoxmix_inrates, // sample rates of input streams + pcm->audio_outrate, // audio output sample rate (use audio rate) + SendAntiVOXData, // pointer to call sending output to Anti-VOX + 0.000, // tdelayup + 0.000, // tslewup + 0.000, // tdelaydown + 0.000); // tslewdown // dsp channel OpenChannel( chid (in_id, 0), // channel number @@ -136,8 +179,8 @@ void create_xmtr() pcm->xmtr[i].ch_outrate, // output sample rate 1, // channel type 0, // initial state - 0.010, // tdelayup - 0.025, // tslewup + 0.000, // tdelayup + 0.010, // tslewup 0.000, // tdelaydown 0.010, // tslewdown 1); // block until output is available @@ -196,7 +239,8 @@ void destroy_xmtr() destroy_txgain (pcm->xmtr[i].pgain); DestroyAnalyzer (inid (1, i)); CloseChannel (chid (inid (1, i), 0)); - destroy_vox (pcm->xmtr[i].pvox); + destroy_aamix ((void *)(pcm->xmtr[i].pavoxmix), -1); + destroy_dexp (i); for (j = 0; j < 2; j++) _aligned_free (pcm->xmtr[i].out[j]); } @@ -269,7 +313,7 @@ void xcmaster (int stream) EnterCriticalSection (&pcm->update[stream]); switch (stype (stream)) { - int rx, tx, j; + int rx, tx, j, k; case 0: // standard receiver rx = rxid (stream); @@ -282,14 +326,18 @@ void xcmaster (int stream) fexchange0 (chid (stream, j), pcm->in[stream], pcm->rcvr[rx].audio[j], &error); // dsp xpipe (stream, 1, pcm->rcvr[rx].audio); for (j = 0; j < pcm->cmSubRCVR; j++) + { xMixAudio (0, 0, chid (stream, j), pcm->rcvr[rx].audio[j]); // mix audio + for (k = 0; k < pcm->cmXMTR; k++) + xMixAudio (pcm->xmtr[k].pavoxmix, -1, chid (stream, j), pcm->rcvr[rx].audio[j]);// send audio to anti-vox mixer(s) + } // if (rx == 0) WriteAudio(30.0, 48000, 64, pcm->rcvr[0].audio[0], 3); break; case 1: // standard transmitter tx = txid (stream); xpipe (stream, 0, pcm->in); - xvox (pcm->xmtr[tx].pvox); // vox + xdexp (tx); // vox-dexp fexchange0 (chid (stream, 0), pcm->in[stream], pcm->xmtr[tx].out[0], &error); // dsp xpipe (stream, 1, pcm->xmtr[tx].out); // Spectrum0 (1, stream, 0, 0, pcm->xmtr[tx].out[0]); // panadapter @@ -354,7 +402,9 @@ void SetXcmInrate (int in_id, int rate) // 2014-12-18: called for streams 0, 1, tx = txid (in_id); SetInputSamplerate (chid (in_id, 0), rate); // dsp channel input rate SetInputBuffsize (chid (in_id, 0), pcm->xcm_insize[in_id]); // dsp channel input size - SetTXAVoxSize (tx, pcm->xcm_insize[in_id]); // VOX size + //SetTXAVoxSize (tx, pcm->xcm_insize[in_id]); // VOX size + SetDEXPSize (tx, pcm->xcm_insize[in_id]); // vox-dexp size + SetDEXPRate (tx, rate); // vox-dexp rate // PIPE - set wave player, rcvr0 (leave in C# since player is there) // PIPE - set wave player, rcvr1 (leave in C# since player is there) // PIPE - set wave recorder, rcvr0 (leave in C# since recorder is there) @@ -439,4 +489,18 @@ void SetXmtrChannelOutrate (int xmtr_id, int rate, int state) // 2014-11-24: Ca SetIVACtxmonSize (1, size); // set vacOUT1 size for tx monitor // PIPE - set Wave Recorder (leave in C# since recorder is there) LeaveCriticalSection (&pcm->update[in_id]); -} \ No newline at end of file +} + +PORT +void SetAntiVOXSourceStates (int txid, int streams, int states) +{ + void* a = (void *)pcm->xmtr[txid].pavoxmix; + SetAAudioMixStates (a, -1, streams, states); +} + +PORT +void SetAntiVOXSourceWhat (int txid, int stream, int state) +{ + void* a = (void *)pcm->xmtr[txid].pavoxmix; + SetAAudioMixWhat (a, -1, stream, state); +} diff --git a/Project Files/Source/ChannelMaster/cmaster.h b/Project Files/Source/ChannelMaster/cmaster.h index 3f8e9098..7018cbbe 100644 --- a/Project Files/Source/ChannelMaster/cmaster.h +++ b/Project Files/Source/ChannelMaster/cmaster.h @@ -2,7 +2,7 @@ This file is part of a program that implements a Software-Defined Radio. -Copyright (C) 2014 Warren Pratt, NR0V +Copyright (C) 2014-2019 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 @@ -33,6 +33,7 @@ warren@wpratt.com #include "sync.h" #include "txgain.h" #include "vox.h" +#include "aamix.h" typedef struct _cmaster { @@ -84,6 +85,7 @@ typedef struct _cmaster TXGAIN pgain; // gain block, for Penelope power control & amp protect EER peer; // eer block ILV pilv; // interleave for EER + AAMIX pavoxmix; // anti-vox mixer } xmtr[cmMAXxmtr]; } cmaster, *CMASTER; diff --git a/Project Files/Source/ChannelMaster/cmbuffs.c b/Project Files/Source/ChannelMaster/cmbuffs.c index fbb07658..8af53016 100644 --- a/Project Files/Source/ChannelMaster/cmbuffs.c +++ b/Project Files/Source/ChannelMaster/cmbuffs.c @@ -29,7 +29,7 @@ warren@wpratt.com void start_cmthread (int id) { HANDLE handle = (HANDLE) _beginthread(cm_main, 0, (void *)id); - SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST); + //SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST); } void create_cmbuffs (int id, int accept, int max_insize, int max_outsize, int outsize) @@ -149,6 +149,11 @@ void cmdata (int id, double* out) void cm_main (void *pargs) { + DWORD taskIndex = 0; + HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex); + if (hTask != 0) AvSetMmThreadPriority(hTask, 2); + else SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + int id = (int)pargs; CMB a = pcm->pdbuff[id]; diff --git a/Project Files/Source/ChannelMaster/cmcomm.h b/Project Files/Source/ChannelMaster/cmcomm.h index bd53d159..34e21259 100644 --- a/Project Files/Source/ChannelMaster/cmcomm.h +++ b/Project Files/Source/ChannelMaster/cmcomm.h @@ -29,6 +29,7 @@ warren@wpratt.com #include #include #include +#include #include "aamix.h" #include "amix.h" diff --git a/Project Files/Source/ChannelMaster/ivac.c b/Project Files/Source/ChannelMaster/ivac.c index 40ff3525..906603fe 100644 --- a/Project Files/Source/ChannelMaster/ivac.c +++ b/Project Files/Source/ChannelMaster/ivac.c @@ -2,7 +2,7 @@ This file is part of a program that implements a Software-Defined Radio. -Copyright (C) 2015-2017 Warren Pratt, NR0V +Copyright (C) 2015-2019 Warren Pratt, NR0V Copyright (C) 2015-2016 Doug Wigley, W5WC This program is free software; you can redistribute it and/or @@ -41,6 +41,7 @@ void create_resamps(IVAC a) else a->rmatchOUT = create_rmatchV (a->iq_size, a->vac_size, a->iq_rate, a->vac_rate, a->OUTringsize); // RX I-Q data going to VAC forceRMatchVar (a->rmatchOUT, a->OUTforce, a->OUTfvar); + a->bitbucket = (double *) malloc0 (getbuffsize (pcm->cmMAXInRate) * sizeof (complex)); } PORT void create_ivac( @@ -93,6 +94,7 @@ PORT void create_ivac( void destroy_resamps(IVAC a) { + _aligned_free (a->bitbucket); destroy_rmatchV (a->rmatchOUT); destroy_rmatchV (a->rmatchIN); } @@ -104,20 +106,20 @@ PORT void destroy_ivac(int id) free (a); } -PORT void xvacIN(int id, double* in_tx) +PORT void xvacIN(int id, double* in_tx, int bypass) { // used for MIC data to TX IVAC a = pvac[id]; - if (a->run && !a->vac_bypass) - { - xrmatchOUT (a->rmatchIN, in_tx); - if (a->vac_combine_input) - combinebuff(a->mic_size, in_tx, in_tx); - if (a->vox || a->mox) + if (a->run) + if (!a->vac_bypass && !bypass) + { + xrmatchOUT (a->rmatchIN, in_tx); + if (a->vac_combine_input) + combinebuff(a->mic_size, in_tx, in_tx); scalebuff(a->mic_size, in_tx, a->vac_preamp, in_tx); + } else - memset(in_tx, 0, a->mic_size * sizeof(complex)); - } + xrmatchOUT (a->rmatchIN, a->bitbucket); } PORT void xvacOUT(int id, int stream, double* data) diff --git a/Project Files/Source/ChannelMaster/ivac.h b/Project Files/Source/ChannelMaster/ivac.h index dad904a8..2e0e3632 100644 --- a/Project Files/Source/ChannelMaster/ivac.h +++ b/Project Files/Source/ChannelMaster/ivac.h @@ -49,6 +49,7 @@ typedef struct _ivac int txmon_size; int vac_size; // VAC buffer size void *mixer; // pointer to async audio mixer + double* bitbucket; // dump for un-needed resampler output void *rmatchIN; void *rmatchOUT; @@ -88,7 +89,7 @@ extern __declspec(dllexport) void *create_resampleV (int samplerate_in, int samp extern __declspec(dllexport) void xresampleV (double *input, double *output, int numsamps, int *outsamps, void *ptr); extern __declspec(dllexport) void destroy_resampleV (/*ResSt*/ void * resst); extern __declspec(dllexport) void destroy_ivac (int id); -extern __declspec(dllexport) void xvacIN(int id, double* in_tx); +extern __declspec(dllexport) void xvacIN(int id, double* in_tx, int bypass); extern __declspec(dllexport) void xvacOUT(int id, int stream, double* data); extern __declspec(dllexport) void create_ivac ( int id, diff --git a/Project Files/Source/ChannelMaster/netInterface.c b/Project Files/Source/ChannelMaster/netInterface.c index e03f3049..3fb8875c 100644 --- a/Project Files/Source/ChannelMaster/netInterface.c +++ b/Project Files/Source/ChannelMaster/netInterface.c @@ -155,8 +155,14 @@ int getOOO() { // OOO == Out Of Order packet result += 8; if (prn->rx[3].rx_in_seq_err > 0) // DDC3 I/Q data result += 16; - if (prn->tx[0].mic_in_seq_err > 0) // mic_in data + if (prn->rx[4].rx_in_seq_err > 0) // DDC4 I/Q data result += 32; + if (prn->rx[5].rx_in_seq_err > 0) // DDC5 I/Q data + result += 64; + if (prn->rx[6].rx_in_seq_err > 0) // DDC6 I/Q data + result += 128; + if (prn->tx[0].mic_in_seq_err > 0) // mic_in data + result += 256; if (result > 0) @@ -169,12 +175,34 @@ int getOOO() { // OOO == Out Of Order packet prn->rx[1].rx_in_seq_err = 0; prn->rx[2].rx_in_seq_err = 0; prn->rx[3].rx_in_seq_err = 0; + prn->rx[4].rx_in_seq_err = 0; + prn->rx[5].rx_in_seq_err = 0; + prn->rx[6].rx_in_seq_err = 0; prn->tx[0].mic_in_seq_err = 0; } return result; } +PORT +int getSeqInDeltaStart(int rx) { + prn->rx[rx].snapshot = prn->rx[rx].snapshots_head; + return prn->rx[rx].snapshot != NULL; +} + +PORT +int getSeqInDelta(int rx, int deltas[]) { + if (prn->rx[rx].snapshot != NULL) + { + memcpy(deltas, prn->rx[rx].snapshot->rx_in_seq_snapshot, sizeof(int) * MAX_IN_SEQ_LOG); + + prn->rx[rx].snapshot = prn->rx[rx].snapshot->next; + + return 1; + } + return 0; +} + PORT int getUserI01() { return (prn->user_io & 0x1) != 0; @@ -1220,133 +1248,160 @@ void create_rnet() { int i; prn = (RADIONET)malloc(sizeof(radionet)); - prn->RxReadBufp = (double *)calloc(1, 2 * sizeof(double) * 240); - prn->TxReadBufp = (double *)calloc(1, 2 * sizeof(double) * 720); - prn->ReadBufp = (unsigned char *)calloc(1, sizeof(unsigned char) * 1444); - //prn->ReadBufp = (char *)calloc(1, sizeof(char) * 1444); - prn->OutBufp = (char *)calloc(1, sizeof(char) * 1440); - //prn->readbuf = prn->ReadBufp; - prn->rx_base_port = 1035; - prn->run = 0; - prn->wdt = 0; - prn->sendHighPriority = 1; - prn->num_adc = 1; - prn->num_dac = 1; - prn->ptt_in = 0; - prn->dot_in = 0; - prn->dash_in = 0; - prn->cc_seq_no = 0; - prn->cc_seq_err = 0; - - prn->cw.mode_control = 0; - prn->cw.sidetone_level = 0; - prn->cw.sidetone_freq = 0; - prn->cw.keyer_speed = 0; - prn->cw.keyer_weight = 0; - prn->cw.hang_delay = 0; - prn->cw.rf_delay = 0; - - prn->mic.mic_control = 0; - prn->mic.line_in_gain = 0; - prn->mic.spp = 64; // 64; 720; // I-samples per packet + if (prn) { + prn->RxReadBufp = (double*)calloc(1, 2 * sizeof(double) * 240); + prn->TxReadBufp = (double*)calloc(1, 2 * sizeof(double) * 720); + prn->ReadBufp = (unsigned char*)calloc(1, sizeof(unsigned char) * 1444); + //prn->ReadBufp = (char *)calloc(1, sizeof(char) * 1444); + prn->OutBufp = (char*)calloc(1, sizeof(char) * 1440); + //prn->readbuf = prn->ReadBufp; + prn->rx_base_port = 1035; + prn->run = 0; + prn->wdt = 0; + prn->sendHighPriority = 1; + prn->num_adc = 1; + prn->num_dac = 1; + prn->ptt_in = 0; + prn->dot_in = 0; + prn->dash_in = 0; + prn->cc_seq_no = 0; + prn->cc_seq_err = 0; - for (i = 0; i < 2; i++) - prn->syncrxbuff[i] = (double *)calloc(1, 2 * sizeof(double) * 120); - - prn->wb_base_port = 1027; - prn->wb_base_dispid = 32; - prn->wb_enable = 0; - prn->wb_samples_per_packet = 512; - prn->wb_sample_size = 16; - prn->wb_update_rate = 70; - prn->wb_packets_per_frame = 32; - for (i = 0; i < MAX_ADC; i++) { - prn->adc[i].id = i; - prn->adc[i].rx_step_attn = 0; - prn->adc[i].tx_step_attn = 31; - prn->adc[i].adc_overload = 0; - prn->adc[i].dither = 0; - prn->adc[i].random = 0; - prn->adc[i].wb_seqnum = 0; - prn->adc[i].wb_state = 0; - prn->adc[i].wb_buff = (double *)malloc0(1024 * sizeof(double)); - } + prn->cw.mode_control = 0; + prn->cw.sidetone_level = 0; + prn->cw.sidetone_freq = 0; + prn->cw.keyer_speed = 0; + prn->cw.keyer_weight = 0; + prn->cw.hang_delay = 0; + prn->cw.rf_delay = 0; + + prn->mic.mic_control = 0; + prn->mic.line_in_gain = 0; + prn->mic.spp = 64; // 64; 720; // I-samples per packet + + for (i = 0; i < 2; i++) + prn->syncrxbuff[i] = (double*)calloc(1, 2 * sizeof(double) * 120); + + prn->wb_base_port = 1027; + prn->wb_base_dispid = 32; + prn->wb_enable = 0; + prn->wb_samples_per_packet = 512; + prn->wb_sample_size = 16; + prn->wb_update_rate = 70; + prn->wb_packets_per_frame = 32; + for (i = 0; i < MAX_ADC; i++) { + prn->adc[i].id = i; + prn->adc[i].rx_step_attn = 0; + prn->adc[i].tx_step_attn = 31; + prn->adc[i].adc_overload = 0; + prn->adc[i].dither = 0; + prn->adc[i].random = 0; + prn->adc[i].wb_seqnum = 0; + prn->adc[i].wb_state = 0; + prn->adc[i].wb_buff = (double*)malloc0(1024 * sizeof(double)); + } - for (i = 0; i < MAX_RX_STREAMS; i++) { - prn->rx[i].id = i; - prn->rx[i].rx_adc = 0; - prn->rx[i].frequency = 0; - prn->rx[i].enable = 0; - prn->rx[i].sync = 0; - prn->rx[i].sampling_rate = 48; - prn->rx[i].bit_depth = 24; - prn->rx[i].preamp = 0; - prn->rx[i].rx_in_seq_no = 0; - prn->rx[i].rx_out_seq_no = 0; - prn->rx[i].rx_in_seq_err = 0; - prn->rx[i].time_stamp = 0; - prn->rx[i].bits_per_sample = 0; - prn->rx[i].spp = 238; // IQ-samples per packet - } - - for (i = 0; i < MAX_TX_STREAMS; i++) { - prn->tx[i].id = i; - prn->tx[i].frequency = 0; - prn->tx[i].sampling_rate = 192; - prn->tx[i].cwx = 0; - prn->tx[i].dash = 0; - prn->tx[i].dot = 0; - prn->tx[i].ptt_out = 0; - prn->tx[i].drive_level = 0; - prn->tx[i].phase_shift = 0; - prn->tx[i].epwm_max = 0; - prn->tx[i].epwm_min = 0; - prn->tx[i].pa = 0; - prn->tx[i].mic_in_seq_no = 0; - prn->tx[i].mic_in_seq_err = 0; - prn->tx[i].mic_out_seq_no = 0; - prn->tx[i].spp = 240; // IQ-samples per packet - } - - for (i = 0; i < MAX_AUDIO_STREAMS; i++) - { - prn->audio[i].spp = 64; // 64; 360; // LR-samples per packet - } + for (i = 0; i < MAX_RX_STREAMS; i++) { + prn->rx[i].id = i; + prn->rx[i].rx_adc = 0; + prn->rx[i].frequency = 0; + prn->rx[i].enable = 0; + prn->rx[i].sync = 0; + prn->rx[i].sampling_rate = 48; + prn->rx[i].bit_depth = 24; + prn->rx[i].preamp = 0; + prn->rx[i].rx_in_seq_no = 0; + prn->rx[i].rx_out_seq_no = 0; + prn->rx[i].rx_in_seq_err = 0; + prn->rx[i].time_stamp = 0; + prn->rx[i].bits_per_sample = 0; + prn->rx[i].spp = 238; // IQ-samples per packet + + //MW0LGE + prn->rx[i].rx_in_seq_delta_index = 0; + for (int ii = 0; ii < MAX_IN_SEQ_LOG; ii++) { + prn->rx[i].rx_in_seq_delta[ii] = 0; + } + prn->rx[i].snapshots_head = NULL; + prn->rx[i].snapshots_tail = NULL; + prn->rx[i].snapshot_length = 0; + } + + for (i = 0; i < MAX_TX_STREAMS; i++) { + prn->tx[i].id = i; + prn->tx[i].frequency = 0; + prn->tx[i].sampling_rate = 192; + prn->tx[i].cwx = 0; + prn->tx[i].dash = 0; + prn->tx[i].dot = 0; + prn->tx[i].ptt_out = 0; + prn->tx[i].drive_level = 0; + prn->tx[i].phase_shift = 0; + prn->tx[i].epwm_max = 0; + prn->tx[i].epwm_min = 0; + prn->tx[i].pa = 0; + prn->tx[i].mic_in_seq_no = 0; + prn->tx[i].mic_in_seq_err = 0; + prn->tx[i].mic_out_seq_no = 0; + prn->tx[i].spp = 240; // IQ-samples per packet + } - prn->puresignal_run = 0; + for (i = 0; i < MAX_AUDIO_STREAMS; i++) + { + prn->audio[i].spp = 64; // 64; 360; // LR-samples per packet + } - for (i = 0; i < 6; i++) - prn->discovery.MACAddr[i] = 0; - prn->discovery.BoardType = 0; - prn->discovery.protocolVersion = 0; - prn->discovery.fwCodeVersion = 0; - prn->discovery.MercuryVersion_0 = 0; - prn->discovery.MercuryVersion_1 = 0; - prn->discovery.MercuryVersion_2 = 0; - prn->discovery.MercuryVersion_3 = 0; - prn->discovery.PennyVersion = 0; - prn->discovery.MetisVersion = 0; - prn->discovery.numRxs = 0; + prn->puresignal_run = 0; - prbpfilter = (RBPFILTER)malloc0(sizeof(rbpfilter)); - prbpfilter->bpfilter = 0; - prbpfilter->enable = 1; + for (i = 0; i < 6; i++) + prn->discovery.MACAddr[i] = 0; + prn->discovery.BoardType = 0; + prn->discovery.protocolVersion = 0; + prn->discovery.fwCodeVersion = 0; + prn->discovery.MercuryVersion_0 = 0; + prn->discovery.MercuryVersion_1 = 0; + prn->discovery.MercuryVersion_2 = 0; + prn->discovery.MercuryVersion_3 = 0; + prn->discovery.PennyVersion = 0; + prn->discovery.MetisVersion = 0; + prn->discovery.numRxs = 0; - prbpfilter2 = (RBPFILTER2)malloc0(sizeof(rbpfilter2)); - prbpfilter2->bpfilter = 0; - prbpfilter2->enable = 2; + prbpfilter = (RBPFILTER)malloc0(sizeof(rbpfilter)); + prbpfilter->bpfilter = 0; + prbpfilter->enable = 1; - prn->hReadThreadMain = NULL; - prn->hReadThreadInitSem = NULL; - prn->hKeepAliveThread = NULL; - prn->hTimer = NULL; + prbpfilter2 = (RBPFILTER2)malloc0(sizeof(rbpfilter2)); + prbpfilter2->bpfilter = 0; + prbpfilter2->enable = 2; - create_obbuffs(0, 1, 2048, prn->audio[0].spp); // last parameter is number of samples per packet - create_obbuffs(1, 1, 2048, prn->tx[0].spp); - InitializeCriticalSectionAndSpinCount(&prn->udpOUT, 2500); - InitializeCriticalSectionAndSpinCount(&prn->rcvpkt, 2500); - InitializeCriticalSectionAndSpinCount(&prn->sndpkt, 2500); - SendpOutbound(OutBound); + prn->hReadThreadMain = NULL; + prn->hReadThreadInitSem = NULL; + prn->hKeepAliveThread = NULL; + prn->hTimer = NULL; + + create_obbuffs(0, 1, 2048, prn->audio[0].spp); // last parameter is number of samples per packet + create_obbuffs(1, 1, 2048, prn->tx[0].spp); + (void)InitializeCriticalSectionAndSpinCount(&prn->udpOUT, 2500); + (void)InitializeCriticalSectionAndSpinCount(&prn->rcvpkt, 2500); + (void)InitializeCriticalSectionAndSpinCount(&prn->sndpkt, 2500); + SendpOutbound(OutBound); + } +} + +PORT +void clearSnapshots() +{ + int i; + for (i = 0; i < MAX_RX_STREAMS; i++) { + while (prn->rx[i].snapshots_head != NULL) + { + _seqLogSnapshot_t* tmp = prn->rx[i].snapshots_head; + prn->rx[i].snapshots_head = tmp->next; + free(tmp); + } + prn->rx[i].snapshot_length = 0; + prn->rx[i].snapshots_tail = NULL; + } } PORT @@ -1365,6 +1420,9 @@ void destroy_rnet() { free(prn->TxReadBufp); free(prn->RxReadBufp); free(prn->ReadBufp); + //MW0LGE + clearSnapshots(); + // free(prn); _aligned_free(prbpfilter); _aligned_free(prbpfilter2); diff --git a/Project Files/Source/ChannelMaster/network.c b/Project Files/Source/ChannelMaster/network.c index 279836b2..bd50d03c 100644 --- a/Project Files/Source/ChannelMaster/network.c +++ b/Project Files/Source/ChannelMaster/network.c @@ -154,13 +154,13 @@ int nativeInitMetis(char *netaddr, char *localaddr, int localport) { fflush(stdout); - sndbufsize = 0x10000; + sndbufsize = 0xffff; // 0x10000; rc = setsockopt(listenSock, SOL_SOCKET, SO_SNDBUF, (const char *)&sndbufsize, sizeof(int)); if (rc == SOCKET_ERROR) { printf("CreateSockets Warning: setsockopt SO_SNDBUF failed!\n"); } - sndbufsize = 0xfa000; + sndbufsize = 0xffff; // 0xfa000; rc = setsockopt(listenSock, SOL_SOCKET, SO_RCVBUF, (const char *)&sndbufsize, sizeof(int)); if (rc == SOCKET_ERROR) { printf("CreateSockets Warning: setsockopt SO_RCVBUF failed!\n"); @@ -200,7 +200,7 @@ void GetCodeVersion(unsigned char addr_bytes[]) { } PORT -void GetMetisBoardID(char addr_bytes[]) { +void GetBoardID(char addr_bytes[]) { //memcpy(addr_bytes, MetisBoardID, 1); memcpy(addr_bytes, &(prn->discovery.BoardType), 1); } @@ -254,194 +254,558 @@ void StopReadThread(void) { return; } -PORT -void ProcessPacket(int port, unsigned char* packet) +//void ReadThreadMainLoop() { +// char ReadBuf[BUFLEN]; +// unsigned char *readbuf = (unsigned char *)&ReadBuf[0]; // &prn->ReadBufp[0]; +// struct sockaddr_in fromaddr; +// int i, rc, k, fromlen; +// unsigned int seqnum; +// unsigned char *seqbytep = (unsigned char *)&seqnum; +// fromlen = sizeof(fromaddr); +// +// //double sbuf[500] = { 0 }; // FOR DEBUG ONLY +// +// while (io_keep_running) { +// //unsigned char readbuf[BUFLEN]; +// +// prn->hDataEvent = WSACreateEvent(); +// WSAEventSelect(listenSock, prn->hDataEvent, FD_READ); +// +// DWORD retVal = WSAWaitForMultipleEvents(1, &prn->hDataEvent, FALSE, 1000, FALSE); +// if ((retVal == WSA_WAIT_FAILED) || (retVal == WSA_WAIT_TIMEOUT)) +// { +// HaveSync = 3; +// memset(prn->RxReadBufp, 0, 238); +// memset(prn->TxReadBufp, 0, 720); +// Inbound(0, 238, prn->RxReadBufp); +// Inbound(1, 238, prn->RxReadBufp); +// Inbound(inid(1, 0), 720, prn->TxReadBufp); +// continue; +// } +// else +// { +// WSAEnumNetworkEvents(listenSock, prn->hDataEvent, &prn->wsaProcessEvents); +// if (prn->wsaProcessEvents.lNetworkEvents & FD_READ) +// { +// if (prn->wsaProcessEvents.iErrorCode[FD_READ_BIT] != 0) +// { +// printf("FD_READ failed with error %d\n", +// prn->wsaProcessEvents.iErrorCode[FD_READ_BIT]); +// break; +// } +// +// EnterCriticalSection(&prn->rcvpkt); +// +// //memset(prn->ReadBufp, 0, BUFLEN); +// //recvfrom(listenSock, prn->ReadBufp, BUFLEN, 0, (SOCKADDR *)&fromaddr, &fromlen); +// memset(ReadBuf, 0, BUFLEN); +// recvfrom(listenSock, &ReadBuf, BUFLEN, 0, (SOCKADDR *)&fromaddr, &fromlen); +// +// seqbytep[3] = readbuf[0]; +// seqbytep[2] = readbuf[1]; +// seqbytep[1] = readbuf[2]; +// seqbytep[0] = readbuf[3]; +// +// switch (rc = ntohs(fromaddr.sin_port)) +// { +// case 1025: +// if (seqnum != (1 + prn->cc_seq_no)) { +// prn->cc_seq_err += 1; +// printf("Rx C&C: seq error this: %d last: %d\n", seqnum, prn->cc_seq_no); +// } +// prn->cc_seq_no = seqnum; +// +// //Byte 4 - Bit [0] - PTT 1 = active, 0 = inactive +// // Bit [1] - Dot 1 = active, 0 = inactive +// // Bit [2] - Dash 1 = active, 0 = inactive +// prn->ptt_in = readbuf[4] & 0x1; +// prn->dot_in = readbuf[4] & 0x2; +// prn->dash_in = readbuf[4] & 0x4; +// +// //Byte 5 - Bit [0] - ADC0 Overload 1 = active, 0 = inactive +// // Bit [1] - ADC1 Overload 1 = active, 0 = inactive +// // Bit [2] - ADC2 Overload 1 = active, 0 = inactive * ADC2-7 set to 0 for Angelia +// // Bit [3] - ADC3 Overload 1 = active, 0 = inactive +// // Bit [4] - ADC4 Overload 1 = active, 0 = inactive +// // Bit [5] - ADC5 Overload 1 = active, 0 = inactive +// // Bit [6] - ADC6 Overload 1 = active, 0 = inactive +// // Bit [7] - ADC7 Overload 1 = active, 0 = inactive +// for (i = 0; i < MAX_ADC; i++) +// prn->adc[i].adc_overload = ((readbuf[5] >> i) & 0x1) != 0; +// +// //Bytes 6,7 Exciter Power [15:0] * 12 bits sign extended to 16 +// //Bytes 14,15 FWD Power [15:0] ditto +// //Bytes 22,23 REV Power [15:0] ditto +// prn->tx[0].exciter_power = readbuf[6] << 8 | readbuf[7]; +// prn->tx[0].fwd_power = readbuf[14] << 8 | readbuf[15]; +// prn->tx[0].rev_power = readbuf[22] << 8 | readbuf[23]; +// +// //Bytes 49,50 Supply Volts [15:0] +// prn->supply_volts = readbuf[49] << 8 | readbuf[50]; +// +// //Bytes 51,52 User ADC3 [15:0] +// //Bytes 53,54 User ADC2 [15:0] +// //Bytes 55,56 User ADC1 [15:0] +// //Bytes 57,58 User ADC0 [15:0] +// prn->user_adc3 = readbuf[51] << 8 | readbuf[52]; +// prn->user_adc2 = readbuf[53] << 8 | readbuf[54]; +// prn->user_adc1 = readbuf[55] << 8 | readbuf[56]; +// prn->user_adc0 = readbuf[57] << 8 | readbuf[58]; +// +// //Byte 59 - Bit [0] - User I/O (IO4) 1 = active, 0 = inactive +// // Bit [1] - User I/O (IO5) 1 = active, 0 = inactive +// // Bit [2] - User I/O (IO6) 1 = active, 0 = inactive +// // Bit [3] - User I/O (IO8) 1 = active, 0 = inactive +// prn->user_io = readbuf[59]; +// break; +// case 1026: // 1440 bytes 16-bit mic samples +// if (seqnum != (1 + prn->tx[0].mic_in_seq_no)) { +// prn->tx[0].mic_in_seq_err += 1; +// printf("Rx Mic: seq error this: %d last: %d\n", seqnum, prn->tx[0].mic_in_seq_no); +// } +// prn->tx[0].mic_in_seq_no = seqnum; +// +// for (i = 0, k = 4; i < 720; i++, k += 2) +// { +// // prn->TxReadBufp[2 * i] = ((prn->ReadBufp[k + 0] & 0xff) | +// // (prn->ReadBufp[k + 1] << 8)) / 32768.0; +// prn->TxReadBufp[2 * i] = const_1_div_2147483648_ * +// (double)(readbuf[k + 1] << 24 | +// readbuf[k + 0] << 16); +// prn->TxReadBufp[2 * i + 1] = 0.0; +// } +// +// Inbound(inid(1, 0), 720, prn->TxReadBufp); +// break; +// case 1027: // 1024 bytes 16bit raw ADC data +// case 1028: +// case 1029: +// case 1030: +// case 1031: +// case 1032: +// case 1033: +// case 1034: +// { +// int adc_id = rc - prn->wb_base_port; // adc number +// int wb_spp = prn->wb_samples_per_packet; // samples per packet +// int wb_ppf = prn->wb_packets_per_frame; // packets per frame +// int disp_id = prn->wb_base_dispid + adc_id; // display id +// double* wb_buff = prn->adc[adc_id].wb_buff; // data buffer for wideband samples +// // NOTE: This code assumes 16-bits per sample ... can add other options as needed. +// int ii, jj; +// for (ii = 0, jj = 4; ii < wb_spp; ii++, jj += 2) // convert the samples to doubles +// wb_buff[ii] = const_1_div_2147483648_ * +// (double)(readbuf[jj + 1] << 24 | +// readbuf[jj + 0] << 16); +// switch (prn->adc[adc_id].wb_state) +// { +// case 0: // wait for frame to begin +// prn->adc[adc_id].wb_seqnum = 0; +// if (seqnum == 0) +// { +// prn->adc[adc_id].wb_state = 1; +// Spectrum(disp_id, 0, 0, wb_buff, wb_buff); +// prn->adc[adc_id].wb_seqnum++; +// } +// break; +// case 1: // continue within the frame +// if (seqnum == prn->adc[adc_id].wb_seqnum) // sequence correct: send the data +// { +// Spectrum(disp_id, 0, 0, wb_buff, wb_buff); +// if (prn->adc[adc_id].wb_seqnum == wb_ppf - 1) +// prn->adc[adc_id].wb_state = 0; +// } +// else // sequence error: pad frame with zeros +// { +// memset(wb_buff, 0, wb_spp * sizeof(double)); +// for (jj = prn->adc[adc_id].wb_seqnum; jj < wb_ppf; jj++) +// Spectrum(disp_id, 0, 0, wb_buff, wb_buff); +// prn->adc[adc_id].wb_state = 0; +// } +// prn->adc[adc_id].wb_seqnum++; +// break; +// } +// break; +// } +// case 1035: // 1428 bytes 24-bit I/Q data +// case 1036: +// case 1037: +// case 1038: +// case 1039: +// case 1040: +// case 1041: +// { +// int rxid = rc - 1035;// prn->rx_base_port; +// if (seqnum != (1 + prn->rx[rxid].rx_in_seq_no)) { +// prn->rx[rxid].rx_in_seq_err += 1; +// printf("Rx0 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[rxid].rx_in_seq_no); +// } +// prn->rx[rxid].rx_in_seq_no = seqnum; +// +// for (i = 0, k = 16; i < 238; i++, k += 6) +// { +// prn->RxReadBufp[2 * i + 0] = const_1_div_2147483648_ * +// (double)(readbuf[k + 0] << 24 | +// readbuf[k + 1] << 16 | +// readbuf[k + 2] << 8); +// +// prn->RxReadBufp[2 * i + 1] = const_1_div_2147483648_ * +// (double)(readbuf[k + 3] << 24 | +// readbuf[k + 4] << 16 | +// readbuf[k + 5] << 8); +// } +// +// // sbuf[] USED FOR DEBUG ONLY +// //for (i = 0; i < 2 * 238; i++) +// //sbuf[i] = prn->RxReadBufp[i]; +// +// xrouter(0, 0, rc, 238, prn->RxReadBufp); +// HaveSync = 1; +// break; +// } +// +// } +// LeaveCriticalSection(&prn->rcvpkt); +// } +// } +// } +//} + +void addSnapShot(int rx) { - // port: port number for the packet - // packet: 1444 bytes, complete packet payload + // add newest to head + + _seqLogSnapshot_t* snapshot = malloc(sizeof(_seqLogSnapshot_t)); + if (snapshot == NULL) return; //eek + + memcpy(snapshot->rx_in_seq_snapshot, prn->rx[rx].rx_in_seq_delta, sizeof(int) * MAX_IN_SEQ_LOG); + + if (prn->rx[rx].snapshot_length == MAX_IN_SEQ_SNAPSHOTS) { + // too many in the list, dump tail + prn->rx[rx].snapshot_length--; + + _seqLogSnapshot_t* tmp = prn->rx[rx].snapshots_tail; + + tmp->previous->next = NULL; // previous will always exist so no need to check for null + + prn->rx[rx].snapshots_tail = tmp->previous; + + free(tmp); + } + + if (prn->rx[rx].snapshots_head == NULL) { + // new + snapshot->previous = NULL; + snapshot->next = NULL; + prn->rx[rx].snapshots_head = snapshot; + prn->rx[rx].snapshots_tail = snapshot; + } + else + { + // add to head + prn->rx[rx].snapshots_head->previous = snapshot; + snapshot->next = prn->rx[rx].snapshots_head; + prn->rx[rx].snapshots_head = snapshot; + } + + prn->rx[rx].snapshot_length++; +} + +void storeRXSeqDelta(int rx, int delta) { + unsigned int i = prn->rx[rx].rx_in_seq_delta_index; + + prn->rx[rx].rx_in_seq_delta[i] = delta; + + i++; + if (i == MAX_IN_SEQ_LOG) i = 0; + prn->rx[rx].rx_in_seq_delta_index = i; +} + +int ReadUDPFrame(unsigned char *bufp) { + unsigned char readbuf[1444]; + struct sockaddr_in fromaddr; + int fromlen; + int nrecv, inport; unsigned int seqnum; - unsigned char *seqbytep; - unsigned char* buff; - int i, k; - // + unsigned char *seqbytep = (unsigned char *)&seqnum; + fromlen = sizeof(fromaddr); + EnterCriticalSection(&prn->rcvpkt); - // strip off the sequence number - seqbytep = (unsigned char *)&seqnum; - seqbytep[3] = packet[0]; - seqbytep[2] = packet[1]; - seqbytep[1] = packet[2]; - seqbytep[0] = packet[3]; - // process based upon packet type, i.e., based upon port number - switch (port) + + nrecv = recvfrom(listenSock, readbuf, sizeof(readbuf), 0, (SOCKADDR *)&fromaddr, &fromlen); + + if (nrecv == -1) { - case HPCCPort: // High Priority C&C data - if (seqnum != (1 + prn->cc_seq_no) && seqnum != 0) + errno = WSAGetLastError(); + if (errno == WSAEWOULDBLOCK || errno == WSAEMSGSIZE) { + printf("Error code %d: recvfrom() : %s\n", errno, strerror(errno)); + fflush(stdout); + } + LeaveCriticalSection(&prn->rcvpkt); + return nrecv; + } + + seqbytep[3] = readbuf[0]; + seqbytep[2] = readbuf[1]; + seqbytep[1] = readbuf[2]; + seqbytep[0] = readbuf[3]; + + switch (inport = ntohs(fromaddr.sin_port)) + { + case HPCCPort: //1025: // 60 bytes - High Priority C&C data + if (nrecv != 60) break; // check for malformed packet + + if (seqnum != (1 + prn->cc_seq_no) && seqnum != 0) { prn->cc_seq_err += 1; + //PrintTimeHack(); printf("- Rx High Priority C&C: seq error this: %d last: %d\n", seqnum, prn->cc_seq_no); fflush(stdout); } + prn->cc_seq_no = seqnum; - // pointer to the data in the packet - buff = &(packet[4]); - // - //Byte 0 - Bit [0] - PTT 1 = active, 0 = inactive - // Bit [1] - Dot 1 = active, 0 = inactive - // Bit [2] - Dash 1 = active, 0 = inactive - prn->ptt_in = buff[0] & 0x1; - prn->dot_in = buff[0] & 0x2; - prn->dash_in = buff[0] & 0x4; - //Byte 1 - Bit [0] - ADC0 Overload 1 = active, 0 = inactive - // Bit [1] - ADC1 Overload 1 = active, 0 = inactive - // Bit [2] - ADC2 Overload 1 = active, 0 = inactive * ADC2-7 set to 0 for Angelia - // Bit [3] - ADC3 Overload 1 = active, 0 = inactive - // Bit [4] - ADC4 Overload 1 = active, 0 = inactive - // Bit [5] - ADC5 Overload 1 = active, 0 = inactive - // Bit [6] - ADC6 Overload 1 = active, 0 = inactive - // Bit [7] - ADC7 Overload 1 = active, 0 = inactive - for (i = 0; i < MAX_ADC; i++) - prn->adc[i].adc_overload = ((buff[1] >> i) & 0x1) != 0; - //Bytes 2,3 Exciter Power [15:0] * 12 bits sign extended to 16 - //Bytes 10,11 FWD Power [15:0] ditto - //Bytes 18,19 REV Power [15:0] ditto - prn->tx[0].exciter_power = buff[2] << 8 | buff[3]; - prn->tx[0].fwd_power = buff[10] << 8 | buff[11]; - prn->tx[0].rev_power = buff[18] << 8 | buff[19]; - PeakFwdPower (prn->tx[0].fwd_power); - PeakRevPower (prn->tx[0].rev_power); - //Bytes 45,46 Supply Volts [15:0] - prn->supply_volts = buff[45] << 8 | buff[46]; - //Bytes 47,48 User ADC3 [15:0] - //Bytes 49,50 User ADC2 [15:0] - //Bytes 51,52 User ADC1 [15:0] - //Bytes 53,54 User ADC0 [15:0] - prn->user_adc3 = buff[47] << 8 | buff[48]; - prn->user_adc2 = buff[49] << 8 | buff[50]; - prn->user_adc1 = buff[51] << 8 | buff[52]; - prn->user_adc0 = buff[53] << 8 | buff[54]; - SetAmpProtectADCValue(0, prn->user_adc0); - //Byte 55 - Bit [0] - User I/O (IO4) 1 = active, 0 = inactive - // Bit [1] - User I/O (IO5) 1 = active, 0 = inactive - // Bit [2] - User I/O (IO6) 1 = active, 0 = inactive - // Bit [3] - User I/O (IO8) 1 = active, 0 = inactive - prn->user_io = buff[55]; - prn->hardware_LEDs = buff[26] << 8 | buff[27]; + memcpy(bufp, readbuf + 4, 56); break; - case RxMicSampPort: // 16-bit mic samples (48ksps) - if (seqnum != (1 + prn->tx[0].mic_in_seq_no) && seqnum != 0) - { + case RxMicSampPort: //1026: // 132 bytes - 16-bit mic samples (48ksps) + if (nrecv != 132) break; // check for malformed packet + + //mic_samples_buf++; + if (seqnum != (1 + prn->tx[0].mic_in_seq_no) && seqnum != 0) { prn->tx[0].mic_in_seq_err += 1; + //PrintTimeHack(); printf("- Mic samples: seq error this: %d last: %d\n", seqnum, prn->tx[0].mic_in_seq_no); fflush(stdout); } + prn->tx[0].mic_in_seq_no = seqnum; - // pointer to the data in the packet - buff = &(packet[4]); - for (i = 0, k = 0; i < prn->mic.spp; i++, k += 2) - { - prn->TxReadBufp[2 * i] = const_1_div_2147483648_ * - (double)(buff[k + 0] << 24 | - buff[k + 1] << 16); - prn->TxReadBufp[2 * i + 1] = 0.0; - } - // WriteAudio(10.0, 48000, 720, prn->TxReadBufp,3); - Inbound(inid(1, 0), prn->mic.spp, prn->TxReadBufp); + memcpy(bufp, readbuf + 4, 128); break; - case WB0Port: // 16-bit raw ADC (default values) - case 1028: - case 1029: - case 1030: - case 1031: - case 1032: - case 1033: - case 1034: - // pointer to the data in the packet - buff = &(packet[4]); + case WB0Port: //1027: // 1028 bytes - 16-bit raw ADC (default values) + //case 1028: + //case 1029: + //case 1030: + //case 1031: + //case 1032: + //case 1033: + //case 1034: + { + if (nrecv != 1028) break; // check for malformed packet + + int adc_id = inport - prn->wb_base_port; // adc number + int wb_spp = prn->wb_samples_per_packet; // samples per packet + int wb_ppf = prn->wb_packets_per_frame; // packets per frame + int disp_id = prn->wb_base_dispid + adc_id; // display id + double* wb_buff = prn->adc[adc_id].wb_buff; // data buffer for wideband samples + // NOTE: This code assumes 16-bits per sample ... can add other options as needed. + int ii, jj; + for (ii = 0, jj = 4; ii < wb_spp; ii++, jj += 2) // convert the samples to doubles + wb_buff[ii] = const_1_div_2147483648_ * + //(double)(readbuf[jj + 1] << 24 | + // readbuf[jj + 0] << 16); + (double)(readbuf[jj + 0] << 24 | + readbuf[jj + 1] << 16); + switch (prn->adc[adc_id].wb_state) { - int adc_id = port - prn->wb_base_port; // adc number - int wb_spp = prn->wb_samples_per_packet; // samples per packet - int wb_ppf = prn->wb_packets_per_frame; // packets per frame - int disp_id = prn->wb_base_dispid + adc_id; // display id - double* wb_buff = prn->adc[adc_id].wb_buff; // data buffer for wideband samples - // NOTE: This code assumes 16-bits per sample ... can add other options as needed. - int ii, jj; - for (ii = 0, jj = 0; ii < wb_spp; ii++, jj += 2) // convert the samples to doubles - wb_buff[ii] = const_1_div_2147483648_ * - (double)(buff[jj + 0] << 24 | - buff[jj + 1] << 16); - switch (prn->adc[adc_id].wb_state) + case 0: // wait for frame to begin + prn->adc[adc_id].wb_seqnum = 0; + if (seqnum == 0) { - case 0: // wait for frame to begin - prn->adc[adc_id].wb_seqnum = 0; - if (seqnum == 0) - { - prn->adc[adc_id].wb_state = 1; - Spectrum(disp_id, 0, 0, wb_buff, wb_buff); - prn->adc[adc_id].wb_seqnum++; - } - break; - case 1: // continue within the frame - if (seqnum == prn->adc[adc_id].wb_seqnum) // sequence correct: send the data - { - Spectrum(disp_id, 0, 0, wb_buff, wb_buff); - if (prn->adc[adc_id].wb_seqnum == wb_ppf - 1) - prn->adc[adc_id].wb_state = 0; - } - else // sequence error: pad frame with zeros - { - memset(wb_buff, 0, wb_spp * sizeof(double)); - for (jj = prn->adc[adc_id].wb_seqnum; jj < wb_ppf; jj++) - Spectrum(disp_id, 0, 0, wb_buff, wb_buff); - prn->adc[adc_id].wb_state = 0; - } + prn->adc[adc_id].wb_state = 1; + Spectrum(disp_id, 0, 0, wb_buff, wb_buff); prn->adc[adc_id].wb_seqnum++; - break; } + break; + case 1: // continue within the frame + if (seqnum == prn->adc[adc_id].wb_seqnum) // sequence correct: send the data + { + Spectrum(disp_id, 0, 0, wb_buff, wb_buff); + if (prn->adc[adc_id].wb_seqnum == wb_ppf - 1) + prn->adc[adc_id].wb_state = 0; + } + else // sequence error: pad frame with zeros + { + memset(wb_buff, 0, wb_spp * sizeof(double)); + for (jj = prn->adc[adc_id].wb_seqnum; jj < wb_ppf; jj++) + Spectrum(disp_id, 0, 0, wb_buff, wb_buff); + prn->adc[adc_id].wb_state = 0; + } + prn->adc[adc_id].wb_seqnum++; + break; } + + //{ + // const int buffs_per_block = 8; + // static int wb_in_seq_no; + // static int wbstate; + // static double wbbuff[512]; + // int ii, jj; + // for (ii = 0, jj = 4; ii < 512; ii++, jj += 2) // convert the samples to doubles + // wbbuff[ii] = const_1_div_2147483648_ * + // (double)(readbuf[jj + 1] << 24 | + // readbuf[jj + 0] << 16); + // switch (wbstate) + // { + // case 0: // wait for block to begin + // wb_in_seq_no = 0; + // if (seqnum == 0) + // { + // wbstate = 1; + // Spectrum(32, 0, 0, wbbuff, wbbuff); + // wb_in_seq_no++; + // } + // break; + //case 1: // continue within the block + // if (seqnum == wb_in_seq_no) // sequence # is correct: send the data + // { + // Spectrum(32, 0, 0, wbbuff, wbbuff); + // if (wb_in_seq_no == buffs_per_block - 1) + // wbstate = 0; + // } + // else // pad the rest of the block with zeros + // { + // memset(wbbuff, 0, 512 * sizeof(double)); + // for (jj = wb_in_seq_no; jj < buffs_per_block; jj++) + // Spectrum(32, 0, 0, wbbuff, wbbuff); + // wbstate = 0; + // } + // wb_in_seq_no++; + // break; + // } + break; - case 1035: // 24-bit DDC I/Q data - case 1036: - case 1037: - case 1038: - case 1039: - case 1040: - case 1041: - // pointer to the data in the packet - buff = &(packet[16]); - { - int ddcnum = port - 1035; - if (seqnum != (1 + prn->rx[ddcnum].rx_in_seq_no) && seqnum != 0) { - prn->rx[ddcnum].rx_in_seq_err += 1; - printf("- DDC%d I/Q: seq error this: %d last: %d\n", ddcnum, seqnum, prn->rx[0].rx_in_seq_no); - fflush(stdout); - } - prn->rx[ddcnum].rx_in_seq_no = seqnum; - for (i = 0, k = 0; i < prn->rx[0].spp; i++, k += 6) - { - prn->RxReadBufp[2 * i + 0] = const_1_div_2147483648_ * - (double)(buff[k + 0] << 24 | - buff[k + 1] << 16 | - buff[k + 2] << 8); - - prn->RxReadBufp[2 * i + 1] = const_1_div_2147483648_ * - (double)(buff[k + 3] << 24 | - buff[k + 4] << 16 | - buff[k + 5] << 8); - } - xrouter(0, 0, port, prn->rx[0].spp, prn->RxReadBufp); + } + case 1035: // 1444 bytes - 24-bit DDC0 I/Q data + if (nrecv != 1444) break; // check for malformed packet + + if (seqnum != 0) storeRXSeqDelta(0, (int)seqnum - (1 + prn->rx[0].rx_in_seq_no)); + + //rx_samples_buf++; + if (seqnum != (1 + prn->rx[0].rx_in_seq_no) && seqnum != 0) { + prn->rx[0].rx_in_seq_err += 1; + //PrintTimeHack(); + printf("- Rx0 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[0].rx_in_seq_no); + fflush(stdout); + + addSnapShot(0); } + + prn->rx[0].rx_in_seq_no = seqnum; + memcpy(bufp, readbuf + 16, 1428); + break; + case 1036: // 1444 bytes - 24-bit DDC1 I/Q data + if (nrecv != 1444) break; // check for malformed packet + + if(seqnum != 0) storeRXSeqDelta(1, (int)seqnum - (1 + prn->rx[1].rx_in_seq_no)); + + if (seqnum != (1 + prn->rx[1].rx_in_seq_no) && seqnum != 0) { + prn->rx[1].rx_in_seq_err += 1; + //PrintTimeHack(); + printf("- Rx1 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[1].rx_in_seq_no); + fflush(stdout); + + addSnapShot(1); + } + + prn->rx[1].rx_in_seq_no = seqnum; + memcpy(bufp, readbuf + 16, 1428); + break; + case 1037: // 1444 bytes - 24-bit DDC2 I/Q data + if (nrecv != 1444) break; // check for malformed packet + + if (seqnum != 0) storeRXSeqDelta(2, (int)seqnum - (1 + prn->rx[2].rx_in_seq_no)); + + //rx_samples_buf++; + if (seqnum != (1 + prn->rx[2].rx_in_seq_no) && seqnum != 0) { + prn->rx[2].rx_in_seq_err += 1; + //PrintTimeHack(); + printf("- Rx2 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[2].rx_in_seq_no); + fflush(stdout); + + addSnapShot(2); + } + + prn->rx[2].rx_in_seq_no = seqnum; + memcpy(bufp, readbuf + 16, 1428); + break; + case 1038: // 1444 bytes - 24-bit DDC3 I/Q data + if (nrecv != 1444) break; // check for malformed packet + + if (seqnum != 0) storeRXSeqDelta(3, (int)seqnum - (1 + prn->rx[3].rx_in_seq_no)); + + if (seqnum != (1 + prn->rx[3].rx_in_seq_no) && seqnum != 0) { + prn->rx[3].rx_in_seq_err += 1; + //PrintTimeHack(); + printf("- Rx3 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[3].rx_in_seq_no); + fflush(stdout); + + addSnapShot(3); + } + + prn->rx[3].rx_in_seq_no = seqnum; + memcpy(bufp, readbuf + 16, 1428); + break; + case 1039: // 1444 bytes - 24-bit DDC4 I/Q data + if (nrecv != 1444) break; // check for malformed packet + + if (seqnum != 0) storeRXSeqDelta(4, (int)seqnum - (1 + prn->rx[4].rx_in_seq_no)); + + if (seqnum != (1 + prn->rx[4].rx_in_seq_no) && seqnum != 0) { + prn->rx[4].rx_in_seq_err += 1; + //PrintTimeHack(); + printf("- Rx4 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[4].rx_in_seq_no); + fflush(stdout); + + addSnapShot(4); + } + + prn->rx[4].rx_in_seq_no = seqnum; + memcpy(bufp, readbuf + 16, 1428); + break; + case 1040: // 1444 bytes - 24-bit DDC5 I/Q data + if (nrecv != 1444) break; // check for malformed packet + + if (seqnum != 0) storeRXSeqDelta(5, (int)seqnum - (1 + prn->rx[5].rx_in_seq_no)); + + if (seqnum != (1 + prn->rx[5].rx_in_seq_no) && seqnum != 0) { + prn->rx[5].rx_in_seq_err += 1; + //PrintTimeHack(); + printf("- Rx5 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[5].rx_in_seq_no); + fflush(stdout); + + addSnapShot(5); + } + + prn->rx[5].rx_in_seq_no = seqnum; + memcpy(bufp, readbuf + 16, 1428); + break; + case 1041: // 1444 bytes - 24-bit DDC6 I/Q data + if (nrecv != 1444) break; // check for malformed packet + + if (seqnum != 0) storeRXSeqDelta(6, (int)seqnum - (1 + prn->rx[6].rx_in_seq_no)); + + if (seqnum != (1 + prn->rx[6].rx_in_seq_no) && seqnum != 0) { + prn->rx[6].rx_in_seq_err += 1; + //PrintTimeHack(); + printf("- Rx6 I/Q: seq error this: %d last: %d\n", seqnum, prn->rx[6].rx_in_seq_no); + fflush(stdout); + + addSnapShot(6); + } + + prn->rx[6].rx_in_seq_no = seqnum; + memcpy(bufp, readbuf + 16, 1428); break; } + LeaveCriticalSection(&prn->rcvpkt); + + return inport; } void -ReadThreadMainLoop() -{ - int rc; - unsigned char readbuf[1444]; - struct sockaddr_in fromaddr; - int fromlen; +ReadThreadMainLoop() { + int i, rc, k; + double sbuf[500] = { 0 }; // FOR DEBUG ONLY prn->hDataEvent = WSACreateEvent(); WSAEventSelect(listenSock, prn->hDataEvent, FD_READ); @@ -449,47 +813,142 @@ ReadThreadMainLoop() printf("- ReadThreadMainLoop()\n"); fflush(stdout); - while (io_keep_running != 0) - { + while (io_keep_running != 0) { DWORD retVal = WSAWaitForMultipleEvents(1, &prn->hDataEvent, FALSE, prn->wdt ? 3000 : WSA_INFINITE, FALSE); - if ((retVal == WSA_WAIT_FAILED) || (retVal == WSA_WAIT_TIMEOUT)) - { - HaveSync = 0; //send console LOS - SendStopToMetis(); - memset(prn->RxReadBufp, 0, prn->rx[0].spp); - memset(prn->TxReadBufp, 0, prn->mic.spp); - Inbound(inid(0, 0), prn->rx[0].spp, prn->RxReadBufp); - Inbound(inid(0, 1), prn->rx[1].spp, prn->RxReadBufp); - Inbound(inid(1, 0), prn->mic.spp, prn->TxReadBufp); - continue; - } - else - { - WSAEnumNetworkEvents(listenSock, prn->hDataEvent, &prn->wsaProcessEvents); - if (prn->wsaProcessEvents.lNetworkEvents & FD_READ) + if ((retVal == WSA_WAIT_FAILED) || (retVal == WSA_WAIT_TIMEOUT)) { - if (prn->wsaProcessEvents.iErrorCode[FD_READ_BIT] != 0) - { - printf("FD_READ failed with error %d\n", - prn->wsaProcessEvents.iErrorCode[FD_READ_BIT]); - break; - } - fromlen = sizeof(fromaddr); - rc = recvfrom(listenSock, readbuf, sizeof(readbuf), 0, (SOCKADDR *)&fromaddr, &fromlen); - if (rc == -1) + HaveSync = 0; //send console LOS + SendStopToMetis(); + memset(prn->RxReadBufp, 0, prn->rx[0].spp); + memset(prn->TxReadBufp, 0, prn->mic.spp); + Inbound(inid(0, 0), prn->rx[0].spp, prn->RxReadBufp); + Inbound(inid(0, 1), prn->rx[1].spp, prn->RxReadBufp); + Inbound(inid(1, 0), prn->mic.spp, prn->TxReadBufp); + continue; + } + else + { + WSAEnumNetworkEvents(listenSock, prn->hDataEvent, &prn->wsaProcessEvents); + if (prn->wsaProcessEvents.lNetworkEvents & FD_READ) { - errno = WSAGetLastError(); - if (errno == WSAEWOULDBLOCK || errno == WSAEMSGSIZE) + if (prn->wsaProcessEvents.iErrorCode[FD_READ_BIT] != 0) + { + printf("FD_READ failed with error %d\n", + prn->wsaProcessEvents.iErrorCode[FD_READ_BIT]); + break; + } + + rc = ReadUDPFrame(prn->ReadBufp); + + switch (rc) { - printf("Error code %d: recvfrom() : %s\n", errno, strerror(errno)); - fflush(stdout); + case 1025: + //Byte 0 - Bit [0] - PTT 1 = active, 0 = inactive + // Bit [1] - Dot 1 = active, 0 = inactive + // Bit [2] - Dash 1 = active, 0 = inactive + prn->ptt_in = prn->ReadBufp[0] & 0x1; + prn->dot_in = prn->ReadBufp[0] & 0x2; + prn->dash_in = prn->ReadBufp[0] & 0x4; + + //Byte 1 - Bit [0] - ADC0 Overload 1 = active, 0 = inactive + // Bit [1] - ADC1 Overload 1 = active, 0 = inactive + // Bit [2] - ADC2 Overload 1 = active, 0 = inactive * ADC2-7 set to 0 for Angelia + // Bit [3] - ADC3 Overload 1 = active, 0 = inactive + // Bit [4] - ADC4 Overload 1 = active, 0 = inactive + // Bit [5] - ADC5 Overload 1 = active, 0 = inactive + // Bit [6] - ADC6 Overload 1 = active, 0 = inactive + // Bit [7] - ADC7 Overload 1 = active, 0 = inactive + for (i = 0; i < MAX_ADC; i++) + prn->adc[i].adc_overload = ((prn->ReadBufp[1] >> i) & 0x1) != 0; + + //Bytes 2,3 Exciter Power [15:0] * 12 bits sign extended to 16 + //Bytes 10,11 FWD Power [15:0] ditto + //Bytes 18,19 REV Power [15:0] ditto + prn->tx[0].exciter_power = prn->ReadBufp[2] << 8 | prn->ReadBufp[3]; + prn->tx[0].fwd_power = prn->ReadBufp[10] << 8 | prn->ReadBufp[11]; + prn->tx[0].rev_power = prn->ReadBufp[18] << 8 | prn->ReadBufp[19]; + PeakFwdPower ((float)(prn->tx[0].fwd_power)); + PeakRevPower ((float)(prn->tx[0].rev_power)); + //Bytes 45,46 Supply Volts [15:0] + prn->supply_volts = prn->ReadBufp[45] << 8 | prn->ReadBufp[46]; + + //Bytes 47,48 User ADC3 [15:0] + //Bytes 49,50 User ADC2 [15:0] + //Bytes 51,52 User ADC1 [15:0] + //Bytes 53,54 User ADC0 [15:0] + prn->user_adc3 = prn->ReadBufp[47] << 8 | prn->ReadBufp[48]; + prn->user_adc2 = prn->ReadBufp[49] << 8 | prn->ReadBufp[50]; + prn->user_adc1 = prn->ReadBufp[51] << 8 | prn->ReadBufp[52]; + prn->user_adc0 = prn->ReadBufp[53] << 8 | prn->ReadBufp[54]; + + SetAmpProtectADCValue(0, prn->user_adc0); + + //Byte 55 - Bit [0] - User I/O (IO4) 1 = active, 0 = inactive + // Bit [1] - User I/O (IO5) 1 = active, 0 = inactive + // Bit [2] - User I/O (IO6) 1 = active, 0 = inactive + // Bit [3] - User I/O (IO8) 1 = active, 0 = inactive + // Bit [4] - User I/O (IO2) 1 = active, 0 = inactive + prn->user_io = prn->ReadBufp[55]; + + prn->hardware_LEDs = prn->ReadBufp[26] << 8 | prn->ReadBufp[27]; + + break; + case 1026: // 1440 bytes 16-bit mic samples + for (i = 0, k = 0; i < prn->mic.spp; i++, k += 2) + { + // prn->TxReadBufp[2 * i] = ((prn->ReadBufp[k + 0] & 0xff) | + // (prn->ReadBufp[k + 1] << 8)) / 32768.0; + prn->TxReadBufp[2 * i] = const_1_div_2147483648_ * + (double)(prn->ReadBufp[k + 0] << 24 | + prn->ReadBufp[k + 1] << 16); + prn->TxReadBufp[2 * i + 1] = 0.0; + } + //WriteAudio(10.0, 48000, 720, prn->TxReadBufp,3); + Inbound(inid(1, 0), prn->mic.spp, prn->TxReadBufp); + break; + case 1027: // 1024 bytes 16bit raw ADC data, handled in ReadUDPFrame() + case 1028: + case 1029: + case 1030: + case 1031: + case 1032: + case 1033: + case 1034: + break; + case 1035: // DDC I&Q data + case 1036: + case 1037: + case 1038: + case 1039: + case 1040: + case 1041: + for (i = 0, k = 0; i < prn->rx[0].spp; i++, k += 6) + { + prn->RxReadBufp[2 * i + 0] = const_1_div_2147483648_ * + (double)(prn->ReadBufp[k + 0] << 24 | + prn->ReadBufp[k + 1] << 16 | + prn->ReadBufp[k + 2] << 8); + + prn->RxReadBufp[2 * i + 1] = const_1_div_2147483648_ * + (double)(prn->ReadBufp[k + 3] << 24 | + prn->ReadBufp[k + 4] << 16 | + prn->ReadBufp[k + 5] << 8); + } + + // sbuf[] USED FOR DEBUG ONLY + for (i = 0; i < 2 * prn->rx[0].spp; i++) + sbuf[i] = prn->RxReadBufp[i]; + + xrouter(0, 0, rc, prn->rx[0].spp, prn->RxReadBufp); + //Inbound (1, 238, prn->RxReadBufp); + break; + //default: + // memset(RxReadBufp, 0, 240); + // Inbound (0, 240, RxReadBufp); + // break; } - return; } - rc = ntohs(fromaddr.sin_port); - ProcessPacket (rc, readbuf); } - } } } @@ -663,8 +1122,8 @@ void CmdHighPriority() { // port 1027 // TX0 drive level packetbuf[345] = prn->tx[0].drive_level; - // Enable transverter T/R relay 8---DLE - packetbuf[1400] = (xvtr_enable << 1) & 0x02; + // Enable transverter T/R relay 8 Mute Audio Amp bit 1 from J16 pin 9 IO4---DLE + packetbuf[1400] = xvtr_enable | ((!(prn->user_io & 0x01)) << 1); // Open Collector Ouputs packetbuf[1401] = (prn->oc_output << 1) & 0xfe; @@ -1028,10 +1487,15 @@ int IOThreadStop() { } DWORD WINAPI ReadThreadMain(LPVOID n) { + DWORD taskIndex = 0; + HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex); + if (hTask != 0) AvSetMmThreadPriority(hTask, 2); + else SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); + io_keep_running = 1; IOThreadRunning = 1; - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); + //SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); ReleaseSemaphore(prn->hReadThreadInitSem, 1, NULL); ReadThreadMainLoop(); diff --git a/Project Files/Source/ChannelMaster/network.h b/Project Files/Source/ChannelMaster/network.h index 3c288340..4b141046 100644 --- a/Project Files/Source/ChannelMaster/network.h +++ b/Project Files/Source/ChannelMaster/network.h @@ -1,460 +1,480 @@ -/* network.h - -This file is part of a program that implements a Software-Defined Radio. - -Copyright (C) 2015-2018 Doug Wigley, W5WC - -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. - -*/ -#pragma once - -#include -#include -#include -#include -#include -#include -#include "analyzer.h" -#include "cmcomm.h" - -#define MAX_ADC (3) -#define MAX_RX_STREAMS (12) -#define MAX_TX_STREAMS (3) -#define MAX_AUDIO_STREAMS (2) -#define MAX_SYNC_RX (2) -#define CACHE_ALIGN __declspec (align(16)) - -typedef struct CACHE_ALIGN _radionet -{ - double* RxReadBufp; - double* TxReadBufp; - unsigned char* ReadBufp; - //unsigned char* readbuf; - char* OutBufp; - double* syncrxbuff[2]; - int rx_base_port; - int run; - int wdt; - int sendHighPriority; - int num_adc; - int num_dac; - int ptt_in; - int dot_in; - int dash_in; - int oc_output; - int supply_volts; - int user_adc0; - int user_adc1; - int user_adc2; - int user_adc3; - int user_io; - unsigned int cc_seq_no; - unsigned int cc_seq_err; - HANDLE hReadThreadMain; - HANDLE hReadThreadInitSem; - HANDLE hKeepAliveThread; - HANDLE hTimer; - LARGE_INTEGER liDueTime; - CRITICAL_SECTION udpOUT; - CRITICAL_SECTION rcvpkt; - CRITICAL_SECTION sndpkt; - WSAEVENT hDataEvent; - WSANETWORKEVENTS wsaProcessEvents; - - int hardware_LEDs; - - // puresignal settings - int puresignal_run; - - // wideband settings - int wb_base_port; - int wb_base_dispid; - int wb_samples_per_packet; - int wb_sample_size; - int wb_update_rate; - int wb_packets_per_frame; - volatile long wb_enable; - - struct _adc - { - int id; - int rx_step_attn; - int tx_step_attn; - int adc_overload; - int dither; - int random; - // wideband dynamic variables & data (per adc) - int wb_seqnum; - int wb_state; - double* wb_buff; - } adc[MAX_ADC]; - - struct _cw - { - int sidetone_level; - int sidetone_freq; - int keyer_speed; - int keyer_weight; - int hang_delay; - int rf_delay; -#pragma pack(push, 1) - union - { - unsigned char mode_control; - struct { - unsigned char eer : 1, // bit 00 - cw_enable : 1, // bit 01 - rev_paddle : 1, // bit 02 - iambic : 1, // bit 03 - sidetone : 1, // bit 04 - mode_b : 1, // bit 05 - strict_spacing : 1, // bit 06 - break_in : 1; // bit 07 - }; - }; -#pragma pack(pop, 1) - }cw; - - struct _mic - { - int line_in_gain; -#pragma pack(push, 1) - union - { - unsigned char mic_control; - struct { - unsigned char line_in : 1; // bit 00 - unsigned char mic_boost : 1; // bit 01 - unsigned char mic_ptt : 1; // bit 02 - unsigned char mic_trs : 1; // bit 03 - unsigned char mic_bias : 1; // bit 04 - unsigned char : 1; // bit 05 - unsigned char : 1; // bit 06 - unsigned char : 1; // bit 07 - }; - }; -#pragma pack(pop, 1) - int spp; // I-samples per network packet - } mic; - - struct _rx - { - int id; - int rx_adc; - int frequency; - int enable; - int sync; - int sampling_rate; - int bit_depth; - int preamp; - unsigned int rx_in_seq_no; - unsigned int rx_in_seq_err; - unsigned int rx_out_seq_no; - unsigned _int64 time_stamp; - unsigned int bits_per_sample; - int spp; // IQ-samples per network packet - } rx[MAX_RX_STREAMS]; - - struct _tx - { - int id; - int frequency; - int sampling_rate; - int cwx; - int dash; - int dot; - int ptt_out; - int drive_level; - int exciter_power; - int fwd_power; - int rev_power; - int phase_shift; - int epwm_max; - int epwm_min; - int pa; - unsigned int mic_in_seq_no; - unsigned int mic_in_seq_err; - unsigned int mic_out_seq_no; - int spp; // IQ-samples per network packet - } tx[MAX_TX_STREAMS]; - - struct _audio - { - int spp; // LR-samples per network packet - } audio[MAX_AUDIO_STREAMS]; - - struct _discovery - { - unsigned char MACAddr[6]; - char BoardType; - char protocolVersion; - char fwCodeVersion; - char MercuryVersion_0; - char MercuryVersion_1; - char MercuryVersion_2; - char MercuryVersion_3; - char PennyVersion; - char MetisVersion; - char numRxs; - } discovery; - -} radionet, *RADIONET; - -RADIONET prn; - -#pragma pack(push, 1) -typedef struct _rbpfilter // radio band pass filter -{ - int enable; - union - { - unsigned bpfilter; - struct { - unsigned _rx_yellow_led : 1; // bit 00 - unsigned _13MHz_HPF : 1; // bit 01 - unsigned _20MHz_HPF : 1; // bit 02 - unsigned _6M_preamp : 1; // bit 03 - unsigned _9_5MHz_HPF : 1; // bit 04 - unsigned _6_5MHz_HPF : 1; // bit 05 - unsigned _1_5MHz_HPF : 1; // bit 06 - unsigned : 1; // bit 07 - - unsigned _XVTR_Rx_In : 1; // bit 08 - unsigned _Rx_2_In : 1; // bit 09 EXT1 - unsigned _Rx_1_In : 1; // bit 10 EXT2 - unsigned _Rx_1_Out : 1; // bit 11 K36 RL17 - unsigned _Bypass : 1; // bit 12 - unsigned _20_dB_Atten : 1; // bit 13 - unsigned _10_dB_Atten : 1; // bit 14 (RX MASTER IN SEL RL22) - unsigned _rx_red_led : 1; // bit 15 - - unsigned : 1; // bit 16 - unsigned : 1; // bit 17 - unsigned _trx_status : 1; // bit 18 - unsigned _tx_yellow_led : 1; // bit 19 - unsigned _30_20_LPF : 1; // bit 20 - unsigned _60_40_LPF : 1; // bit 21 - unsigned _80_LPF : 1; // bit 22 - unsigned _160_LPF : 1; // bit 23 - - unsigned _ANT_1 : 1; // bit 24 - unsigned _ANT_2 : 1; // bit 25 - unsigned _ANT_3 : 1; // bit 26 - unsigned _TR_Relay : 1; // bit 27 - unsigned _tx_red_led : 1; // bit 28 - unsigned _6_LPF : 1; // bit 29 - unsigned _12_10_LPF : 1; // bit 30 - unsigned _17_15_LPF : 1; // bit 31 - }; - }; -}rbpfilter, *RBPFILTER; -#pragma pack(pop, 1) -RBPFILTER prbpfilter; - -#pragma pack(push, 1) -typedef struct _rbpfilter2 // radio band pass filter -{ - int enable; - union - { - unsigned bpfilter; - struct { - unsigned _rx_yellow_led : 1; // bit - unsigned _13MHz_HPF : 1; // bit - unsigned _20MHz_HPF : 1; // bit - unsigned _6M_preamp : 1; // bit - unsigned _9_5MHz_HPF : 1; // bit - unsigned _6_5MHz_HPF : 1; // bit - unsigned _1_5MHz_HPF : 1; // bit - unsigned : 1; // bit - - unsigned _rx2_gnd : 1; // bit - unsigned : 1; // bit - unsigned : 1; // bit - unsigned : 1; // bit - unsigned _Bypass : 1; // bit - unsigned : 1; // bit - unsigned : 1; // bit - unsigned _rx_red_led : 1; // bit - }; - }; -}rbpfilter2, *RBPFILTER2; -#pragma pack(pop, 1) -RBPFILTER2 prbpfilter2; - -extern __declspec(dllexport) void ProcessPacket(int port, unsigned char* packet); -extern __declspec(dllexport) void create_rnet(); -void WriteUDPFrame(int id, char *bufp, int buflen); -void sendPacket(SOCKET sock, char *data, int length, int port); -void CmdGeneral(void); -void CmdHighPriority(void); -extern __declspec(dllexport) void CmdRx(void); -void CmdTx(void); -DWORD WINAPI ReadThreadMain(LPVOID); -DWORD WINAPI KeepAliveMain(LPVOID); -void ReadThreadMainLoop(); -void KeepAliveLoop(); -void PrintTimeHack(); -void PeakFwdPower(float fwd); -void PeakRevPower(float rev); - -void InitWinsock(); -void CreateRIOSocket(); -void Bind(SOCKET s, const unsigned short port); -void PostRIORecvs(const DWORD recvBufferSize, const DWORD pendingRecvs); -void InitializeRIO(SOCKET s); - -// IOThread rountines -int IOThreadStop(void); -int StartReadThread(void); -void StopReadThread(void); -int io_keep_running; -int IOThreadRunning; // non zero if IOThread is running - -int DotDashBits; -int XmitBit; -int SampleRate; -//int SampleBits; // how many bits in a sample - -unsigned char ControlBytesIn[5]; -unsigned char ControlBytesOut[5]; -unsigned int LostSyncCount; -unsigned int SyncGainedCount; - -int HaveSync; -int VFOfreq; -int ADC_cntrl1; -int ADC_cntrl2; - -int C1Mask; -char PennyOCBits; /* pennny open collector bits */ - -int nreceivers; - -//int AlexAtten; -//int Alex2Atten; -//int Alex3Atten; -//int Alex4Atten; -//int MercDither; -//int MercPreamp; -//int RX1Preamp; -//int RX2Preamp; -//int MicTipRing; -//int MicBias; -//int MicPTT; -//int Merc3Preamp; -//int Merc4Preamp; -//int MercRandom; -//int adc1_step_att_data; -//int adc2_step_att_data; -//int adc3_step_att_data; -//int tx_att_data; -//int PureSignal; -int MercTxAtten; - -//int enable_cw_keyer; -//int cw_sidetone_volume; -//int cw_ptt_delay; -//int cw_hang_time; -//int cw_sidetone_freq; -//int cw_speed; -//int cw_mode; -//int cw_weight; -//int enable_cw_spacing; -//int reverse_paddles; -//int cw_dash; -//int cw_dot; -//int cwx; - -//int MicBoost; -//int LineIn; -//int LineBoost; - -int UserOut0; -int UserOut1; -int UserOut2; -int UserOut3; -int xvtr_enable; - -//unsigned char AlexManEnable; -//unsigned char AlexEnabled; -int AlexHPFMask; -int AlexLPFMask; -int AlexTRRelay; -int Alex2HPFMask; -int Alex2LPFMask; -int Alex3HPFMask; -int Alex3LPFMask; -int Alex4HPFMask; -int Alex4LPFMask; - -int mkiibpf; -//int AlexRxAnt; -//int AlexTxAnt; -//int AlexRxOut; -//int ExciterPower; -float RevPower; -float FwdPower; - -int ApolloFilt; -int ApolloTuner; -int ApolloATU; - -//int ADC_Overload; // Single ADC -//int ADC1_Overload; -//int ADC2_Overload; -//int ADC3_Overload; -//int ADC4_Overload; -//int ADC_Overloads; -//int User_I01; -//int User_I02; -//int User_I03; -//int User_I04; -//unsigned char pf; - -//unsigned int OutputPowerFactor; -//int HermesDCV; - -int CandCAddrMask; -int CandCFwdPowerBit; -int DotDashMask; - -int WSAinitialized; -SOCKET listenSock; -SYSTEMTIME lt; -static const double const_1_div_2147483648_ = 1.0 / 2147483648.0; - -enum _TXPort -{ - -}; - -enum _RXPort -{ - HPCCPort = 1025, // High Priority C&C Data - RxMicSampPort = 1026, // 16-bit Mic Samples - WB0Port = 1027, // 16-Raw ADC Samples -}; - -enum HPSDRHW -{ - Atlas = 0, - Hermes = 1, // ANAN-10/100 - HermesII = 2, // ANAN-10E/100B - Angelia = 3, // ANAN-100D - Orion = 4, // ANAN-200D - OrionMKII = 5 // ANAN-7000DLE/8000DLE -}; +/* network.h + +This file is part of a program that implements a Software-Defined Radio. + +Copyright (C) 2015-2018 Doug Wigley, W5WC + +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. + +*/ +#pragma once + +#include +#include +#include +#include +#include +#include +#include "analyzer.h" +#include "cmcomm.h" + +#define MAX_ADC (3) +#define MAX_RX_STREAMS (12) +#define MAX_TX_STREAMS (3) +#define MAX_AUDIO_STREAMS (2) +#define MAX_SYNC_RX (2) +#define CACHE_ALIGN __declspec (align(16)) + +#define MAX_IN_SEQ_LOG (40) +#define MAX_IN_SEQ_SNAPSHOTS (20) + +typedef struct _seqLogSnapshot { + struct _seqLogSnapshot* next; + struct _seqLogSnapshot* previous; + + int rx_in_seq_snapshot[MAX_IN_SEQ_LOG]; +} _seqLogSnapshot_t; + +typedef struct CACHE_ALIGN _radionet +{ + double* RxReadBufp; + double* TxReadBufp; + unsigned char* ReadBufp; + //unsigned char* readbuf; + char* OutBufp; + double* syncrxbuff[2]; + int rx_base_port; + int run; + int wdt; + int sendHighPriority; + int num_adc; + int num_dac; + int ptt_in; + int dot_in; + int dash_in; + int oc_output; + int supply_volts; + int user_adc0; + int user_adc1; + int user_adc2; + int user_adc3; + int user_io; + unsigned int cc_seq_no; + unsigned int cc_seq_err; + HANDLE hReadThreadMain; + HANDLE hReadThreadInitSem; + HANDLE hKeepAliveThread; + HANDLE hTimer; + LARGE_INTEGER liDueTime; + CRITICAL_SECTION udpOUT; + CRITICAL_SECTION rcvpkt; + CRITICAL_SECTION sndpkt; + WSAEVENT hDataEvent; + WSANETWORKEVENTS wsaProcessEvents; + + int hardware_LEDs; + + // puresignal settings + int puresignal_run; + + // wideband settings + int wb_base_port; + int wb_base_dispid; + int wb_samples_per_packet; + int wb_sample_size; + int wb_update_rate; + int wb_packets_per_frame; + volatile long wb_enable; + + struct _adc + { + int id; + int rx_step_attn; + int tx_step_attn; + int adc_overload; + int dither; + int random; + // wideband dynamic variables & data (per adc) + int wb_seqnum; + int wb_state; + double* wb_buff; + } adc[MAX_ADC]; + + struct _cw + { + int sidetone_level; + int sidetone_freq; + int keyer_speed; + int keyer_weight; + int hang_delay; + int rf_delay; +#pragma pack(push, 1) + union + { + unsigned char mode_control; + struct { + unsigned char eer : 1, // bit 00 + cw_enable : 1, // bit 01 + rev_paddle : 1, // bit 02 + iambic : 1, // bit 03 + sidetone : 1, // bit 04 + mode_b : 1, // bit 05 + strict_spacing : 1, // bit 06 + break_in : 1; // bit 07 + }; + }; +#pragma pack(pop) + }cw; + + struct _mic + { + int line_in_gain; +#pragma pack(push, 1) + union + { + unsigned char mic_control; + struct { + unsigned char line_in : 1; // bit 00 + unsigned char mic_boost : 1; // bit 01 + unsigned char mic_ptt : 1; // bit 02 + unsigned char mic_trs : 1; // bit 03 + unsigned char mic_bias : 1; // bit 04 + unsigned char : 1; // bit 05 + unsigned char : 1; // bit 06 + unsigned char : 1; // bit 07 + }; + }; +#pragma pack(pop) + int spp; // I-samples per network packet + } mic; + + struct _rx + { + int id; + int rx_adc; + int frequency; + int enable; + int sync; + int sampling_rate; + int bit_depth; + int preamp; + unsigned int rx_in_seq_no; + unsigned int rx_in_seq_err; + unsigned int rx_out_seq_no; + unsigned _int64 time_stamp; + unsigned int bits_per_sample; + int spp; // IQ-samples per network packet + + //MW0LGE logging + int rx_in_seq_delta[MAX_IN_SEQ_LOG]; // ring buffer that contains a delta expected frame number vs recevied frame number + unsigned int rx_in_seq_delta_index; // next slot to use in ring + _seqLogSnapshot_t* snapshots_head; // simple linked list of snapshots of this ring buffer when a seq error occurs + _seqLogSnapshot_t* snapshots_tail; // simple linked list of snapshots of this ring buffer when a seq error occurs + int snapshot_length; // len of this snapshot list (used to limit) + _seqLogSnapshot_t* snapshot; // used by netInterface to work through the list each call + //-- + } rx[MAX_RX_STREAMS]; + + struct _tx + { + int id; + int frequency; + int sampling_rate; + int cwx; + int dash; + int dot; + int ptt_out; + int drive_level; + int exciter_power; + int fwd_power; + int rev_power; + int phase_shift; + int epwm_max; + int epwm_min; + int pa; + unsigned int mic_in_seq_no; + unsigned int mic_in_seq_err; + unsigned int mic_out_seq_no; + int spp; // IQ-samples per network packet + } tx[MAX_TX_STREAMS]; + + struct _audio + { + int spp; // LR-samples per network packet + } audio[MAX_AUDIO_STREAMS]; + + struct _discovery + { + unsigned char MACAddr[6]; + char BoardType; + char protocolVersion; + char fwCodeVersion; + char MercuryVersion_0; + char MercuryVersion_1; + char MercuryVersion_2; + char MercuryVersion_3; + char PennyVersion; + char MetisVersion; + char numRxs; + } discovery; + +} radionet, *RADIONET; + +RADIONET prn; + +#pragma pack(push, 1) +typedef struct _rbpfilter // radio band pass filter +{ + int enable; + union + { + unsigned bpfilter; + struct { + unsigned _rx_yellow_led : 1; // bit 00 + unsigned _13MHz_HPF : 1; // bit 01 + unsigned _20MHz_HPF : 1; // bit 02 + unsigned _6M_preamp : 1; // bit 03 + unsigned _9_5MHz_HPF : 1; // bit 04 + unsigned _6_5MHz_HPF : 1; // bit 05 + unsigned _1_5MHz_HPF : 1; // bit 06 + unsigned : 1; // bit 07 + + unsigned _XVTR_Rx_In : 1; // bit 08 + unsigned _Rx_2_In : 1; // bit 09 EXT1 + unsigned _Rx_1_In : 1; // bit 10 EXT2 + unsigned _Rx_1_Out : 1; // bit 11 K36 RL17 + unsigned _Bypass : 1; // bit 12 + unsigned _20_dB_Atten : 1; // bit 13 + unsigned _10_dB_Atten : 1; // bit 14 (RX MASTER IN SEL RL22) + unsigned _rx_red_led : 1; // bit 15 + + unsigned : 1; // bit 16 + unsigned : 1; // bit 17 + unsigned _trx_status : 1; // bit 18 + unsigned _tx_yellow_led : 1; // bit 19 + unsigned _30_20_LPF : 1; // bit 20 + unsigned _60_40_LPF : 1; // bit 21 + unsigned _80_LPF : 1; // bit 22 + unsigned _160_LPF : 1; // bit 23 + + unsigned _ANT_1 : 1; // bit 24 + unsigned _ANT_2 : 1; // bit 25 + unsigned _ANT_3 : 1; // bit 26 + unsigned _TR_Relay : 1; // bit 27 + unsigned _tx_red_led : 1; // bit 28 + unsigned _6_LPF : 1; // bit 29 + unsigned _12_10_LPF : 1; // bit 30 + unsigned _17_15_LPF : 1; // bit 31 + }; + }; +}rbpfilter, *RBPFILTER; +#pragma pack(pop) +RBPFILTER prbpfilter; + +#pragma pack(push, 1) +typedef struct _rbpfilter2 // radio band pass filter +{ + int enable; + union + { + unsigned bpfilter; + struct { + unsigned _rx_yellow_led : 1; // bit + unsigned _13MHz_HPF : 1; // bit + unsigned _20MHz_HPF : 1; // bit + unsigned _6M_preamp : 1; // bit + unsigned _9_5MHz_HPF : 1; // bit + unsigned _6_5MHz_HPF : 1; // bit + unsigned _1_5MHz_HPF : 1; // bit + unsigned : 1; // bit + + unsigned _rx2_gnd : 1; // bit + unsigned : 1; // bit + unsigned : 1; // bit + unsigned : 1; // bit + unsigned _Bypass : 1; // bit + unsigned : 1; // bit + unsigned : 1; // bit + unsigned _rx_red_led : 1; // bit + }; + }; +}rbpfilter2, *RBPFILTER2; +#pragma pack(pop) +RBPFILTER2 prbpfilter2; + +extern __declspec(dllexport) void create_rnet(); +void WriteUDPFrame(int id, char *bufp, int buflen); +void sendPacket(SOCKET sock, char *data, int length, int port); +void CmdGeneral(void); +void CmdHighPriority(void); +extern __declspec(dllexport) void CmdRx(void); +void CmdTx(void); +DWORD WINAPI ReadThreadMain(LPVOID); +DWORD WINAPI KeepAliveMain(LPVOID); +void ReadThreadMainLoop(); +void KeepAliveLoop(); +void PrintTimeHack(); +void PeakFwdPower(float fwd); +void PeakRevPower(float rev); + +//void InitWinsock(); +//void CreateRIOSocket(); +//void Bind(SOCKET s, const unsigned short port); +//void PostRIORecvs(const DWORD recvBufferSize, const DWORD pendingRecvs); +//void InitializeRIO(SOCKET s); + +// IOThread rountines +int IOThreadStop(void); +int StartReadThread(void); +void StopReadThread(void); +int io_keep_running; +int IOThreadRunning; // non zero if IOThread is running + +int DotDashBits; +int XmitBit; +int SampleRate; +//int SampleBits; // how many bits in a sample + +unsigned char ControlBytesIn[5]; +unsigned char ControlBytesOut[5]; +unsigned int LostSyncCount; +unsigned int SyncGainedCount; + +int HaveSync; +int VFOfreq; +int ADC_cntrl1; +int ADC_cntrl2; + +int C1Mask; +char PennyOCBits; /* pennny open collector bits */ + +int nreceivers; + +//int AlexAtten; +//int Alex2Atten; +//int Alex3Atten; +//int Alex4Atten; +//int MercDither; +//int MercPreamp; +//int RX1Preamp; +//int RX2Preamp; +//int MicTipRing; +//int MicBias; +//int MicPTT; +//int Merc3Preamp; +//int Merc4Preamp; +//int MercRandom; +//int adc1_step_att_data; +//int adc2_step_att_data; +//int adc3_step_att_data; +//int tx_att_data; +//int PureSignal; +int MercTxAtten; + +//int enable_cw_keyer; +//int cw_sidetone_volume; +//int cw_ptt_delay; +//int cw_hang_time; +//int cw_sidetone_freq; +//int cw_speed; +//int cw_mode; +//int cw_weight; +//int enable_cw_spacing; +//int reverse_paddles; +//int cw_dash; +//int cw_dot; +//int cwx; + +//int MicBoost; +//int LineIn; +//int LineBoost; + +int UserOut0; +int UserOut1; +int UserOut2; +int UserOut3; +int xvtr_enable; + +//unsigned char AlexManEnable; +//unsigned char AlexEnabled; +int AlexHPFMask; +int AlexLPFMask; +int AlexTRRelay; +int Alex2HPFMask; +int Alex2LPFMask; +int Alex3HPFMask; +int Alex3LPFMask; +int Alex4HPFMask; +int Alex4LPFMask; + +int mkiibpf; +//int AlexRxAnt; +//int AlexTxAnt; +//int AlexRxOut; +//int ExciterPower; +float RevPower; +float FwdPower; + +int ApolloFilt; +int ApolloTuner; +int ApolloATU; + +//int ADC_Overload; // Single ADC +//int ADC1_Overload; +//int ADC2_Overload; +//int ADC3_Overload; +//int ADC4_Overload; +//int ADC_Overloads; +//int User_I01; +//int User_I02; +//int User_I03; +//int User_I04; +//unsigned char pf; + +//unsigned int OutputPowerFactor; +//int HermesDCV; + +int CandCAddrMask; +int CandCFwdPowerBit; +int DotDashMask; + +int WSAinitialized; +SOCKET listenSock; +SYSTEMTIME lt; +static const double const_1_div_2147483648_ = 1.0 / 2147483648.0; + +enum _TXPort +{ + +}; + +enum _RXPort +{ + HPCCPort = 1025, // High Priority C&C Data + RxMicSampPort = 1026, // 16-bit Mic Samples + WB0Port = 1027, // 16-Raw ADC Samples +}; + +enum HPSDRHW +{ + Atlas = 0, + Hermes = 1, // ANAN-10/100 + HermesII = 2, // ANAN-10E/100B + Angelia = 3, // ANAN-100D + Orion = 4, // ANAN-200D + OrionMKII = 5 // ANAN-7000DLE/8000DLE +}; + + diff --git a/Project Files/Source/ChannelMaster/obbuffs.c b/Project Files/Source/ChannelMaster/obbuffs.c index 38e90544..29e93fec 100644 --- a/Project Files/Source/ChannelMaster/obbuffs.c +++ b/Project Files/Source/ChannelMaster/obbuffs.c @@ -37,7 +37,7 @@ struct _obpointers void start_obthread (int id) { HANDLE handle = (HANDLE) _beginthread(ob_main, 0, (void *)id); - SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST); + //SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST); } void create_obbuffs (int id, int accept, int max_insize, int outsize) @@ -151,6 +151,11 @@ void obdata (int id, double* out) void ob_main (void *pargs) { + DWORD taskIndex = 0; + HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex); + if (hTask != 0) AvSetMmThreadPriority(hTask, 2); + else SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + int id = (int)pargs; OBB a = obp.pdbuff[id]; diff --git a/Project Files/Source/ChannelMaster/obbuffs.h b/Project Files/Source/ChannelMaster/obbuffs.h index 5cb23868..f6f9b3b9 100644 --- a/Project Files/Source/ChannelMaster/obbuffs.h +++ b/Project Files/Source/ChannelMaster/obbuffs.h @@ -29,6 +29,7 @@ warren@wpratt.com #include #include #include +#include #include "cmUtilities.h" typedef double complex[2]; diff --git a/Project Files/Source/ChannelMaster/pipe.c b/Project Files/Source/ChannelMaster/pipe.c index cffed8a3..ce84e991 100644 --- a/Project Files/Source/ChannelMaster/pipe.c +++ b/Project Files/Source/ChannelMaster/pipe.c @@ -185,8 +185,8 @@ void xpipe (int stream, int pos, double** buffs) (*pip.rcvr[1].xplaywave)(1, buff); // wav player 1 (*pip.rcvr[0].xrecordwave)(1, 0, buff); // wav recorder 0 (*pip.rcvr[1].xrecordwave)(1, 0, buff); // wav recorder 1 - xvacIN(0, buff); // data from VAC 0 - xvacIN(1, buff); // data from VAC 1 + if (pip.xmtr[0].txvac == 0) { xvacIN(0, buff, 0); xvacIN(1, buff, 1); } + if (pip.xmtr[0].txvac == 1) { xvacIN(1, buff, 0); xvacIN(0, buff, 1); } break; case 1: // IQ data (*pip.rcvr[0].xscope)(1, buffs[0]); // scope @@ -251,4 +251,10 @@ PORT void SetTopPan3Run (int run) { _InterlockedExchange (&pip.rcvr[0].top_pan3_run, run); +} + +PORT +void SetTXVAC (int txid, int txvac) +{ + _InterlockedExchange (&pip.xmtr[txid].txvac, txvac); } \ No newline at end of file diff --git a/Project Files/Source/ChannelMaster/pipe.h b/Project Files/Source/ChannelMaster/pipe.h index 40f5fd38..043e435e 100644 --- a/Project Files/Source/ChannelMaster/pipe.h +++ b/Project Files/Source/ChannelMaster/pipe.h @@ -44,6 +44,10 @@ typedef struct _pipe void (__stdcall *xplaywave)(int state, double* data); // WAV player void (__stdcall *xrecordwave)(int state, int pos, double* data); // WAV recorder } rcvr[cmMAXrcvr]; + struct // transmitter items + { + volatile long txvac; + } xmtr[cmMAXxmtr]; struct _spc0 // spc0 items { ANB panb; diff --git a/Project Files/Source/RawInput/bin/x86/Debug/RawInput.dll b/Project Files/Source/RawInput/bin/x86/Debug/RawInput.dll index 4a5829b66e8ee2dfce17d7b8a99b3d4f5f7c082b..ace1626ee24b5de133714ae75c1d1fb83ef02f75 100644 GIT binary patch delta 2818 zcmZ9O4Nz3q701uL@9x{x-DUSdPz>0z8g*9!5ok~&_-$$ej2}yoOeKQVXjB}MSWAie z9)n5ENXErS92%{GX)?jq7}KSd&d?F2R_oYI$cIy=GZd!98tbMyiMB=?rso`f{Lg*&UEa>Fl@L}!#13c!oA(UaY$0a3+7AL`*&+F`{j``R!giA| zg|dZAa~)d&pxL3FbK|S!%;^&hPs>aI5q>&u&KQ#7PP{t&m1Z_-I^1#-ANB7=>i#C= znD1reXWFaCq9AdthZys=AaA*;exGUTR3GNdX67a@InM*Jk-5rGb*Fv^d5XDhB3=^`rXumNI)bcpzk!^mUjZGyzzb+l=J_e|ysHy=PQ8uYz5Wx(GupdI%INUoMB?~V zijQV{6gd|S;wkNYTX>X)TSZ?{>j6I36@_WglE)q_r53bDvT%=Z$nYs8Q#Yel z0tcejM;uLX1Gw&D3hsKD|7Pbg9E(~xoE&8Sl{w7a>&!4`@|g#?E1Bu&tj-2}orjAP z%R$)YoVtJ)Z{cPhxkq51+iTyOv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JL8^HAd6HkxbROXlL+=F8=Cy$e7n15%U=k90B2xkhITe&NlndmIb0el^U<0(}j zTsyxhY-j;vbI9EdPx}n_TK;B{;{Lo~a$ZQ|2S1-W9a+O66MQgmQ~7_SGqn#!J=LT$ z-6I82k?me7h=!->AnY&ZDSxG&=H?bsr=l=wM|B2FEW5Q{zWyFWld4!xgp!-e|D08- zv*12fZT@{$KB`KuH`}^b-v-rQuhc3=Rqyp~s3m$5^m@wDOY~&;v!}}Rv^#Y+ob@Cg zOizK&Jw=Z*6|Q@V9%o8XG+d=~pn3ky2dS`9+y{&1hO>1pbS@yT8z!c$boUfR?K(XJ zdhR99g$L8?QC;xVMPH+y36VwA+YRT9b$S+*d+Lm_K}Vp$Q~xkF>L|2&>LjW=q03V; zuu13965xQF^BdKsXaA3S*4BkdnGt+m&-GMyPDb!$U6Slwv<5YwoR_Hy4{2VXRbk+W z#xDqb(H2#K_x1fS;B7yaR;Pam)!g0!Lnpbq}J9E{^9?jJx70uNq70uOsXKqy_*-V&M_3EU$WRC0lq{6}YV|PEM z%>qFmefP}wBla_L0?ZRGvQ+d+KP(i#MwW}0koSvy=r0rdk=5c2WUUxNzn(JvD3p&uQ+LA=tXfF*(d&rd_|l?4v0^Y`8FQgBK#h1wU#5c$f#C7Be0m=s-3WYo^Oyn6c0XfRa3!J>n$pmM{I5RE+ z%J#um9Q{^=aR4My%XH<3YMF_wm6MQl@^)msyaU-F=_qR?9dwydBDN0Eo+TIAdE3FI&?JqJ=D!72Ge?=AxyuBDYvw{`J=0B710c^dkXd2k>(&J1LM!xtJ|^QIm)#~Zx68K`{khYqC73yXHVyYuF&Rp&UfdV!ST-IW)O1EuAeL*{`LAy(Veg3q2_Ot%qfdo JEmu+d{tIife)|9b diff --git a/Project Files/Source/RawInput/bin/x86/Debug/RawInput.pdb b/Project Files/Source/RawInput/bin/x86/Debug/RawInput.pdb index 49bcf48d3a01bb435b0610fcc3dcfbd5260ae178..a4c2e113cdba2592227b8593bfb01758b22309bc 100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TTY|Z4m2u_>()f-1qy;QG*|Xd)qH^%~#x1osJj=y^Ir@Htk~#jn>_D znA3Lj(iE$Oh6g1PX00bu-w{j4gcCHf^r~UD|H0QjVkre;5!3$J7`65#q*84tOm#AD zHOQxO6PhSDic(I-DCHkM=jNg@2qzfmOVn&uOPiK>TZ0U(MOB;8? z2&Q1ISQ9nQo^GsJ$!wywbSXY!)+CPaf2p#N$gWzUv2KxDH>0r>k#z2n${NJ0^X<{B zK(*eD+N?q~1HK_Z3Ijy{N$c_$iN~O+o1nF7NA7;Vzw@V$v zde;@Z-58_NI$Oh7Ed n$iR@%0K`cQ3_-yz!Tmq48jF<2dv80W-nP|EWb)>kq!xAnRp=ev delta 88 zcmZp;!q{+yaY6_4-gWyocDu$1WIj9HxZ(0Y&uyu!(+=6|Ufld3rhrukC>zTF1WZ6I o!^psp(E!9r3=BcRF2St@)0ThJIq2G=uQRQvP(fsKO;QUx0EN&Z9RL6T diff --git a/Project Files/Source/RawInput/bin/x86/Release/RawInput.pdb b/Project Files/Source/RawInput/bin/x86/Release/RawInput.pdb index 4bdc17838c8f60be867319f0eb240b810661d466..4e6fdffa2afe2a0a2e884cc040bfd4072da49695 100644 GIT binary patch delta 87 zcmZpe!`v{3c>@cVM54@@cV#NKuLV;LD37+MRaE&rx-(6vQhXIfFAg2-kWt~aV2>-Jk5J3Z+t UGM|$z7-}i(c0NzL<^8f$< diff --git a/Project Files/Source/RawInput/obj/x86/Debug/RawInput.csproj.FileListAbsolute.txt b/Project Files/Source/RawInput/obj/x86/Debug/RawInput.csproj.FileListAbsolute.txt index b5aa14a5..887c1a85 100644 --- a/Project Files/Source/RawInput/obj/x86/Debug/RawInput.csproj.FileListAbsolute.txt +++ b/Project Files/Source/RawInput/obj/x86/Debug/RawInput.csproj.FileListAbsolute.txt @@ -10,8 +10,3 @@ D:\OpenHPSDR\GitHub\W5WC\Thetis-2.6.8\Project Files\Source\RawInput\obj\x86\Debu D:\OpenHPSDR\GitHub\W5WC\Thetis-2.6.8\Project Files\Source\RawInput\obj\x86\Debug\RawInput.csproj.CoreCompileInputs.cache D:\OpenHPSDR\GitHub\W5WC\Thetis-2.6.8\Project Files\Source\RawInput\obj\x86\Debug\RawInput.dll D:\OpenHPSDR\GitHub\W5WC\Thetis-2.6.8\Project Files\Source\RawInput\obj\x86\Debug\RawInput.pdb -D:\OpenHPSDR\GitHub\W5WC\Thetis\Project Files\Source\RawInput\bin\x86\Debug\RawInput.dll -D:\OpenHPSDR\GitHub\W5WC\Thetis\Project Files\Source\RawInput\bin\x86\Debug\RawInput.pdb -D:\OpenHPSDR\GitHub\W5WC\Thetis\Project Files\Source\RawInput\obj\x86\Debug\RawInput.csprojAssemblyReference.cache -D:\OpenHPSDR\GitHub\W5WC\Thetis\Project Files\Source\RawInput\obj\x86\Debug\RawInput.dll -D:\OpenHPSDR\GitHub\W5WC\Thetis\Project Files\Source\RawInput\obj\x86\Debug\RawInput.pdb diff --git a/Project Files/Source/RawInput/obj/x86/Debug/RawInput.csprojAssemblyReference.cache b/Project Files/Source/RawInput/obj/x86/Debug/RawInput.csprojAssemblyReference.cache index f4a358918be0eb3643b683d052300d8be2059321..537c4f644aa20b2595a7db1daa0706a93efbfc57 100644 GIT binary patch delta 13 UcmZ3%yn=ayKO>{y{`0z8g*9!5ok~&_-$$ej2}yoOeKQVXjB}MSWAie z9)n5ENXErS92%{GX)?jq7}KSd&d?F2R_oYI$cIy=GZd!98tbMyiMB=?rso`f{Lg*&UEa>Fl@L}!#13c!oA(UaY$0a3+7AL`*&+F`{j``R!giA| zg|dZAa~)d&pxL3FbK|S!%;^&hPs>aI5q>&u&KQ#7PP{t&m1Z_-I^1#-ANB7=>i#C= znD1reXWFaCq9AdthZys=AaA*;exGUTR3GNdX67a@InM*Jk-5rGb*Fv^d5XDhB3=^`rXumNI)bcpzk!^mUjZGyzzb+l=J_e|ysHy=PQ8uYz5Wx(GupdI%INUoMB?~V zijQV{6gd|S;wkNYTX>X)TSZ?{>j6I36@_WglE)q_r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/RawInput/obj/x86/Debug/RawInput.pdb b/Project Files/Source/RawInput/obj/x86/Debug/RawInput.pdb index 49bcf48d3a01bb435b0610fcc3dcfbd5260ae178..a4c2e113cdba2592227b8593bfb01758b22309bc 100644 GIT binary patch delta 1662 zcmZ`(Ur1A76#uT9Q)jz5|KPuLYNXrlT$@IUnz53=ziFU}5M{K`dMd&qC>QzSL!_R) zWj;g%S*h#xAmvLzgj=X9L846j^CGAah(rZ;j_clii~8W)^PTVaJLmgz?m3rHHIri)!xp21Mwyn0UsNrBE@6kzsWxCi!=UO+v@5#XPz`oebHM z8ZId1!D-1HX5>NrOdM2&Hw;SkVbl(FHr3ZRSpWkzDU9a9f=xY&Z&HG?LY3^9Av791 zg?kl;pp*l@{6?7NSvfEqG)C@kg0pt+geG`wH{@?cF}9{<>;Yz?5v5PZ*e2>~T;I?z z=0a><*YC=29>G*?qtIwTWC(>H-e|^FP^wVMFba*6A*Fs>aYiZkV$>nrA+_JNZ@>|& z8~mA>wsa9hM`e5aJ8_3jhce?VbIBnDeoP!o4ZG~r!)NVrPB0NIRq@3XB;^o(L0(w5;62^1s zaTM;g8-{w~(!&v#FrG^fu5h<~;tFyz7-fRU1oGs0Sac@2DT9R0{}qZdt%UmIFTX(B zQVxhq7$1rL28HXj9RE&S`a6hAm|M=(eH5M_IF}$a$nL6bV^meNe7@z4M%a`sZ84%S zB0D>lMWIhlxjL#5R^+$W@5Tv@a&u2+v@j%J>YdXFUb*_toG5I_xr3VQD6>}1e>p4` z)ME6*c$zKTsULLFQ;UAqL5k|~vm4wPMqW*l7HQ|E6V)v^R7U~@a z=<;*^CV1gjizQTH5e~J1h~6=7O@=1{)t^fGTR<)8pk$Zp-d_<0^xBO7b-n#s$ewCY zju>ihiEw|)$}g2z4DfI|Vrj}ELQUjSr`7oP()x5|I1cqDu9>y+$b!uX@j-3}rQK-Z z48KhMr9A9t0_}&C?t+1MIu9ilB@+{vfLf121S1NzcS+ZHJ+bh?BP#nMQ))~ieBL9v#9bM$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awInput/obj/x86/Release/RawInput.dll b/Project Files/Source/RawInput/obj/x86/Release/RawInput.dll index 43b168ff14123d15996f1feb4537d71c51318a69..9fffe2cae3b2a4a0b5290953232fc9b854472d16 100644 GIT binary patch delta 88 zcmZp;!q{+yaY6@kqRf?z-L5eL^QsSLImGpP%(XEwR|-lN+Wa7-58_NI$Oh7Ed n$iR@%0K`cQ3_-yz!Tmq48jF<2dv80W-nP|EWb)>kq!xAnRp=ev delta 88 zcmZp;!q{+yaY6_4-gWyocDu$1WIj9HxZ(0Y&uyu!(+=6|Ufld3rhrukC>zTF1WZ6I o!^psp(E!9r3=BcRF2St@)0ThJIq2G=uQRQvP(fsKO;QUx0EN&Z9RL6T diff --git a/Project Files/Source/RawInput/obj/x86/Release/RawInput.pdb b/Project Files/Source/RawInput/obj/x86/Release/RawInput.pdb index 4bdc17838c8f60be867319f0eb240b810661d466..4e6fdffa2afe2a0a2e884cc040bfd4072da49695 100644 GIT binary patch delta 87 zcmZpe!`v{3c>@cVM54@@cV#NKuLV;LD37+MRaE&rx-(6vQhXIfFAg2-kWt~aV2>-Jk5J3Z+t UGM|$z7-}i(c0NzL<^8f$<