Commit 9257223e authored by Nick Ho's avatar Nick Ho

Link the physical layer stuff in cmakelist and debugged

parent 15e4e6a4
...@@ -975,6 +975,10 @@ set(PHY_SRC ...@@ -975,6 +975,10 @@ set(PHY_SRC
# depend on code generation from asn1c # depend on code generation from asn1c
${RRC_FULL_DIR}/asn1_constants.h ${RRC_FULL_DIR}/asn1_constants.h
# actual source # actual source
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/npss_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/nsss_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/npbch_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#include "PHY/defs.h" #include "PHY/defs.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"
...@@ -118,10 +119,11 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch, ...@@ -118,10 +119,11 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch,
int amp, int amp,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu, uint8_t *npbch_pdu,
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;
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;
...@@ -139,7 +141,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch, ...@@ -139,7 +141,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch,
if (frame_mod64==0) { if (frame_mod64==0) {
bzero(npbch_a,5); // initializing input data stream , filling with zeros bzero(npbch_a,5); // initializing input data stream , filling with zeros
bzero(eNB_npbch->npbch_e,pbch_E); // filling with "0" the table pbch_e[1600] bzero(eNB_npbch->npbch_e,npbch_E); // filling with "0" the table pbch_e[1600]
memset(eNB_npbch->npbch_d,LTE_NULL,96); // filling with "2" the first 96 elements of table pbch_d[216] memset(eNB_npbch->npbch_d,LTE_NULL,96); // filling with "2" the first 96 elements of table pbch_d[216]
for (i=0; i<5; i++) // set input bits stream for (i=0; i<5; i++) // set input bits stream
...@@ -155,7 +157,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch, ...@@ -155,7 +157,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch,
if (frame_parms->mode1_flag == 1) // setting CRC mask depending on the number of used eNB antennas if (frame_parms->mode1_flag == 1) // setting CRC mask depending on the number of used eNB antennas
amask = 0x0000; amask = 0x0000;
else { else {
switch (frame_parms->nb_antennas_tx_eNB) { // *****???? better replacing nb_antennas_tx_eNB by nb_antennas_tx_eNB_NB_IoT switch (frame_parms->nb_antennas_tx) { // *****???? better replacing nb_antennas_tx_eNB by nb_antennas_tx_eNB_NB_IoT
case 1: case 1:
amask = 0x0000; amask = 0x0000;
break; break;
...@@ -190,9 +192,9 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch, ...@@ -190,9 +192,9 @@ int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch,
if(RB_IoT_ID < (frame_parms->N_RB_DL/2)) if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{ {
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(ceil(frame_parms->N_RB_DL/(float)2))); NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else { } else {
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(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
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
*/ */
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/defs_nb_iot.h"
#include "PHY/extern.h" #include "PHY/extern.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,
...@@ -41,9 +43,9 @@ int generate_npss_NB_IoT(int32_t **txdataF, ...@@ -41,9 +43,9 @@ int generate_npss_NB_IoT(int32_t **txdataF,
if(RB_IoT_ID < (frame_parms->N_RB_DL/2)) if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{ {
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(ceil(frame_parms->N_RB_DL/(float)2))); NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else { } else {
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(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)));
} }
// For the In-band or Stand-alone case the REs of NPSS signal have the same positions // For the In-band or Stand-alone case the REs of NPSS signal have the same positions
for (s=0; s<11; s++ ) // loop on OFDM symbols for (s=0; s<11; s++ ) // loop on OFDM symbols
......
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/defs_nb_iot.h"
#include "defs.h" #include "defs.h"
#include "PHY/extern.h" #include "PHY/extern.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,
...@@ -27,7 +29,6 @@ int generate_sss_NB_IoT(int32_t **txdataF, ...@@ -27,7 +29,6 @@ int generate_sss_NB_IoT(int32_t **txdataF,
{ {
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;
uint8_t Nid2;
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
...@@ -109,9 +110,9 @@ int generate_sss_NB_IoT(int32_t **txdataF, ...@@ -109,9 +110,9 @@ int generate_sss_NB_IoT(int32_t **txdataF,
if(RB_IoT_ID < (frame_parms->N_RB_DL/2)) if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{ {
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(ceil(frame_parms->N_RB_DL/(float)2))); NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else { } else {
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(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)));
} }
// For the In-band or Stand-alone case the REs of NPSS signal have the same positions // For the In-band or Stand-alone case the REs of NPSS signal have the same positions
for (s=0; s<11; s++ ) // loop on OFDM symbols for (s=0; s<11; s++ ) // loop on OFDM symbols
......
...@@ -13,16 +13,17 @@ ...@@ -13,16 +13,17 @@
*/ */
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/defs_nb_iot.h"
void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, void generate_pilots_NB_IoT(PHY_VARS_eNB *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
{ {
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms;
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;
......
...@@ -34,6 +34,59 @@ ...@@ -34,6 +34,59 @@
#include "PHY/defs_nb_iot.h" #include "PHY/defs_nb_iot.h"
#include <math.h> #include <math.h>
//NPSS
int generate_npss_NB_IoT(int32_t **txdataF,
short amp,
LTE_DL_FRAME_PARMS *frame_parms,
unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT
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
//NSSS
int generate_sss_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint16_t symbol_offset, // symbol_offset = 3 for NB-IoT
uint16_t slot_offset,
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
//NRS
void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 10
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
//NPBCH
int allocate_npbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
int16_t amp,
unsigned short id_offset,
uint32_t *re_allocated);
int generate_npbch(NB_IoT_eNB_NPBCH *eNB_npbch,
int32_t **txdataF,
int amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID);
void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e,
uint32_t length);
// Functions below implement 36-211 and 36-212 // Functions below implement 36-211 and 36-212
/*Function to pack the DCI*/ /*Function to pack the DCI*/
......
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