|
|
|
|
@ -48,6 +48,7 @@
|
|
|
|
|
#include <regex.h>
|
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <libconfig.h++>
|
|
|
|
|
@ -117,7 +118,7 @@ static struct {
|
|
|
|
|
uint32_t adr;
|
|
|
|
|
struct sockaddr_in band_addr;
|
|
|
|
|
time_t last_time;
|
|
|
|
|
unsigned short G2_COUNTER;
|
|
|
|
|
std::atomic<unsigned short> G2_COUNTER;
|
|
|
|
|
unsigned char sequence;
|
|
|
|
|
} toRptr[3]; /* 0=A, 1=B, 2=C */
|
|
|
|
|
|
|
|
|
|
@ -128,7 +129,7 @@ static struct sockaddr_in fromRptr;
|
|
|
|
|
|
|
|
|
|
static unsigned char end_of_audio[29];
|
|
|
|
|
|
|
|
|
|
static volatile bool keep_running = true;
|
|
|
|
|
static std::atomic<bool> keep_running(true);
|
|
|
|
|
|
|
|
|
|
/* send packets to g2_link */
|
|
|
|
|
static struct sockaddr_in plug;
|
|
|
|
|
@ -2588,16 +2589,6 @@ static void *echotest(void *arg)
|
|
|
|
|
else if (dstar_buf[25] == 'C')
|
|
|
|
|
i = 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***
|
|
|
|
|
WARNING: G2_COUNTER is accessed by both threads.
|
|
|
|
|
It should be protected with a MUTEX,
|
|
|
|
|
but since this version is NOT for RP2C, but for home-brew
|
|
|
|
|
it does not really matter.
|
|
|
|
|
Anyway, accessing G2_COUNTER and adding 1 to it,
|
|
|
|
|
should be an atomic operation.
|
|
|
|
|
***/
|
|
|
|
|
|
|
|
|
|
memcpy(rptr_buf, "DSTR", 4);
|
|
|
|
|
rptr_buf[5] = (unsigned char)(toRptr[i].G2_COUNTER & 0xff);
|
|
|
|
|
rptr_buf[4] = (unsigned char)((toRptr[i].G2_COUNTER >> 8) & 0xff);
|
|
|
|
|
|