diff --git a/openair1/PHY/CODING/ccoding_byte_NB_IoT.c b/openair1/PHY/CODING/ccoding_byte_NB_IoT.c index b16838d2d1176d533964ff8b3df3bc5ebf07dbcf..198bbb6ab575fa858e2e4cc8f6cd24e257ce532b 100644 --- a/openair1/PHY/CODING/ccoding_byte_NB_IoT.c +++ b/openair1/PHY/CODING/ccoding_byte_NB_IoT.c @@ -12,13 +12,10 @@ * \warning */ -#include "defs.h" - #include "defs_nb_iot.h" unsigned char ccodelte_table_NB_IoT[128]; // for transmitter unsigned short glte_NB_IoT[] = { 0133, 0171, 0165 }; // {A,B} //renaimed but is exactly the same as the one in the old implementation -//unsigned char ccodelte_table_rev[128]; // for receiver /************************************************************************* Encodes for an arbitrary convolutional code of rate 1/3 diff --git a/openair1/PHY/CODING/crc_byte_NB_IoT.c b/openair1/PHY/CODING/crc_byte_NB_IoT.c index 0a96b6bec138bae6be5712fbb9bd674c3626f300..805bb8dc071d8bac83852663c2d8156703beda92 100644 --- a/openair1/PHY/CODING/crc_byte_NB_IoT.c +++ b/openair1/PHY/CODING/crc_byte_NB_IoT.c @@ -34,16 +34,16 @@ //#include "PHY/types.h" -#include "defs.h" // to delete in final code version +//#include "defs.h" // to delete in final code version #include "defs_nb_iot.h" // /*ref 36-212 v8.6.0 , pp 8-9 */ /* the highest degree is set by default */ -unsigned int poly24a = 0x864cfb00; //1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 -unsigned int poly24b = 0x80006300; // 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1 -unsigned int poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 -unsigned int poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 -unsigned int poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 +unsigned int poly24a_NB_IoT = 0x864cfb00; //1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 +unsigned int poly24b_NB_IoT = 0x80006300; // 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1 +unsigned int poly16_NB_IoT = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 +unsigned int poly12_NB_IoT = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 +unsigned int poly8_NB_IoT = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 /********************************************************* For initialization && verification purposes, @@ -78,22 +78,22 @@ crcbit_NB_IoT (unsigned char * inputptr, int octetlen, unsigned int poly) crc table initialization *********************************************************/ -static unsigned int crc24aTable[256]; -static unsigned int crc24bTable[256]; -static unsigned short crc16Table[256]; -static unsigned short crc12Table[256]; -static unsigned char crc8Table[256]; +static unsigned int crc24aTable_NB_IoT[256]; +static unsigned int crc24bTable_NB_IoT[256]; +static unsigned short crc16Table_NB_IoT[256]; +static unsigned short crc12Table_NB_IoT[256]; +static unsigned char crc8Table_NB_IoT[256]; void crcTableInit_NB_IoT (void) { unsigned char c = 0; do { - crc24aTable[c] = crcbit (&c, 1, poly24a); - crc24bTable[c] = crcbit (&c, 1, poly24b); - crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16); - crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16); - crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24); + crc24aTable_NB_IoT[c] = crcbit_NB_IoT (&c, 1, poly24a_NB_IoT); + crc24bTable_NB_IoT[c] = crcbit_NB_IoT (&c, 1, poly24b_NB_IoT); + crc16Table_NB_IoT[c] = (unsigned short) (crcbit_NB_IoT (&c, 1, poly16_NB_IoT) >> 16); + crc12Table_NB_IoT[c] = (unsigned short) (crcbit_NB_IoT (&c, 1, poly12_NB_IoT) >> 16); + crc8Table_NB_IoT[c] = (unsigned char) (crcbit_NB_IoT (&c, 1, poly8_NB_IoT) >> 24); } while (++c); } /********************************************************* @@ -113,11 +113,11 @@ crc24a_NB_IoT (unsigned char * inptr, int bitlen) while (octetlen-- > 0) { // printf("in %x => crc %x\n",crc,*inptr); - crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)]; + crc = (crc << 8) ^ crc24aTable_NB_IoT[(*inptr++) ^ (crc >> 24)]; } if (resbit > 0) - crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; + crc = (crc << resbit) ^ crc24aTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; return crc; } @@ -131,11 +131,11 @@ unsigned int crc24b_NB_IoT (unsigned char * inptr, int bitlen) resbit = (bitlen % 8); while (octetlen-- > 0) { - crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)]; + crc = (crc << 8) ^ crc24bTable_NB_IoT[(*inptr++) ^ (crc >> 24)]; } if (resbit > 0) - crc = (crc << resbit) ^ crc24bTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; + crc = (crc << resbit) ^ crc24bTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; return crc; } @@ -150,11 +150,11 @@ crc16_NB_IoT (unsigned char * inptr, int bitlen) while (octetlen-- > 0) { - crc = (crc << 8) ^ (crc16Table[(*inptr++) ^ (crc >> 24)] << 16); + crc = (crc << 8) ^ (crc16Table_NB_IoT[(*inptr++) ^ (crc >> 24)] << 16); } if (resbit > 0) - crc = (crc << resbit) ^ (crc16Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16); + crc = (crc << resbit) ^ (crc16Table_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16); return crc; } diff --git a/openair1/PHY/CODING/defs_nb_iot.h b/openair1/PHY/CODING/defs_nb_iot.h index d2fbc5e394344dd89559dff3a72e0d0609736917..f4bb70bb4141054b711fe867d0ecd59fd99eeb4b 100644 --- a/openair1/PHY/CODING/defs_nb_iot.h +++ b/openair1/PHY/CODING/defs_nb_iot.h @@ -29,8 +29,22 @@ #define OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_ #include <stdint.h> -//#include "PHY/defs.h" + +#ifndef NO_OPENAIR1 #include "PHY/defs_nb_iot.h" +#else +#include "PHY/TOOLS/time_meas.h" +#endif + +#define CRC24_A_NB_IoT 0 +#define CRC24_B_NB_IoT 1 +#define CRC16_NB_IoT 2 +#define CRC8_NB_IoT 3 + +//#define MAX_TURBO_ITERATIONS_MBSFN 8 // no MBSFN +#define MAX_TURBO_ITERATIONS_NB_IoT 4 + +#define LTE_NULL_NB_IoT 2 /** \fn uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w) \brief This is the subblock interleaving algorithm for convolutionally coded blocks from 36-212 (Release 13.4, 2017). @@ -51,9 +65,9 @@ uint32_t sub_block_interleaving_cc_NB_IoT(uint32_t D, uint8_t *d,uint8_t *w); \returns \f$E\f$, the number of coded bits per segment */ uint32_t lte_rate_matching_cc_NB_IoT(uint32_t RCC, // RRC = 2 - uint16_t E, // E = 1600 - uint8_t *w, // length - uint8_t *e); // length 1600 + uint16_t E, // E = 1600 + uint8_t *w, // length + uint8_t *e); // length 1600 /** \fn void ccodelte_encode(int32_t numbits,uint8_t add_crc, uint8_t *inPtr,uint8_t *outPtr,uint16_t rnti) \brief This function implements the LTE convolutional code of rate 1/3 @@ -106,8 +120,8 @@ uint32_t crc16_NB_IoT (uint8_t *inPtr, int32_t bitlen); uint32_t crcbit_NB_IoT (uint8_t * , - int32_t, - uint32_t); + int32_t, + uint32_t); /** \fn void sub_block_deinterleaving_turbo(uint32_t D, int16_t *d,int16_t *w) \brief This is the subblock deinterleaving algorithm from 36-212 (Release 8, 8.6 2009-03), pages 15-16. diff --git a/openair1/SCHED/IF_Module_L1_primitives_nb_iot.c b/openair1/SCHED/IF_Module_L1_primitives_nb_iot.c index 152f2307aa73db2715e0a4be44b731ee46f9bfa5..8c702dfcfb501cdf7d4b03ee1deea37c9d4a9a74 100644 --- a/openair1/SCHED/IF_Module_L1_primitives_nb_iot.c +++ b/openair1/SCHED/IF_Module_L1_primitives_nb_iot.c @@ -1,7 +1,7 @@ #include "../SCHED/IF_Module_L1_primitives_nb_iot.h" #include "../SCHED/defs.h" #include "../SCHED/defs_nb_iot.h" -#include "common/utils/itti/assertions.h" +#include "assertions.h" #include "PHY/defs.h" #include "PHY/defs_nb_iot.h" //#include "PHY/extern.h" diff --git a/openair1/SCHED/phy_procedures_lte_eNb_nb_iot.c b/openair1/SCHED/phy_procedures_lte_eNb_nb_iot.c index 98921290157726b2ece5afd2a25b9cca6d9735c8..d10d8b8421da859bb697f2de7356b1126f557f8c 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb_nb_iot.c +++ b/openair1/SCHED/phy_procedures_lte_eNb_nb_iot.c @@ -946,7 +946,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int8_t UE_id = 0; int **txdataF = eNB->common_vars.txdataF[0]; uint32_t sib1_startFrame = -1; - NB_IoT_eNB_NPDCCH_t*npdcch; + //NB_IoT_eNB_NPDCCH_t*npdcch;