From 0097942732b2ae0d89a307ae0ed55f3187cc8237 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sat, 19 Aug 2023 10:04:09 -0400 Subject: [PATCH] DMR increase BF and block storage; R1 Pad Bit Fix; --- include/dsd.h | 2 +- src/dmr_block.c | 15 ++++++--------- src/dmr_dburst.c | 14 ++++++-------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/include/dsd.h b/include/dsd.h index 3cab3bb..dcd01b8 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -599,7 +599,7 @@ typedef struct //new stuff below here uint8_t data_conf_data[2]; //flag for confirmed data blocks per slot - uint8_t dmr_pdu_sf[2][288]; //unified pdu 'superframe' //[slot][byte] + uint8_t dmr_pdu_sf[2][24*128]; //unified pdu 'superframe' //[slot][byte] -- increased capacity to 127(+1) full rate blocks uint8_t cap_plus_csbk_bits[2][12*8*8]; //CSBK Cap+ FL initial and appended block bit storage, by slot uint8_t cap_plus_block_num[2]; //received block number storage -- per timeslot uint8_t data_block_crc_valid[2][25]; //flag each individual block as good crc on confirmed data diff --git a/src/dmr_block.c b/src/dmr_block.c index ee0d94a..d0a0356 100644 --- a/src/dmr_block.c +++ b/src/dmr_block.c @@ -16,7 +16,7 @@ void dmr_dheader (dsd_opts * opts, dsd_state * state, uint8_t dheader[], uint8_t uint8_t slot = state->currentslot; //clear out unified pdu 'superframe' slot - for (short int i = 0; i < 288; i++) state->dmr_pdu_sf[slot][i] = 0; + for (int i = 0; i < 24*127; i++) state->dmr_pdu_sf[slot][i] = 0; //reset block counter to 1 state->data_block_counter[slot] = 1; @@ -320,7 +320,7 @@ void dmr_dheader (dsd_opts * opts, dsd_state * state, uint8_t dheader[], uint8_t } //block storage sanity - if (state->data_header_blocks[slot] > 9) state->data_header_blocks[slot] = 9; + if (state->data_header_blocks[slot] > 127) state->data_header_blocks[slot] = 127; //assuming we didn't receive the initial data header block on a p_head and then decremented it //3 or 4 seems to be the average safe value if (state->data_header_blocks[slot] < 1) state->data_header_blocks[slot] = 4; @@ -442,7 +442,7 @@ void dmr_block_assembler (dsd_opts * opts, dsd_state * state, uint8_t block_byte //sanity check, setting block_len and block values to sane numbers in case of missing header, else could overload array (crash) or print out if (blocks < 1) blocks = 1; //changed blocks from uint8_t to int - if (blocks > 9) blocks = 9; + if (blocks > 127) blocks = 127; if (block_len == 0) block_len = 18; if (block_len > 24) block_len = 24; @@ -549,11 +549,8 @@ void dmr_block_assembler (dsd_opts * opts, dsd_state * state, uint8_t block_byte fprintf (stderr, "\n Slot %d - Multi Block PDU Message\n ", slot+1); for (i = 0; i < ((blocks+1)*block_len); i++) { + if ( (i != 0) && (i % 12 == 0) ) fprintf (stderr, "\n "); fprintf (stderr, "[%02X]", state->dmr_pdu_sf[slot][i]); - if (i == 11 || i == 23 || i == 35 || i == 47 || i == 59 || i == 71 || i == 83 || i == 95) - { - fprintf (stderr, "\n "); - } } //debug print @@ -719,7 +716,7 @@ void dmr_block_assembler (dsd_opts * opts, dsd_state * state, uint8_t block_byte { //clear out unified pdu 'superframe' slot - for (short int i = 0; i < 288; i++) + for (int i = 0; i < 24*127; i++) { state->dmr_pdu_sf[slot][i] = 0; } @@ -742,7 +739,7 @@ void dmr_block_assembler (dsd_opts * opts, dsd_state * state, uint8_t block_byte { //clear out unified pdu 'superframe' slot - for (short int i = 0; i < 288; i++) + for (int i = 0; i < 24*127; i++) { state->dmr_pdu_sf[slot][i] = 0; } diff --git a/src/dmr_dburst.c b/src/dmr_dburst.c index 018d528..27f94fa 100644 --- a/src/dmr_dburst.c +++ b/src/dmr_dburst.c @@ -497,20 +497,18 @@ void dmr_data_burst_handler(dsd_opts * opts, dsd_state * state, uint8_t info[196 } - if (is_full) //Rate 1 Data -- todo: fix padding bits, the four padding bits are on bit 96,97,98,99 + if (is_full) //Rate 1 Data { CRCExtracted = 0; CRCComputed = 0; IrrecoverableErrors = 0; //implicit, since there is no encoding - for (i = 0; i < 24; i++) - { + for (i = 0; i < 12; i++) DMR_PDU[i] = (uint8_t)ConvertBitIntoBytes(&info[i*8], 8); - } - //leftover 4 bits, manual doesn't say which 4 so assuming last 4 - //pushing last 4 to 25 and shifting it - DMR_PDU[25] = (uint8_t)ConvertBitIntoBytes(&info[192], 4); - DMR_PDU[25] = DMR_PDU[25] << 4; + + //Skip Padding Bits (96,97,98,99) + for (i = 0; i < 12; i++) + DMR_PDU[i+12] = (uint8_t)ConvertBitIntoBytes(&info[(i*8)+100], 8); //set CRC to correct on unconfirmed 1 rate data blocks (for reporting due to no CRC available on these) if (state->data_conf_data[slot] == 0) CRCCorrect = 1;