Commit 99df8881 authored by Matthieu Kanj's avatar Matthieu Kanj

procedures for msg4

parent 72f01769
...@@ -189,6 +189,20 @@ typedef struct { ...@@ -189,6 +189,20 @@ typedef struct {
/// Sub-block interleaver outputs /// Sub-block interleaver outputs
uint8_t w[3*3*(56+24)]; // new parameter uint8_t w[3*3*(56+24)]; // new parameter
/////////////////////////////////
uint16_t si_rnti_x;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e_x[236];
/// data after scrambling
uint8_t s_e_x[236];
//length of the table e
uint16_t length_e_x; // new parameter
/// Tail-biting convolutional coding outputs
uint8_t d_x[96+(3*(24+120))]; // new parameter
/// Sub-block interleaver outputs
uint8_t w_x[3*3*(120+24)]; // new parameter
////////////////////////////////
/// Status Flag indicating for this DLSCH (idle,active,disabled) /// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status; //SCH_status_t status;
/// Transport block size /// Transport block size
......
...@@ -162,8 +162,13 @@ int dlsch_encoding_rar_NB_IoT(unsigned char *a, ...@@ -162,8 +162,13 @@ int dlsch_encoding_rar_NB_IoT(unsigned char *a,
uint8_t npbch_a_crc[10]; uint8_t npbch_a_crc[10];
bzero(npbch_a,7); bzero(npbch_a,7);
bzero(npbch_a_crc,10); bzero(npbch_a_crc,10);
uint8_t npbch_a_x[15];
uint8_t npbch_a_crc_x[18];
bzero(npbch_a_x,15);
bzero(npbch_a_crc_x,18);
A = 56;
dlsch->length_e = G; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236 dlsch->length_e = G; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
...@@ -171,36 +176,65 @@ int dlsch_encoding_rar_NB_IoT(unsigned char *a, ...@@ -171,36 +176,65 @@ int dlsch_encoding_rar_NB_IoT(unsigned char *a,
if(option ==1) if(option ==1)
{ {
A = 56;
for (int i=0; i<7; i++) for (int i=0; i<7; i++)
{ {
npbch_a[i] = a[i]; npbch_a[i] = a[i];
} }
} else { } else {
for (int i=0; i<6; i++) A = 120;
for (int i=0; i<15; i++)
{ {
npbch_a[i] = a[i]; npbch_a_x[i] = a[i];
} }
} }
crc = crc24a_NB_IoT(npbch_a,A)>>8;
if(option==1)
{
crc = crc24a_NB_IoT(npbch_a,A)>>8;
for (int j=0; j<7; j++) for (int j=0; j<7; j++)
{ {
npbch_a_crc[j] = npbch_a[j]; npbch_a_crc[j] = npbch_a[j];
}
npbch_a_crc[7] = ((uint8_t*)&crc)[2];
npbch_a_crc[8] = ((uint8_t*)&crc)[1];
npbch_a_crc[9] = ((uint8_t*)&crc)[0];
dlsch->B = numbits; // The length of table b in bits
//memcpy(dlsch->b,a,numbits/8); // comment if option 2
memset(dlsch->d,LTE_NULL_NB_IoT,96);
ccode_encode_npdsch_NB_IoT(numbits,npbch_a_crc,dlsch->d+96,crc);
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->d+96,dlsch->w); // step 2 interleaving
lte_rate_matching_cc_NB_IoT(RCC,dlsch->length_e,dlsch->w,dlsch->e); // step 3 Rate Matching
} else {
crc = crc24a_NB_IoT(npbch_a_x,A)>>8;
for (int j=0; j<7; j++)
{
npbch_a_crc_x[j] = npbch_a_x[j];
}
npbch_a_crc_x[7] = ((uint8_t*)&crc)[2];
npbch_a_crc_x[8] = ((uint8_t*)&crc)[1];
npbch_a_crc_x[9] = ((uint8_t*)&crc)[0];
dlsch->B = numbits; // The length of table b in bits
//memcpy(dlsch->b,a,numbits/8); // comment if option 2
memset(dlsch->d_x,LTE_NULL_NB_IoT,96);
ccode_encode_npdsch_NB_IoT(numbits,npbch_a_crc_x,dlsch->d_x+96,crc);
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->d_x+96,dlsch->w_x); // step 2 interleaving
lte_rate_matching_cc_NB_IoT(RCC,dlsch->length_e_x,dlsch->w_x,dlsch->e_x); // step 3 Rate Matching
} }
npbch_a_crc[7] = ((uint8_t*)&crc)[2];
npbch_a_crc[8] = ((uint8_t*)&crc)[1];
npbch_a_crc[9] = ((uint8_t*)&crc)[0];
dlsch->B = numbits; // The length of table b in bits
//memcpy(dlsch->b,a,numbits/8); // comment if option 2
memset(dlsch->d,LTE_NULL_NB_IoT,96);
ccode_encode_npdsch_NB_IoT(numbits,npbch_a_crc,dlsch->d+96,crc);
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->d+96,dlsch->w); // step 2 interleaving
lte_rate_matching_cc_NB_IoT(RCC,dlsch->length_e,dlsch->w,dlsch->e); // step 3 Rate Matching
return(0); return(0);
} }
......
...@@ -81,7 +81,7 @@ void dlsch_sib_scrambling_rar_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -81,7 +81,7 @@ void dlsch_sib_scrambling_rar_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int tot_bits, // total number of bits to transmit int tot_bits, // total number of bits to transmit
uint16_t Nf, // Nf is the frame number (0..9) uint16_t Nf, // Nf is the frame number (0..9)
uint8_t Ns, uint8_t Ns,
uint16_t rnti) uint32_t rnti)
{ {
int i,j,k=0; int i,j,k=0;
uint32_t x1,x2, s=0; uint32_t x1,x2, s=0;
......
...@@ -124,7 +124,7 @@ void dlsch_sib_scrambling_rar_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -124,7 +124,7 @@ void dlsch_sib_scrambling_rar_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int tot_bits, // total number of bits to transmit int tot_bits, // total number of bits to transmit
uint16_t Nf, // Nf is the frame number (0..9) uint16_t Nf, // Nf is the frame number (0..9)
uint8_t Ns, uint8_t Ns,
uint16_t rnti); uint32_t rnti);
/* /*
int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms, int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF, int32_t **txdataF,
......
...@@ -78,9 +78,11 @@ typedef struct { ...@@ -78,9 +78,11 @@ typedef struct {
uint8_t rar_to_transmit; uint8_t rar_to_transmit;
uint8_t subframe_SP; uint8_t subframe_SP;
uint8_t subframe_SP2;
int next_frame_tx; int next_frame_tx;
int next_subframe_tx; int next_subframe_tx;
uint8_t SP; uint8_t SP;
uint8_t SP2;
uint8_t there_is_sib23; uint8_t there_is_sib23;
int next_frame_tx_DCI; int next_frame_tx_DCI;
int next_subframe_tx_DCI; int next_subframe_tx_DCI;
...@@ -92,6 +94,17 @@ typedef struct { ...@@ -92,6 +94,17 @@ typedef struct {
uint8_t counter_msg3; uint8_t counter_msg3;
uint32_t frame_msg3; uint32_t frame_msg3;
uint8_t flag_DCI_msg4;
uint8_t flag_msg4;
uint8_t counter_DCI_msg4;
uint8_t counter_msg4;
uint32_t frame_DCI_msg4;
uint32_t frame_msg4;
uint32_t subframe_DCI_msg4;
uint32_t subframe_msg4;
uint8_t guard;
uint8_t remaining_dci; uint8_t remaining_dci;
uint8_t remaining_rar; uint8_t remaining_rar;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment