Commit 9b5d4c88 authored by Matthieu Kanj's avatar Matthieu Kanj

Code Separation for openair1/PHY/, (134 warnings)

parent 71780feb
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* \warning * \warning
*/ */
#include "defs_NB_IoT.h" #include "PHY/CODING/defs_NB_IoT.h"
unsigned char ccodelte_table_NB_IoT[128]; // for transmitter 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 short glte_NB_IoT[] = { 0133, 0171, 0165 }; // {A,B} //renaimed but is exactly the same as the one in the old implementation
...@@ -24,15 +24,15 @@ unsigned short glte_NB_IoT[] = { 0133, 0171, 0165 }; // {A,B} //renaimed but is ...@@ -24,15 +24,15 @@ unsigned short glte_NB_IoT[] = { 0133, 0171, 0165 }; // {A,B} //renaimed but is
An optional 8-bit CRC (3GPP) can be added. An optional 8-bit CRC (3GPP) can be added.
Trellis tail-biting is included here Trellis tail-biting is included here
*************************************************************************/ *************************************************************************/
void ccode_encode_NB_IoT (int32_t numbits, void ccode_encode_NB_IoT (int32_t numbits,
uint8_t add_crc, uint8_t add_crc,
uint8_t *inPtr, uint8_t *inPtr,
uint8_t *outPtr, uint8_t *outPtr,
uint16_t rnti) uint16_t rnti)
{ {
uint32_t state; uint32_t state;
uint8_t c, out, first_bit; uint8_t c, out, first_bit;
int8_t shiftbit=0; int8_t shiftbit=0;
uint16_t c16; uint16_t c16;
uint16_t next_last_byte=0; uint16_t next_last_byte=0;
uint32_t crc=0; uint32_t crc=0;
...@@ -42,23 +42,27 @@ void ccode_encode_NB_IoT (int32_t numbits, ...@@ -42,23 +42,27 @@ void ccode_encode_NB_IoT (int32_t numbits,
state = 0; state = 0;
if (add_crc == 2) { if (add_crc == 2) {
crc = crc16_NB_IoT(inPtr,numbits); // crc is 2 bytes
// scramble with RNTI crc = crc16_NB_IoT(inPtr,numbits); // crc is 2 bytes
crc ^= (((uint32_t)rnti)<<16); // XOR with crc // scramble with RNTI
first_bit = 2; crc ^= (((uint32_t)rnti)<<16); // XOR with crc
c = (uint8_t)((crc>>16)&0xff); first_bit = 2;
c = (uint8_t)((crc>>16)&0xff);
} else { } else {
next_last_byte = numbits>>3;
first_bit = (numbits-6)&7; next_last_byte = numbits>>3;
c = inPtr[next_last_byte-1]; first_bit = (numbits-6)&7;
c = inPtr[next_last_byte-1];
} }
// Perform Tail-biting // Perform Tail-biting
// get bits from last byte of input (or crc) // get bits from last byte of input (or crc)
for (shiftbit = 0 ; shiftbit <(8-first_bit) ; shiftbit++) { for (shiftbit = 0 ; shiftbit <(8-first_bit) ; shiftbit++) {
if ((c&(1<<(7-first_bit-shiftbit))) != 0)
state |= (1<<shiftbit); if ((c&(1<<(7-first_bit-shiftbit))) != 0)
state |= (1<<shiftbit);
} }
state = state & 0x3f; // true initial state of Tail-biting CCode state = state & 0x3f; // true initial state of Tail-biting CCode
...@@ -69,20 +73,19 @@ void ccode_encode_NB_IoT (int32_t numbits, ...@@ -69,20 +73,19 @@ void ccode_encode_NB_IoT (int32_t numbits,
c = *inPtr++; c = *inPtr++;
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) { for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) { state >>= 1;
state |= 64;
}
out = ccodelte_table_NB_IoT[state]; if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
*outPtr++ = out & 1; out = ccodelte_table_NB_IoT[state];
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
} }
} }
// now code 16-bit CRC for DCI // Tail-biting is applied to CRC bits , input 16 bits , output 48 bits // now code 16-bit CRC for DCI // Tail-biting is applied to CRC bits , input 16 bits , output 48 bits
...@@ -91,18 +94,18 @@ void ccode_encode_NB_IoT (int32_t numbits, ...@@ -91,18 +94,18 @@ void ccode_encode_NB_IoT (int32_t numbits,
c16 = (uint16_t)(crc>>16); c16 = (uint16_t)(crc>>16);
for (shiftbit = 15; (shiftbit>=0); shiftbit--) { for (shiftbit = 15; (shiftbit>=0); shiftbit--) {
state >>= 1;
if ((c16&(1<<shiftbit)) != 0) { state >>= 1;
state |= 64;
}
out = ccodelte_table_NB_IoT[state]; if ((c16&(1<<shiftbit)) != 0) {
state |= 64;
}
*outPtr++ = out & 1; out = ccodelte_table_NB_IoT[state];
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
} }
} }
} }
...@@ -119,6 +122,7 @@ void ccodelte_init_NB_IoT(void) ...@@ -119,6 +122,7 @@ void ccodelte_init_NB_IoT(void)
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
ccodelte_table_NB_IoT[i] = 0; ccodelte_table_NB_IoT[i] = 0;
/* Compute 3 output bits */ /* Compute 3 output bits */
......
...@@ -36,14 +36,14 @@ ...@@ -36,14 +36,14 @@
//#include "defs.h" // to delete in final code version //#include "defs.h" // to delete in final code version
#include "defs_NB_IoT.h" // #include "PHY/CODING/defs_NB_IoT.h" //
/*ref 36-212 v8.6.0 , pp 8-9 */ /*ref 36-212 v8.6.0 , pp 8-9 */
/* the highest degree is set by default */ /* the highest degree is set by default */
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 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 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 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 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 unsigned int poly8_NB_IoT = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
/********************************************************* /*********************************************************
For initialization && verification purposes, For initialization && verification purposes,
...@@ -52,22 +52,26 @@ For initialization && verification purposes, ...@@ -52,22 +52,26 @@ For initialization && verification purposes,
The first bit is in the MSB of each byte The first bit is in the MSB of each byte
*********************************************************/ *********************************************************/
unsigned int unsigned int crcbit_NB_IoT (unsigned char * inputptr, int octetlen, unsigned int poly)
crcbit_NB_IoT (unsigned char * inputptr, int octetlen, unsigned int poly)
{ {
unsigned int i, crc = 0, c; unsigned int i, crc = 0, c;
while (octetlen-- > 0) { while (octetlen-- > 0) {
c = (*inputptr++) << 24;
c = (*inputptr++) << 24;
for (i = 8; i != 0; i--) { for (i = 8; i != 0; i--) {
if ((1 << 31) & (c ^ crc))
crc = (crc << 1) ^ poly;
else
crc <<= 1;
c <<= 1; if ((1 << 31) & (c ^ crc))
}
crc = (crc << 1) ^ poly;
else
crc <<= 1;
c <<= 1;
}
} }
return crc; return crc;
...@@ -86,15 +90,16 @@ static unsigned char crc8Table_NB_IoT[256]; ...@@ -86,15 +90,16 @@ static unsigned char crc8Table_NB_IoT[256];
void crcTableInit_NB_IoT (void) void crcTableInit_NB_IoT (void)
{ {
unsigned char c = 0; unsigned char c = 0;
do { do {
crc24aTable_NB_IoT[c] = crcbit_NB_IoT (&c, 1, poly24a_NB_IoT); crc24aTable_NB_IoT[c] = crcbit_NB_IoT (&c, 1, poly24a_NB_IoT);
crc24bTable_NB_IoT[c] = crcbit_NB_IoT (&c, 1, poly24b_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); 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); 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); crc8Table_NB_IoT[c] = (unsigned char) (crcbit_NB_IoT (&c, 1, poly8_NB_IoT) >> 24);
} while (++c); } while (++c);
} }
/********************************************************* /*********************************************************
...@@ -102,22 +107,24 @@ Byte by byte implementations, ...@@ -102,22 +107,24 @@ Byte by byte implementations,
assuming initial byte is 0 padded (in MSB) if necessary assuming initial byte is 0 padded (in MSB) if necessary
*********************************************************/ *********************************************************/
unsigned int unsigned int crc24a_NB_IoT (unsigned char * inptr, int bitlen)
crc24a_NB_IoT (unsigned char * inptr, int bitlen)
{ {
int octetlen, resbit; int octetlen, resbit;
unsigned int crc = 0; unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */ octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8); resbit = (bitlen % 8);
while (octetlen-- > 0) { while (octetlen-- > 0) {
// printf("in %x => crc %x\n",crc,*inptr);
crc = (crc << 8) ^ crc24aTable_NB_IoT[(*inptr++) ^ (crc >> 24)]; crc = (crc << 8) ^ crc24aTable_NB_IoT[(*inptr++) ^ (crc >> 24)];
} }
if (resbit > 0) if (resbit > 0)
crc = (crc << resbit) ^ crc24aTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
crc = (crc << resbit) ^ crc24aTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc; return crc;
} }
...@@ -126,41 +133,47 @@ unsigned int crc24b_NB_IoT (unsigned char * inptr, int bitlen) ...@@ -126,41 +133,47 @@ unsigned int crc24b_NB_IoT (unsigned char * inptr, int bitlen)
{ {
int octetlen, resbit; int octetlen, resbit;
unsigned int crc = 0; unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */ octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8); resbit = (bitlen % 8);
while (octetlen-- > 0) { while (octetlen-- > 0) {
crc = (crc << 8) ^ crc24bTable_NB_IoT[(*inptr++) ^ (crc >> 24)];
crc = (crc << 8) ^ crc24bTable_NB_IoT[(*inptr++) ^ (crc >> 24)];
} }
if (resbit > 0) if (resbit > 0)
crc = (crc << resbit) ^ crc24bTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
crc = (crc << resbit) ^ crc24bTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc; return crc;
} }
unsigned int unsigned int crc16_NB_IoT (unsigned char * inptr, int bitlen)
crc16_NB_IoT (unsigned char * inptr, int bitlen)
{ {
int octetlen, resbit; int octetlen, resbit;
unsigned int crc = 0; unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */ octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8); resbit = (bitlen % 8);
while (octetlen-- > 0) { while (octetlen-- > 0) {
crc = (crc << 8) ^ (crc16Table_NB_IoT[(*inptr++) ^ (crc >> 24)] << 16); crc = (crc << 8) ^ (crc16Table_NB_IoT[(*inptr++) ^ (crc >> 24)] << 16);
} }
if (resbit > 0) if (resbit > 0)
crc = (crc << resbit) ^ (crc16Table_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16); crc = (crc << resbit) ^ (crc16Table_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
return crc; return crc;
} }
#ifdef DEBUG_CRC //#ifdef DEBUG_CRC
/*******************************************************************/ /*******************************************************************/
/** /**
Test code Test code
...@@ -177,5 +190,5 @@ crc16_NB_IoT (unsigned char * inptr, int bitlen) ...@@ -177,5 +190,5 @@ crc16_NB_IoT (unsigned char * inptr, int bitlen)
// printf("%x\n", crcbit(test, sizeof(test) - 1, poly8)); // printf("%x\n", crcbit(test, sizeof(test) - 1, poly8));
// printf("%x\n", crc8(test, (sizeof(test) - 1)*8)); // printf("%x\n", crc8(test, (sizeof(test) - 1)*8));
// } // }
#endif //#endif
...@@ -28,13 +28,15 @@ ...@@ -28,13 +28,15 @@
#ifndef OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_ #ifndef OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_
#define OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_ #define OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_
#include <stdint.h> #include <stdint.h> // for uint8/16/32_t
#ifndef NO_OPENAIR1 /* check if this ifndef is required for NB-IoT ?!
#include "PHY/defs_NB_IoT.h" //#ifndef NO_OPENAIR1
#else //#include "PHY/defs_NB_IoT.h"
#include "PHY/TOOLS/time_meas.h" //#else
#endif //#include "PHY/TOOLS/time_meas.h"
//#endif
*/
#define CRC24_A_NB_IoT 0 #define CRC24_A_NB_IoT 0
#define CRC24_B_NB_IoT 1 #define CRC24_B_NB_IoT 1
...@@ -44,7 +46,7 @@ ...@@ -44,7 +46,7 @@
//#define MAX_TURBO_ITERATIONS_MBSFN 8 // no MBSFN //#define MAX_TURBO_ITERATIONS_MBSFN 8 // no MBSFN
#define MAX_TURBO_ITERATIONS_NB_IoT 4 #define MAX_TURBO_ITERATIONS_NB_IoT 4
#define LTE_NULL_NB_IoT 2 #define LTE_NULL_NB_IoT 2 // defined also in PHY/LTE_TRANSPORT/defs_NB_IoT.h
/** \fn uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w) /** \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). \brief This is the subblock interleaving algorithm for convolutionally coded blocks from 36-212 (Release 13.4, 2017).
......
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
* \warning * \warning
*/ */
/* // check if this ifdef MAIN is required for NB-IoT
#ifdef MAIN #ifdef MAIN
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#endif #endif
*/
#include "PHY/defs_NB_IoT.h" #include "PHY/CODING/defs_NB_IoT.h"
#include "assertions.h" //#include "assertions.h"
//#include "PHY/LTE_REFSIG/defs_NB_IoT.h" // does this file is needed ? //#include "PHY/LTE_REFSIG/defs_NB_IoT.h" // does this file is needed ?
...@@ -26,44 +27,44 @@ static uint32_t bitrev_cc_NB_IoT[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15, ...@@ -26,44 +27,44 @@ static uint32_t bitrev_cc_NB_IoT[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,
uint32_t sub_block_interleaving_cc_NB_IoT(uint32_t D, uint8_t *d,uint8_t *w) uint32_t sub_block_interleaving_cc_NB_IoT(uint32_t D, uint8_t *d,uint8_t *w)
{ {
uint32_t RCC = (D>>5), ND, ND3; // D = 50 , uint32_t RCC = (D>>5), ND, ND3; // D = 50 ,
uint32_t row,col,Kpi,index; uint32_t row,col,Kpi,index;
uint32_t index3,k; uint32_t index3,k;
if ((D&0x1f) > 0)
RCC++;
if ((D&0x1f) > 0) Kpi = (RCC<<5); // Kpi = 32
RCC++; ND = Kpi - D;
ND3 = ND*3; // ND3 = ND*3 = 18 *3 = 54
k=0;
Kpi = (RCC<<5); // Kpi = 32 for (col=0; col<32; col++) {
ND = Kpi - D;
ND3 = ND*3; // ND3 = ND*3 = 18 *3 = 54
k=0;
for (col=0; col<32; col++) { index = bitrev_cc_NB_IoT[col];
index3 = 3*index;
index = bitrev_cc_NB_IoT[col]; for (row=0; row<RCC; row++) {
index3 = 3*index;
for (row=0; row<RCC; row++) { w[k] = d[(int32_t)index3-(int32_t)ND3];
w[k] = d[(int32_t)index3-(int32_t)ND3]; w[Kpi+k] = d[(int32_t)index3-(int32_t)ND3+1];
w[Kpi+k] = d[(int32_t)index3-(int32_t)ND3+1]; w[(Kpi<<1)+k] = d[(int32_t)index3-(int32_t)ND3+2];
w[(Kpi<<1)+k] = d[(int32_t)index3-(int32_t)ND3+2];
index3+=96; index3+=96;
index+=32; index+=32;
k++; k++;
}
} }
} return(RCC);
return(RCC);
} }
uint32_t lte_rate_matching_cc_NB_IoT(uint32_t RCC, // RRC = 2 uint32_t lte_rate_matching_cc_NB_IoT(uint32_t RCC, // RRC = 2
uint16_t E, // E = 1600 uint16_t E, // E = 1600
uint8_t *w, // length uint8_t *w, // length
uint8_t *e) // length 1600 uint8_t *e) // length 1600
{ {
uint32_t ind=0,k; uint32_t ind=0,k;
uint16_t Kw = 3*(RCC<<5); // 3*64 = 192 uint16_t Kw = 3*(RCC<<5); // 3*64 = 192
for (k=0; k<E; k++) { for (k=0; k<E; k++) {
......
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
#ifndef __INIT_DEFS_NB_IOT__H__ #ifndef __INIT_DEFS_NB_IOT__H__
#define __INIT_DEFS_NB_IOT__H__ #define __INIT_DEFS_NB_IOT__H__
#include "PHY/defs_NB_IoT.h" //#include "PHY/defs_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
// nfapi_interface.h is required here, it is called through IF_Module_NB_IoT.h
//#include "SystemInformationBlockType2.h" //#include "SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h" //#include "RadioResourceConfigCommonSIB.h"
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
//#include "defs.h" //#include "defs.h"
#include "SCHED/defs_NB_IoT.h" #include "SCHED/defs_NB_IoT.h"
//#include "PHY/extern.h" //#include "PHY/extern.h"
#include "PHY/extern_NB_IoT.h" #include "PHY/extern_NB_IoT.h" // PHY/defs_NB_IoT.h is called here , log.h & LTE_TRANSPORT/defs_NB_IoT.h are included through PHY/defs_NB_IoT.h
//#include "RRC/LITE/proto_NB_IoT.h" #include "RRC/LITE/proto_NB_IoT.h" // for functions: from_earfcn_NB_IoT, get_uldl_offset_NB_IoT
//#include "SIMULATION/TOOLS/defs.h" //#include "SIMULATION/TOOLS/defs.h"
//#include "RadioResourceConfigCommonSIB.h" //#include "RadioResourceConfigCommonSIB.h"
//#include "RadioResourceConfigDedicated.h" //#include "RadioResourceConfigDedicated.h"
...@@ -31,15 +31,16 @@ ...@@ -31,15 +31,16 @@
//#include "LAYER2/MAC/extern.h" //#include "LAYER2/MAC/extern.h"
//#include "MBSFN-SubframeConfigList.h" //#include "MBSFN-SubframeConfigList.h"
//#include "UTIL/LOG/vcd_signal_dumper.h" //#include "UTIL/LOG/vcd_signal_dumper.h"
#define DEBUG_PHY //#define DEBUG_PHY
#include "assertions.h" #include "assertions.h"
#include <math.h> //#include <math.h>
//NB-IoT //NB-IoT
#include "defs_NB_IoT.h" #include "PHY/INIT/defs_NB_IoT.h" // nfapi_interface.h & IF_Module_NB_IoT.h are included here
#include "RadioResourceConfigCommonSIB-NB-r13.h" //#include "RadioResourceConfigCommonSIB-NB-r13.h"
#include "RadioResourceConfigDedicated-NB-r13.h" //#include "RadioResourceConfigDedicated-NB-r13.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" //#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
//#include "openair2/RRC/LITE/proto_NB_IoT.h"
//extern uint16_t prach_root_sequence_map0_3[838]; //extern uint16_t prach_root_sequence_map0_3[838];
//extern uint16_t prach_root_sequence_map4[138]; //extern uint16_t prach_root_sequence_map4[138];
...@@ -67,8 +68,7 @@ void phy_config_mib_eNB_NB_IoT(int Mod_id, ...@@ -67,8 +68,7 @@ void phy_config_mib_eNB_NB_IoT(int Mod_id,
NB_IoT_DL_FRAME_PARMS *fp = &PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->frame_parms_NB_IoT; NB_IoT_DL_FRAME_PARMS *fp = &PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->frame_parms_NB_IoT;
LOG_I(PHY,"Configuring MIB-NB for instance %d, CCid %d : (band %d,Nid_cell %d,p %d,EARFCN %u)\n", LOG_I(PHY,"Configuring MIB-NB for instance %d, CCid %d : (band %d,Nid_cell %d,p %d,EARFCN %u)\n",Mod_id, CC_id, eutra_band, Nid_cell, p_eNB,EARFCN);
Mod_id, CC_id, eutra_band, Nid_cell, p_eNB,EARFCN);
// fp->N_RB_DL // fp->N_RB_DL
// fp->N_RB_UL also this two values need to be known when we are dealing with in-band and guard-band operating mode // fp->N_RB_UL also this two values need to be known when we are dealing with in-band and guard-band operating mode
...@@ -189,12 +189,12 @@ void phy_config_mib_eNB_NB_IoT(int Mod_id, ...@@ -189,12 +189,12 @@ void phy_config_mib_eNB_NB_IoT(int Mod_id,
// //
//} //}
void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id, void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id,
int CC_id, int CC_id,
nfapi_config_NB_IoT_t *config, nfapi_config_NB_IoT_t *config,
nfapi_rf_config_t *rf_config, nfapi_rf_config_t *rf_config,
nfapi_uplink_reference_signal_config_t* ul_nrs_config, nfapi_uplink_reference_signal_config_t *ul_nrs_config,
extra_phyConfig_t* extra_phy_parms) extra_phyConfig_t *extra_phy_parms)
{ {
NB_IoT_DL_FRAME_PARMS *fp = &PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->frame_parms; NB_IoT_DL_FRAME_PARMS *fp = &PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->frame_parms;
LOG_D(PHY,"[eNB%d] CCid %d: Applying config_NB_IoT from sib2_NB\n",Mod_id,CC_id); LOG_D(PHY,"[eNB%d] CCid %d: Applying config_NB_IoT from sib2_NB\n",Mod_id,CC_id);
...@@ -349,37 +349,36 @@ void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id, ...@@ -349,37 +349,36 @@ void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id,
void phy_config_dedicated_eNB_NB_IoT(uint8_t Mod_id, void phy_config_dedicated_eNB_NB_IoT(uint8_t Mod_id,
int CC_id, int CC_id,
uint16_t rnti, uint16_t rnti,
extra_phyConfig_t *extra_parms) extra_phyConfig_t *extra_parms)
{ {
PHY_VARS_eNB_NB_IoT *eNB = PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]; PHY_VARS_eNB_NB_IoT *eNB = PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id];
NB_IoT_eNB_NPDCCH_t *npdcch; NB_IoT_eNB_NPDCCH_t *npdcch;
uint8_t UE_id = find_ue_NB_IoT(rnti,eNB); uint8_t UE_id = find_ue_NB_IoT(rnti,eNB);
if (UE_id == -1) { if (UE_id == -1) {
LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id); LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
return; return;
} }
//configure UE specific parameters for NPDCCH Search Space //configure UE specific parameters for NPDCCH Search Space
//
if (eNB->npdcch[UE_id]) { if (eNB->npdcch[UE_id]) {
npdcch = eNB->npdcch[UE_id]; npdcch = eNB->npdcch[UE_id];
npdcch->rnti = rnti; npdcch->rnti = rnti;
npdcch->npdcch_NumRepetitions = extra_parms->npdcch_NumRepetitions; //Rmax maybe is the only one needed npdcch->npdcch_NumRepetitions = extra_parms->npdcch_NumRepetitions; //Rmax maybe is the only one needed
// npdcch->npdcch_Offset_USS = extra_parms->npdcch_Offset_USS; //npdcch->npdcch_Offset_USS = extra_parms->npdcch_Offset_USS;
// npdcch->npdcch_StartSF_USS = extra_parms->npdcch_StartSF_USS; //npdcch->npdcch_StartSF_USS = extra_parms->npdcch_StartSF_USS;
LOG_I(PHY,"phy_config_dedicated_eNB_NB_IoT: npdcch_NumRepetitions = %d\n", LOG_I(PHY,"phy_config_dedicated_eNB_NB_IoT: npdcch_NumRepetitions = %d\n",npdcch->npdcch_NumRepetitions);
npdcch->npdcch_NumRepetitions);
} else { } else {
LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id); LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
return; return;
} }
} }
......
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
@param lte_gold_table pointer to table where sequences are stored @param lte_gold_table pointer to table where sequences are stored
@param Nid_cell Cell Id for NB_IoT (to compute sequences for local and adjacent cells) */ @param Nid_cell Cell Id for NB_IoT (to compute sequences for local and adjacent cells) */
void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_NB_IoT[20][2][14],uint16_t Nid_cell); void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint32_t lte_gold_table_NB_IoT[20][2][14],
uint16_t Nid_cell);
/*! \brief This function generates the Narrowband reference signal (NRS) sequence (36-211, Sec 6.10.1.1) /*! \brief This function generates the Narrowband reference signal (NRS) sequence (36-211, Sec 6.10.1.1)
@param phy_vars_eNB Pointer to eNB variables @param phy_vars_eNB Pointer to eNB variables
...@@ -38,15 +40,17 @@ void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_ ...@@ -38,15 +40,17 @@ void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_
@param p antenna index @param p antenna index
@param RB_IoT_ID the ID of the RB dedicated for NB_IoT @param RB_IoT_ID the ID of the RB dedicated for NB_IoT
*/ */
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB, int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t *output, int32_t *output,
short amp, short amp,
unsigned char Ns, unsigned char Ns,
unsigned char l, unsigned char l,
unsigned char p, unsigned char p,
unsigned short RB_IoT_ID); unsigned short RB_IoT_ID);
unsigned int lte_gold_generic_NB_IoT(unsigned int *x1, unsigned int *x2, unsigned char reset); unsigned int lte_gold_generic_NB_IoT(unsigned int *x1,
unsigned int *x2,
unsigned char reset);
#endif #endif
...@@ -12,26 +12,27 @@ ...@@ -12,26 +12,27 @@
* \warning * \warning
*/ */
/* check if this is required for NB-IoT
#ifdef USER_MODE #ifdef USER_MODE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#endif #endif
*/
#include "defs_NB_IoT.h" #include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/defs_NB_IoT.h" #include "PHY/defs_NB_IoT.h"
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB, int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t *output, int32_t *output,
short amp, short amp,
unsigned char Ns, unsigned char Ns,
unsigned char l, unsigned char l,
unsigned char p, unsigned char p,
unsigned short RB_IoT_ID) // the ID of the RB dedicated for NB_IoT unsigned short RB_IoT_ID) // the ID of the RB dedicated for NB_IoT
{ {
unsigned char nu,m; unsigned char nu,m;
unsigned short k,a; unsigned short k,a;
unsigned short NB_IoT_start,bandwidth_even_odd; unsigned short NB_IoT_start,bandwidth_even_odd;
int32_t qpsk[4]; int32_t qpsk[4];
a = (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15; a = (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
((short *)&qpsk[0])[0] = a; ((short *)&qpsk[0])[0] = a;
......
...@@ -13,20 +13,18 @@ ...@@ -13,20 +13,18 @@
*/ */
//#include "defs.h" //#include "defs.h"
#include "defs_NB_IoT.h" #include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_NB_IoT[20][2][14],uint16_t Nid_cell) // Nid_cell = Nid_cell_NB_IoT void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_NB_IoT[20][2][14],uint16_t Nid_cell) // Nid_cell = Nid_cell_NB_IoT
{ {
unsigned char ns,l,Ncp=1; unsigned char ns,l,Ncp=1;
unsigned int n,x1,x2; unsigned int n,x1,x2;
for (ns=0; ns<20; ns++) { for (ns=0; ns<20; ns++) {
for (l=0; l<2; l++) { for (l=0; l<2; l++) {
x2 = Ncp + x2 = Ncp + (Nid_cell<<1) + (((1+(Nid_cell<<1))*(1 + (l+5) + (7*(1+ns))))<<10); //cinit
(Nid_cell<<1) +
(((1+(Nid_cell<<1))*(1 + (l+5) + (7*(1+ns))))<<10); //cinit
x1 = 1+ (1<<31); x1 = 1+ (1<<31);
x2 = x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); x2 = x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
......
...@@ -35,8 +35,10 @@ ...@@ -35,8 +35,10 @@
#include <string.h> #include <string.h>
#endif #endif
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h" //#include "PHY/LTE_TRANSPORT/dci_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h" //#include "PHY/CODING/defs_NB_IoT.h"
#include "PHY/defs_NB_IoT.h" // /LTE_TRANSPORT/defs_NB_IoT.h
//#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
//#include "PHY/extern.h" //#include "PHY/extern.h"
//////////#include "PHY/extern_NB_IoT.h" //////////#include "PHY/extern_NB_IoT.h"
//#include "SCHED/defs.h" //#include "SCHED/defs.h"
...@@ -57,17 +59,17 @@ static uint8_t w[2][3*3*(MAX_DCI_SIZE_BITS_NB_IoT+16)]; ...@@ -57,17 +59,17 @@ static uint8_t w[2][3*3*(MAX_DCI_SIZE_BITS_NB_IoT+16)];
void dci_encoding_NB_IoT(uint8_t *a[2], // Array of two DCI pdus, even if one DCI is to transmit , the number of DCI is indicated in dci_number void dci_encoding_NB_IoT(uint8_t *a[2], // Array of two DCI pdus, even if one DCI is to transmit , the number of DCI is indicated in dci_number
uint8_t A, // Length of array a (in number of bytes)(es 4 bytes = 32 bits) is a parameter fixed uint8_t A, // Length of array a (in number of bytes)(es 4 bytes = 32 bits) is a parameter fixed
uint16_t E, // E should equals to G (number of available bits in one RB) uint16_t E, // E should equals to G (number of available bits in one RB)
uint8_t *e[2], // *e should be e[2][G] uint8_t *e[2], // *e should be e[2][G]
uint16_t rnti[2], // RNTI for UE specific or common search space uint16_t rnti[2], // RNTI for UE specific or common search space
uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI) uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI)
uint8_t agr_level) // Aggregation level uint8_t agr_level) // Aggregation level
{ {
uint8_t D = (A + 16); uint8_t D = (A + 16);
uint32_t RCC; uint32_t RCC;
uint8_t occupation_size=1; uint8_t occupation_size=1;
// encode dci // encode dci
if(dci_number == 1) if(dci_number == 1)
{ {
...@@ -109,10 +111,10 @@ void npdcch_scrambling_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms, ...@@ -109,10 +111,10 @@ void npdcch_scrambling_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI) uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI)
uint8_t agr_level) // Aggregation level uint8_t agr_level) // Aggregation level
{ {
int i,k=0; int i,k=0;
uint32_t x1, x2, s=0; uint32_t x1, x2, s=0;
uint8_t reset; uint8_t reset;
uint8_t occupation_size=1; uint8_t occupation_size=1;
reset = 1; reset = 1;
...@@ -178,11 +180,12 @@ int dci_allocate_REs_in_RB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms, ...@@ -178,11 +180,12 @@ int dci_allocate_REs_in_RB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t agr_level) uint8_t agr_level)
{ {
MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)?SISO_NB_IoT:ALAMOUTI_NB_IoT; MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)?SISO_NB_IoT:ALAMOUTI_NB_IoT;
uint32_t tti_offset,aa;
uint8_t re; uint32_t tti_offset,aa;
int16_t gain_lin_QPSK; uint8_t re;
uint8_t first_re,last_re; int16_t gain_lin_QPSK;
int32_t tmp_sample1,tmp_sample2,tmp_sample3,tmp_sample4; uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2,tmp_sample3,tmp_sample4;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15); gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
first_re=0; first_re=0;
...@@ -413,12 +416,13 @@ int dci_modulation_NB_IoT(int32_t **txdataF, ...@@ -413,12 +416,13 @@ int dci_modulation_NB_IoT(int32_t **txdataF,
uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI) uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI)
uint8_t agr_level) // Aggregation level uint8_t agr_level) // Aggregation level
{ {
uint32_t jj=0; uint32_t jj=0;
uint32_t re_allocated,symbol_offset; uint32_t re_allocated,symbol_offset;
uint16_t l; uint16_t l;
uint8_t id_offset,pilots=0; uint8_t id_offset,pilots=0;
unsigned short bandwidth_even_odd; unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start, RB_IoT_ID; unsigned short NB_IoT_start, RB_IoT_ID;
re_allocated=0; re_allocated=0;
id_offset=0; id_offset=0;
// testing if the total number of RBs is even or odd // testing if the total number of RBs is even or odd
...@@ -475,10 +479,10 @@ uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch, ...@@ -475,10 +479,10 @@ uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch,
{ {
int i, G; int i, G;
//temporary variable //temporary variable
uint16_t rnti[2]; uint16_t rnti[2];
uint8_t L = 0; uint8_t L = 0;
/* PARAMETERS may not needed /* PARAMETERS may not needed
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
//#ifndef USER_MODE //#ifndef USER_MODE
//#include "PHY/types.h" //#include "PHY/types.h"
//#else //#else
////////////////////////////////////////#include <stdint.h> #include <stdint.h>
//#endif //#endif
typedef enum typedef enum
......
...@@ -30,20 +30,22 @@ ...@@ -30,20 +30,22 @@
* \warning * \warning
*/ */
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/extern_NB_IoT.h" //#include "PHY/extern_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/extern_NB_IoT.h" //#include "PHY/LTE_TRANSPORT/extern_NB_IoT.h"
#include "SCHED/defs_NB_IoT.h" //#include "SCHED/defs_NB_IoT.h"
/*
#ifdef DEBUG_DCI_TOOLS #ifdef DEBUG_DCI_TOOLS
#include "PHY/vars_NB_IoT.h" #include "PHY/vars_NB_IoT.h"
#endif #endif
#include "assertions.h" */
//#include "assertions.h"
//#include "dlsch_tbs_full.h" //#include "dlsch_tbs_full.h"
#include "PHY/LTE_TRANSPORT/dlsch_tbs_full_NB_IoT.h" #include "PHY/LTE_TRANSPORT/dlsch_tbs_full_NB_IoT.h"
//#define DEBUG_HARQ //#define DEBUG_HARQ
#include "LAYER2/MAC/extern_NB_IoT.h" //#include "LAYER2/MAC/extern_NB_IoT.h"
#include "LAYER2/MAC/defs_NB_IoT.h" //#include "LAYER2/MAC/defs_NB_IoT.h"
#include "PHY/defs_NB_IoT.h" #include "PHY/defs_NB_IoT.h"
//#define DEBUG_DCI //#define DEBUG_DCI
...@@ -53,11 +55,11 @@ void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,void *pdu,rnti_t rnti,unsigned char ...@@ -53,11 +55,11 @@ void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,void *pdu,rnti_t rnti,unsigned char
//put the pdu //put the pdu
memcpy(&DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_pdu[0],pdu,dci_size_bytes); memcpy(&DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_pdu[0],pdu,dci_size_bytes);
//configure the dci alloc //configure the dci alloc
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_length = dci_size_bits; DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_length = dci_size_bits;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].L = aggregation; DCI_pdu->dci_alloc[DCI_pdu->Num_dci].L = aggregation;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].rnti = rnti; DCI_pdu->dci_alloc[DCI_pdu->Num_dci].rnti = rnti;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].format = dci_fmt; DCI_pdu->dci_alloc[DCI_pdu->Num_dci].format = dci_fmt;
DCI_pdu->npdcch_start_symbol = npdcch_start_symbol; DCI_pdu->npdcch_start_symbol = npdcch_start_symbol;
DCI_pdu->Num_dci++; DCI_pdu->Num_dci++;
...@@ -65,14 +67,14 @@ void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,void *pdu,rnti_t rnti,unsigned char ...@@ -65,14 +67,14 @@ void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,void *pdu,rnti_t rnti,unsigned char
} }
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc, eNB_rxtx_proc_NB_IoT_t *proc,
DCI_CONTENT *DCI_Content, DCI_CONTENT *DCI_Content,
uint16_t rnti, uint16_t rnti,
DCI_format_NB_IoT_t dci_format, DCI_format_NB_IoT_t dci_format,
uint8_t UE_id, uint8_t UE_id,
uint8_t aggregation, uint8_t aggregation,
uint8_t npdcch_start_symbol) uint8_t npdcch_start_symbol)
{ {
void *ULSCH_DCI_NB_IoT = NULL; void *ULSCH_DCI_NB_IoT = NULL;
...@@ -141,20 +143,21 @@ int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -141,20 +143,21 @@ int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
//map the Isf (DCI param) to the number of subframes (Nsf) //map the Isf (DCI param) to the number of subframes (Nsf)
int resource_to_subframe[8] = {1,2,3,4,5,6,8,10}; int resource_to_subframe[8] = {1,2,3,4,5,6,8,10};
int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int frame, int frame,
uint8_t subframe, uint8_t subframe,
DCI_CONTENT *DCI_Content, DCI_CONTENT *DCI_Content,
uint16_t rnti, uint16_t rnti,
DCI_format_NB_IoT_t dci_format, DCI_format_NB_IoT_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch, NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_IoT_DL_FRAME_PARMS *frame_parms, NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation, uint8_t aggregation,
uint8_t npdcch_start_symbol) uint8_t npdcch_start_symbol)
{ {
NB_IoT_DL_eNB_HARQ_t* ndlsch_harq = ndlsch->harq_process; NB_IoT_DL_eNB_HARQ_t *ndlsch_harq = ndlsch->harq_process;
void *DLSCH_DCI_NB_IoT = NULL; void *DLSCH_DCI_NB_IoT = NULL;
eNB->DCI_pdu = (DCI_PDU_NB_IoT*) malloc(sizeof(DCI_PDU_NB_IoT)); eNB->DCI_pdu = (DCI_PDU_NB_IoT*) malloc(sizeof(DCI_PDU_NB_IoT));
...@@ -232,15 +235,15 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -232,15 +235,15 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
ndlsch->active = 0; //will be activated by the corresponding NDSLCH pdu ndlsch->active = 0; //will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping. // use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay; ndlsch_harq->scheduling_delay = Sched_delay;
ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlsch_harq->repetition_number = RepNum; ndlsch_harq->repetition_number = RepNum;
ndlsch_harq->dci_subframe_repetitions = DCIRep; ndlsch_harq->dci_subframe_repetitions = DCIRep;
ndlsch_harq->modulation = 2; //QPSK ndlsch_harq->modulation = 2; //QPSK
if(ndlsch_harq->round == 0) //this should be set from initialization (init-lte) if(ndlsch_harq->round == 0) //this should be set from initialization (init-lte)
ndlsch_harq->status = ACTIVE;
ndlsch_harq->status = ACTIVE_NB_IoT;
ndlsch_harq->mcs = mcs; ndlsch_harq->mcs = mcs;
/* /*
* TS 36.213 ch 16.4.1.5 * TS 36.213 ch 16.4.1.5
...@@ -248,8 +251,8 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -248,8 +251,8 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
* ISF = ResAssign * ISF = ResAssign
*/ */
ndlsch_harq->TBS = TBStable_NB_IoT[mcs][ResAssign]; ndlsch_harq->TBS = TBStable_NB_IoT[mcs][ResAssign];
ndlsch_harq->subframe = subframe; ndlsch_harq->subframe = subframe;
//ndlsch_harq->B; we don-t have now my is given when we receive the dlsch data //ndlsch_harq->B; we don-t have now my is given when we receive the dlsch data
//ndlsch->error_treshold //ndlsch->error_treshold
...@@ -298,21 +301,22 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -298,21 +301,22 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
/*Now configure the ndlsch structure*/ /*Now configure the ndlsch structure*/
ndlsch->subframe_tx[subframe] = 1; // check if it's OK ndlsch->subframe_tx[subframe] = 1; // check if it's OK
ndlsch->rnti = rnti; //we store the RNTI (e.g. for RNTI will be used later) ndlsch->rnti = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlsch->active = 0;//will be activated by the corresponding NDSLCH pdu ndlsch->active = 0;//will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping. // use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay; ndlsch_harq->scheduling_delay = Sched_delay;
ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlsch_harq->repetition_number = RepNum; ndlsch_harq->repetition_number = RepNum;
ndlsch_harq->dci_subframe_repetitions = DCIRep; ndlsch_harq->dci_subframe_repetitions = DCIRep;
ndlsch_harq->modulation = 2; //QPSK ndlsch_harq->modulation = 2; //QPSK
if(ndlsch_harq->round == 0){ //this should be set from initialization (init-lte) if(ndlsch_harq->round == 0){ //this should be set from initialization (init-lte)
ndlsch_harq->status = ACTIVE;
ndlsch_harq->mcs = mcs; ndlsch_harq->status = ACTIVE_NB_IoT;
ndlsch_harq->TBS = TBStable_NB_IoT[mcs][ResAssign]; // this table should be rewritten for nb-iot ndlsch_harq->mcs = mcs;
ndlsch_harq->TBS = TBStable_NB_IoT[mcs][ResAssign]; // this table should be rewritten for nb-iot
} }
ndlsch_harq->frame = frame; ndlsch_harq->frame = frame;
ndlsch_harq->subframe = subframe; ndlsch_harq->subframe = subframe;
......
This diff is collapsed.
...@@ -11,20 +11,19 @@ ...@@ -11,20 +11,19 @@
* \note * \note
* \warning * \warning
*/ */
#include <string.h>
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h" //#include "PHY/defs_NB_IoT.h"
#include "PHY/extern_NB_IoT.h" //#include "PHY/extern_NB_IoT.h"
#include "PHY/CODING/defs_NB_IoT.h" #include "PHY/CODING/defs_NB_IoT.h"
//#include "PHY/CODING/extern.h" //#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h" //#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h" #include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h" //#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
#include "SCHED/defs_NB_IoT.h" //#include "SCHED/defs_NB_IoT.h"
//#include "defs_nb_iot.h" //#include "defs_nb_iot.h"
//#include "UTIL/LOG/vcd_signal_dumper.h" //#include "UTIL/LOG/vcd_signal_dumper.h"
#include "PHY/TOOLS/time_meas_NB_IoT.h"
//#include "PHY/LTE_TRANSPORT/defs_nb_iot.h" // newly added for NB_IoT
unsigned char ccodelte_table2_NB_IoT[128]; unsigned char ccodelte_table2_NB_IoT[128];
...@@ -35,12 +34,12 @@ void ccode_encode_npdsch_NB_IoT (int32_t numbits, ...@@ -35,12 +34,12 @@ void ccode_encode_npdsch_NB_IoT (int32_t numbits,
{ {
uint32_t state; uint32_t state;
uint8_t c, out, first_bit; uint8_t c, out, first_bit;
int8_t shiftbit=0; int8_t shiftbit = 0;
/* The input bit is shifted in position 8 of the state. /* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */ Shiftbit will take values between 1 and 8 */
state = 0; state = 0;
first_bit = 2; first_bit = 2;
c = ((uint8_t*)&crc)[0]; c = ((uint8_t*)&crc)[0];
// Perform Tail-biting // Perform Tail-biting
// get bits from last byte of input (or crc) // get bits from last byte of input (or crc)
for (shiftbit = 0 ; shiftbit <(8-first_bit) ; shiftbit++) { for (shiftbit = 0 ; shiftbit <(8-first_bit) ; shiftbit++) {
...@@ -74,19 +73,21 @@ int dlsch_encoding_NB_IoT(unsigned char *a, ...@@ -74,19 +73,21 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
time_stats_t_NB_IoT *te_stats, time_stats_t_NB_IoT *te_stats,
time_stats_t_NB_IoT *i_stats) time_stats_t_NB_IoT *i_stats)
{ {
unsigned int crc=1; unsigned int crc = 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 //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
unsigned int A; unsigned int A;
uint8_t RCC; uint8_t RCC;
A = dlsch->harq_process.TBS; // 680
dlsch->harq_process.length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit A = dlsch->harq_process.TBS; // 680
dlsch->harq_process.length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit
int32_t numbits = A+24; int32_t numbits = A+24;
if (dlsch->harq_process.round == 0) { // This is a new packet if (dlsch->harq_process.round == 0) { // This is a new packet
crc = crc24a_NB_IoT(a,A)>>8; // CRC calculation (24 bits CRC) crc = crc24a_NB_IoT(a,A)>>8; // CRC calculation (24 bits CRC)
// CRC attachment to payload // CRC attachment to payload
a[A>>3] = ((uint8_t*)&crc)[2]; a[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1]; a[1+(A>>3)] = ((uint8_t*)&crc)[1];
a[2+(A>>3)] = ((uint8_t*)&crc)[0]; a[2+(A>>3)] = ((uint8_t*)&crc)[0];
......
...@@ -11,14 +11,16 @@ ...@@ -11,14 +11,16 @@
* \note * \note
* \warning * \warning
*/ */
#include <math.h>
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h" //#include "PHY/defs_NB_IoT.h"
//#include "PHY/extern_NB_IoT.h" //#include "PHY/extern_NB_IoT.h"
//#include "PHY/CODING/defs_nb_iot.h" //#include "PHY/CODING/defs_nb_iot.h"
//#include "PHY/CODING/extern.h" //#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h" //#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h" #include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/impl_defs_top_NB_IoT.h"
//#include "defs.h" //#include "defs.h"
//#include "UTIL/LOG/vcd_signal_dumper.h" //#include "UTIL/LOG/vcd_signal_dumper.h"
...@@ -32,15 +34,17 @@ int allocate_REs_in_RB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms, ...@@ -32,15 +34,17 @@ int allocate_REs_in_RB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
unsigned short id_offset, unsigned short id_offset,
uint32_t *re_allocated) // not used variable ??!! uint32_t *re_allocated) // not used variable ??!!
{ {
MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)?SISO_NB_IoT:ALAMOUTI_NB_IoT; MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)? SISO_NB_IoT:ALAMOUTI_NB_IoT;
uint32_t tti_offset,aa;
uint8_t re; uint32_t tti_offset,aa;
int16_t gain_lin_QPSK; uint8_t re;
uint8_t first_re,last_re; int16_t gain_lin_QPSK;
int32_t tmp_sample1,tmp_sample2; uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15); gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
first_re=0; first_re = 0;
last_re=12; last_re = 12;
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
...@@ -119,24 +123,25 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF, ...@@ -119,24 +123,25 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
{ {
//uint8_t harq_pid = dlsch0->current_harq_pid; //uint8_t harq_pid = dlsch0->current_harq_pid;
//NB_IoT_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid]; //NB_IoT_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid];
uint32_t jj=0; uint32_t jj = 0;
uint32_t re_allocated,symbol_offset; uint32_t re_allocated,symbol_offset;
uint16_t l; uint16_t l;
uint8_t id_offset,pilots=0; uint8_t id_offset,pilots = 0;
unsigned short bandwidth_even_odd; unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start, RB_IoT_ID; unsigned short NB_IoT_start, RB_IoT_ID;
re_allocated=0;
id_offset=0; re_allocated = 0;
id_offset = 0;
// testing if the total number of RBs is even or odd // testing if the total number of RBs is even or odd
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd
RB_IoT_ID = NB_IoT_RB_ID; RB_IoT_ID = NB_IoT_RB_ID;
// step 5, 6, 7 // modulation and mapping (slot 1, symbols 0..3) // step 5, 6, 7 // modulation and mapping (slot 1, symbols 0..3)
for (l=control_region_size; l<14; l++) { // loop on OFDM symbols for (l=control_region_size; l<14; l++) { // loop on OFDM symbols
if((l>=4 && l<=8) || (l>=11 && l<=13)) if((l>=4 && l<=8) || (l>=11 && l<=13))
{ {
pilots =1; pilots = 1;
} else { } else {
pilots=0; pilots = 0;
} }
id_offset = frame_parms->Nid_cell % 3; // Cell_ID_NB_IoT % 3 id_offset = frame_parms->Nid_cell % 3; // Cell_ID_NB_IoT % 3
if(RB_IoT_ID < (frame_parms->N_RB_DL/2)) if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
...@@ -146,6 +151,7 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF, ...@@ -146,6 +151,7 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID % (int)(ceil(frame_parms->N_RB_DL/(float)2))); NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID % (int)(ceil(frame_parms->N_RB_DL/(float)2)));
} }
symbol_offset = frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start symbol_offset = frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start
allocate_REs_in_RB_NB_IoT(frame_parms, allocate_REs_in_RB_NB_IoT(frame_parms,
txdataF, txdataF,
&jj, &jj,
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
//#define DEBUG_SCRAMBLING 1 //#define DEBUG_SCRAMBLING 1
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h" //#include "PHY/defs_NB_IoT.h"
//#include "PHY/CODING/extern.h" //#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h" //#include "PHY/CODING/lte_interleaver_inline.h"
//#include "defs.h" //#include "defs.h"
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
//#include "UTIL/LOG/vcd_signal_dumper.h" //#include "UTIL/LOG/vcd_signal_dumper.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h" #include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void dlsch_scrambling_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms, void dlsch_scrambling_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_DLSCH_t *dlsch, NB_IoT_eNB_DLSCH_t *dlsch,
...@@ -31,11 +33,11 @@ void dlsch_scrambling_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms, ...@@ -31,11 +33,11 @@ void dlsch_scrambling_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t Nf, // Nf is the frame number (0..9) uint8_t Nf, // Nf is the frame number (0..9)
uint8_t Ns) // slot number (0..19) uint8_t Ns) // slot number (0..19)
{ {
int i,j,k=0; int i,j,k=0;
uint32_t x1, x2, s=0; uint32_t x1,x2, s=0;
uint8_t *e=dlsch->harq_process.e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e; uint8_t *e = dlsch->harq_process.e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
x2 = (dlsch->rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 10.2.3.1 x2 = (dlsch->rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 10.2.3.1
s = lte_gold_generic_NB_IoT(&x1, &x2, 1); s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
......
...@@ -13,16 +13,17 @@ ...@@ -13,16 +13,17 @@
*/ */
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h" //#include "PHY/defs_NB_IoT.h"
//#include "PHY/CODING/extern.h" //#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h" //#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
//#include "extern_NB_IoT.h" //#include "extern_NB_IoT.h"
//#include "PHY/extern_NB_IoT.h" //#include "PHY/extern_NB_IoT.h"
//#include "PHY/sse_intrin.h" //#include "PHY/sse_intrin.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/CODING/defs_NB_IoT.h" #include "PHY/CODING/defs_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h" #include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/impl_defs_top_NB_IoT.h"
//#ifdef PHY_ABSTRACTION //#ifdef PHY_ABSTRACTION
//#include "SIMULATION/TOOLS/defs.h" //#include "SIMULATION/TOOLS/defs.h"
...@@ -45,14 +46,16 @@ int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms, ...@@ -45,14 +46,16 @@ int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint32_t *re_allocated) // not used variable ??!! uint32_t *re_allocated) // not used variable ??!!
{ {
MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)?SISO_NB_IoT:ALAMOUTI_NB_IoT; MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)?SISO_NB_IoT:ALAMOUTI_NB_IoT;
uint32_t tti_offset,aa;
uint8_t re; uint32_t tti_offset,aa;
int16_t gain_lin_QPSK; uint8_t re;
uint8_t first_re,last_re; int16_t gain_lin_QPSK;
int32_t tmp_sample1,tmp_sample2; uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15); gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
first_re=0; first_re = 0;
last_re=12; last_re = 12;
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
...@@ -125,19 +128,20 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch, ...@@ -125,19 +128,20 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
uint8_t frame_mod64, uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID) unsigned short NB_IoT_RB_ID)
{ {
int i, l; int i, l;
int id_offset; int id_offset;
uint32_t npbch_D,npbch_E; uint32_t npbch_D,npbch_E;
uint8_t npbch_a[5]; // 34/8 =4.25 => 4 bytes and 2 bits uint8_t npbch_a[5]; // 34/8 =4.25 => 4 bytes and 2 bits
uint8_t RCC; uint8_t RCC;
unsigned short bandwidth_even_odd; unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start, RB_IoT_ID; unsigned short NB_IoT_start, RB_IoT_ID;
uint32_t pilots; uint32_t pilots;
uint32_t jj=0; uint32_t jj=0;
uint32_t re_allocated=0; uint32_t re_allocated=0;
uint32_t symbol_offset; uint32_t symbol_offset;
uint16_t amask=0; uint16_t amask=0;
npbch_D = 16+NPBCH_A;
npbch_D = 16 + NPBCH_A;
npbch_E = 1600; npbch_E = 1600;
if (frame_mod64==0) { if (frame_mod64==0) {
...@@ -147,7 +151,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch, ...@@ -147,7 +151,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
for (i=0; i<5; i++) // set input bits stream for (i=0; i<5; i++) // set input bits stream
{ {
if (i !=4 ) if (i != 4)
{ {
npbch_a[5-i-1] = npbch_pdu[i]; // ????????/*****?? in LTE 24 bits with 3 bytes, but in NB_IoT 34 bits will require 4 bytes+2 bits !! to verify npbch_a[5-i-1] = npbch_pdu[i]; // ????????/*****?? in LTE 24 bits with 3 bytes, but in NB_IoT 34 bits will require 4 bytes+2 bits !! to verify
} else { } else {
...@@ -220,14 +224,17 @@ void npbch_scrambling(NB_IoT_DL_FRAME_PARMS *frame_parms, ...@@ -220,14 +224,17 @@ void npbch_scrambling(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e, uint8_t *npbch_e,
uint32_t length) // 1600 uint32_t length) // 1600
{ {
int i; int i;
uint8_t reset; uint8_t reset;
uint32_t x1, x2, s=0; uint32_t x1, x2, s=0;
reset = 1; reset = 1;
x2 = frame_parms->Nid_cell; x2 = frame_parms->Nid_cell;
for (i=0; i<length; i++) { for (i=0; i<length; i++) {
if ((i&0x1f)==0) { if ((i&0x1f)==0) {
s = lte_gold_generic_NB_IoT(&x1, &x2, reset);
s = lte_gold_generic_NB_IoT(&x1, &x2, reset);
reset = 0; reset = 0;
} }
npbch_e[i] = (npbch_e[i]&1) ^ ((s>>(i&0x1f))&1); npbch_e[i] = (npbch_e[i]&1) ^ ((s>>(i&0x1f))&1);
......
...@@ -21,20 +21,20 @@ ...@@ -21,20 +21,20 @@
//or #include "PHY/defs_nb_iot.h" //or #include "PHY/defs_nb_iot.h"
#include "PHY/LTE_REFSIG/primary_synch_NB_IoT.h" #include "PHY/LTE_REFSIG/primary_synch_NB_IoT.h"
int generate_npss_NB_IoT(int32_t **txdataF, int generate_npss_NB_IoT(int32_t **txdataF,
short amp, short amp,
NB_IoT_DL_FRAME_PARMS *frame_parms, NB_IoT_DL_FRAME_PARMS *frame_parms,
unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT
unsigned short slot_offset, unsigned short slot_offset,
unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
{ {
unsigned short c,aa,a,s; unsigned short c,aa,a,s;
unsigned short slot_id; unsigned short slot_id;
short *primary_sync; short *primary_sync;
unsigned short NB_IoT_start; // Index of the first RE in the RB dedicated for NB-IoT unsigned short NB_IoT_start; // Index of the first RE in the RB dedicated for NB-IoT
unsigned short bandwidth_even_odd; unsigned short bandwidth_even_odd;
slot_id = slot_offset; // The id(0..19) of the slot including the NPSS signal // For NB-IoT, slod_id should be 10 (SF5) slot_id = slot_offset; // The id(0..19) of the slot including the NPSS signal // For NB-IoT, slod_id should be 10 (SF5)
primary_sync = primary_synch_NB_IoT; // primary_synch_NB_IoT[264] of primary_synch_NB_IoT.h primary_sync = primary_synch_NB_IoT; // primary_synch_NB_IoT[264] of primary_synch_NB_IoT.h
// Signal amplitude // Signal amplitude
......
...@@ -12,30 +12,32 @@ ...@@ -12,30 +12,32 @@
* \warning * \warning
*/ */
//#include <math.h>
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h" #include "PHY/defs_NB_IoT.h" // not can be replaced by impl_defs_lte_NB_IoT & impl_defs_top_NB_IoT if "msg" function is not used
//#include "defs.h" //#include "defs.h"
//#include "PHY/extern_NB_IoT.h" //#include "PHY/extern_NB_IoT.h"
//#include "PHY/impl_defs_lte_NB_IoT.h"
//#include "PHY/impl_defs_top_NB_IoT.h"
#include "nsss_NB_IoT.h" #include "nsss_NB_IoT.h"
int generate_sss_NB_IoT(int32_t **txdataF, int generate_sss_NB_IoT(int32_t **txdataF,
int16_t amp, int16_t amp,
NB_IoT_DL_FRAME_PARMS *frame_parms, NB_IoT_DL_FRAME_PARMS *frame_parms,
uint16_t symbol_offset, // symbol_offset = 3 for NB-IoT uint16_t symbol_offset, // symbol_offset = 3 for NB-IoT
uint16_t slot_offset, uint16_t slot_offset,
unsigned short frame_number, // new attribute (Get value from higher layer), it does not exist for LTE unsigned short frame_number, // new attribute (Get value from higher layer), it does not exist for LTE
unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
{ {
uint8_t aa,Nid_NB_IoT,Nid2,f,q,s,c,u; uint8_t aa,Nid_NB_IoT,Nid2,f,q,s,c,u;
int16_t *d; int16_t *d;
uint16_t n_f; uint16_t n_f;
unsigned short a; unsigned short a;
uint16_t slot_id; // slot_id = 17 in NB_IoT uint16_t slot_id; // slot_id = 17 in NB_IoT
unsigned short bandwidth_even_odd; unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start; unsigned short NB_IoT_start;
n_f = frame_number; n_f = frame_number;
Nid_NB_IoT = frame_parms->Nid_cell; // supposing Cell_Id of LTE = Cell_Id of NB-IoT // if different , NB_IOT_DL_FRAME_PARMS should be includes as attribute Nid_NB_IoT = frame_parms->Nid_cell; // supposing Cell_Id of LTE = Cell_Id of NB-IoT // if different , NB_IOT_DL_FRAME_PARMS should be includes as attribute
f = (n_f/2) % 4; // f = 0, 1, 2, 3 f = (n_f/2) % 4; // f = 0, 1, 2, 3
......
...@@ -16,98 +16,99 @@ ...@@ -16,98 +16,99 @@
#include "PHY/defs_NB_IoT.h" #include "PHY/defs_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h" #include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB, void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
uint16_t Ntti, // Ntti = 10 uint16_t Ntti, // Ntti = 10
unsigned short RB_IoT_ID, // RB reserved for NB-IoT unsigned short RB_IoT_ID, // RB reserved for NB-IoT
unsigned short With_NSSS) // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal unsigned short With_NSSS) // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
{ {
NB_IoT_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms_NB_IoT; NB_IoT_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms_NB_IoT;
uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol; uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
uint8_t first_pilot,second_pilot; uint8_t first_pilot,second_pilot;
Nsymb = 14;
first_pilot = 5; // first pilot position Nsymb = 14;
first_pilot = 5; // first pilot position
second_pilot = 6; // second pilot position second_pilot = 6; // second pilot position
for (tti=0; tti<Ntti; tti++) { // loop on sub-frames for (tti=0; tti<Ntti; tti++) { // loop on sub-frames
tti_offset = tti*frame_parms->ofdm_symbol_size*Nsymb; // begins with 0 tti_offset = tti*frame_parms->ofdm_symbol_size*Nsymb; // begins with 0
samples_per_symbol = frame_parms->ofdm_symbol_size; // ex. 512 samples_per_symbol = frame_parms->ofdm_symbol_size; // ex. 512
slot_offset = (tti*2)%20; // 0, 2, 4, ....... 18 slot_offset = (tti*2)%20; // 0, 2, 4, ....... 18
if((slot_offset != 10) && ((With_NSSS*slot_offset) != 18)) { // condition to avoid NPSS and NSSS signals if((slot_offset != 10) && ((With_NSSS*slot_offset) != 18)) { // condition to avoid NPSS and NSSS signals
//Generate Pilots for slot 0 and 1 //Generate Pilots for slot 0 and 1
//antenna 0 symbol 5 slot 0 //antenna 0 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB, lte_dl_cell_spec_NB_IoT(phy_vars_eNB,
&txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits &txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits
amp, amp,
RB_IoT_ID, RB_IoT_ID,
slot_offset, slot_offset,
0, //p 0, //p
0); 0);
//antenna 0 symbol 6 slot 0 //antenna 0 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)], lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)],
amp, amp,
RB_IoT_ID, RB_IoT_ID,
slot_offset, slot_offset,
1, 1,
0); 0);
//antenna 0 symbol 5 slot 1 //antenna 0 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)], lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp, amp,
RB_IoT_ID, RB_IoT_ID,
1+slot_offset, 1+slot_offset,
0, 0,
0); 0);
//antenna 0 symbol 6 slot 1 //antenna 0 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)], lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp, amp,
RB_IoT_ID, RB_IoT_ID,
1+slot_offset, 1+slot_offset,
1, 1,
0); 0);
if (frame_parms->nb_antennas_tx > 1) { // Pilots generation with two antennas if (frame_parms->nb_antennas_tx > 1) { // Pilots generation with two antennas
// antenna 1 symbol 5 slot 0 // antenna 1 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)], lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)],
amp, amp,
RB_IoT_ID, RB_IoT_ID,
slot_offset, slot_offset,
0, 0,
1); 1);
// antenna 1 symbol 6 slot 0 // antenna 1 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)], lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)],
amp, amp,
RB_IoT_ID, RB_IoT_ID,
slot_offset, slot_offset,
1, 1,
1); 1);
//antenna 1 symbol 5 slot 1 //antenna 1 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)], lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp, amp,
RB_IoT_ID, RB_IoT_ID,
1+slot_offset, 1+slot_offset,
0, 0,
1); 1);
// antenna 1 symbol 6 slot 1 // antenna 1 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)], lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp, amp,
RB_IoT_ID, RB_IoT_ID,
1+slot_offset, 1+slot_offset,
1, 1,
1); 1);
} }
} }
} }
......
This diff is collapsed.
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "PHY/types_NB_IoT.h" #ifndef __UCI_NB_IOT__H__
#define __UCI_NB_IOT__H__
//#include "PHY/types_NB_IoT.h"
...@@ -335,4 +337,5 @@ HLC_subband_cqi_mcs_CBA_20MHz; ...@@ -335,4 +337,5 @@ HLC_subband_cqi_mcs_CBA_20MHz;
#define MAX_CQI_BYTES (sizeof(HLC_subband_cqi_rank2_2A_20MHz)) #define MAX_CQI_BYTES (sizeof(HLC_subband_cqi_rank2_2A_20MHz))
#define MAX_ACK_PAYLOAD 18 #define MAX_ACK_PAYLOAD 18
#define MAX_RI_PAYLOAD 6 #define MAX_RI_PAYLOAD 6
*/ */
\ No newline at end of file #endif
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define __IF_MODULE_NB_IoT__H__ #define __IF_MODULE_NB_IoT__H__
#include "nfapi_interface.h" #include "nfapi_interface.h"
#include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h" //#include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PhysicalConfigDedicated-NB-r13.h" #include "PhysicalConfigDedicated-NB-r13.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" //#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "openair2/COMMON/platform_types.h" #include "openair2/COMMON/platform_types.h"
......
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