commit
f61c59ccc0
|
|
@ -563,6 +563,11 @@ typedef struct
|
|||
unsigned int dmrburstL;
|
||||
unsigned int dmrburstR;
|
||||
unsigned long long int R;
|
||||
unsigned long long int H;
|
||||
unsigned long long int HYTL;
|
||||
unsigned long long int HYTR;
|
||||
int DMRvcL;
|
||||
int DMRvcR;
|
||||
// int block_count;
|
||||
short int dmr_encL;
|
||||
short int dmr_encR;
|
||||
|
|
@ -887,11 +892,13 @@ void dstar_header_decode(dsd_state * state, int radioheaderbuffer[660]);
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef USE_RTLSDR
|
||||
void open_rtlsdr_stream(dsd_opts *opts);
|
||||
void cleanup_rtlsdr_stream();
|
||||
void get_rtlsdr_sample(int16_t *sample, dsd_opts * opts, dsd_state * state);
|
||||
void rtlsdr_sighandler();
|
||||
|
||||
#endif
|
||||
//TRELLIS
|
||||
void CDMRTrellisTribitsToBits(const unsigned char* tribits, unsigned char* payload);
|
||||
unsigned int CDMRTrellisCheckCode(const unsigned char* points, unsigned char* tribits);
|
||||
|
|
|
|||
85
src/dmr_bs.c
85
src/dmr_bs.c
|
|
@ -368,10 +368,16 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
if (opts->inverted_dmr == 0)
|
||||
{
|
||||
fprintf (stderr,"Sync: +DMR [SLOT1] slot2 | | DMRSTEREO | VC%d ",vc1);
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
|
|
@ -379,10 +385,16 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
else
|
||||
{
|
||||
fprintf (stderr,"Sync: -DMR [SLOT1] slot2 | | DMRSTEREO | VC%d ",vc1);
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
|
|
@ -395,10 +407,16 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
if (opts->inverted_dmr == 0)
|
||||
{
|
||||
fprintf (stderr,"Sync: +DMR slot1 [SLOT2] | | DMRSTEREO | VC%d ",vc2);
|
||||
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0)
|
||||
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if (state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
|
|
@ -406,10 +424,16 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
else
|
||||
{
|
||||
fprintf (stderr,"Sync: -DMR slot1 [SLOT2] | | DMRSTEREO | VC%d ",vc2);
|
||||
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0)
|
||||
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if (state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
|
|
@ -435,10 +459,10 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
if (internalslot == 0 && vc1 == 6)
|
||||
{
|
||||
|
||||
state->DMRvcL = 0;
|
||||
if (state->payload_algid >= 0x21)
|
||||
{
|
||||
//running this as state->payload_mi > 0 apparently causes some problem, don't know why
|
||||
|
||||
if (state->payload_mi != 0 && state->payload_algid >= 0x21)
|
||||
{
|
||||
LFSR(state);
|
||||
|
|
@ -449,12 +473,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
if (internalslot == 1 && vc2 == 6)
|
||||
{
|
||||
|
||||
state->DMRvcR = 0;
|
||||
if (state->payload_algidR >= 0x21)
|
||||
{
|
||||
if (state->payload_miR != 0 && state->payload_algidR == 0x21)
|
||||
{
|
||||
LFSR(state); //re-enable this one after testing Late Entry MI
|
||||
LFSR(state);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
|
@ -565,8 +589,8 @@ void dmrBSBootstrap (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
//payload buffer
|
||||
//CACH + First Half Payload + Sync = 12 + 54 + 24
|
||||
dibit_p = state->dibit_buf_p - 90; //this seems to work okay for both
|
||||
//dibit_p = state->dmr_payload_p - 90;
|
||||
//dibit_p = state->dibit_buf_p - 90; //this seems to work okay for both
|
||||
dibit_p = state->dmr_payload_p - 90;
|
||||
for (i = 0; i < 90; i++) //90
|
||||
{
|
||||
dibit = *dibit_p;
|
||||
|
|
@ -686,30 +710,47 @@ void dmrBSBootstrap (dsd_opts * opts, dsd_state * state)
|
|||
if (opts->inverted_dmr == 0)
|
||||
{
|
||||
fprintf (stderr,"Sync: +DMR | Frame Sync | DMRSTEREO | VC1 ");
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) )
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
|
||||
}
|
||||
if ( (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
//state->currentslot = 0; //slot now set from cach data from buffer
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,"Sync: -DMR | Frame Sync | DMRSTEREO | VC1 ");
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) )
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
|
||||
}
|
||||
if ( (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
//state->currentslot = 0; //slot now set from cach data from buffer
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
state->DMRvcL = 0;
|
||||
state->DMRvcR = 0;
|
||||
|
||||
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
|
||||
processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
|
||||
processMbeFrame (opts, state, NULL, ambe_fr3, NULL);
|
||||
|
|
|
|||
|
|
@ -51,15 +51,15 @@ processDMRdata (dsd_opts * opts, dsd_state * state)
|
|||
ccAscii[4] = 0;
|
||||
bursttype[4] = 0;
|
||||
|
||||
dibit_p = state->dibit_buf_p - 90;
|
||||
//dibit_p = state->dibit_buf_p - 90;
|
||||
//using the estimate_symbol method for the dmr_payload_p buffer causes sync
|
||||
//issues with P25, so only do it when frame_p25p1 == 0, or -fr option
|
||||
//temp fix to only use dmr_payload_p buffer when no inversion expected, otherwise use dibit_buf
|
||||
if (opts->frame_p25p1 == 0 && opts->inverted_dmr == 0) //opts->frame_p25p1 == 0 && opts->inverted_dmr == 0
|
||||
{
|
||||
dibit_p = state->dmr_payload_p - 90;
|
||||
}
|
||||
|
||||
// if (opts->frame_p25p1 == 0 && opts->inverted_dmr == 0) //opts->frame_p25p1 == 0 && opts->inverted_dmr == 0
|
||||
// {
|
||||
// dibit_p = state->dmr_payload_p - 90;
|
||||
// }
|
||||
dibit_p = state->dmr_payload_p - 90;
|
||||
// CACH, why aren't we running any FEC on this?
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
|
|
|
|||
50
src/dmr_ms.c
50
src/dmr_ms.c
|
|
@ -366,10 +366,16 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
|
|||
if (internalslot == 0 && opts->inverted_dmr == 0)
|
||||
{
|
||||
fprintf (stderr,"Sync: +DMR MS MODE | Color Code=%02d | DMRSTEREO | VC%d ", state->color_code, vc1);
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
|
|
@ -378,10 +384,16 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
|
|||
if (internalslot == 0 && opts->inverted_dmr == 1)
|
||||
{
|
||||
fprintf (stderr,"Sync: -DMR MS MODE | Color Code=%02d | DMRSTEREO | VC%d ", state->color_code, vc1);
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
|
|
@ -400,10 +412,9 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
|
|||
processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
|
||||
processMbeFrame (opts, state, NULL, ambe_fr3, NULL);
|
||||
|
||||
//need to seperate the algs here so we don't run LFSR on 22 and so on
|
||||
if (vc1 == 6 && state->payload_algid >= 21)
|
||||
{
|
||||
//state->currentslot = 0;
|
||||
state->DMRvcL = 0;
|
||||
if (state->payload_mi != 0 && state->payload_algid >= 0x21)
|
||||
{
|
||||
LFSR(state);
|
||||
|
|
@ -614,11 +625,18 @@ void dmrMSBootstrap (dsd_opts * opts, dsd_state * state)
|
|||
if (opts->inverted_dmr == 0)
|
||||
{
|
||||
fprintf (stderr,"Sync: +DMR MS MODE | Frame Sync | DMRSTEREO | VC1 ");
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) )
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x10) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if ( (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x68) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
|
|
@ -626,17 +644,25 @@ void dmrMSBootstrap (dsd_opts * opts, dsd_state * state)
|
|||
else
|
||||
{
|
||||
fprintf (stderr,"Sync: -DMR MS MODE | Frame Sync | DMRSTEREO | VC1 ");
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) )
|
||||
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x10) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
if ( (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68) ||
|
||||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x68) )
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
state->dmr_ms_mode = 1;
|
||||
state->DMRvcL = 0;
|
||||
|
||||
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
|
||||
processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void ProcessDMR (dsd_opts * opts, dsd_state * state)
|
|||
TSVoiceSupFrameL = &state->TS1SuperFrame;
|
||||
TSVoiceSupFrameR = &state->TS2SuperFrame;
|
||||
|
||||
int BP[256] = {
|
||||
int Pr[256] = {
|
||||
0x0000, 0x1F00, 0xE300, 0xFC00, 0x2503, 0x3A03, 0xC603, 0xD903,
|
||||
0x4A05, 0x5505, 0xA905, 0xB605, 0x6F06, 0x7006, 0x8C06, 0x9306,
|
||||
0x2618, 0x3918, 0xC518, 0xDA18, 0x031B, 0x1C1B, 0xE01B, 0xFF1B,
|
||||
|
|
@ -72,12 +72,12 @@ int BP[256] = {
|
|||
};
|
||||
|
||||
|
||||
if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
|
||||
if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
k = BP[state->K];
|
||||
k = Pr[state->K];
|
||||
k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k );
|
||||
|
||||
for(Frame = 0; Frame < 6; Frame++)
|
||||
|
|
@ -93,12 +93,12 @@ if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->pa
|
|||
}
|
||||
}
|
||||
|
||||
if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0)
|
||||
if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10)
|
||||
{
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " BPK %lld", state->K);
|
||||
fprintf(stderr, " PrK %lld", state->K);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
k = BP[state->K];
|
||||
k = Pr[state->K];
|
||||
k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k );
|
||||
|
||||
for(Frame = 0; Frame < 6; Frame++)
|
||||
|
|
@ -114,6 +114,70 @@ if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->p
|
|||
}
|
||||
}
|
||||
|
||||
if (state->currentslot == 0 && state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
|
||||
{
|
||||
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
k = state->H;
|
||||
|
||||
unsigned long long int msb = 0;
|
||||
|
||||
k = k << 8;
|
||||
k = k | ((k >> 40) & 0xFF);
|
||||
|
||||
for(Frame = 0; Frame < 6; Frame++)
|
||||
{
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
for(j = 0; j < 48; j++)
|
||||
{
|
||||
x = ( ((k << j) & 0x800000000000) >> 47 );
|
||||
TSVoiceSupFrameL->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i][j] ^= x;
|
||||
}
|
||||
|
||||
k = k << 1;
|
||||
msb = (k >> 32) & 0xFFFF;
|
||||
k = (k << 8) & 0xFFFFFFFF0000;
|
||||
k = k | msb;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state->currentslot == 1 && state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
|
||||
{
|
||||
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
fprintf(stderr, " T10 %010llX", state->H);
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
k = state->H;
|
||||
|
||||
unsigned long long int msb = 0;
|
||||
|
||||
k = k << 8;
|
||||
k = k | ((k >> 40) & 0xFF);
|
||||
|
||||
for(Frame = 0; Frame < 6; Frame++)
|
||||
{
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
for(j = 0; j < 48; j++)
|
||||
{
|
||||
x = ( ((k << j) & 0x800000000000) >> 47 );
|
||||
TSVoiceSupFrameR->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i][j] ^= x;
|
||||
}
|
||||
|
||||
k = k << 1;
|
||||
msb = (k >> 32) & 0xFFFF;
|
||||
k = (k << 8) & 0xFFFFFFFF0000;
|
||||
k = k | msb;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
|
||||
|
|
|
|||
186
src/dmr_sync.c
186
src/dmr_sync.c
|
|
@ -1618,7 +1618,7 @@ void ProcessCSBK(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t
|
|||
uint8_t nb4 = DmrDataByte[5] & 0x3F; //extract(csbk, 42, 48);
|
||||
uint8_t nb5 = DmrDataByte[6] & 0x3F; //extract(csbk, 50, 56);
|
||||
fprintf (stderr, "\nMotoTRBO Capacity Plus Neighbors");
|
||||
//fprintf(stderr, " NB1(%02x), NB2(%02x), NB3(%02x), NB4(%02x), NB5(%02x)", nb1, nb2, nb3, nb4, nb5);
|
||||
fprintf(stderr, " NB1(%02x), NB2(%02x), NB3(%02x), NB4(%02x), NB5(%02x)", nb1, nb2, nb3, nb4, nb5);
|
||||
sprintf(state->dmr_branding, " MotoTRBO Capacity Plus ");
|
||||
}
|
||||
|
||||
|
|
@ -1842,6 +1842,9 @@ void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], u
|
|||
|
||||
}
|
||||
|
||||
//need to look into differences with Cap+ and other systems affecting the expected radio src id values
|
||||
//find a way to differentiate the system types so we get good radio id decodes all the time
|
||||
//svc op 0x60 for cap+?? if so, then should we use a mask?
|
||||
void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])
|
||||
{
|
||||
uint32_t i, j, k;
|
||||
|
|
@ -1861,7 +1864,7 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
{
|
||||
TSVoiceSupFrame = &state->TS1SuperFrame;
|
||||
}
|
||||
else
|
||||
if(state->currentslot == 1)
|
||||
{
|
||||
TSVoiceSupFrame = &state->TS2SuperFrame;
|
||||
}
|
||||
|
|
@ -1918,7 +1921,7 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
DmrDataBit[j + 6] = (DmrDataByte[i] >> 1) & 0x01;
|
||||
DmrDataBit[j + 7] = (DmrDataByte[i] >> 0) & 0x01;
|
||||
}
|
||||
//fprintf (stderr, "\nDDB = 0x%X \n", DmrDataBit);
|
||||
|
||||
/* Store the Protect Flag (PF) bit */
|
||||
TSVoiceSupFrame->FullLC.ProtectFlag = (unsigned int)(DmrDataBit[0]);
|
||||
|
||||
|
|
@ -1930,7 +1933,6 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
|
||||
/* Store the Feature set ID (FID) */
|
||||
TSVoiceSupFrame->FullLC.FeatureSetID = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[8], 8);
|
||||
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
|
||||
/* Store the Service Options */
|
||||
TSVoiceSupFrame->FullLC.ServiceOptions = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[16], 8);
|
||||
|
|
@ -1940,7 +1942,6 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
|
||||
/* Store the Source address */
|
||||
TSVoiceSupFrame->FullLC.SourceAddress = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[48], 24);
|
||||
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
|
||||
|
||||
if((IrrecoverableErrors == 0) && CRCCorrect)
|
||||
{
|
||||
|
|
@ -1948,24 +1949,36 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
TSVoiceSupFrame->FullLC.DataValidity = 1;
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
|
||||
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress; //disabled for now, Cap+ and other systems cause issues with these values
|
||||
}
|
||||
if (state->currentslot == 1)
|
||||
{
|
||||
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//state->lasttgR = TSVoiceSupFrame->FullLC.GroupAddress;
|
||||
//state->lastsrcR = TSVoiceSupFrame->FullLC.SourceAddress;
|
||||
}
|
||||
}
|
||||
else if(IrrecoverableErrors == 0)
|
||||
{
|
||||
//FEC okay? Set SVCop code anyways
|
||||
TSVoiceSupFrame->FullLC.DataValidity = 0; //shouldn't matter in this context
|
||||
//FEC okay. Set all variables anyways.
|
||||
TSVoiceSupFrame->FullLC.DataValidity = 0;
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
|
||||
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
|
||||
}
|
||||
if (state->currentslot == 1)
|
||||
{
|
||||
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//state->lasttgR = TSVoiceSupFrame->FullLC.GroupAddress;
|
||||
//state->lastsrcR = TSVoiceSupFrame->FullLC.SourceAddress;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1973,19 +1986,12 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
/* CRC checking error, so consider the Full LC data as invalid */
|
||||
TSVoiceSupFrame->FullLC.DataValidity = 0;
|
||||
}
|
||||
//Full, amateur callsigns and labels not on this,
|
||||
if (opts->payload == 1)
|
||||
{
|
||||
//fprintf (stderr, "\nFull VoiceLC Payload ");
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
//fprintf (stderr, "[%02X]", DmrDataByte[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print the destination ID (TG) and the source ID */
|
||||
fprintf (stderr, "%s \n", KGRN);
|
||||
fprintf (stderr, " Slot %d ", state->currentslot+1);
|
||||
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
fprintf (stderr, " SLOT %d ", state->currentslot+1);
|
||||
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
|
||||
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x80) fprintf(stderr, "Emergency ");
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x40)
|
||||
|
|
@ -2186,16 +2192,26 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
{
|
||||
state->payload_algid = 0;
|
||||
state->payload_keyid = 0;
|
||||
//state->payload_mfid = 0;
|
||||
state->payload_mi = 0;
|
||||
// state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
// state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//state->dmr_fid = 0;
|
||||
//state->dmr_so = 0; //leave disabled so will persist to aid in muting or unmuting when required
|
||||
state->lastsrc = 0;
|
||||
state->lasttg = 0;
|
||||
|
||||
}
|
||||
if (state->currentslot == 1)
|
||||
{
|
||||
state->payload_algidR = 0;
|
||||
state->payload_keyidR = 0;
|
||||
//state->payload_mfid = 0;
|
||||
state->payload_miR = 0;
|
||||
// state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
// state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//state->dmr_fidR = 0;
|
||||
//state->dmr_soR = 0;
|
||||
state->lastsrcR = 0;
|
||||
state->lasttgR = 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -2203,31 +2219,33 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
if((IrrecoverableErrors == 0) && CRCCorrect) //amateur DMR seems to only set radio ID up here I think, figure out best way to set without messing up other DMR types
|
||||
{
|
||||
fprintf (stderr, "%s \n", KRED);
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
|
||||
fprintf (stderr, " SLOT %d ", state->currentslot+1);
|
||||
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
//fprintf(stderr, "(CRC OK ) ");
|
||||
|
||||
if (TSVoiceSupFrame->FullLC.FullLinkControlOpcode == 0) //other opcodes may convey callsigns, names, etc.
|
||||
{
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
// state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
// state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//zero out src and tgt here as well, or will that cause issues with ncurses terminal and per call?
|
||||
}
|
||||
if (state->currentslot == 1)
|
||||
{
|
||||
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
// state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
// state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
//zero out src and tgt here as well, or will that cause issues with ncurses terminal and per call?
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(IrrecoverableErrors == 0)
|
||||
{
|
||||
fprintf (stderr, "%s \n", KRED);
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
|
||||
fprintf (stderr, " SLOT %d ", state->currentslot+1);
|
||||
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
|
||||
fprintf(stderr, "RAS (FEC OK/CRC ERR)"); //tlc
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
if (TSVoiceSupFrame->FullLC.FullLinkControlOpcode == 0) //other opcodes may convey callsigns, names, etc.
|
||||
|
|
@ -2235,13 +2253,13 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
|
|||
{
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
// state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
// state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
}
|
||||
if (state->currentslot == 1)
|
||||
{
|
||||
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
// state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
|
||||
// state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2306,11 +2324,6 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
uint8_t CRCComputed;
|
||||
uint32_t CRCCorrect = 0;
|
||||
|
||||
/* Remove warning compiler */
|
||||
//UNUSED_VARIABLE(opts);
|
||||
|
||||
/* Check the current time slot */
|
||||
|
||||
if(state->currentslot == 0)
|
||||
{
|
||||
TSVoiceSupFrame = &state->TS1SuperFrame;
|
||||
|
|
@ -2320,7 +2333,6 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
TSVoiceSupFrame = &state->TS2SuperFrame;
|
||||
}
|
||||
|
||||
|
||||
/* First step : Reconstitute the BPTC 16x8 matrix */
|
||||
Burst = 1; /* Burst B to E contains embedded signaling data */
|
||||
k = 0;
|
||||
|
|
@ -2350,14 +2362,12 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
for(i = 0; i < 10; i++)
|
||||
{
|
||||
LC_DataBytes[i] = 0;
|
||||
for(j = 0; j < 8; j++)
|
||||
//for(j = 0; j < 10; j++)
|
||||
for(j = 0; j < 10; j++) //why did I change this?
|
||||
{
|
||||
LC_DataBytes[i] = LC_DataBytes[i] << 1;
|
||||
LC_DataBytes[i] = LC_DataBytes[i] | (LC_DataBit[k] & 0x01);
|
||||
k++;
|
||||
if(k >= 76) break;
|
||||
//if(k >= 80) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2395,7 +2405,6 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
|
||||
/* Store the Source address */
|
||||
TSVoiceSupFrame->FullLC.SourceAddress = (unsigned int)ConvertBitIntoBytes(&LC_DataBit[48], 24);
|
||||
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
|
||||
|
||||
/* Check the CRC values */
|
||||
if((IrrecoverableErrors == 0))// && CRCCorrect)
|
||||
|
|
@ -2440,7 +2449,7 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf (stderr, " Embedded Alias Header and Blocks: [%s%s%s%s%s]", state->dmr_callsign[state->currentslot][0],
|
||||
state->dmr_callsign[state->currentslot][1], state->dmr_callsign[state->currentslot][2],
|
||||
state->dmr_callsign[state->currentslot][3], state->dmr_callsign[state->currentslot][4] );
|
||||
|
|
@ -2467,7 +2476,7 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf (stderr, " Embedded GPS: [%s]", state->dmr_callsign[state->currentslot][5] );
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
}
|
||||
|
|
@ -2483,11 +2492,45 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
|
||||
fprintf (stderr, " SLOT %d ", state->currentslot+1);
|
||||
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
//fprintf(stderr, "(CRC OK ) ");
|
||||
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x80) fprintf(stderr, "Emergency ");
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x40)
|
||||
{
|
||||
fprintf (stderr, "%s ", KRED);
|
||||
fprintf(stderr, "Encrypted ");
|
||||
//fprintf (stderr, "%s ", KNRM);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s ", KGRN);
|
||||
fprintf(stderr, "Clear/Unencrypted ");
|
||||
//fprintf (stderr, "%s ", KNRM);
|
||||
}
|
||||
|
||||
/* Check the "Reserved" bits */
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x30)
|
||||
{
|
||||
/* Experimentally determined with DSD+, when the "Reserved" bit field
|
||||
* is equal to 0x2, this is a TXI call */
|
||||
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) == 0x20) fprintf(stderr, "TXI ");
|
||||
else fprintf(stderr, "Reserved=%d ", (TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) >> 4);
|
||||
}
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x08) fprintf(stderr, "Broadcast ");
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x04) fprintf(stderr, "OVCM ");
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x03)
|
||||
{
|
||||
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x01) fprintf(stderr, "Priority 1 ");
|
||||
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x02) fprintf(stderr, "Priority 2 ");
|
||||
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x03) fprintf(stderr, "Priority 3 ");
|
||||
else fprintf(stderr, "No Priority "); /* We should never go here */
|
||||
}
|
||||
fprintf(stderr, "Call ");
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
|
||||
|
|
@ -2516,12 +2559,47 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
fprintf (stderr, " SLOT %d", state->currentslot+1);
|
||||
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
|
||||
fprintf (stderr, " SLOT %d ", state->currentslot+1);
|
||||
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
|
||||
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
|
||||
fprintf (stderr, "%s ", KRED);
|
||||
fprintf(stderr, "RAS (FEC OK/CRC ERR) ");
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x80) fprintf(stderr, "Emergency ");
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x40)
|
||||
{
|
||||
fprintf (stderr, "%s ", KRED);
|
||||
fprintf(stderr, "Encrypted ");
|
||||
//fprintf (stderr, "%s ", KNRM);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s ", KGRN);
|
||||
fprintf(stderr, "Clear/Unencrypted ");
|
||||
//fprintf (stderr, "%s ", KNRM);
|
||||
}
|
||||
|
||||
/* Check the "Reserved" bits */
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x30)
|
||||
{
|
||||
/* Experimentally determined with DSD+, when the "Reserved" bit field
|
||||
* is equal to 0x2, this is a TXI call */
|
||||
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) == 0x20) fprintf(stderr, "TXI ");
|
||||
else fprintf(stderr, "Reserved=%d ", (TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) >> 4);
|
||||
}
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x08) fprintf(stderr, "Broadcast ");
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x04) fprintf(stderr, "OVCM ");
|
||||
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x03)
|
||||
{
|
||||
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x01) fprintf(stderr, "Priority 1 ");
|
||||
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x02) fprintf(stderr, "Priority 2 ");
|
||||
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x03) fprintf(stderr, "Priority 3 ");
|
||||
else fprintf(stderr, "No Priority "); /* We should never go here */
|
||||
}
|
||||
fprintf(stderr, "Call ");
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
|
||||
|
|
|
|||
|
|
@ -318,6 +318,13 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
|
|||
// store non-inverted values in dibit_buf
|
||||
*state->dibit_buf_p = invert_dibit(dibit);
|
||||
state->dibit_buf_p++;
|
||||
|
||||
//dmr buffer
|
||||
*state->dmr_payload_p = invert_dibit(dibit); //invert, or no?
|
||||
// *state->dmr_payload_p = dibit; //invert, or no?
|
||||
state->dmr_payload_p++;
|
||||
//dmr buffer end
|
||||
|
||||
return dibit;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -295,14 +295,14 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
state->dmr_payload_p = state->dmr_payload_buf + 200;
|
||||
}
|
||||
|
||||
int valid;
|
||||
// int valid;
|
||||
//running estimate_symbol causes an issue with P25 syncing properly
|
||||
if (opts->frame_p25p1 != 1)
|
||||
{
|
||||
valid = estimate_symbol(state->rf_mod, &(state->p25_heuristics), state->last_dibit, symbol, &dibit);
|
||||
}
|
||||
// if (opts->frame_p25p1 != 1)
|
||||
// {
|
||||
// valid = estimate_symbol(state->rf_mod, &(state->p25_heuristics), state->last_dibit, symbol, &dibit);
|
||||
// }
|
||||
|
||||
if (opts->frame_dmr == 1 && valid == 0) //opts->dmr_stereo
|
||||
if (1 == 1) //opts->dmr_stereo //opts->frame_dmr == 1 && valid == 0
|
||||
{
|
||||
if (symbol > state->center)
|
||||
{
|
||||
|
|
@ -1197,7 +1197,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
}
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameSync (opts, state, " +NXDN96 ", synctest_pos + 1, modulation);
|
||||
printFrameSync (opts, state, "+NXDN96 ", synctest_pos + 1, modulation);
|
||||
}
|
||||
}
|
||||
state->lastsynctype = 8;
|
||||
|
|
|
|||
|
|
@ -144,6 +144,16 @@ noCarrier (dsd_opts * opts, dsd_state * state)
|
|||
state->payload_keyid = 0;
|
||||
state->payload_keyidR = 0;
|
||||
|
||||
state->dmr_fid = 0;
|
||||
state->dmr_so = 0;
|
||||
state->dmr_fidR = 0;
|
||||
state->dmr_soR = 0;
|
||||
|
||||
state->HYTL = 0;
|
||||
state->HYTR = 0;
|
||||
state->DMRvcL = 0;
|
||||
state->DMRvcR = 0;
|
||||
|
||||
state->payload_miN = 0;
|
||||
state->p25vc = 0;
|
||||
state->payload_miP = 0;
|
||||
|
|
@ -469,6 +479,7 @@ initState (dsd_state * state)
|
|||
|
||||
state->K = 0;
|
||||
state->R = 0;
|
||||
state->H = 0;
|
||||
|
||||
state->dmr_stereo = 0;
|
||||
state->dmrburstL = 17; //initialize at higher value than possible
|
||||
|
|
@ -479,6 +490,11 @@ initState (dsd_state * state)
|
|||
state->dmr_fidR = 0;
|
||||
state->dmr_ms_mode = 0;
|
||||
|
||||
state->HYTL = 0;
|
||||
state->HYTR = 0;
|
||||
state->DMRvcL = 0;
|
||||
state->DMRvcR = 0;
|
||||
|
||||
state->p25vc = 0;
|
||||
|
||||
state->payload_miP = 0;
|
||||
|
|
@ -616,6 +632,10 @@ usage ()
|
|||
printf (" Use if skipping occurs, but may cause wonky audio due to loss of good sync\n");
|
||||
printf (" -Z Log MBE/Frame Payloads to console\n");
|
||||
printf ("\n");
|
||||
printf (" -K <dec> Manually Enter DMRA Privacy Key (Decimal Value of Key Number)\n");
|
||||
printf ("\n");
|
||||
printf (" -H <hex> Manually Enter 'Tera 10 Privacy Key (40-Bit/10-Char Hex Value)\n");
|
||||
printf ("\n");
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
|
@ -854,7 +874,7 @@ main (int argc, char **argv)
|
|||
exitflag = 0;
|
||||
signal (SIGINT, sigfun);
|
||||
|
||||
while ((c = getopt (argc, argv, "haep:P:qstv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:Y:K:NQWrlZTF")) != -1)
|
||||
while ((c = getopt (argc, argv, "haep:P:qstv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:Y:K:H:NQWrlZTF")) != -1)
|
||||
{
|
||||
opterr = 0;
|
||||
switch (c)
|
||||
|
|
@ -933,6 +953,21 @@ main (int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
sscanf (optarg, "%llX", &state.H);
|
||||
if (state.H > 0xFFFFFFFFFF)
|
||||
{
|
||||
state.H = 0xFFFFFFFFFF;
|
||||
}
|
||||
opts.dmr_mute_encL = 0;
|
||||
opts.dmr_mute_encR = 0;
|
||||
if (state.H == 0)
|
||||
{
|
||||
opts.dmr_mute_encL = 1;
|
||||
opts.dmr_mute_encR = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'G': //Set rtl device gain
|
||||
sscanf (optarg, "%d", &opts.rtl_gain_value); //multiple value by ten to make it consitent with the way rtl_fm really works
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||
{
|
||||
|
||||
//
|
||||
int BP[256] = {
|
||||
int Pr[256] = {
|
||||
0x0000, 0x1F00, 0xE300, 0xFC00, 0x2503, 0x3A03, 0xC603, 0xD903,
|
||||
0x4A05, 0x5505, 0xA905, 0xB605, 0x6F06, 0x7006, 0x8C06, 0x9306,
|
||||
0x2618, 0x3918, 0xC518, 0xDA18, 0x031B, 0x1C1B, 0xE01B, 0xFF1B,
|
||||
|
|
@ -228,10 +228,9 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||
mbe_demodulateAmbe3600x2450Data (ambe_fr);
|
||||
state->errs2 += mbe_eccAmbe3600x2450Data (ambe_fr, ambe_d);
|
||||
|
||||
//
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) //
|
||||
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
|
||||
{
|
||||
k = BP[state->K];
|
||||
k = Pr[state->K];
|
||||
k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k );
|
||||
for (short int j = 0; j < 48; j++) //49
|
||||
{
|
||||
|
|
@ -240,6 +239,36 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||
}
|
||||
}
|
||||
|
||||
if (state->currentslot == 0 && state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
|
||||
{
|
||||
unsigned long long int msb = 0;
|
||||
if (state->DMRvcL == 0)
|
||||
{
|
||||
state->HYTL = state->H;
|
||||
k = state->H;
|
||||
|
||||
k = k << 8;
|
||||
k = k | ((k >> 40) & 0xFF);
|
||||
state->HYTL = k;
|
||||
}
|
||||
|
||||
k = state->HYTL;
|
||||
for(short int j = 0; j < 48; j++)
|
||||
{
|
||||
x = ( ((k << j) & 0x800000000000) >> 47 );
|
||||
ambe_d[j] ^= x;
|
||||
}
|
||||
|
||||
k = k << 1;
|
||||
msb = (k >> 32) & 0xFFFF; //new MSB
|
||||
k = (k << 8) & 0xFFFFFFFF0000;
|
||||
k = k | msb;
|
||||
|
||||
state->HYTL = k;
|
||||
state->DMRvcL++;
|
||||
|
||||
}
|
||||
|
||||
mbe_processAmbe2450Dataf (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str,
|
||||
ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
|
||||
|
||||
|
|
@ -260,10 +289,10 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||
mbe_demodulateAmbe3600x2450Data (ambe_fr);
|
||||
state->errs2R += mbe_eccAmbe3600x2450Data (ambe_fr, ambe_d);
|
||||
|
||||
//BP Handling, Slot 2
|
||||
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) //
|
||||
|
||||
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10)
|
||||
{
|
||||
k = BP[state->K];
|
||||
k = Pr[state->K];
|
||||
k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k );
|
||||
for (short int j = 0; j < 48; j++)
|
||||
{
|
||||
|
|
@ -272,6 +301,36 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||
}
|
||||
}
|
||||
|
||||
if (state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
|
||||
{
|
||||
unsigned long long int msb = 0;
|
||||
if (state->DMRvcR == 0)
|
||||
{
|
||||
state->HYTR = state->H;
|
||||
k = state->H;
|
||||
|
||||
k = k << 8;
|
||||
k = k | ((k >> 40) & 0xFF);
|
||||
state->HYTR = k;
|
||||
}
|
||||
|
||||
k = state->HYTR;
|
||||
for(short int j = 0; j < 48; j++)
|
||||
{
|
||||
x = ( ((k << j) & 0x800000000000) >> 47 );
|
||||
ambe_d[j] ^= x;
|
||||
}
|
||||
|
||||
k = k << 1;
|
||||
msb = (k >> 32) & 0xFFFF;
|
||||
k = (k << 8) & 0xFFFFFFFF0000;
|
||||
k = k | msb;
|
||||
|
||||
state->HYTR = k;
|
||||
state->DMRvcR++;
|
||||
|
||||
}
|
||||
|
||||
mbe_processAmbe2450Dataf (state->audio_out_temp_bufR, &state->errsR, &state->errs2R, state->err_strR,
|
||||
ambe_d, state->cur_mp2, state->prev_mp2, state->prev_mp_enhanced2, opts->uvquality);
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ char *choices[] = {
|
|||
"Decode NXDN96",
|
||||
"Decode X2-TDMA*",
|
||||
"Toggle Signal Inversion",
|
||||
" ", //spacer
|
||||
"Privacy Key Entry", //spacer
|
||||
"Reset Call History",
|
||||
"Enable Payloads to Console",
|
||||
"Disable Payloads to Console",
|
||||
|
|
@ -312,13 +312,6 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
|||
closePulseInput(opts);
|
||||
}
|
||||
|
||||
if (opts->audio_in_type == 3)
|
||||
{
|
||||
//function hangs, figure out why I can't release/stop the dongle
|
||||
//cleanup_rtlsdr_stream(); //close down the rtl dongle
|
||||
//rtlsdr_sighandler();
|
||||
}
|
||||
|
||||
state->payload_keyid = 0;
|
||||
state->payload_keyidR = 0;
|
||||
|
||||
|
|
@ -809,27 +802,59 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
state->payload_keyid = 0;
|
||||
state->payload_keyidR = 0;
|
||||
state->K = 0;
|
||||
|
||||
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
|
||||
// state->K = 0;
|
||||
// state->H = 0;
|
||||
short int option = 0;
|
||||
entry_win = newwin(9, WIDTH+6, starty+10, startx+10);
|
||||
box (entry_win, 0, 0);
|
||||
mvwprintw(entry_win, 2, 2, " ");
|
||||
mvwprintw(entry_win, 3, 3, " ");
|
||||
mvwprintw(entry_win, 2, 2, "Key Type Selection");
|
||||
mvwprintw(entry_win, 3, 2, " ");
|
||||
mvwprintw(entry_win, 4, 2, "1 - DMRA Privacy ");
|
||||
mvwprintw(entry_win, 5, 2, "2 - 'Tera Privacy ");
|
||||
mvwprintw(entry_win, 6, 3, " ");
|
||||
echo();
|
||||
refresh();
|
||||
wscanw(entry_win, "%d", &state->K);
|
||||
wscanw(entry_win, "%d", &option);
|
||||
noecho();
|
||||
opts->dmr_mute_encL = 0;
|
||||
opts->dmr_mute_encR = 0;
|
||||
if (state->K > 255)
|
||||
if (option == 1)
|
||||
{
|
||||
state->K = 255;
|
||||
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
|
||||
box (entry_win, 0, 0);
|
||||
mvwprintw(entry_win, 2, 2, "DMRA Privacy Key Number (DEC):");
|
||||
mvwprintw(entry_win, 3, 3, " ");
|
||||
echo();
|
||||
refresh();
|
||||
wscanw(entry_win, "%lld", &state->K);
|
||||
noecho();
|
||||
if (state->K > 255)
|
||||
{
|
||||
state->K = 255;
|
||||
}
|
||||
}
|
||||
if (state->K == 0)
|
||||
if (option == 2)
|
||||
{
|
||||
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
|
||||
box (entry_win, 0, 0);
|
||||
mvwprintw(entry_win, 2, 2, "'Tera 10 Key Value (HEX):");
|
||||
mvwprintw(entry_win, 3, 3, " ");
|
||||
echo();
|
||||
refresh();
|
||||
wscanw(entry_win, "%llX", &state->H);
|
||||
noecho();
|
||||
if (state->H > 0xFFFFFFFFFF)
|
||||
{
|
||||
state->H = 0xFFFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
if (state->K == 0 && state->H == 0)
|
||||
{
|
||||
opts->dmr_mute_encL = 1;
|
||||
opts->dmr_mute_encR = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1367,7 +1392,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
}
|
||||
|
||||
if (state->dmrburstR == 16 && state->lastsrcR > 0) //state->currentslot == 1 &&
|
||||
if (state->dmrburstR == 16 && state->lasttgR > 0) //state->currentslot == 1 &&
|
||||
{
|
||||
tgR = state->lasttgR;
|
||||
|
||||
|
|
@ -1766,7 +1791,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||
if (state->payload_algid == 0xAA)
|
||||
{
|
||||
attron(COLOR_PAIR(1));
|
||||
printw(" ADP/RC4");
|
||||
printw(" RC4");
|
||||
attron(COLOR_PAIR(3));
|
||||
}
|
||||
if (state->payload_algid == 0x81)
|
||||
|
|
@ -1810,22 +1835,31 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||
printw ("\n");
|
||||
//printw ("| | "); //10 spaces
|
||||
printw ("| V XTRA | "); //10 spaces
|
||||
//Burger King
|
||||
|
||||
if(state->dmrburstL == 16 && state->payload_algid == 0 && (state->dmr_so & 0xCF) == 0x40) //4F or CF mask? & 0xCF currently
|
||||
{
|
||||
attron(COLOR_PAIR(5));
|
||||
printw (" **BP** ");
|
||||
printw (" **Pr** ");
|
||||
attroff(COLOR_PAIR(5));
|
||||
attron(COLOR_PAIR(3));
|
||||
}
|
||||
//Point
|
||||
if(state->dmrburstL == 16 && state->payload_algid == 0 && state->K > 0 && (state->dmr_so & 0xCF) == 0x40)
|
||||
|
||||
if(state->dmrburstL == 16 && state->payload_algid == 0 && state->K > 0 && state->dmr_fid == 0x10 && (state->dmr_so & 0xCF) == 0x40)
|
||||
{
|
||||
attron(COLOR_PAIR(1));
|
||||
printw ("BPK [%3lld] ", state->K);
|
||||
printw ("DMRA Pr Key [%3lld] ", state->K);
|
||||
attroff(COLOR_PAIR(1));
|
||||
attron(COLOR_PAIR(3));
|
||||
}
|
||||
|
||||
if(state->dmrburstL == 16 && state->payload_algid == 0 && state->H > 0 && state->dmr_fid == 0x68 && ((state->dmr_so & 0xCF) == 0x40) )
|
||||
{
|
||||
attron(COLOR_PAIR(1));
|
||||
printw ("**'Tera Pr Key [%010llX] ", state->H);
|
||||
attroff(COLOR_PAIR(1));
|
||||
attron(COLOR_PAIR(3));
|
||||
}
|
||||
|
||||
//ALG, KeyID, MI //was key_id
|
||||
if(state->dmrburstL == 16 && state->payload_algid > 0 && (state->dmr_so & 0xCF) == 0x40)
|
||||
{
|
||||
|
|
@ -1911,19 +1945,25 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||
//printw ("| | "); //12 spaces
|
||||
printw ("| V XTRA | "); //10 spaces
|
||||
|
||||
//Burger King 2
|
||||
if(state->dmrburstR == 16 && state->payload_algidR == 0 && (state->dmr_soR & 0xCF) == 0x40) //4F or CF mask?
|
||||
{
|
||||
attron(COLOR_PAIR(5));
|
||||
printw (" **BP** ");
|
||||
printw (" **Pr** ");
|
||||
attroff(COLOR_PAIR(5));
|
||||
attron(COLOR_PAIR(3));
|
||||
}
|
||||
//Point 2
|
||||
if(state->dmrburstR == 16 && state->payload_algidR == 0 && state->K > 0 && (state->dmr_soR & 0xCF) == 0x40)
|
||||
|
||||
if(state->dmrburstR == 16 && state->payload_algidR == 0 && state->K > 0 && ((state->dmr_soR & 0xCF) == 0x40) && state->dmr_fidR == 0x10)
|
||||
{
|
||||
attron(COLOR_PAIR(1));
|
||||
printw ("BPK [%3lld] ", state->K);
|
||||
printw ("DMRA Pr Key [%3lld] ", state->K);
|
||||
attroff(COLOR_PAIR(1));
|
||||
attron(COLOR_PAIR(3));
|
||||
}
|
||||
if(state->dmrburstR == 16 && state->payload_algidR == 0 && state->H > 0 && ((state->dmr_soR & 0xCF) == 0x40) && state->dmr_fidR == 0x68)
|
||||
{
|
||||
attron(COLOR_PAIR(1));
|
||||
printw ("**'Tera Pr Key [%010llX] ", state->H);
|
||||
attroff(COLOR_PAIR(1));
|
||||
attron(COLOR_PAIR(3));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
|
|||
//use fopen and read in a symbol, check op25 for clues
|
||||
if(opts->symbolfile == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error Opening File %s\n", opts->symbolfile);
|
||||
fprintf(stderr, "Error Opening File %s\n", opts->audio_in_dev); //double check this
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue