Commit c6b11be0 authored by Nick Ho's avatar Nick Ho

code compiled, phy modify

parent 6bc94248
......@@ -1003,6 +1003,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_nb_iot.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c
......
......@@ -2045,7 +2045,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
uint32_t n_rnti,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
//NB_IoT_eNB_NPDCCH_t npdcch,
int32_t **txdataF,
uint32_t subframe)
{
......@@ -2132,24 +2131,11 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
#endif
if (dci_alloc[i].firstCCE>=0) {
//encoding
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length,
dci_alloc[i].L,
dci_alloc[i].rnti);
//new NB-IoT
npdcch_encoding_NB_IoT(
dci_alloc[i].dci_pdu,
frame_parms,
npdcch, //see when function dci_top is called
//no frame
subframe
//rm_stats, te_stats, i_stats
);
}
}
}
......@@ -2171,9 +2157,9 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
dci_alloc[i].L,
dci_alloc[i].rnti);
}
else {
}
else {
}
}
}
}
......@@ -2188,31 +2174,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
//NB-IoT--------------------------
/*
* switch(npdcch_start_index)
* case 0
* G = 272
* case 1
* G = 248
* case 2
* G = 224
* case 3
* G = 200
*/
npdcch_scrambling_NB_IoT(
frame_parms,
npdcch,
//G,
//q = nf mod 2 (TS 36.211 ch 10.2.3.1) with nf = number of frame
//slot_id
);
// Now do modulation
if (frame_parms->mode1_flag==1)
......@@ -2274,18 +2235,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
}
//NB-IoT
npdcch_modulation_NB_IoT(
txdataF,
AMP,
frame_parms,
//no symbol
//npdcch0???
//RB_ID --> statically get from the higher layer (may included in the dl_frame params)
);
#ifdef DEBUG_DCI_ENCODING
printf(" PDCCH Interleaving\n");
#endif
......@@ -2294,9 +2243,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
// This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
pdcch_interleaving(frame_parms,&y[0],&wbar[0],num_pdcch_symbols,mi);
//in NB-IoT the interleaving is done directly with the encoding procedure
mprime=0;
nsymb = (frame_parms->Ncp==0) ? 14:12;
re_offset = frame_parms->first_carrier_offset;
......@@ -2422,7 +2368,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
return(num_pdcch_symbols);
}
#ifdef PHY_ABSTRACTION
uint8_t generate_dci_top_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t num_ue_spec_dci,
......
......@@ -53,22 +53,8 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
uint32_t subframe)
{
uint8_t *e_ptr,num_pdcch_symbols;
int8_t L;
uint32_t i, lprime;
uint32_t gain_lin_QPSK,kprime,kprime_mod12,mprime,nsymb,symbol_offset,tti_offset;
int16_t re_offset;
uint8_t mi = get_mi(frame_parms,subframe);
static uint8_t e[DCI_BITS_MAX];
static int32_t yseq0[Msymb],yseq1[Msymb],wbar0[Msymb],wbar1[Msymb];
int32_t *y[2];
int32_t *wbar[2];
int nushiftmod3 = frame_parms->nushift%3;
int split_flag=0;
int i,L;
/*
**e_ptr : store the encoding result, and as a input to modulation
*num_pdcch_symbols : to calculate the resource allocation for pdcch
......@@ -82,18 +68,6 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//num_pdcch_symbols = get_num_pdcch_symbols(num_ue_spec_dci+num_common_dci,dci_alloc,frame_parms,subframe);
wbar[0] = &wbar0[0];
wbar[1] = &wbar1[0];
y[0] = &yseq0[0];
y[1] = &yseq1[0];
// reset all bits to <NIL>, here we set <NIL> elements as 2
// memset(e, 2, DCI_BITS_MAX);
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
for (i=0; i<DCI_BITS_MAX; i++)
e[i]=taus()&1;
e_ptr = e;
// generate DCIs in order of decreasing aggregation level, then common/ue spec
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
......@@ -104,18 +78,15 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
if (dci_alloc[i].L == (uint8_t)L) {
if (dci_alloc[i].firstCCE>=0) {
//encoding
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,e+(72*dci_alloc[i].firstCCE),dci_alloc[i].dci_length,dci_alloc[i].L,dci_alloc[i].rnti);
//new NB-IoT
npdcch_encoding_NB_IoT(
dci_alloc[i].dci_pdu,
frame_parms,
npdcch, //see when function dci_top is called
//no frame
subframe
//rm_stats, te_stats, i_stats
);
//NB-IoT encoding
/*npdcch_encoding_NB_IoT(dci_alloc[i].dci_pdu,
frame_parms,
npdcch, //see when function dci_top is called
//no frame
subframe
//rm_stats, te_stats, i_stats
);*/
}
......@@ -142,7 +113,8 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
* G = 200
*/
/*
// NB-IoT scrambling
npdcch_scrambling_NB_IoT(
frame_parms,
npdcch,
......@@ -153,7 +125,7 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//NB-IoT
//NB-IoT modulation
npdcch_modulation_NB_IoT(
txdataF,
AMP,
......@@ -161,7 +133,7 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//no symbol
//npdcch0???
//RB_ID --> statically get from the higher layer (may included in the dl_frame params)
);
);*/
......
......@@ -29,6 +29,9 @@
* \note
* \warning
*/
#ifndef __DCI_NB_IOT_H__
#define __DCI_NB_IOT_H__
#ifndef USER_MODE
#include "PHY/types.h"
#else
......@@ -281,3 +284,7 @@ struct DCIN2_Pag{
typedef struct DCIN2_Pag DCIN2_Pag_t;
#define sizeof_DCIN2_Pag_t 15
#define MAX_DCI_SIZE_BITS_NB_IOT 23
#endif
\ No newline at end of file
......@@ -62,8 +62,8 @@ void NB_add_dci(DCI_PDU_NB *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size
}
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
eNB_rxtx_proc_NB_t *proc,
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_t dci_format,
......@@ -137,7 +137,8 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
}
}
int NB_generate_eNB_dlsch_params_from_dci(int frame,
int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
......
......@@ -901,7 +901,7 @@ typedef struct {
/// Pointers to 8 HARQ processes for the ULSCH
LTE_UL_eNB_HARQ_t *harq_process;
/// Maximum number of HARQ rounds
//uint8_t Mlimit;
uint8_t Mlimit;
/// Maximum number of iterations used in eNB turbo decoder
//uint8_t max_turbo_iterations;
//boundling not exist in NB-IoT since we are not using TDD and only 1 HARQ process
......
......@@ -31,36 +31,13 @@
*/
#ifndef __LTE_TRANSPORT_DEFS_NB_IOT__H__
#define __LTE_TRANSPORT_DEFS_NB_IOT__H__
#include "PHY/defs.h"
#include "dci_nb_iot.h"
#include "PHY/defs.h"
#ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h"
#endif
typedef struct {
/// Length of DCI in bits
uint8_t dci_length;
/// Aggregation level only 0,1 in NB-IoT
uint8_t L;
/// Position of first CCE of the dci
int firstCCE;
/// flag to indicate that this is a RA response
boolean_t ra_flag;
/// rnti
rnti_t rnti;
/// Format
DCI_format_NB_t format;
/// DCI pdu
uint8_t dci_pdu[8];
} DCI_ALLOC_NB_t;
typedef struct {
//delete the count for the DCI numbers,NUM_DCI_MAX should set to 1
uint32_t num_npdcch_symbols;
uint8_t Num_dci;
DCI_ALLOC_NB_t dci_alloc[2] ;
} DCI_PDU_NB;
// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table
......
......@@ -93,8 +93,8 @@ void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
void NB_add_dci(DCI_PDU_NB *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt);
/*Use the UL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
eNB_rxtx_proc_NB_t *proc,
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_t dci_format,
......@@ -103,7 +103,8 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
uint8_t Num_dci
);
/*Use the DL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_dlsch_params_from_dci(int frame,
int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
......
......@@ -216,6 +216,7 @@ typedef struct {
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
} eNB_rxtx_proc_t;
typedef struct {
......@@ -428,6 +429,30 @@ typedef struct {
UE_rxtx_proc_t proc_rxtx[2];
} UE_proc_t;
typedef struct {
/// Length of DCI in bits
uint8_t dci_length;
/// Aggregation level only 0,1 in NB-IoT
uint8_t L;
/// Position of first CCE of the dci
int firstCCE;
/// flag to indicate that this is a RA response
boolean_t ra_flag;
/// rnti
rnti_t rnti;
/// Format
DCI_format_NB_t format;
/// DCI pdu
uint8_t dci_pdu[8];
} DCI_ALLOC_NB_t;
typedef struct {
//delete the count for the DCI numbers,NUM_DCI_MAX should set to 1
uint32_t num_npdcch_symbols;
uint8_t Num_dci;
DCI_ALLOC_NB_t dci_alloc[2] ;
} DCI_PDU_NB;
/// Top-level PHY Data Structure for eNB
typedef struct PHY_VARS_eNB_s {
......@@ -667,13 +692,13 @@ typedef struct PHY_VARS_eNB_s {
NB_IoT_eNB_NPBCH npbch;
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAX_NB_IoT]; //check the max size of this array
NB_IoT_eNB_NDLSCH_t *ndlsch[NUMBER_OF_UE_MAX_NB_IoT];
NB_IoT_eNB_NULSCH_t *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1] //nulsch[0] contains the RAR
NB_IoT_eNB_NULSCH_t *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1]; //nulsch[0] contains the RAR
NB_IoT_eNB_NDLSCH_t *dlsch_SI_NB,*dlsch_ra_NB;
NB_DL_FRAME_PARMS frame_parms_nb_iot;
DCI_PDU_NB DCI_pdu;
DCI_PDU_NB *DCI_pdu;
......@@ -960,6 +985,7 @@ void exit_fun(const char* s);
static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
// lock the mutex, if lock successfully, it would return the 0, the other value means failed
if (pthread_mutex_lock(mutex) != 0) {
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
exit_fun("nothing to add");
......
......@@ -172,7 +172,7 @@ typedef struct{
}nulsch_t;
typedef union{
typedef struct{
npdcch_t NB_DCI;
......@@ -182,7 +182,7 @@ typedef union{
nulsch_t NB_UL;
}NB_DL_u;
}NB_DL_t;
typedef struct{
......@@ -198,7 +198,7 @@ typedef struct{
//subframe
sub_frame_t subframeP;
NB_DL_u NB_DL;
NB_DL_t NB_DL;
}Sched_Rsp_t;
......
......@@ -575,7 +575,9 @@ int wait_CCs(eNB_rxtx_proc_t *proc) {
return(0);
}
/*NB-IoT rxtx*/
/*NB-IoT implementation
*rxtx
*/
static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
UL_IND_t UL_INFO; //not here but temp
......@@ -588,9 +590,6 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_
if ((eNB->do_prach)&&((eNB->node_function != NGFI_RCC_IF4p5)))
eNB->do_prach(eNB,proc->frame_rx,proc->subframe_rx);
// skip the comment for this moment
// phy_procedures_eNB_common_RX(eNB,proc);
// UE-specific RX processing for subframe n
......@@ -619,6 +618,51 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_
return(0);
}
/*!
* \brief The RX UE-specific and TX thread of NB-IoT eNB (NB-rxtx).
* \param param is a \ref eNB_proc_t structure which contains the info what to process.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static void* eNB_thread_NB_rxtx( void* param ) {
static int eNB_thread_rxtx_status;
eNB_rxtx_proc_t *proc = (eNB_rxtx_proc_t*)param;
PHY_VARS_eNB *eNB = PHY_vars_eNB_g[0][proc->CC_id];
char thread_name[100];
// set default return value
eNB_thread_rxtx_status = 0;
sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
thread_top_init(thread_name,1,850000L,1000000L,2000000L);
while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 );
if (oai_exit) break;
if (eNB->CC_id==0)
if (NB_rxtx(eNB,proc,thread_name) < 0) break;
} // while !oai_exit
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
printf( "Exiting eNB thread RXn_TXnp4\n");
eNB_thread_rxtx_status = 0;
return &eNB_thread_rxtx_status;
}
static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
start_meas(&softmodem_stats_rxtx_sf);
......
......@@ -171,7 +171,7 @@ void init_lte_eNB_NB(
LOG_I(PHY,"init eNB NB_IoT: Nid_cell %d\n", frame_parms->Nid_cell);
LOG_I(PHY,"init eNB NB_IoT: number of ue max %d number of enb max %d \n",
NUMBER_OF_UE_MAX, NUMBER_OF_eNB_MAX);
LOG_I(PHY,"init eNB NB_IoT: N_RB_DL %d\n", frame_parms->N_RB_DL);
//LOG_I(PHY,"init eNB NB_IoT: N_RB_DL %d\n", frame_parms->N_RB_DL);
//LOG_I(PHY,"init eNB NB_IoT: prach_config_index %d\n", frame_parms->nprach_config_common.prach_ConfigInfo.prach_ConfigIndex);
if (node_function >= NGFI_RRU_IF5)
......@@ -185,15 +185,15 @@ void init_lte_eNB_NB(
* In NB-IoT we not transmit two dlsch pdu at the same time so the dlsch dimension in PHY_vars_eNB for NB-IoT is just an array
*/
for (i=0; i<NUMBER_OF_UE_MAX_NB_IOT; i++) {
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
LOG_I(PHY,"[NB-IoT] Allocating Transport Channel Buffers for NDLSCH, UE %d\n",i);
PHY_vars_eNB->ndlsch[i] = new_eNB_dlsch_NB(NSOFT,abstraction_flag,frame_parms);
if (!PHY_vars_eNB->ndlsch[i]) {
LOG_E(PHY,"Can't get eNB ndlsch structures for UE %d \n", i);
exit(-1);
} else {
LOG_D(PHY,"dlsch[%d] => %p\n",i,PHY_vars_eNB->dlsch[i]);
PHY_vars_eNB->dlsch[i]->rnti=0;
LOG_D(PHY,"dlsch[%d] => %p\n",i,PHY_vars_eNB->ndlsch[i]);
PHY_vars_eNB->ndlsch[i]->rnti=0;
}
......
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