uint8_tNsf,// number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsignedintG,
uint8_toption)// G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
...
...
@@ -92,158 +133,135 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
uint32_tcrc=1;
//unsigned char harq_pid = dlsch->current_harq_pid; // to check during implementation if harq_pid is required in the NB_IoT_eNB_DLSCH_t structure in defs_NB_IoT.h
//uint8_t option1,option2,option3,option4;
unsignedintA;
unsignedintA=0;
A=dlsch->TBS/8;
uint8_tRCC;
uint8_tnpbch_a[85];
uint8_tnpbch_a_crc[88];
bzero(npbch_a,85);
bzero(npbch_a_crc,88);
A=680;
uint8_tnpbch_a[A];
uint8_tnpbch_a_crc[A+3];
bzero(npbch_a,A);
bzero(npbch_a_crc,A+3);
dlsch->length_e=G*Nsf;// G*Nsf (number_of_subframes) = total number of bits to transmit G=236
int32_tnumbits=A+24;
if(option==1)
{
for(inti=0;i<19;i++)
{
npbch_a[i]=a[i];
}
}else{
for(inti=0;i<33;i++)
for(inti=0;i<A;i++)
{
npbch_a[i]=a[i];
}
}
crc=crc24a_NB_IoT(npbch_a,A)>>8;
int32_tnumbits=(A*8)+24;
crc=crc24a_NB_IoT(npbch_a,A)>>8;
for(intj=0;j<85;j++)
{
npbch_a_crc[j]=npbch_a[j];
}
for(intj=0;j<A;j++)
{
npbch_a_crc[j]=npbch_a[j];
}
npbch_a_crc[A]=((uint8_t*)&crc)[2];
npbch_a_crc[A+1]=((uint8_t*)&crc)[1];
npbch_a_crc[A+2]=((uint8_t*)&crc)[0];
dlsch->B=numbits;// The length of table b in bits
//memcpy(dlsch->b,a,numbits/8); // comment if option 2
//unsigned char harq_pid = dlsch->current_harq_pid; // to check during implementation if harq_pid is required in the NB_IoT_eNB_DLSCH_t structure in defs_NB_IoT.h