apply astyle, fix compilation warnings in raw aeth transport and kernel modules
This commit is contained in:
@@ -37,27 +37,25 @@
|
|||||||
extern PHY_VARS_eNB *eNB;
|
extern PHY_VARS_eNB *eNB;
|
||||||
extern PHY_VARS_UE *UE;
|
extern PHY_VARS_UE *UE;
|
||||||
extern RU_t *ru;
|
extern RU_t *ru;
|
||||||
extern void phy_init_RU(RU_t*);
|
extern void phy_init_RU(RU_t *);
|
||||||
|
|
||||||
void lte_param_init(PHY_VARS_eNB **eNBp,
|
void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||||
PHY_VARS_UE **UEp,
|
PHY_VARS_UE **UEp,
|
||||||
RU_t **rup,
|
RU_t **rup,
|
||||||
unsigned char N_tx_port_eNB,
|
unsigned char N_tx_port_eNB,
|
||||||
unsigned char N_tx_phy,
|
unsigned char N_tx_phy,
|
||||||
unsigned char N_rx_ru,
|
unsigned char N_rx_ru,
|
||||||
unsigned char N_rx_ue,
|
unsigned char N_rx_ue,
|
||||||
unsigned char transmission_mode,
|
unsigned char transmission_mode,
|
||||||
uint8_t extended_prefix_flag,
|
uint8_t extended_prefix_flag,
|
||||||
frame_t frame_type,
|
frame_t frame_type,
|
||||||
uint16_t Nid_cell,
|
uint16_t Nid_cell,
|
||||||
uint8_t tdd_config,
|
uint8_t tdd_config,
|
||||||
uint8_t N_RB_DL,
|
uint8_t N_RB_DL,
|
||||||
uint8_t pa,
|
uint8_t pa,
|
||||||
uint8_t threequarter_fs,
|
uint8_t threequarter_fs,
|
||||||
uint8_t osf,
|
uint8_t osf,
|
||||||
uint32_t perfect_ce)
|
uint32_t perfect_ce) {
|
||||||
{
|
|
||||||
|
|
||||||
LTE_DL_FRAME_PARMS *frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms;
|
||||||
int i;
|
int i;
|
||||||
PHY_VARS_eNB *eNB;
|
PHY_VARS_eNB *eNB;
|
||||||
@@ -71,23 +69,16 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
|||||||
UE = *UEp;
|
UE = *UEp;
|
||||||
ru = *rup;
|
ru = *rup;
|
||||||
printf("eNB %p, UE %p, ru %p\n",eNB,UE,ru);
|
printf("eNB %p, UE %p, ru %p\n",eNB,UE,ru);
|
||||||
|
memset((void *)eNB,0,sizeof(PHY_VARS_eNB));
|
||||||
|
memset((void *)UE,0,sizeof(PHY_VARS_UE));
|
||||||
|
memset((void *)ru,0,sizeof(RU_t));
|
||||||
memset((void*)eNB,0,sizeof(PHY_VARS_eNB));
|
|
||||||
memset((void*)UE,0,sizeof(PHY_VARS_UE));
|
|
||||||
memset((void*)ru,0,sizeof(RU_t));
|
|
||||||
|
|
||||||
ru->eNB_list[0] = eNB;
|
ru->eNB_list[0] = eNB;
|
||||||
eNB->RU_list[0] = ru;
|
eNB->RU_list[0] = ru;
|
||||||
ru->num_eNB=1;
|
ru->num_eNB=1;
|
||||||
|
|
||||||
srand(0);
|
srand(0);
|
||||||
randominit(0);
|
randominit(0);
|
||||||
set_taus_seed(0);
|
set_taus_seed(0);
|
||||||
|
|
||||||
frame_parms = &(eNB->frame_parms);
|
frame_parms = &(eNB->frame_parms);
|
||||||
|
|
||||||
frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
|
frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
|
||||||
frame_parms->N_RB_UL = N_RB_DL;
|
frame_parms->N_RB_UL = N_RB_DL;
|
||||||
frame_parms->threequarter_fs = threequarter_fs;
|
frame_parms->threequarter_fs = threequarter_fs;
|
||||||
@@ -106,13 +97,9 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
|||||||
// frame_parms->Bsrs = 0;
|
// frame_parms->Bsrs = 0;
|
||||||
// frame_parms->kTC = 0;44
|
// frame_parms->kTC = 0;44
|
||||||
// frame_parms->n_RRC = 0;
|
// frame_parms->n_RRC = 0;
|
||||||
|
|
||||||
init_frame_parms(frame_parms,osf);
|
init_frame_parms(frame_parms,osf);
|
||||||
|
|
||||||
//copy_lte_parms_to_phy_framing(frame_parms, &(PHY_config->PHY_framing));
|
//copy_lte_parms_to_phy_framing(frame_parms, &(PHY_config->PHY_framing));
|
||||||
|
|
||||||
// phy_init_top(frame_parms); //allocation
|
// phy_init_top(frame_parms); //allocation
|
||||||
|
|
||||||
UE->is_secondary_ue = 0;
|
UE->is_secondary_ue = 0;
|
||||||
UE->frame_parms = *frame_parms;
|
UE->frame_parms = *frame_parms;
|
||||||
UE->frame_parms.nb_antennas_rx=N_rx_ue;
|
UE->frame_parms.nb_antennas_rx=N_rx_ue;
|
||||||
@@ -121,14 +108,10 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
|||||||
ru->nb_tx = N_tx_phy;
|
ru->nb_tx = N_tx_phy;
|
||||||
ru->nb_rx = N_rx_ru;
|
ru->nb_rx = N_rx_ru;
|
||||||
ru->if_south = LOCAL_RF;
|
ru->if_south = LOCAL_RF;
|
||||||
|
|
||||||
eNB->configured=1;
|
eNB->configured=1;
|
||||||
|
|
||||||
eNB->transmission_mode[0] = transmission_mode;
|
eNB->transmission_mode[0] = transmission_mode;
|
||||||
UE->transmission_mode[0] = transmission_mode;
|
UE->transmission_mode[0] = transmission_mode;
|
||||||
|
|
||||||
dump_frame_parms(frame_parms);
|
dump_frame_parms(frame_parms);
|
||||||
|
|
||||||
UE->measurements.n_adj_cells=0;
|
UE->measurements.n_adj_cells=0;
|
||||||
UE->measurements.adj_cell_id[0] = Nid_cell+1;
|
UE->measurements.adj_cell_id[0] = Nid_cell+1;
|
||||||
UE->measurements.adj_cell_id[1] = Nid_cell+2;
|
UE->measurements.adj_cell_id[1] = Nid_cell+2;
|
||||||
@@ -144,7 +127,6 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
|||||||
phy_init_RU(ru);
|
phy_init_RU(ru);
|
||||||
generate_pcfich_reg_mapping(&UE->frame_parms);
|
generate_pcfich_reg_mapping(&UE->frame_parms);
|
||||||
generate_phich_reg_mapping(&UE->frame_parms);
|
generate_phich_reg_mapping(&UE->frame_parms);
|
||||||
|
|
||||||
// DL power control init
|
// DL power control init
|
||||||
//if (transmission_mode == 1) {
|
//if (transmission_mode == 1) {
|
||||||
UE->pdsch_config_dedicated->p_a = pa;
|
UE->pdsch_config_dedicated->p_a = pa;
|
||||||
@@ -166,17 +148,13 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
|||||||
if (eNB->frame_parms.N_RB_DL == 100) ru->N_TA_offset = 624;
|
if (eNB->frame_parms.N_RB_DL == 100) ru->N_TA_offset = 624;
|
||||||
else if (eNB->frame_parms.N_RB_DL == 50) ru->N_TA_offset = 624/2;
|
else if (eNB->frame_parms.N_RB_DL == 50) ru->N_TA_offset = 624/2;
|
||||||
else if (eNB->frame_parms.N_RB_DL == 25) ru->N_TA_offset = 624/4;
|
else if (eNB->frame_parms.N_RB_DL == 25) ru->N_TA_offset = 624/4;
|
||||||
}
|
} else ru->N_TA_offset=0;
|
||||||
else ru->N_TA_offset=0;
|
|
||||||
|
|
||||||
if (IS_SOFTMODEM_BASICSIM)
|
if (IS_SOFTMODEM_BASICSIM)
|
||||||
/* this is required for the basic simulator in TDD mode
|
/* this is required for the basic simulator in TDD mode
|
||||||
* TODO: find a proper cleaner solution
|
* TODO: find a proper cleaner solution
|
||||||
*/
|
*/
|
||||||
UE->N_TA_offset = 0;
|
UE->N_TA_offset = 0;
|
||||||
|
|
||||||
|
|
||||||
printf("Done lte_param_init\n");
|
printf("Done lte_param_init\n");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,35 +64,26 @@ void dci_encoding(uint8_t *a,
|
|||||||
uint8_t A,
|
uint8_t A,
|
||||||
uint16_t E,
|
uint16_t E,
|
||||||
uint8_t *e,
|
uint8_t *e,
|
||||||
uint16_t rnti)
|
uint16_t rnti) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t D = (A + 16);
|
uint8_t D = (A + 16);
|
||||||
uint32_t RCC;
|
uint32_t RCC;
|
||||||
uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||||
uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
int32_t i;
|
int32_t i;
|
||||||
#endif
|
#endif
|
||||||
// encode dci
|
// encode dci
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf("Doing DCI encoding for %d bits, e %p, rnti %x, E %d\n",A,e,rnti,E);
|
printf("Doing DCI encoding for %d bits, e %p, rnti %x, E %d\n",A,e,rnti,E);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset((void *)d,LTE_NULL,96);
|
memset((void *)d,LTE_NULL,96);
|
||||||
|
|
||||||
ccodelte_encode(A,2,a,d+96,rnti);
|
ccodelte_encode(A,2,a,d+96,rnti);
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
|
|
||||||
for (i=0; i<16+A; i++)
|
for (i=0; i<16+A; i++)
|
||||||
printf("%d : (%d,%d,%d)\n",i,*(d+96+(3*i)),*(d+97+(3*i)),*(d+98+(3*i)));
|
printf("%d : (%d,%d,%d)\n",i,*(d+96+(3*i)),*(d+97+(3*i)),*(d+98+(3*i)));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf("Doing DCI interleaving for %d coded bits, e %p\n",D*3,e);
|
printf("Doing DCI interleaving for %d coded bits, e %p\n",D*3,e);
|
||||||
#endif
|
#endif
|
||||||
@@ -100,27 +91,24 @@ void dci_encoding(uint8_t *a,
|
|||||||
|
|
||||||
//#ifdef DEBUG_DCI_ENCODING
|
//#ifdef DEBUG_DCI_ENCODING
|
||||||
if (E>1000) printf("Doing DCI rate matching for %d channel bits, RCC %d, e %p\n",E,RCC,e);
|
if (E>1000) printf("Doing DCI rate matching for %d channel bits, RCC %d, e %p\n",E,RCC,e);
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
lte_rate_matching_cc(RCC,E,w,e);
|
lte_rate_matching_cc(RCC,E,w,e);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t *generate_dci0(uint8_t *dci,
|
uint8_t *generate_dci0(uint8_t *dci,
|
||||||
uint8_t *e,
|
uint8_t *e,
|
||||||
uint8_t DCI_LENGTH,
|
uint8_t DCI_LENGTH,
|
||||||
uint16_t coded_bits,
|
uint16_t coded_bits,
|
||||||
uint16_t rnti)
|
uint16_t rnti) {
|
||||||
{
|
|
||||||
|
|
||||||
uint8_t dci_flip[8];
|
uint8_t dci_flip[8];
|
||||||
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
for (int i=0; i<1+((DCI_LENGTH+16)/8); i++)
|
||||||
for (int i=0;i<1+((DCI_LENGTH+16)/8);i++)
|
|
||||||
printf("i %d : %x\n",i,dci[i]);
|
printf("i %d : %x\n",i,dci[i]);
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if (DCI_LENGTH<=32) {
|
if (DCI_LENGTH<=32) {
|
||||||
dci_flip[0] = dci[3];
|
dci_flip[0] = dci[3];
|
||||||
@@ -129,8 +117,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
|||||||
dci_flip[3] = dci[0];
|
dci_flip[3] = dci[0];
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf("DCI => %x,%x,%x,%x\n",
|
printf("DCI => %x,%x,%x,%x\n",
|
||||||
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3]);
|
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
dci_flip[0] = dci[7];
|
dci_flip[0] = dci[7];
|
||||||
@@ -143,13 +130,12 @@ uint8_t *generate_dci0(uint8_t *dci,
|
|||||||
dci_flip[7] = dci[0];
|
dci_flip[7] = dci[0];
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf("DCI => %x,%x,%x,%x,%x,%x,%x,%x\n",
|
printf("DCI => %x,%x,%x,%x,%x,%x,%x,%x\n",
|
||||||
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3],
|
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3],
|
||||||
dci_flip[4],dci_flip[5],dci_flip[6],dci_flip[7]);
|
dci_flip[4],dci_flip[5],dci_flip[6],dci_flip[7]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
dci_encoding(dci_flip,DCI_LENGTH,coded_bits,e,rnti);
|
dci_encoding(dci_flip,DCI_LENGTH,coded_bits,e,rnti);
|
||||||
|
|
||||||
return(e+coded_bits);
|
return(e+coded_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,9 +146,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi)
|
void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi) {
|
||||||
{
|
|
||||||
|
|
||||||
int32_t *wptr,*wptr2,*zptr;
|
int32_t *wptr,*wptr2,*zptr;
|
||||||
uint32_t Mquad = get_nquad(n_symbols_pdcch,frame_parms,mi);
|
uint32_t Mquad = get_nquad(n_symbols_pdcch,frame_parms,mi);
|
||||||
uint32_t RCC = (Mquad>>5), ND;
|
uint32_t RCC = (Mquad>>5), ND;
|
||||||
@@ -180,7 +164,6 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
|||||||
|
|
||||||
Kpi = (RCC<<5);
|
Kpi = (RCC<<5);
|
||||||
ND = Kpi - Mquad;
|
ND = Kpi - Mquad;
|
||||||
|
|
||||||
k=0;
|
k=0;
|
||||||
|
|
||||||
for (col=0; col<32; col++) {
|
for (col=0; col<32; col++) {
|
||||||
@@ -191,12 +174,9 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
|||||||
if (index>=ND) {
|
if (index>=ND) {
|
||||||
for (a=0; a<frame_parms->nb_antenna_ports_eNB; a++) {
|
for (a=0; a<frame_parms->nb_antenna_ports_eNB; a++) {
|
||||||
//printf("a %d k %d\n",a,k);
|
//printf("a %d k %d\n",a,k);
|
||||||
|
|
||||||
wptr = &wtemp[a][k<<2];
|
wptr = &wtemp[a][k<<2];
|
||||||
zptr = &z[a][(index-ND)<<2];
|
zptr = &z[a][(index-ND)<<2];
|
||||||
|
|
||||||
//printf("wptr=%p, zptr=%p\n",wptr,zptr);
|
//printf("wptr=%p, zptr=%p\n",wptr,zptr);
|
||||||
|
|
||||||
wptr[0] = zptr[0];
|
wptr[0] = zptr[0];
|
||||||
wptr[1] = zptr[1];
|
wptr[1] = zptr[1];
|
||||||
wptr[2] = zptr[2];
|
wptr[2] = zptr[2];
|
||||||
@@ -212,9 +192,7 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
|||||||
|
|
||||||
// permutation
|
// permutation
|
||||||
for (i=0; i<Mquad; i++) {
|
for (i=0; i<Mquad; i++) {
|
||||||
|
|
||||||
for (a=0; a<frame_parms->nb_antenna_ports_eNB; a++) {
|
for (a=0; a<frame_parms->nb_antenna_ports_eNB; a++) {
|
||||||
|
|
||||||
//wptr = &wtemp[a][i<<2];
|
//wptr = &wtemp[a][i<<2];
|
||||||
//wptr2 = &wbar[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
|
//wptr2 = &wbar[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
|
||||||
wptr = &wtemp[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
|
wptr = &wtemp[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
|
||||||
@@ -230,17 +208,13 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
|||||||
void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
uint8_t subframe,
|
uint8_t subframe,
|
||||||
uint8_t *e,
|
uint8_t *e,
|
||||||
uint32_t length)
|
uint32_t length) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
uint8_t reset;
|
uint8_t reset;
|
||||||
uint32_t x1, x2, s=0;
|
uint32_t x1, x2, s=0;
|
||||||
|
|
||||||
//LOG_D(PHY, "%s(fp, subframe:%d, e, length:%d)\n", __FUNCTION__, subframe, length);
|
//LOG_D(PHY, "%s(fp, subframe:%d, e, length:%d)\n", __FUNCTION__, subframe, length);
|
||||||
|
|
||||||
reset = 1;
|
reset = 1;
|
||||||
// x1 is set in lte_gold_generic
|
// x1 is set in lte_gold_generic
|
||||||
|
|
||||||
x2 = (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.8.2
|
x2 = (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.8.2
|
||||||
|
|
||||||
for (i=0; i<length; i++) {
|
for (i=0; i<length; i++) {
|
||||||
@@ -257,16 +231,13 @@ void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||||
uint8_t num_dci,
|
uint8_t num_dci,
|
||||||
DCI_ALLOC_t *dci_alloc,
|
DCI_ALLOC_t *dci_alloc,
|
||||||
uint32_t n_rnti,
|
uint32_t n_rnti,
|
||||||
int16_t amp,
|
int16_t amp,
|
||||||
LTE_DL_FRAME_PARMS *frame_parms,
|
LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
int32_t **txdataF,
|
int32_t **txdataF,
|
||||||
uint32_t subframe)
|
uint32_t subframe) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t *e_ptr;
|
uint8_t *e_ptr;
|
||||||
int8_t L;
|
int8_t L;
|
||||||
uint32_t i, lprime;
|
uint32_t i, lprime;
|
||||||
@@ -276,46 +247,42 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
uint8_t e[DCI_BITS_MAX];
|
uint8_t e[DCI_BITS_MAX];
|
||||||
uint32_t Msymb=(DCI_BITS_MAX/2);
|
uint32_t Msymb=(DCI_BITS_MAX/2);
|
||||||
int32_t yseq0[Msymb],yseq1[Msymb],wbar0[Msymb],wbar1[Msymb];
|
int32_t yseq0[Msymb],yseq1[Msymb],wbar0[Msymb],wbar1[Msymb];
|
||||||
|
|
||||||
int32_t *y[2];
|
int32_t *y[2];
|
||||||
int32_t *wbar[2];
|
int32_t *wbar[2];
|
||||||
|
|
||||||
int nushiftmod3 = frame_parms->nushift%3;
|
int nushiftmod3 = frame_parms->nushift%3;
|
||||||
|
|
||||||
int Msymb2;
|
int Msymb2;
|
||||||
int split_flag=0;
|
int split_flag=0;
|
||||||
|
|
||||||
switch (frame_parms->N_RB_DL) {
|
switch (frame_parms->N_RB_DL) {
|
||||||
case 100:
|
case 100:
|
||||||
Msymb2 = Msymb;
|
Msymb2 = Msymb;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 75:
|
case 75:
|
||||||
Msymb2 = 3*Msymb/4;
|
Msymb2 = 3*Msymb/4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 50:
|
case 50:
|
||||||
Msymb2 = Msymb>>1;
|
Msymb2 = Msymb>>1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 25:
|
case 25:
|
||||||
Msymb2 = Msymb>>2;
|
Msymb2 = Msymb>>2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 15:
|
case 15:
|
||||||
Msymb2 = Msymb*15/100;
|
Msymb2 = Msymb*15/100;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
Msymb2 = Msymb*6/100;
|
Msymb2 = Msymb*6/100;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Msymb2 = Msymb>>2;
|
Msymb2 = Msymb>>2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,1);
|
||||||
generate_pcfich(num_pdcch_symbols,
|
generate_pcfich(num_pdcch_symbols,
|
||||||
amp,
|
amp,
|
||||||
@@ -328,41 +295,37 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
y[0] = &yseq0[0];
|
y[0] = &yseq0[0];
|
||||||
y[1] = &yseq1[0];
|
y[1] = &yseq1[0];
|
||||||
|
|
||||||
if (IS_SOFTMODEM_BASICSIM){
|
if (IS_SOFTMODEM_BASICSIM) {
|
||||||
/* this should be the normal case
|
/* this should be the normal case
|
||||||
* but it has to be validated for all the various cases
|
* but it has to be validated for all the various cases
|
||||||
* so let's just do it for the basic simulator
|
* so let's just do it for the basic simulator
|
||||||
*/
|
*/
|
||||||
// memset(e, 2, DCI_BITS_MAX);
|
// memset(e, 2, DCI_BITS_MAX);
|
||||||
} else {
|
} else {
|
||||||
// reset all bits to <NIL>, here we set <NIL> elements as 2
|
// reset all bits to <NIL>, here we set <NIL> elements as 2
|
||||||
// memset(e, 2, DCI_BITS_MAX);
|
// memset(e, 2, DCI_BITS_MAX);
|
||||||
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
|
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
|
||||||
for (i=0; i<DCI_BITS_MAX; i++)
|
for (i=0; i<DCI_BITS_MAX; i++)
|
||||||
e[i]=taus()&1;
|
e[i]=taus()&1;
|
||||||
|
|
||||||
|
/* clear all bits, the above code may generate too much false detections
|
||||||
/* clear all bits, the above code may generate too much false detections
|
* (not sure about this, to be checked somehow)
|
||||||
* (not sure about this, to be checked somehow)
|
*/
|
||||||
*/
|
//memset(e, 0, DCI_BITS_MAX);
|
||||||
//memset(e, 0, DCI_BITS_MAX);
|
|
||||||
}/* BASIC_SIMULATOR */
|
}/* BASIC_SIMULATOR */
|
||||||
|
|
||||||
e_ptr = e;
|
e_ptr = e;
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,1);
|
||||||
|
|
||||||
// generate DCIs in order of decreasing aggregation level, then common/ue spec
|
// 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
|
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
|
||||||
for (L=8; L>=1; L>>=1) {
|
for (L=8; L>=1; L>>=1) {
|
||||||
for (i=0; i<num_dci; i++) {
|
for (i=0; i<num_dci; i++) {
|
||||||
|
|
||||||
if (dci_alloc[i].L == (uint8_t)L) {
|
if (dci_alloc[i].L == (uint8_t)L) {
|
||||||
|
|
||||||
LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",
|
LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",
|
||||||
i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
|
i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
|
||||||
*(unsigned int*)dci_alloc[i].dci_pdu,
|
*(unsigned int *)dci_alloc[i].dci_pdu,
|
||||||
dci_alloc[i].rnti);
|
dci_alloc[i].rnti);
|
||||||
|
|
||||||
if (dci_alloc[i].firstCCE>=0) {
|
if (dci_alloc[i].firstCCE>=0) {
|
||||||
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
|
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
|
||||||
@@ -374,14 +337,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,0);
|
|
||||||
|
|
||||||
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,0);
|
||||||
// Scrambling
|
// Scrambling
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf("pdcch scrambling\n");
|
printf("pdcch scrambling\n");
|
||||||
#endif
|
#endif
|
||||||
//LOG_D(PHY, "num_pdcch_symbols:%d mi:%d nquad:%d\n", num_pdcch_symbols, mi, get_nquad(num_pdcch_symbols, frame_parms, mi));
|
//LOG_D(PHY, "num_pdcch_symbols:%d mi:%d nquad:%d\n", num_pdcch_symbols, mi, get_nquad(num_pdcch_symbols, frame_parms, mi));
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,1);
|
||||||
pdcch_scrambling(frame_parms,
|
pdcch_scrambling(frame_parms,
|
||||||
subframe,
|
subframe,
|
||||||
@@ -389,11 +351,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
8*get_nquad(num_pdcch_symbols, frame_parms, mi));
|
8*get_nquad(num_pdcch_symbols, frame_parms, mi));
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,0);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,0);
|
||||||
//72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
|
//72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,1);
|
||||||
|
|
||||||
// Now do modulation
|
// Now do modulation
|
||||||
if (frame_parms->nb_antenna_ports_eNB==1)
|
if (frame_parms->nb_antenna_ports_eNB==1)
|
||||||
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
|
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
|
||||||
@@ -401,7 +360,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
gain_lin_QPSK = amp/2;
|
gain_lin_QPSK = amp/2;
|
||||||
|
|
||||||
e_ptr = e;
|
e_ptr = e;
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf(" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d\n",Msymb,Msymb2,gain_lin_QPSK);
|
printf(" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d\n",Msymb,Msymb2,gain_lin_QPSK);
|
||||||
#endif
|
#endif
|
||||||
@@ -409,91 +367,73 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
//LOG_D(PHY,"%s() Msymb2:%d\n", __FUNCTION__, Msymb2);
|
//LOG_D(PHY,"%s() Msymb2:%d\n", __FUNCTION__, Msymb2);
|
||||||
|
|
||||||
if (frame_parms->nb_antenna_ports_eNB==1) { //SISO
|
if (frame_parms->nb_antenna_ports_eNB==1) { //SISO
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<Msymb2; i++) {
|
for (i=0; i<Msymb2; i++) {
|
||||||
|
|
||||||
//((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
//((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
//((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
//((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
((int16_t *)(&(y[0][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
((int16_t *)(&(y[1][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
e_ptr++;
|
e_ptr++;
|
||||||
//((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
//((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
//((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
//((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
((int16_t *)(&(y[0][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
((int16_t *)(&(y[1][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
|
|
||||||
e_ptr++;
|
e_ptr++;
|
||||||
}
|
}
|
||||||
} else { //ALAMOUTI
|
} else { //ALAMOUTI
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<Msymb2; i+=2) {
|
for (i=0; i<Msymb2; i+=2) {
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf(" PDCCH Modulation (TX diversity): REG %d\n",i>>2);
|
printf(" PDCCH Modulation (TX diversity): REG %d\n",i>>2);
|
||||||
#endif
|
#endif
|
||||||
// first antenna position n -> x0
|
// first antenna position n -> x0
|
||||||
((int16_t*)&y[0][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
((int16_t *)&y[0][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
e_ptr++;
|
e_ptr++;
|
||||||
((int16_t*)&y[0][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
((int16_t *)&y[0][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
e_ptr++;
|
e_ptr++;
|
||||||
|
|
||||||
// second antenna position n -> -x1*
|
// second antenna position n -> -x1*
|
||||||
((int16_t*)&y[1][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? gain_lin_QPSK : -gain_lin_QPSK;
|
((int16_t *)&y[1][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? gain_lin_QPSK : -gain_lin_QPSK;
|
||||||
e_ptr++;
|
e_ptr++;
|
||||||
((int16_t*)&y[1][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
((int16_t *)&y[1][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||||
e_ptr++;
|
e_ptr++;
|
||||||
|
|
||||||
// fill in the rest of the ALAMOUTI precoding
|
// fill in the rest of the ALAMOUTI precoding
|
||||||
((int16_t*)&y[0][i+1])[0] = -((int16_t*)&y[1][i])[0];
|
((int16_t *)&y[0][i+1])[0] = -((int16_t *)&y[1][i])[0];
|
||||||
((int16_t*)&y[0][i+1])[1] = ((int16_t*)&y[1][i])[1];
|
((int16_t *)&y[0][i+1])[1] = ((int16_t *)&y[1][i])[1];
|
||||||
((int16_t*)&y[1][i+1])[0] = ((int16_t*)&y[0][i])[0];
|
((int16_t *)&y[1][i+1])[0] = ((int16_t *)&y[0][i])[0];
|
||||||
((int16_t*)&y[1][i+1])[1] = -((int16_t*)&y[0][i])[1];
|
((int16_t *)&y[1][i+1])[1] = -((int16_t *)&y[0][i])[1];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,0);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,0);
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf(" PDCCH Interleaving\n");
|
printf(" PDCCH Interleaving\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,1);
|
||||||
// printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
|
// printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
|
||||||
// This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
|
// 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);
|
pdcch_interleaving(frame_parms,&y[0],&wbar[0],num_pdcch_symbols,mi);
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,0);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,0);
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,1);
|
||||||
mprime=0;
|
mprime=0;
|
||||||
nsymb = (frame_parms->Ncp==0) ? 14:12;
|
nsymb = (frame_parms->Ncp==0) ? 14:12;
|
||||||
re_offset = frame_parms->first_carrier_offset;
|
re_offset = frame_parms->first_carrier_offset;
|
||||||
|
|
||||||
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
|
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
|
||||||
// printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
|
// printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf("kprime loop - N_RB_DL:%d lprime:num_pdcch_symbols:%d Ncp:%d pcfich:%02x,%02x,%02x,%02x ofdm_symbol_size:%d first_carrier_offset:%d nb_antenna_ports_eNB:%d\n",
|
printf("kprime loop - N_RB_DL:%d lprime:num_pdcch_symbols:%d Ncp:%d pcfich:%02x,%02x,%02x,%02x ofdm_symbol_size:%d first_carrier_offset:%d nb_antenna_ports_eNB:%d\n",
|
||||||
frame_parms->N_RB_DL, num_pdcch_symbols,frame_parms->Ncp,
|
frame_parms->N_RB_DL, num_pdcch_symbols,frame_parms->Ncp,
|
||||||
frame_parms->pcfich_reg[0],
|
frame_parms->pcfich_reg[0],
|
||||||
frame_parms->pcfich_reg[1],
|
frame_parms->pcfich_reg[1],
|
||||||
frame_parms->pcfich_reg[2],
|
frame_parms->pcfich_reg[2],
|
||||||
frame_parms->pcfich_reg[3],
|
frame_parms->pcfich_reg[3],
|
||||||
frame_parms->ofdm_symbol_size,
|
frame_parms->ofdm_symbol_size,
|
||||||
frame_parms->first_carrier_offset,
|
frame_parms->first_carrier_offset,
|
||||||
frame_parms->nb_antenna_ports_eNB
|
frame_parms->nb_antenna_ports_eNB
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (kprime=0; kprime<frame_parms->N_RB_DL*12; kprime++) {
|
for (kprime=0; kprime<frame_parms->N_RB_DL*12; kprime++) {
|
||||||
for (lprime=0; lprime<num_pdcch_symbols; lprime++) {
|
for (lprime=0; lprime<num_pdcch_symbols; lprime++) {
|
||||||
|
|
||||||
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(lprime+(subframe*nsymb));
|
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(lprime+(subframe*nsymb));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tti_offset = symbol_offset + re_offset;
|
tti_offset = symbol_offset + re_offset;
|
||||||
|
|
||||||
(re_offset==(frame_parms->ofdm_symbol_size-2)) ? (split_flag=1) : (split_flag=0);
|
(re_offset==(frame_parms->ofdm_symbol_size-2)) ? (split_flag=1) : (split_flag=0);
|
||||||
|
|
||||||
// printf("kprime %d, lprime %d => REG %d (symbol %d)\n",kprime,lprime,(lprime==0)?(kprime/6) : (kprime>>2),symbol_offset);
|
// printf("kprime %d, lprime %d => REG %d (symbol %d)\n",kprime,lprime,(lprime==0)?(kprime/6) : (kprime>>2),symbol_offset);
|
||||||
@@ -504,16 +444,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Copy REG to TX buffer
|
// Copy REG to TX buffer
|
||||||
|
|
||||||
if ((lprime == 0)||
|
if ((lprime == 0)||
|
||||||
((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) {
|
((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) {
|
||||||
// first symbol, or second symbol+4 TX antennas skip pilots
|
// first symbol, or second symbol+4 TX antennas skip pilots
|
||||||
|
|
||||||
kprime_mod12 = kprime%12;
|
kprime_mod12 = kprime%12;
|
||||||
|
|
||||||
if ((kprime_mod12 == 0) || (kprime_mod12 == 6)) {
|
if ((kprime_mod12 == 0) || (kprime_mod12 == 6)) {
|
||||||
// kprime represents REG
|
// kprime represents REG
|
||||||
|
|
||||||
for (i=0; i<6; i++) {
|
for (i=0; i<6; i++) {
|
||||||
if ((i!=(nushiftmod3))&&(i!=(nushiftmod3+3))) {
|
if ((i!=(nushiftmod3))&&(i!=(nushiftmod3+3))) {
|
||||||
txdataF[0][tti_offset+i] = wbar[0][mprime];
|
txdataF[0][tti_offset+i] = wbar[0][mprime];
|
||||||
@@ -522,9 +459,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
txdataF[1][tti_offset+i] = wbar[1][mprime];
|
txdataF[1][tti_offset+i] = wbar[1][mprime];
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mprime++;
|
mprime++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -542,7 +478,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
txdataF[1][tti_offset+i] = wbar[1][mprime];
|
txdataF[1][tti_offset+i] = wbar[1][mprime];
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||||
#endif
|
#endif
|
||||||
mprime++;
|
mprime++;
|
||||||
}
|
}
|
||||||
@@ -553,7 +489,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
txdataF[1][tti_offset+0] = wbar[1][mprime];
|
txdataF[1][tti_offset+0] = wbar[1][mprime];
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||||
#endif
|
#endif
|
||||||
mprime++;
|
mprime++;
|
||||||
txdataF[0][tti_offset+1] = wbar[0][mprime];
|
txdataF[0][tti_offset+1] = wbar[0][mprime];
|
||||||
@@ -562,7 +498,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
txdataF[1][tti_offset+1] = wbar[1][mprime];
|
txdataF[1][tti_offset+1] = wbar[1][mprime];
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf("PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+1,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
printf("PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+1,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||||
#endif
|
#endif
|
||||||
mprime++;
|
mprime++;
|
||||||
txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[0][mprime];
|
txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[0][mprime];
|
||||||
@@ -571,8 +507,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[1][mprime];
|
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[1][mprime];
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+3,*(short*)&wbar[0][mprime],
|
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+3,*(short *)&wbar[0][mprime],
|
||||||
*(1+(short*)&wbar[0][mprime]));
|
*(1+(short *)&wbar[0][mprime]));
|
||||||
#endif
|
#endif
|
||||||
mprime++;
|
mprime++;
|
||||||
txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[0][mprime];
|
txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[0][mprime];
|
||||||
@@ -581,11 +517,10 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[1][mprime];
|
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[1][mprime];
|
||||||
|
|
||||||
#ifdef DEBUG_DCI_ENCODING
|
#ifdef DEBUG_DCI_ENCODING
|
||||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+4,*(short*)&wbar[0][mprime],
|
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+4,*(short *)&wbar[0][mprime],
|
||||||
*(1+(short*)&wbar[0][mprime]));
|
*(1+(short *)&wbar[0][mprime]));
|
||||||
#endif
|
#endif
|
||||||
mprime++;
|
mprime++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -593,7 +528,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
if (mprime>=Msymb2)
|
if (mprime>=Msymb2)
|
||||||
return(num_pdcch_symbols);
|
return(num_pdcch_symbols);
|
||||||
} // check_phich_reg
|
} // check_phich_reg
|
||||||
|
|
||||||
} //lprime loop
|
} //lprime loop
|
||||||
|
|
||||||
re_offset++;
|
re_offset++;
|
||||||
@@ -601,8 +535,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
|||||||
if (re_offset == (frame_parms->ofdm_symbol_size))
|
if (re_offset == (frame_parms->ofdm_symbol_size))
|
||||||
re_offset = 1;
|
re_offset = 1;
|
||||||
} // kprime loop
|
} // kprime loop
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,0);
|
|
||||||
|
|
||||||
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,0);
|
||||||
return(num_pdcch_symbols);
|
return(num_pdcch_symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,66 +44,59 @@ int generate_pss(int32_t **txdataF,
|
|||||||
short amp,
|
short amp,
|
||||||
LTE_DL_FRAME_PARMS *frame_parms,
|
LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
unsigned short symbol,
|
unsigned short symbol,
|
||||||
unsigned short slot_offset)
|
unsigned short slot_offset) {
|
||||||
{
|
|
||||||
|
|
||||||
unsigned int Nsymb;
|
unsigned int Nsymb;
|
||||||
unsigned short k,m,aa,a;
|
unsigned short k,m,aa,a;
|
||||||
uint8_t Nid2;
|
uint8_t Nid2;
|
||||||
short *primary_sync;
|
short *primary_sync;
|
||||||
|
|
||||||
|
|
||||||
Nid2 = frame_parms->Nid_cell % 3;
|
Nid2 = frame_parms->Nid_cell % 3;
|
||||||
|
|
||||||
switch (Nid2) {
|
switch (Nid2) {
|
||||||
case 0:
|
case 0:
|
||||||
primary_sync = primary_synch0;
|
primary_sync = primary_synch0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
primary_sync = primary_synch1;
|
primary_sync = primary_synch1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
primary_sync = primary_synch2;
|
primary_sync = primary_synch2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_E(PHY,"[PSS] eNb_id has to be 0,1,2\n");
|
LOG_E(PHY,"[PSS] eNb_id has to be 0,1,2\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||||
//printf("[PSS] amp=%d, a=%d\n",amp,a);
|
//printf("[PSS] amp=%d, a=%d\n",amp,a);
|
||||||
|
|
||||||
if (IS_SOFTMODEM_BASICSIM)
|
if (IS_SOFTMODEM_BASICSIM)
|
||||||
/* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
|
/* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
|
||||||
a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||||
|
|
||||||
Nsymb = (frame_parms->Ncp==NORMAL)?14:12;
|
Nsymb = (frame_parms->Ncp==NORMAL)?14:12;
|
||||||
|
|
||||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||||
// aa = 0;
|
// aa = 0;
|
||||||
|
|
||||||
// The PSS occupies the inner 6 RBs, which start at
|
// The PSS occupies the inner 6 RBs, which start at
|
||||||
k = frame_parms->ofdm_symbol_size-3*12+5;
|
k = frame_parms->ofdm_symbol_size-3*12+5;
|
||||||
|
|
||||||
//printf("[PSS] k = %d\n",k);
|
//printf("[PSS] k = %d\n",k);
|
||||||
for (m=5; m<67; m++) {
|
for (m=5; m<67; m++) {
|
||||||
((short*)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
((short *)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
||||||
symbol*frame_parms->ofdm_symbol_size + k)] =
|
symbol*frame_parms->ofdm_symbol_size + k)] =
|
||||||
(a * primary_sync[2*m]) >> 15;
|
(a * primary_sync[2*m]) >> 15;
|
||||||
((short*)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
((short *)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
||||||
symbol*frame_parms->ofdm_symbol_size + k) + 1] =
|
symbol*frame_parms->ofdm_symbol_size + k) + 1] =
|
||||||
(a * primary_sync[2*m+1]) >> 15;
|
(a * primary_sync[2*m+1]) >> 15;
|
||||||
|
|
||||||
k+=1;
|
k+=1;
|
||||||
|
|
||||||
if (k >= frame_parms->ofdm_symbol_size) {
|
if (k >= frame_parms->ofdm_symbol_size) {
|
||||||
k++; //skip DC
|
k++; //skip DC
|
||||||
k-=frame_parms->ofdm_symbol_size;
|
k-=frame_parms->ofdm_symbol_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ struct msghdr nas_msg_rx;
|
|||||||
|
|
||||||
#define GRAAL_NETLINK_ID 31
|
#define GRAAL_NETLINK_ID 31
|
||||||
|
|
||||||
|
|
||||||
static int tun_alloc(char *dev) {
|
static int tun_alloc(char *dev) {
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int fd, err;
|
int fd, err;
|
||||||
|
|||||||
@@ -782,13 +782,15 @@ int main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
dual_stream_UE=1;
|
dual_stream_UE=1;
|
||||||
if (UE != NULL)
|
|
||||||
UE->use_ia_receiver = 1;
|
if (UE != NULL)
|
||||||
|
UE->use_ia_receiver = 1;
|
||||||
else {
|
else {
|
||||||
printf("UE is NULL\n");
|
printf("UE is NULL\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n_tx_port!=2) || (transmission_mode!=5)) {
|
if ((n_tx_port!=2) || (transmission_mode!=5)) {
|
||||||
printf("IA receiver only supported for TM5!");
|
printf("IA receiver only supported for TM5!");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@@ -951,8 +953,8 @@ int main(int argc, char **argv) {
|
|||||||
fl_set_object_label(form_ue->button_0, "IA Receiver ON");
|
fl_set_object_label(form_ue->button_0, "IA Receiver ON");
|
||||||
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
|
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
|
||||||
} else {
|
} else {
|
||||||
printf("UE is NULL\n");
|
printf("UE is NULL\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1211,9 +1211,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
|
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
|
||||||
|
|
||||||
round=5;
|
round=5;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_frames==1) printf("round %d errors %u/%u\n",round,errs[round],trials);
|
if (n_frames==1) printf("round %d errors %u/%u\n",round,errs[round],trials);
|
||||||
|
|||||||
+139
-138
@@ -440,7 +440,6 @@ pdcp_data_ind(
|
|||||||
uint32_t rx_hfn_for_count;
|
uint32_t rx_hfn_for_count;
|
||||||
int pdcp_sn_for_count;
|
int pdcp_sn_for_count;
|
||||||
int security_ok;
|
int security_ok;
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
|
||||||
LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP,
|
LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP,
|
||||||
"[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
|
"[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
|
||||||
@@ -567,6 +566,7 @@ pdcp_data_ind(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/* Removed by Cedric */
|
/* Removed by Cedric */
|
||||||
if (pdcp_is_rx_seq_number_valid(sequence_number, pdcp_p, srb_flagP) == TRUE) {
|
if (pdcp_is_rx_seq_number_valid(sequence_number, pdcp_p, srb_flagP) == TRUE) {
|
||||||
LOG_T(PDCP, "Incoming PDU has a sequence number (%d) in accordance with RX window\n", sequence_number);
|
LOG_T(PDCP, "Incoming PDU has a sequence number (%d) in accordance with RX window\n", sequence_number);
|
||||||
@@ -588,6 +588,7 @@ pdcp_data_ind(
|
|||||||
free_mem_block(sdu_buffer_pP, __func__);
|
free_mem_block(sdu_buffer_pP, __func__);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SRB1/2: control-plane data
|
// SRB1/2: control-plane data
|
||||||
@@ -678,158 +679,156 @@ pdcp_data_ind(
|
|||||||
payload_offset=pdcp_header_len;// PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE;
|
payload_offset=pdcp_header_len;// PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE;
|
||||||
|
|
||||||
switch (pdcp_p->rlc_mode) {
|
switch (pdcp_p->rlc_mode) {
|
||||||
case RLC_MODE_AM: {
|
case RLC_MODE_AM: {
|
||||||
/* process as described in 36.323 5.1.2.1.2 */
|
/* process as described in 36.323 5.1.2.1.2 */
|
||||||
int reordering_window;
|
int reordering_window;
|
||||||
|
|
||||||
if (pdcp_p->seq_num_size == 7)
|
if (pdcp_p->seq_num_size == 7)
|
||||||
reordering_window = REORDERING_WINDOW_SN_7BIT;
|
reordering_window = REORDERING_WINDOW_SN_7BIT;
|
||||||
else
|
else
|
||||||
reordering_window = REORDERING_WINDOW_SN_12BIT;
|
reordering_window = REORDERING_WINDOW_SN_12BIT;
|
||||||
|
|
||||||
if (sequence_number - pdcp_p->last_submitted_pdcp_rx_sn > reordering_window ||
|
if (sequence_number - pdcp_p->last_submitted_pdcp_rx_sn > reordering_window ||
|
||||||
(pdcp_p->last_submitted_pdcp_rx_sn - sequence_number >= 0 &&
|
(pdcp_p->last_submitted_pdcp_rx_sn - sequence_number >= 0 &&
|
||||||
pdcp_p->last_submitted_pdcp_rx_sn - sequence_number < reordering_window)) {
|
pdcp_p->last_submitted_pdcp_rx_sn - sequence_number < reordering_window)) {
|
||||||
/* TODO: specs say to decipher and do header decompression */
|
/* TODO: specs say to decipher and do header decompression */
|
||||||
LOG_W(PDCP,
|
LOG_W(PDCP,
|
||||||
PROTOCOL_PDCP_CTXT_FMT"discard PDU, out of\n",
|
PROTOCOL_PDCP_CTXT_FMT"discard PDU, out of\n",
|
||||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
|
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
|
||||||
LOG_W(PDCP, "Ignoring PDU...\n");
|
LOG_W(PDCP, "Ignoring PDU...\n");
|
||||||
free_mem_block(sdu_buffer_pP, __func__);
|
free_mem_block(sdu_buffer_pP, __func__);
|
||||||
/* TODO: indicate integrity verification failure to upper layer */
|
/* TODO: indicate integrity verification failure to upper layer */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
} else if (pdcp_p->next_pdcp_rx_sn - sequence_number > reordering_window) {
|
||||||
|
pdcp_p->rx_hfn++;
|
||||||
|
rx_hfn_for_count = pdcp_p->rx_hfn;
|
||||||
|
pdcp_sn_for_count = sequence_number;
|
||||||
|
pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
|
||||||
|
} else if (sequence_number - pdcp_p->next_pdcp_rx_sn >= reordering_window) {
|
||||||
|
rx_hfn_for_count = pdcp_p->rx_hfn - 1;
|
||||||
|
pdcp_sn_for_count = sequence_number;
|
||||||
|
} else if (sequence_number >= pdcp_p->next_pdcp_rx_sn) {
|
||||||
|
rx_hfn_for_count = pdcp_p->rx_hfn;
|
||||||
|
pdcp_sn_for_count = sequence_number;
|
||||||
|
pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
|
||||||
|
|
||||||
|
if (pdcp_p->next_pdcp_rx_sn > pdcp_p->maximum_pdcp_rx_sn) {
|
||||||
|
pdcp_p->next_pdcp_rx_sn = 0;
|
||||||
|
pdcp_p->rx_hfn++;
|
||||||
|
}
|
||||||
|
} else { /* sequence_number < pdcp_p->next_pdcp_rx_sn */
|
||||||
|
rx_hfn_for_count = pdcp_p->rx_hfn;
|
||||||
|
pdcp_sn_for_count = sequence_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pdcp_p->security_activated == 1) {
|
||||||
|
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||||
|
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
|
} else {
|
||||||
|
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
|
}
|
||||||
|
|
||||||
|
security_ok = pdcp_validate_security(ctxt_pP,
|
||||||
|
pdcp_p,
|
||||||
|
srb_flagP,
|
||||||
|
rb_idP,
|
||||||
|
pdcp_header_len,
|
||||||
|
rx_hfn_for_count,
|
||||||
|
pdcp_sn_for_count,
|
||||||
|
sdu_buffer_pP->data,
|
||||||
|
sdu_buffer_sizeP - pdcp_tailer_len) == 0;
|
||||||
|
|
||||||
|
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||||
|
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
|
} else {
|
||||||
|
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
security_ok = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (security_ok == 0) {
|
||||||
|
LOG_W(PDCP,
|
||||||
|
PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/AM PDU\n",
|
||||||
|
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
|
||||||
|
LOG_W(PDCP, "Ignoring PDU...\n");
|
||||||
|
free_mem_block(sdu_buffer_pP, __func__);
|
||||||
|
/* TODO: indicate integrity verification failure to upper layer */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: specs say we have to store this PDU in a list and then deliver
|
||||||
|
* stored packets to upper layers according to a well defined
|
||||||
|
* procedure. The code below that deals with delivery is today
|
||||||
|
* too complex to do this properly, so we only send the current
|
||||||
|
* received packet. This is not correct and has to be fixed
|
||||||
|
* some day.
|
||||||
|
* In the meantime, let's pretend the last submitted PDCP SDU
|
||||||
|
* is the current one.
|
||||||
|
* TODO: we also have to deal with re-establishment PDU (control PDUs)
|
||||||
|
* that contain no SDU.
|
||||||
|
*/
|
||||||
|
pdcp_p->last_submitted_pdcp_rx_sn = sequence_number;
|
||||||
|
break;
|
||||||
|
} /* case RLC_MODE_AM */
|
||||||
|
|
||||||
|
case RLC_MODE_UM:
|
||||||
|
|
||||||
|
/* process as described in 36.323 5.1.2.1.3 */
|
||||||
|
if (sequence_number < pdcp_p->next_pdcp_rx_sn) {
|
||||||
|
pdcp_p->rx_hfn++;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (pdcp_p->next_pdcp_rx_sn - sequence_number > reordering_window) {
|
|
||||||
pdcp_p->rx_hfn++;
|
|
||||||
rx_hfn_for_count = pdcp_p->rx_hfn;
|
rx_hfn_for_count = pdcp_p->rx_hfn;
|
||||||
pdcp_sn_for_count = sequence_number;
|
pdcp_sn_for_count = sequence_number;
|
||||||
pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
|
pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
|
||||||
|
|
||||||
} else if (sequence_number - pdcp_p->next_pdcp_rx_sn >= reordering_window) {
|
|
||||||
rx_hfn_for_count = pdcp_p->rx_hfn - 1;
|
|
||||||
pdcp_sn_for_count = sequence_number;
|
|
||||||
|
|
||||||
} else if (sequence_number >= pdcp_p->next_pdcp_rx_sn) {
|
|
||||||
rx_hfn_for_count = pdcp_p->rx_hfn;
|
|
||||||
pdcp_sn_for_count = sequence_number;
|
|
||||||
pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
|
|
||||||
if (pdcp_p->next_pdcp_rx_sn > pdcp_p->maximum_pdcp_rx_sn) {
|
if (pdcp_p->next_pdcp_rx_sn > pdcp_p->maximum_pdcp_rx_sn) {
|
||||||
pdcp_p->next_pdcp_rx_sn = 0;
|
pdcp_p->next_pdcp_rx_sn = 0;
|
||||||
pdcp_p->rx_hfn++;
|
pdcp_p->rx_hfn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { /* sequence_number < pdcp_p->next_pdcp_rx_sn */
|
if (pdcp_p->security_activated == 1) {
|
||||||
rx_hfn_for_count = pdcp_p->rx_hfn;
|
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||||
pdcp_sn_for_count = sequence_number;
|
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
}
|
} else {
|
||||||
|
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
|
}
|
||||||
|
|
||||||
if (pdcp_p->security_activated == 1) {
|
security_ok = pdcp_validate_security(ctxt_pP,
|
||||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
pdcp_p,
|
||||||
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
srb_flagP,
|
||||||
|
rb_idP,
|
||||||
|
pdcp_header_len,
|
||||||
|
rx_hfn_for_count,
|
||||||
|
pdcp_sn_for_count,
|
||||||
|
sdu_buffer_pP->data,
|
||||||
|
sdu_buffer_sizeP - pdcp_tailer_len) == 0;
|
||||||
|
|
||||||
|
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||||
|
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
|
} else {
|
||||||
|
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
security_ok = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
security_ok = pdcp_validate_security(ctxt_pP,
|
if (security_ok == 0) {
|
||||||
pdcp_p,
|
LOG_W(PDCP,
|
||||||
srb_flagP,
|
PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/UM PDU\n",
|
||||||
rb_idP,
|
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
|
||||||
pdcp_header_len,
|
LOG_W(PDCP, "Ignoring PDU...\n");
|
||||||
rx_hfn_for_count,
|
free_mem_block(sdu_buffer_pP, __func__);
|
||||||
pdcp_sn_for_count,
|
/* TODO: indicate integrity verification failure to upper layer */
|
||||||
sdu_buffer_pP->data,
|
return FALSE;
|
||||||
sdu_buffer_sizeP - pdcp_tailer_len) == 0;
|
|
||||||
|
|
||||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
|
||||||
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
|
||||||
} else {
|
|
||||||
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
security_ok = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (security_ok == 0) {
|
|
||||||
LOG_W(PDCP,
|
|
||||||
PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/AM PDU\n",
|
|
||||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
|
|
||||||
LOG_W(PDCP, "Ignoring PDU...\n");
|
|
||||||
free_mem_block(sdu_buffer_pP, __func__);
|
|
||||||
/* TODO: indicate integrity verification failure to upper layer */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: specs say we have to store this PDU in a list and then deliver
|
|
||||||
* stored packets to upper layers according to a well defined
|
|
||||||
* procedure. The code below that deals with delivery is today
|
|
||||||
* too complex to do this properly, so we only send the current
|
|
||||||
* received packet. This is not correct and has to be fixed
|
|
||||||
* some day.
|
|
||||||
* In the meantime, let's pretend the last submitted PDCP SDU
|
|
||||||
* is the current one.
|
|
||||||
* TODO: we also have to deal with re-establishment PDU (control PDUs)
|
|
||||||
* that contain no SDU.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pdcp_p->last_submitted_pdcp_rx_sn = sequence_number;
|
|
||||||
|
|
||||||
break;
|
|
||||||
} /* case RLC_MODE_AM */
|
|
||||||
|
|
||||||
case RLC_MODE_UM:
|
|
||||||
/* process as described in 36.323 5.1.2.1.3 */
|
|
||||||
if (sequence_number < pdcp_p->next_pdcp_rx_sn) {
|
|
||||||
pdcp_p->rx_hfn++;
|
|
||||||
}
|
|
||||||
rx_hfn_for_count = pdcp_p->rx_hfn;
|
|
||||||
pdcp_sn_for_count = sequence_number;
|
|
||||||
pdcp_p->next_pdcp_rx_sn = sequence_number + 1;
|
|
||||||
if (pdcp_p->next_pdcp_rx_sn > pdcp_p->maximum_pdcp_rx_sn) {
|
|
||||||
pdcp_p->next_pdcp_rx_sn = 0;
|
|
||||||
pdcp_p->rx_hfn++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pdcp_p->security_activated == 1) {
|
|
||||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
|
||||||
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
|
||||||
} else {
|
|
||||||
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
security_ok = pdcp_validate_security(ctxt_pP,
|
break;
|
||||||
pdcp_p,
|
|
||||||
srb_flagP,
|
|
||||||
rb_idP,
|
|
||||||
pdcp_header_len,
|
|
||||||
rx_hfn_for_count,
|
|
||||||
pdcp_sn_for_count,
|
|
||||||
sdu_buffer_pP->data,
|
|
||||||
sdu_buffer_sizeP - pdcp_tailer_len) == 0;
|
|
||||||
|
|
||||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
default:
|
||||||
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security);
|
LOG_E(PDCP, "bad RLC mode, cannot happen.\n");
|
||||||
} else {
|
exit(1);
|
||||||
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].validate_security);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
security_ok = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (security_ok == 0) {
|
|
||||||
LOG_W(PDCP,
|
|
||||||
PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/UM PDU\n",
|
|
||||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p));
|
|
||||||
LOG_W(PDCP, "Ignoring PDU...\n");
|
|
||||||
free_mem_block(sdu_buffer_pP, __func__);
|
|
||||||
/* TODO: indicate integrity verification failure to upper layer */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG_E(PDCP, "bad RLC mode, cannot happen.\n");
|
|
||||||
exit(1);
|
|
||||||
} /* switch (pdcp_p->rlc_mode) */
|
} /* switch (pdcp_p->rlc_mode) */
|
||||||
} else { /* MBMS_flagP == 0 */
|
} else { /* MBMS_flagP == 0 */
|
||||||
payload_offset=0;
|
payload_offset=0;
|
||||||
@@ -1145,10 +1144,10 @@ pdcp_run (
|
|||||||
} while(msg_p != NULL);
|
} while(msg_p != NULL);
|
||||||
|
|
||||||
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
|
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
|
||||||
// if (LINK_ENB_PDCP_TO_GTPV1U && ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
// if (LINK_ENB_PDCP_TO_GTPV1U && ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||||
if (!EPC_MODE_ENABLED || ctxt_pP->enb_flag == ENB_FLAG_NO ) {
|
if (!EPC_MODE_ENABLED || ctxt_pP->enb_flag == ENB_FLAG_NO ) {
|
||||||
pdcp_fifo_read_input_sdus(ctxt_pP);
|
pdcp_fifo_read_input_sdus(ctxt_pP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PDCP -> NAS/IP traffic: RX
|
// PDCP -> NAS/IP traffic: RX
|
||||||
if (ctxt_pP->enb_flag) {
|
if (ctxt_pP->enb_flag) {
|
||||||
@@ -2042,6 +2041,8 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
|
|||||||
((PDCP_USE_NETLINK)?"usenetlink":""));
|
((PDCP_USE_NETLINK)?"usenetlink":""));
|
||||||
|
|
||||||
if (PDCP_USE_NETLINK) {
|
if (PDCP_USE_NETLINK) {
|
||||||
|
nas_getparams();
|
||||||
|
|
||||||
if(UE_NAS_USE_TUN) {
|
if(UE_NAS_USE_TUN) {
|
||||||
netlink_init_tun("ue");
|
netlink_init_tun("ue");
|
||||||
LOG_I(PDCP, "UE pdcp will use tun interface\n");
|
LOG_I(PDCP, "UE pdcp will use tun interface\n");
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
|
int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
|
||||||
pdcp_data_req_header_t pdcp_read_header_g;
|
pdcp_data_req_header_t pdcp_read_header_g;
|
||||||
|
|
||||||
|
|
||||||
if (UE_NAS_USE_TUN || ENB_NAS_USE_TUN) {
|
if (UE_NAS_USE_TUN || ENB_NAS_USE_TUN) {
|
||||||
protocol_ctxt_t ctxt = *ctxt_pP;
|
protocol_ctxt_t ctxt = *ctxt_pP;
|
||||||
@@ -163,22 +162,20 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
|
|||||||
|
|
||||||
if (len<=0) continue;
|
if (len<=0) continue;
|
||||||
|
|
||||||
|
|
||||||
if (UE_NAS_USE_TUN) {
|
if (UE_NAS_USE_TUN) {
|
||||||
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
|
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
|
||||||
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
||||||
} else {
|
} else {
|
||||||
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0];
|
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0];
|
||||||
ctxt.enb_flag=ENB_FLAG_YES;
|
ctxt.enb_flag=ENB_FLAG_YES;
|
||||||
ctxt.module_id=0;
|
ctxt.module_id=0;
|
||||||
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_YES);
|
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_YES);
|
||||||
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
||||||
}
|
}
|
||||||
LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
|
|
||||||
|
LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
|
||||||
ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
|
ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (h_rc == HASH_TABLE_OK) {
|
if (h_rc == HASH_TABLE_OK) {
|
||||||
LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n",
|
LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n",
|
||||||
ctxt.frame, ctxt.instance, len, rab_id);
|
ctxt.frame, ctxt.instance, len, rab_id);
|
||||||
|
|||||||
@@ -584,14 +584,12 @@ void rlc_data_ind (
|
|||||||
const sdu_size_t sdu_sizeP,
|
const sdu_size_t sdu_sizeP,
|
||||||
mem_block_t *sdu_pP) {
|
mem_block_t *sdu_pP) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n",
|
LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n",
|
||||||
PROTOCOL_CTXT_ARGS(ctxt_pP),
|
PROTOCOL_CTXT_ARGS(ctxt_pP),
|
||||||
(srb_flagP) ? "SRB" : "DRB",
|
(srb_flagP) ? "SRB" : "DRB",
|
||||||
rb_idP,
|
rb_idP,
|
||||||
sdu_sizeP);
|
sdu_sizeP);
|
||||||
rlc_util_print_hex_octets(RLC, (unsigned char *)sdu_pP->data, sdu_sizeP);
|
rlc_util_print_hex_octets(RLC, (unsigned char *)sdu_pP->data, sdu_sizeP);
|
||||||
|
|
||||||
#if T_TRACER
|
#if T_TRACER
|
||||||
|
|
||||||
if (ctxt_pP->enb_flag)
|
if (ctxt_pP->enb_flag)
|
||||||
|
|||||||
@@ -47,7 +47,8 @@
|
|||||||
#define NAS_INET6_ADDRSTRLEN 46
|
#define NAS_INET6_ADDRSTRLEN 46
|
||||||
#define NAS_INET_ADDRSTRLEN 16
|
#define NAS_INET_ADDRSTRLEN 16
|
||||||
|
|
||||||
#define NAS_CX_MAX 128 // 32 //Identical to RRC constant
|
#define NAS_CX_MAX 32 //128 //Identical to RRC constant: no you cannot
|
||||||
|
/* increase to 128 without risking stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
|
||||||
//#define NAS_CX_MULTICAST_ALLNODE 2
|
//#define NAS_CX_MULTICAST_ALLNODE 2
|
||||||
|
|
||||||
#define NAS_RETRY_LIMIT_DEFAULT 5
|
#define NAS_RETRY_LIMIT_DEFAULT 5
|
||||||
|
|||||||
@@ -64,7 +64,8 @@
|
|||||||
// Max number of entry of a message list
|
// Max number of entry of a message list
|
||||||
#define NAS_LIST_CX_MAX 32
|
#define NAS_LIST_CX_MAX 32
|
||||||
#define NAS_LIST_RB_MAX 32
|
#define NAS_LIST_RB_MAX 32
|
||||||
#define NAS_LIST_CLASS_MAX 32
|
#define NAS_LIST_CLASS_MAX 16 // 32 is too high!!:
|
||||||
|
/* risk of stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
|
||||||
|
|
||||||
typedef unsigned short nasMsgType_t;
|
typedef unsigned short nasMsgType_t;
|
||||||
|
|
||||||
|
|||||||
+26
-28
@@ -801,7 +801,6 @@ rrc_ue_establish_drb(
|
|||||||
(void)ip_addr_offset4;
|
(void)ip_addr_offset4;
|
||||||
LOG_I(RRC,"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d\n",
|
LOG_I(RRC,"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d\n",
|
||||||
ue_mod_idP, frameP, DRB_config->drb_Identity, (int)*DRB_config->logicalChannelIdentity);
|
ue_mod_idP, frameP, DRB_config->drb_Identity, (int)*DRB_config->logicalChannelIdentity);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD,
|
rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD,
|
||||||
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity, UNDEF_SECURITY_MODE);
|
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity, UNDEF_SECURITY_MODE);
|
||||||
@@ -810,35 +809,34 @@ rrc_ue_establish_drb(
|
|||||||
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity,
|
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity,
|
||||||
RADIO_ACCESS_BEARER,Rlc_info_um);
|
RADIO_ACCESS_BEARER,Rlc_info_um);
|
||||||
*/
|
*/
|
||||||
// if(!EPC_MODE_ENABLED) {
|
// if(!EPC_MODE_ENABLED) {
|
||||||
//# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
|
//# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
|
||||||
ip_addr_offset3 = 0;
|
ip_addr_offset3 = 0;
|
||||||
ip_addr_offset4 = 1;
|
ip_addr_offset4 = 1;
|
||||||
LOG_I(OIP,"[UE %d] trying to bring up the OAI interface oip%d, IP 10.0.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP,
|
LOG_I(OIP,"[UE %d] trying to bring up the OAI interface oip%d, IP 10.0.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP,
|
||||||
ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1);
|
ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1);
|
||||||
oip_ifup=nas_config(ip_addr_offset3+ue_mod_idP+1, // interface_id
|
oip_ifup=nas_config(ip_addr_offset3+ue_mod_idP+1, // interface_id
|
||||||
ip_addr_offset3+ue_mod_idP+1, // third_octet
|
ip_addr_offset3+ue_mod_idP+1, // third_octet
|
||||||
ip_addr_offset4+ue_mod_idP+1, // fourth_octet
|
ip_addr_offset4+ue_mod_idP+1, // fourth_octet
|
||||||
"oip"); // interface suffix
|
"oip"); // interface suffix
|
||||||
|
|
||||||
if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB
|
if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB
|
||||||
LOG_I(OIP,"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n",
|
LOG_I(OIP,"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n",
|
||||||
ue_mod_idP,
|
ue_mod_idP,
|
||||||
ip_addr_offset3+ue_mod_idP,
|
ip_addr_offset3+ue_mod_idP,
|
||||||
(long int)((eNB_index * LTE_maxDRB) + DRB_config->drb_Identity));
|
(long int)((eNB_index * LTE_maxDRB) + DRB_config->drb_Identity));
|
||||||
rb_conf_ipv4(0,//add
|
rb_conf_ipv4(0,//add
|
||||||
ue_mod_idP,//cx align with the UE index
|
ue_mod_idP,//cx align with the UE index
|
||||||
ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index
|
ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index
|
||||||
(eNB_index * LTE_maxDRB) + DRB_config->drb_Identity,//rb
|
(eNB_index * LTE_maxDRB) + DRB_config->drb_Identity,//rb
|
||||||
0,//dscp
|
0,//dscp
|
||||||
ipv4_address(ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1),//saddr
|
ipv4_address(ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1),//saddr
|
||||||
ipv4_address(ip_addr_offset3+ue_mod_idP+1,eNB_index+1));//daddr
|
ipv4_address(ip_addr_offset3+ue_mod_idP+1,eNB_index+1));//daddr
|
||||||
LOG_D(RRC,"[UE %d] State = Attached (eNB %d)\n",ue_mod_idP,eNB_index);
|
LOG_D(RRC,"[UE %d] State = Attached (eNB %d)\n",ue_mod_idP,eNB_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//# endif
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
//# endif
|
||||||
|
// }
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6269,6 +6269,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
|
|||||||
LOG_D(RRC,
|
LOG_D(RRC,
|
||||||
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
|
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
|
||||||
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
|
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
|
||||||
|
|
||||||
if (!EPC_MODE_ENABLED && !ENB_NAS_USE_TUN) {
|
if (!EPC_MODE_ENABLED && !ENB_NAS_USE_TUN) {
|
||||||
LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n",
|
LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n",
|
||||||
ctxt_pP->module_id,
|
ctxt_pP->module_id,
|
||||||
@@ -6278,6 +6279,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
|
|||||||
ctxt_pP->module_id + 1, // thrid octet
|
ctxt_pP->module_id + 1, // thrid octet
|
||||||
ctxt_pP->module_id + 1, // fourth octet
|
ctxt_pP->module_id + 1, // fourth octet
|
||||||
"oai");
|
"oai");
|
||||||
|
|
||||||
if (oip_ifup == 0) { // interface is up --> send a config the DRB
|
if (oip_ifup == 0) { // interface is up --> send a config the DRB
|
||||||
module_id_t ue_module_id;
|
module_id_t ue_module_id;
|
||||||
dest_ip_offset = 8;
|
dest_ip_offset = 8;
|
||||||
|
|||||||
@@ -45,47 +45,55 @@
|
|||||||
#include "nas_config.h"
|
#include "nas_config.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "targets/RT/USER/lte-softmodem.h"
|
#include "targets/RT/USER/lte-softmodem.h"
|
||||||
|
#include "common/config/config_userapi.h"
|
||||||
|
|
||||||
//default values according to the examples,
|
//default values according to the examples,
|
||||||
|
|
||||||
char *baseNetAddress = "10.0" ;
|
char *baseNetAddress ;
|
||||||
char *netMask = "255.255.255.0" ;
|
char *netMask ;
|
||||||
char *broadcastAddr = "10.0.255.255" ;
|
char *broadcastAddr ;
|
||||||
|
#define NASHLP_NETPREFIX "<NAS network prefix, two first bytes of network addresses>\n"
|
||||||
|
#define NASHLP_NETMASK "<NAS network mask>\n"
|
||||||
|
#define NASHLP_BROADCASTADDR "<NAS network broadcast address>\n"
|
||||||
|
void nas_getparams(void) {
|
||||||
|
paramdef_t nasoptions[] = {
|
||||||
|
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
/* configuration parameters for netlink, includes network parameters when running in noS1 mode */
|
||||||
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
|
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
{"NetworkPrefix", NASHLP_NETPREFIX, 0, strptr:&baseNetAddress, defstrval:"10.0", TYPE_STRING, 0 },
|
||||||
|
{"NetworkMask", NASHLP_NETMASK, 0, strptr:&netMask, defstrval:"255.255.255.0", TYPE_STRING, 0 },
|
||||||
|
{"BroadcastAddr", NASHLP_BROADCASTADDR, 0, strptr:&broadcastAddr, defstrval:"10.0.255.255", TYPE_STRING, 0 },
|
||||||
|
};
|
||||||
|
config_get( nasoptions,sizeof(nasoptions)/sizeof(paramdef_t),"nas.noS1");
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBaseNetAddress (char *baseAddr) {
|
||||||
void setBaseNetAddress (char* baseAddr)
|
|
||||||
{
|
|
||||||
strcpy(baseNetAddress,baseAddr);
|
strcpy(baseNetAddress,baseAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* getBaseNetAddress (void)
|
char *getBaseNetAddress (void) {
|
||||||
{
|
|
||||||
return baseNetAddress;
|
return baseNetAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNetMask (char* baseAddr)
|
void setNetMask (char *baseAddr) {
|
||||||
{
|
|
||||||
strcpy(netMask,baseAddr);
|
strcpy(netMask,baseAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* getNetMask (void)
|
char *getNetMask (void) {
|
||||||
{
|
|
||||||
return netMask;
|
return netMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBroadcastAddress (char* baseAddr)
|
void setBroadcastAddress (char *baseAddr) {
|
||||||
{
|
|
||||||
strcpy(broadcastAddr, baseAddr);
|
strcpy(broadcastAddr, baseAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* getBroadcastAddress (void)
|
char *getBroadcastAddress (void) {
|
||||||
{
|
|
||||||
return broadcastAddr;
|
return broadcastAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add Gateway to the interface
|
//Add Gateway to the interface
|
||||||
int set_gateway(char *interfaceName, char *gateway)
|
int set_gateway(char *interfaceName, char *gateway) {
|
||||||
{
|
|
||||||
int sock_fd;
|
int sock_fd;
|
||||||
struct rtentry rt;
|
struct rtentry rt;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@@ -96,20 +104,16 @@ int set_gateway(char *interfaceName, char *gateway)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset (&rt, 0, sizeof (rt));
|
memset (&rt, 0, sizeof (rt));
|
||||||
|
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
/*set Destination addr*/
|
/*set Destination addr*/
|
||||||
inet_aton("0.0.0.0",&addr.sin_addr);
|
inet_aton("0.0.0.0",&addr.sin_addr);
|
||||||
memcpy(&rt.rt_dst, &addr, sizeof(struct sockaddr_in));
|
memcpy(&rt.rt_dst, &addr, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
/*set gateway addr*/
|
/*set gateway addr*/
|
||||||
inet_aton(gateway,&addr.sin_addr);
|
inet_aton(gateway,&addr.sin_addr);
|
||||||
memcpy(&rt.rt_gateway, &addr, sizeof(struct sockaddr_in));
|
memcpy(&rt.rt_gateway, &addr, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
/*set genmask addr*/
|
/*set genmask addr*/
|
||||||
inet_aton("0.0.0.0",&addr.sin_addr);
|
inet_aton("0.0.0.0",&addr.sin_addr);
|
||||||
memcpy(&rt.rt_genmask, &addr, sizeof(struct sockaddr_in));
|
memcpy(&rt.rt_genmask, &addr, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
rt.rt_dev = interfaceName;
|
rt.rt_dev = interfaceName;
|
||||||
//rt.rt_flags = RTF_UP|RTF_GATEWAY|RTF_DEFAULT;
|
//rt.rt_flags = RTF_UP|RTF_GATEWAY|RTF_DEFAULT;
|
||||||
/* SR: rt_flags on 16 bits but RTF_DEFAULT = 0x00010000
|
/* SR: rt_flags on 16 bits but RTF_DEFAULT = 0x00010000
|
||||||
@@ -129,19 +133,16 @@ int set_gateway(char *interfaceName, char *gateway)
|
|||||||
LOG_I(OIP,"set_gateway OK!\n");
|
LOG_I(OIP,"set_gateway OK!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close(sock_fd);
|
close(sock_fd);
|
||||||
|
|
||||||
LOG_D(OIP,"Set Gateway OK!\n");
|
LOG_D(OIP,"Set Gateway OK!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets a genneric interface parameter
|
// sets a genneric interface parameter
|
||||||
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
|
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
|
||||||
int setInterfaceParameter(char *interfaceName, char *settingAddress, int operation)
|
int setInterfaceParameter(char *interfaceName, char *settingAddress, int operation) {
|
||||||
{
|
|
||||||
int sock_fd;
|
int sock_fd;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@@ -154,10 +155,8 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
|
|||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name)-1);
|
strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name)-1);
|
||||||
|
|
||||||
memset(&addr, 0, sizeof(struct sockaddr_in));
|
memset(&addr, 0, sizeof(struct sockaddr_in));
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
|
|
||||||
inet_aton(settingAddress,&addr.sin_addr);
|
inet_aton(settingAddress,&addr.sin_addr);
|
||||||
memcpy(&ifr.ifr_ifru.ifru_addr,&addr,sizeof(struct sockaddr_in));
|
memcpy(&ifr.ifr_ifru.ifru_addr,&addr,sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
@@ -169,15 +168,13 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(sock_fd);
|
close(sock_fd);
|
||||||
|
|
||||||
// printf("Set OK!\n");
|
// printf("Set OK!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets a genneric interface parameter
|
// sets a genneric interface parameter
|
||||||
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
|
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
|
||||||
int bringInterfaceUp(char *interfaceName, int up)
|
int bringInterfaceUp(char *interfaceName, int up) {
|
||||||
{
|
|
||||||
int sock_fd;
|
int sock_fd;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
|
||||||
@@ -213,8 +210,7 @@ int bringInterfaceUp(char *interfaceName, int up)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// non blocking full configuration of the interface (address, net mask, and broadcast mask)
|
// non blocking full configuration of the interface (address, net mask, and broadcast mask)
|
||||||
int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *broadcastAddress)
|
int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *broadcastAddress) {
|
||||||
{
|
|
||||||
bringInterfaceUp(interfaceName, 0);
|
bringInterfaceUp(interfaceName, 0);
|
||||||
// sets the machine address
|
// sets the machine address
|
||||||
int returnValue= setInterfaceParameter(interfaceName, ipAddress,SIOCSIFADDR);
|
int returnValue= setInterfaceParameter(interfaceName, ipAddress,SIOCSIFADDR);
|
||||||
@@ -229,28 +225,21 @@ int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *br
|
|||||||
|
|
||||||
// if(!returnValue)
|
// if(!returnValue)
|
||||||
// returnValue=set_gateway(interfaceName, broadcastAddress);
|
// returnValue=set_gateway(interfaceName, broadcastAddress);
|
||||||
|
|
||||||
bringInterfaceUp(interfaceName, 1);
|
bringInterfaceUp(interfaceName, 1);
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// non blocking full configuration of the interface (address, and the two lest octets of the address)
|
// non blocking full configuration of the interface (address, and the two lest octets of the address)
|
||||||
int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
|
int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname) {
|
||||||
{
|
|
||||||
//char buf[5];
|
//char buf[5];
|
||||||
char ipAddress[20];
|
char ipAddress[20];
|
||||||
char broadcastAddress[20];
|
char broadcastAddress[20];
|
||||||
char interfaceName[20];
|
char interfaceName[20];
|
||||||
int returnValue;
|
int returnValue;
|
||||||
sprintf(ipAddress, "10.0.%d.%d", thirdOctet,fourthOctet);
|
sprintf(ipAddress, "10.0.%d.%d", thirdOctet,fourthOctet);
|
||||||
|
|
||||||
sprintf(broadcastAddress, "10.0.%d.255", thirdOctet);
|
sprintf(broadcastAddress, "10.0.%d.255", thirdOctet);
|
||||||
|
|
||||||
|
|
||||||
sprintf(interfaceName, "%s%s%d", (UE_NAS_USE_TUN || ENB_NAS_USE_TUN)?"oaitun_":ifname,
|
sprintf(interfaceName, "%s%s%d", (UE_NAS_USE_TUN || ENB_NAS_USE_TUN)?"oaitun_":ifname,
|
||||||
UE_NAS_USE_TUN?"ue": (ENB_NAS_USE_TUN?"enb":""),interface_id);
|
UE_NAS_USE_TUN?"ue": (ENB_NAS_USE_TUN?"enb":""),interface_id);
|
||||||
|
|
||||||
bringInterfaceUp(interfaceName, 0);
|
bringInterfaceUp(interfaceName, 0);
|
||||||
// sets the machine address
|
// sets the machine address
|
||||||
returnValue= setInterfaceParameter(interfaceName, ipAddress,SIOCSIFADDR);
|
returnValue= setInterfaceParameter(interfaceName, ipAddress,SIOCSIFADDR);
|
||||||
@@ -264,18 +253,13 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
|
|||||||
returnValue= setInterfaceParameter(interfaceName, broadcastAddress,SIOCSIFBRDADDR);
|
returnValue= setInterfaceParameter(interfaceName, broadcastAddress,SIOCSIFBRDADDR);
|
||||||
|
|
||||||
bringInterfaceUp(interfaceName, 1);
|
bringInterfaceUp(interfaceName, 1);
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blocking full configuration of the interface (address, net mask, and broadcast mask)
|
// Blocking full configuration of the interface (address, net mask, and broadcast mask)
|
||||||
int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *broadcastAddress)
|
int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *broadcastAddress) {
|
||||||
{
|
|
||||||
|
|
||||||
char command[200];
|
char command[200];
|
||||||
command[0]='\0';
|
command[0]='\0';
|
||||||
|
|
||||||
strcat(command, "ifconfig ");
|
strcat(command, "ifconfig ");
|
||||||
strncat(command, interfaceName, sizeof(command) - strlen(command) - 1);
|
strncat(command, interfaceName, sizeof(command) - strlen(command) - 1);
|
||||||
strncat(command, " ", sizeof(command) - strlen(command) - 1);
|
strncat(command, " ", sizeof(command) - strlen(command) - 1);
|
||||||
@@ -284,16 +268,13 @@ int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask,
|
|||||||
strncat(command, networkMask, sizeof(command) - strlen(command) - 1);
|
strncat(command, networkMask, sizeof(command) - strlen(command) - 1);
|
||||||
strncat(command, " broadcast ", sizeof(command) - strlen(command) - 1);
|
strncat(command, " broadcast ", sizeof(command) - strlen(command) - 1);
|
||||||
strncat(command, broadcastAddress, sizeof(command) - strlen(command) - 1);
|
strncat(command, broadcastAddress, sizeof(command) - strlen(command) - 1);
|
||||||
|
|
||||||
// ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255
|
// ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255
|
||||||
int i = system (command);
|
int i = system (command);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// program help
|
// program help
|
||||||
void helpOptions(char **argv)
|
void helpOptions(char **argv) {
|
||||||
{
|
|
||||||
printf("Help for %s\n", argv[0]);
|
printf("Help for %s\n", argv[0]);
|
||||||
printf(" -i <interfaceName>\n");
|
printf(" -i <interfaceName>\n");
|
||||||
printf(" -a <IP address>\n");
|
printf(" -a <IP address>\n");
|
||||||
@@ -305,13 +286,11 @@ void helpOptions(char **argv)
|
|||||||
printf(" IP Address: 10.0.1.1\n");
|
printf(" IP Address: 10.0.1.1\n");
|
||||||
printf(" Net mask: 255.255.255.0\n");
|
printf(" Net mask: 255.255.255.0\n");
|
||||||
printf(" Broadcast address: [Beginning of the IP address].255\n");
|
printf(" Broadcast address: [Beginning of the IP address].255\n");
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates the broadcast address if it wasn't set before
|
// creates the broadcast address if it wasn't set before
|
||||||
void createBroadcast(char *broadcastAddress)
|
void createBroadcast(char *broadcastAddress) {
|
||||||
{
|
|
||||||
int pos=strlen(broadcastAddress)-1;
|
int pos=strlen(broadcastAddress)-1;
|
||||||
|
|
||||||
while(broadcastAddress[pos]!='.')
|
while(broadcastAddress[pos]!='.')
|
||||||
@@ -333,7 +312,6 @@ int main(int argc,char **argv)
|
|||||||
char ipAddress[100];
|
char ipAddress[100];
|
||||||
char networkMask[100];
|
char networkMask[100];
|
||||||
char broadcastAddress[100];
|
char broadcastAddress[100];
|
||||||
|
|
||||||
strcpy(interfaceName, "oai0");
|
strcpy(interfaceName, "oai0");
|
||||||
strcpy(ipAddress, "10.0.1.1");
|
strcpy(ipAddress, "10.0.1.1");
|
||||||
strcpy(networkMask, "255.255.255.0");
|
strcpy(networkMask, "255.255.255.0");
|
||||||
@@ -341,38 +319,38 @@ int main(int argc,char **argv)
|
|||||||
|
|
||||||
while ((c = getopt (argc, argv, "i:a:n:b:h")) != -1)
|
while ((c = getopt (argc, argv, "i:a:n:b:h")) != -1)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
helpOptions(argv);
|
helpOptions(argv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
strcpy(interfaceName,optarg);
|
strcpy(interfaceName,optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
strcpy(ipAddress,optarg);
|
strcpy(ipAddress,optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
strcpy(networkMask,optarg);
|
strcpy(networkMask,optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
strcpy(broadcastAddress,optarg);
|
strcpy(broadcastAddress,optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
if (isprint (optopt))
|
if (isprint (optopt))
|
||||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||||
else
|
else
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Unknown option character `\\x%x'.\n",
|
"Unknown option character `\\x%x'.\n",
|
||||||
optopt);
|
optopt);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(broadcastAddress)==0) {
|
if(strlen(broadcastAddress)==0) {
|
||||||
@@ -385,7 +363,6 @@ int main(int argc,char **argv)
|
|||||||
//test
|
//test
|
||||||
// setBaseNetAddress("11.11");
|
// setBaseNetAddress("11.11");
|
||||||
// nas_config(interfaceName, 33, 44);
|
// nas_config(interfaceName, 33, 44);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -31,6 +31,13 @@
|
|||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
/*! \fn void void nas_getparams(void)(void)
|
||||||
|
* \brief This function get parameters used to configure network interface when running in noS1 mode
|
||||||
|
* \note
|
||||||
|
* @ingroup ?????
|
||||||
|
*/
|
||||||
|
void nas_getparams(void);
|
||||||
|
|
||||||
/*! \fn int NAS_config(char*, char*, char*, char*)
|
/*! \fn int NAS_config(char*, char*, char*, char*)
|
||||||
* \brief This function initializes the nasmesh interface
|
* \brief This function initializes the nasmesh interface
|
||||||
* \param[in] interfaceName, the name of the interface, e.g. nasmesh0 or nasmesh1
|
* \param[in] interfaceName, the name of the interface, e.g. nasmesh0 or nasmesh1
|
||||||
@@ -98,7 +105,7 @@ int set_gateway(char *interfaceName, char *gateway);
|
|||||||
* \note
|
* \note
|
||||||
* @ingroup ?????
|
* @ingroup ?????
|
||||||
*/
|
*/
|
||||||
void setBaseNetAddress(char* baseAddr);
|
void setBaseNetAddress(char *baseAddr);
|
||||||
|
|
||||||
/*! \fn char* getBaseNetAddress()
|
/*! \fn char* getBaseNetAddress()
|
||||||
* \brief This function returns the basic network address used
|
* \brief This function returns the basic network address used
|
||||||
@@ -106,7 +113,7 @@ void setBaseNetAddress(char* baseAddr);
|
|||||||
* \note
|
* \note
|
||||||
* @ingroup ?????
|
* @ingroup ?????
|
||||||
*/
|
*/
|
||||||
char* getBaseNetAddress(void);
|
char *getBaseNetAddress(void);
|
||||||
|
|
||||||
/*! \fn void setNetMask(char*)
|
/*! \fn void setNetMask(char*)
|
||||||
* \brief This function sets the new default network mask used
|
* \brief This function sets the new default network mask used
|
||||||
@@ -114,7 +121,7 @@ char* getBaseNetAddress(void);
|
|||||||
* \note
|
* \note
|
||||||
* @ingroup ?????
|
* @ingroup ?????
|
||||||
*/
|
*/
|
||||||
void setNetMask(char* baseAddr);
|
void setNetMask(char *baseAddr);
|
||||||
|
|
||||||
/*! \fn char* getNetMask()
|
/*! \fn char* getNetMask()
|
||||||
* \brief This function returns the network mask address in use
|
* \brief This function returns the network mask address in use
|
||||||
@@ -122,7 +129,7 @@ void setNetMask(char* baseAddr);
|
|||||||
* \note
|
* \note
|
||||||
* @ingroup ?????
|
* @ingroup ?????
|
||||||
*/
|
*/
|
||||||
char* getNetMask(void);
|
char *getNetMask(void);
|
||||||
|
|
||||||
/*! \fn coid setBroadcastAddress(char*)
|
/*! \fn coid setBroadcastAddress(char*)
|
||||||
* \brief This function sets the new broadcast address used
|
* \brief This function sets the new broadcast address used
|
||||||
@@ -130,7 +137,7 @@ char* getNetMask(void);
|
|||||||
* \note
|
* \note
|
||||||
* @ingroup ?????
|
* @ingroup ?????
|
||||||
*/
|
*/
|
||||||
void setBroadcastAddress(char* baseAddr);
|
void setBroadcastAddress(char *baseAddr);
|
||||||
|
|
||||||
/*! \fn char* getBroadcastAddress()
|
/*! \fn char* getBroadcastAddress()
|
||||||
* \brief This function returns the broadcast address in use
|
* \brief This function returns the broadcast address in use
|
||||||
@@ -138,7 +145,7 @@ void setBroadcastAddress(char* baseAddr);
|
|||||||
* \note
|
* \note
|
||||||
* @ingroup ?????
|
* @ingroup ?????
|
||||||
*/
|
*/
|
||||||
char* getBroadcastAddress(void);
|
char *getBroadcastAddress(void);
|
||||||
|
|
||||||
int bringInterfaceUp(char *interfaceName, int up);
|
int bringInterfaceUp(char *interfaceName, int up);
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file common_lib.c
|
/*! \file common_lib.c
|
||||||
* \brief common APIs for different RF frontend device
|
* \brief common APIs for different RF frontend device
|
||||||
* \author HongliangXU, Navid Nikaein
|
* \author HongliangXU, Navid Nikaein
|
||||||
* \date 2015
|
* \date 2015
|
||||||
* \version 0.2
|
* \version 0.2
|
||||||
@@ -40,113 +40,121 @@
|
|||||||
#include "targets/RT/USER/lte-softmodem.h"
|
#include "targets/RT/USER/lte-softmodem.h"
|
||||||
|
|
||||||
int set_device(openair0_device *device) {
|
int set_device(openair0_device *device) {
|
||||||
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
|
case EXMIMO_DEV:
|
||||||
case EXMIMO_DEV:
|
printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
break;
|
||||||
break;
|
|
||||||
case USRP_B200_DEV:
|
case USRP_B200_DEV:
|
||||||
printf("[%s] has loaded USRP B200 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
printf("[%s] has loaded USRP B200 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
break;
|
break;
|
||||||
case USRP_X300_DEV:
|
|
||||||
printf("[%s] has loaded USRP X300 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
case USRP_X300_DEV:
|
||||||
break;
|
printf("[%s] has loaded USRP X300 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
case BLADERF_DEV:
|
break;
|
||||||
printf("[%s] has loaded BLADERF device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
|
||||||
break;
|
case BLADERF_DEV:
|
||||||
case LMSSDR_DEV:
|
printf("[%s] has loaded BLADERF device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
printf("[%s] has loaded LMSSDR device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
break;
|
||||||
break;
|
|
||||||
case IRIS_DEV:
|
case LMSSDR_DEV:
|
||||||
printf("[%s] has loaded Iris device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
printf("[%s] has loaded LMSSDR device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
break;
|
break;
|
||||||
case NONE_DEV:
|
|
||||||
printf("[%s] has not loaded a HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
case IRIS_DEV:
|
||||||
break;
|
printf("[%s] has loaded Iris device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
default:
|
break;
|
||||||
printf("[%s] invalid HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
|
||||||
return -1;
|
case NONE_DEV:
|
||||||
|
printf("[%s] has not loaded a HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("[%s] invalid HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_transport(openair0_device *device) {
|
int set_transport(openair0_device *device) {
|
||||||
|
|
||||||
switch (device->transp_type) {
|
switch (device->transp_type) {
|
||||||
|
case ETHERNET_TP:
|
||||||
case ETHERNET_TP:
|
printf("[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
printf("[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
return 0;
|
||||||
return 0;
|
break;
|
||||||
break;
|
|
||||||
case NONE_TP:
|
case NONE_TP:
|
||||||
printf("[%s] has not loaded a transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
printf("[%s] has not loaded a transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
printf("[%s] invalid transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
default:
|
||||||
return -1;
|
printf("[%s] invalid transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||||
break;
|
return -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *);
|
typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *);
|
||||||
/* look for the interface library and load it */
|
/* look for the interface library and load it */
|
||||||
int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * cfg, uint8_t flag) {
|
int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *cfg, uint8_t flag) {
|
||||||
|
|
||||||
loader_shlibfunc_t shlib_fdesc[1];
|
loader_shlibfunc_t shlib_fdesc[1];
|
||||||
int ret=0;
|
int ret=0;
|
||||||
char *libname;
|
char *libname;
|
||||||
|
|
||||||
if ( IS_SOFTMODEM_BASICSIM ) {
|
if ( IS_SOFTMODEM_BASICSIM ) {
|
||||||
libname=OAI_BASICSIM_LIBNAME;
|
libname=OAI_BASICSIM_LIBNAME;
|
||||||
shlib_fdesc[0].fname="device_init";
|
shlib_fdesc[0].fname="device_init";
|
||||||
} else
|
} else if ( IS_SOFTMODEM_RFSIM ) {
|
||||||
if ( IS_SOFTMODEM_RFSIM ) {
|
libname=OAI_RFSIM_LIBNAME;
|
||||||
libname=OAI_RFSIM_LIBNAME;
|
shlib_fdesc[0].fname="device_init";
|
||||||
shlib_fdesc[0].fname="device_init";
|
|
||||||
} else if (flag == RAU_LOCAL_RADIO_HEAD) {
|
} else if (flag == RAU_LOCAL_RADIO_HEAD) {
|
||||||
libname=OAI_RF_LIBNAME;
|
libname=OAI_RF_LIBNAME;
|
||||||
shlib_fdesc[0].fname="device_init";
|
shlib_fdesc[0].fname="device_init";
|
||||||
} else {
|
} else {
|
||||||
libname=OAI_TP_LIBNAME;
|
libname=OAI_TP_LIBNAME;
|
||||||
shlib_fdesc[0].fname="transport_init";
|
shlib_fdesc[0].fname="transport_init";
|
||||||
}
|
}
|
||||||
|
|
||||||
ret=load_module_shlib(libname,shlib_fdesc,1,NULL);
|
ret=load_module_shlib(libname,shlib_fdesc,1,NULL);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr,"Library %s couldn't be loaded\n",libname);
|
fprintf(stderr,"Library %s couldn't be loaded\n",libname);
|
||||||
} else {
|
} else {
|
||||||
ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
|
ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg) {
|
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||||
|
|
||||||
int rc=0;
|
int rc=0;
|
||||||
rc=load_lib(device, openair0_cfg, NULL,RAU_LOCAL_RADIO_HEAD );
|
rc=load_lib(device, openair0_cfg, NULL,RAU_LOCAL_RADIO_HEAD );
|
||||||
|
|
||||||
if ( rc >= 0) {
|
if ( rc >= 0) {
|
||||||
if ( set_device(device) < 0) {
|
if ( set_device(device) < 0) {
|
||||||
fprintf(stderr, "%s %d:Unsupported radio head\n",__FILE__, __LINE__);
|
fprintf(stderr, "%s %d:Unsupported radio head\n",__FILE__, __LINE__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params) {
|
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params) {
|
||||||
int rc;
|
int rc;
|
||||||
rc=load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD);
|
rc=load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD);
|
||||||
if ( rc >= 0) {
|
|
||||||
|
if ( rc >= 0) {
|
||||||
if ( set_transport(device) < 0) {
|
if ( set_transport(device) < 0) {
|
||||||
fprintf(stderr, "%s %d:Unsupported transport protocol\n",__FILE__, __LINE__);
|
fprintf(stderr, "%s %d:Unsupported transport protocol\n",__FILE__, __LINE__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file common_lib.h
|
/*! \file common_lib.h
|
||||||
* \brief common APIs for different RF frontend device
|
* \brief common APIs for different RF frontend device
|
||||||
* \author HongliangXU, Navid Nikaein
|
* \author HongliangXU, Navid Nikaein
|
||||||
* \date 2015
|
* \date 2015
|
||||||
* \version 0.2
|
* \version 0.2
|
||||||
@@ -48,13 +48,13 @@
|
|||||||
#define RAU_REMOTE_RADIO_HEAD 1
|
#define RAU_REMOTE_RADIO_HEAD 1
|
||||||
|
|
||||||
#ifndef MAX_CARDS
|
#ifndef MAX_CARDS
|
||||||
#define MAX_CARDS 8
|
#define MAX_CARDS 8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef int64_t openair0_timestamp;
|
typedef int64_t openair0_timestamp;
|
||||||
typedef volatile int64_t openair0_vtimestamp;
|
typedef volatile int64_t openair0_vtimestamp;
|
||||||
|
|
||||||
|
|
||||||
/*!\brief structrue holds the parameters to configure USRP devices*/
|
/*!\brief structrue holds the parameters to configure USRP devices*/
|
||||||
typedef struct openair0_device_t openair0_device;
|
typedef struct openair0_device_t openair0_device;
|
||||||
|
|
||||||
@@ -123,16 +123,16 @@ typedef enum {
|
|||||||
/*!\brief openair0 device host type */
|
/*!\brief openair0 device host type */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MIN_HOST_TYPE = 0,
|
MIN_HOST_TYPE = 0,
|
||||||
/*!\brief device functions within a RAU */
|
/*!\brief device functions within a RAU */
|
||||||
RAU_HOST,
|
RAU_HOST,
|
||||||
/*!\brief device functions within a RRU */
|
/*!\brief device functions within a RRU */
|
||||||
RRU_HOST,
|
RRU_HOST,
|
||||||
MAX_HOST_TYPE
|
MAX_HOST_TYPE
|
||||||
|
|
||||||
}host_type_t;
|
} host_type_t;
|
||||||
|
|
||||||
|
|
||||||
/*! \brief RF Gain clibration */
|
/*! \brief RF Gain clibration */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
//! Frequency for which RX chain was calibrated
|
//! Frequency for which RX chain was calibrated
|
||||||
double freq;
|
double freq;
|
||||||
@@ -160,7 +160,7 @@ typedef struct {
|
|||||||
duplex_mode_t duplex_mode;
|
duplex_mode_t duplex_mode;
|
||||||
//! number of downlink resource blocks
|
//! number of downlink resource blocks
|
||||||
int num_rb_dl;
|
int num_rb_dl;
|
||||||
//! number of samples per frame
|
//! number of samples per frame
|
||||||
unsigned int samples_per_frame;
|
unsigned int samples_per_frame;
|
||||||
//! the sample rate for both transmit and receive.
|
//! the sample rate for both transmit and receive.
|
||||||
double sample_rate;
|
double sample_rate;
|
||||||
@@ -175,9 +175,9 @@ typedef struct {
|
|||||||
//! number of TX channels (=TX antennas)
|
//! number of TX channels (=TX antennas)
|
||||||
int tx_num_channels;
|
int tx_num_channels;
|
||||||
//! \brief RX base addresses for mmapped_dma
|
//! \brief RX base addresses for mmapped_dma
|
||||||
int32_t* rxbase[4];
|
int32_t *rxbase[4];
|
||||||
//! \brief TX base addresses for mmapped_dma
|
//! \brief TX base addresses for mmapped_dma
|
||||||
int32_t* txbase[4];
|
int32_t *txbase[4];
|
||||||
//! \brief Center frequency in Hz for RX.
|
//! \brief Center frequency in Hz for RX.
|
||||||
//! index: [0..rx_num_channels[
|
//! index: [0..rx_num_channels[
|
||||||
double rx_freq[4];
|
double rx_freq[4];
|
||||||
@@ -188,7 +188,7 @@ typedef struct {
|
|||||||
//! \brief Pointer to Calibration table for RX gains
|
//! \brief Pointer to Calibration table for RX gains
|
||||||
rx_gain_calib_table_t *rx_gain_calib_table;
|
rx_gain_calib_table_t *rx_gain_calib_table;
|
||||||
|
|
||||||
//! mode for rxgain (ExpressMIMO2)
|
//! mode for rxgain (ExpressMIMO2)
|
||||||
rx_gain_t rxg_mode[4];
|
rx_gain_t rxg_mode[4];
|
||||||
//! \brief Gain for RX in dB.
|
//! \brief Gain for RX in dB.
|
||||||
//! index: [0..rx_num_channels]
|
//! index: [0..rx_num_channels]
|
||||||
@@ -202,14 +202,14 @@ typedef struct {
|
|||||||
double rx_bw;
|
double rx_bw;
|
||||||
//! TX bandwidth in Hz
|
//! TX bandwidth in Hz
|
||||||
double tx_bw;
|
double tx_bw;
|
||||||
//! clock source
|
//! clock source
|
||||||
clock_source_t clock_source;
|
clock_source_t clock_source;
|
||||||
//! Manual SDR IP address
|
//! Manual SDR IP address
|
||||||
char *sdr_addrs;
|
char *sdr_addrs;
|
||||||
//! Auto calibration flag
|
//! Auto calibration flag
|
||||||
int autocal[4];
|
int autocal[4];
|
||||||
//! rf devices work with x bits iqs when oai have its own iq format
|
//! rf devices work with x bits iqs when oai have its own iq format
|
||||||
//! the two following parameters are used to convert iqs
|
//! the two following parameters are used to convert iqs
|
||||||
int iq_txshift;
|
int iq_txshift;
|
||||||
int iq_rxrescale;
|
int iq_rxrescale;
|
||||||
//! Configuration file for LMS7002M
|
//! Configuration file for LMS7002M
|
||||||
@@ -222,10 +222,10 @@ typedef struct {
|
|||||||
unsigned int sf_read_delay; // read delay in replay mode
|
unsigned int sf_read_delay; // read delay in replay mode
|
||||||
unsigned int sf_write_delay; // write delay in replay mode
|
unsigned int sf_write_delay; // write delay in replay mode
|
||||||
unsigned int eth_mtu; // ethernet MTU
|
unsigned int eth_mtu; // ethernet MTU
|
||||||
#endif
|
#endif
|
||||||
} openair0_config_t;
|
} openair0_config_t;
|
||||||
|
|
||||||
/*! \brief RF mapping */
|
/*! \brief RF mapping */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
//! card id
|
//! card id
|
||||||
int card;
|
int card;
|
||||||
@@ -272,14 +272,14 @@ struct openair0_device_t {
|
|||||||
|
|
||||||
/*!brief Component Carrier ID of this device */
|
/*!brief Component Carrier ID of this device */
|
||||||
int CC_id;
|
int CC_id;
|
||||||
|
|
||||||
/*!brief Type of this device */
|
/*!brief Type of this device */
|
||||||
dev_type_t type;
|
dev_type_t type;
|
||||||
|
|
||||||
/*!brief Transport protocol type that the device suppports (in case I/Q samples need to be transported) */
|
/*!brief Transport protocol type that the device suppports (in case I/Q samples need to be transported) */
|
||||||
transport_type_t transp_type;
|
transport_type_t transp_type;
|
||||||
|
|
||||||
/*!brief Type of the device's host (RAU/RRU) */
|
/*!brief Type of the device's host (RAU/RRU) */
|
||||||
host_type_t host_type;
|
host_type_t host_type;
|
||||||
|
|
||||||
/* !brief RF frontend parameters set by application */
|
/* !brief RF frontend parameters set by application */
|
||||||
@@ -301,25 +301,25 @@ struct openair0_device_t {
|
|||||||
/*! \brief Called to send a request message between RAU-RRU on control port
|
/*! \brief Called to send a request message between RAU-RRU on control port
|
||||||
@param device pointer to the device structure specific to the RF hardware target
|
@param device pointer to the device structure specific to the RF hardware target
|
||||||
@param msg pointer to the message structure passed between RAU-RRU
|
@param msg pointer to the message structure passed between RAU-RRU
|
||||||
@param msg_len length of the message
|
@param msg_len length of the message
|
||||||
*/
|
*/
|
||||||
int (*trx_ctlsend_func)(openair0_device *device, void *msg, ssize_t msg_len);
|
int (*trx_ctlsend_func)(openair0_device *device, void *msg, ssize_t msg_len);
|
||||||
|
|
||||||
/*! \brief Called to receive a reply message between RAU-RRU on control port
|
/*! \brief Called to receive a reply message between RAU-RRU on control port
|
||||||
@param device pointer to the device structure specific to the RF hardware target
|
@param device pointer to the device structure specific to the RF hardware target
|
||||||
@param msg pointer to the message structure passed between RAU-RRU
|
@param msg pointer to the message structure passed between RAU-RRU
|
||||||
@param msg_len length of the message
|
@param msg_len length of the message
|
||||||
*/
|
*/
|
||||||
int (*trx_ctlrecv_func)(openair0_device *device, void *msg, ssize_t msg_len);
|
int (*trx_ctlrecv_func)(openair0_device *device, void *msg, ssize_t msg_len);
|
||||||
|
|
||||||
/*! \brief Called to send samples to the RF target
|
/*! \brief Called to send samples to the RF target
|
||||||
@param device pointer to the device structure specific to the RF hardware target
|
@param device pointer to the device structure specific to the RF hardware target
|
||||||
@param timestamp The timestamp at whicch the first sample MUST be sent
|
@param timestamp The timestamp at whicch the first sample MUST be sent
|
||||||
@param buff Buffer which holds the samples
|
@param buff Buffer which holds the samples
|
||||||
@param nsamps number of samples to be sent
|
@param nsamps number of samples to be sent
|
||||||
@param antenna_id index of the antenna if the device has multiple anteannas
|
@param antenna_id index of the antenna if the device has multiple anteannas
|
||||||
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
|
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
|
||||||
*/
|
*/
|
||||||
int (*trx_write_func)(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int antenna_id, int flags);
|
int (*trx_write_func)(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int antenna_id, int flags);
|
||||||
|
|
||||||
/*! \brief Receive samples from hardware.
|
/*! \brief Receive samples from hardware.
|
||||||
@@ -335,55 +335,55 @@ struct openair0_device_t {
|
|||||||
*/
|
*/
|
||||||
int (*trx_read_func)(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps,int antenna_id);
|
int (*trx_read_func)(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps,int antenna_id);
|
||||||
|
|
||||||
/*! \brief print the device statistics
|
/*! \brief print the device statistics
|
||||||
* \param device the hardware to use
|
* \param device the hardware to use
|
||||||
* \returns 0 on success
|
* \returns 0 on success
|
||||||
*/
|
*/
|
||||||
int (*trx_get_stats_func)(openair0_device *device);
|
int (*trx_get_stats_func)(openair0_device *device);
|
||||||
|
|
||||||
/*! \brief Reset device statistics
|
/*! \brief Reset device statistics
|
||||||
* \param device the hardware to use
|
* \param device the hardware to use
|
||||||
* \returns 0 in success
|
* \returns 0 in success
|
||||||
*/
|
*/
|
||||||
int (*trx_reset_stats_func)(openair0_device *device);
|
int (*trx_reset_stats_func)(openair0_device *device);
|
||||||
|
|
||||||
/*! \brief Terminate operation of the transceiver -- free all associated resources
|
/*! \brief Terminate operation of the transceiver -- free all associated resources
|
||||||
* \param device the hardware to use
|
* \param device the hardware to use
|
||||||
*/
|
*/
|
||||||
void (*trx_end_func)(openair0_device *device);
|
void (*trx_end_func)(openair0_device *device);
|
||||||
|
|
||||||
/*! \brief Stop operation of the transceiver
|
/*! \brief Stop operation of the transceiver
|
||||||
*/
|
*/
|
||||||
int (*trx_stop_func)(openair0_device *device);
|
int (*trx_stop_func)(openair0_device *device);
|
||||||
|
|
||||||
/* Functions API related to UE*/
|
/* Functions API related to UE*/
|
||||||
|
|
||||||
/*! \brief Set RX feaquencies
|
/*! \brief Set RX feaquencies
|
||||||
* \param device the hardware to use
|
* \param device the hardware to use
|
||||||
* \param openair0_cfg RF frontend parameters set by application
|
* \param openair0_cfg RF frontend parameters set by application
|
||||||
* \param exmimo_dump_config dump EXMIMO configuration
|
* \param exmimo_dump_config dump EXMIMO configuration
|
||||||
* \returns 0 in success
|
* \returns 0 in success
|
||||||
*/
|
*/
|
||||||
int (*trx_set_freq_func)(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config);
|
int (*trx_set_freq_func)(openair0_device *device, openair0_config_t *openair0_cfg,int exmimo_dump_config);
|
||||||
|
|
||||||
/*! \brief Set gains
|
/*! \brief Set gains
|
||||||
* \param device the hardware to use
|
* \param device the hardware to use
|
||||||
* \param openair0_cfg RF frontend parameters set by application
|
* \param openair0_cfg RF frontend parameters set by application
|
||||||
* \returns 0 in success
|
* \returns 0 in success
|
||||||
*/
|
*/
|
||||||
int (*trx_set_gains_func)(openair0_device* device, openair0_config_t *openair0_cfg);
|
int (*trx_set_gains_func)(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||||
|
|
||||||
/*! \brief RRU Configuration callback
|
/*! \brief RRU Configuration callback
|
||||||
* \param idx RU index
|
* \param idx RU index
|
||||||
* \param arg pointer to capabilities or configuration
|
* \param arg pointer to capabilities or configuration
|
||||||
*/
|
*/
|
||||||
void (*configure_rru)(int idx, void* arg);
|
void (*configure_rru)(int idx, void *arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* type of device init function, implemented in shared lib */
|
/* type of device init function, implemented in shared lib */
|
||||||
typedef int(*oai_device_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg);
|
typedef int(*oai_device_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||||
/* type of transport init function, implemented in shared lib */
|
/* type of transport init function, implemented in shared lib */
|
||||||
typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params);
|
typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -391,23 +391,23 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Initialize openair RF target. It returns 0 if OK */
|
/*! \brief Initialize openair RF target. It returns 0 if OK */
|
||||||
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg);
|
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||||
/*! \brief Initialize transport protocol . It returns 0 if OK */
|
/*! \brief Initialize transport protocol . It returns 0 if OK */
|
||||||
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params);
|
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Get current timestamp of USRP
|
|
||||||
* \param device the hardware to use
|
|
||||||
*/
|
|
||||||
openair0_timestamp get_usrp_time(openair0_device *device);
|
|
||||||
|
|
||||||
/*! \brief Set RX frequencies
|
/*! \brief Get current timestamp of USRP
|
||||||
* \param device the hardware to use
|
* \param device the hardware to use
|
||||||
* \param openair0_cfg RF frontend parameters set by application
|
*/
|
||||||
* \returns 0 in success
|
openair0_timestamp get_usrp_time(openair0_device *device);
|
||||||
*/
|
|
||||||
int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg);
|
/*! \brief Set RX frequencies
|
||||||
|
* \param device the hardware to use
|
||||||
|
* \param openair0_cfg RF frontend parameters set by application
|
||||||
|
* \returns 0 in success
|
||||||
|
*/
|
||||||
|
int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ int eth_socket_init_raw(openair0_device *device) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 09/03/2019: fix obvious inconsistencies, but this code hasn't be tested for sure */
|
||||||
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags) {
|
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags) {
|
||||||
|
|
||||||
int bytes_sent=0;
|
int bytes_sent=0;
|
||||||
@@ -148,7 +148,12 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
|
|||||||
//sendto_flag|=flags;
|
//sendto_flag|=flags;
|
||||||
|
|
||||||
eth->tx_nsamps=nsamps;
|
eth->tx_nsamps=nsamps;
|
||||||
|
int pktsize;
|
||||||
|
if (eth->compression == ALAW_COMPRESS) {
|
||||||
|
pktsize = RAW_PACKET_SIZE_BYTES_ALAW(nsamps);
|
||||||
|
} else {
|
||||||
|
pktsize = RAW_PACKET_SIZE_BYTES(nsamps);
|
||||||
|
}
|
||||||
for (i=0;i<cc;i++) {
|
for (i=0;i<cc;i++) {
|
||||||
/* buff[i] points to the position in tx buffer where the payload to be sent is
|
/* buff[i] points to the position in tx buffer where the payload to be sent is
|
||||||
buff2 points to the position in tx buffer where the packet header will be placed */
|
buff2 points to the position in tx buffer where the packet header will be placed */
|
||||||
@@ -162,44 +167,27 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
|
|||||||
bytes_sent = 0;
|
bytes_sent = 0;
|
||||||
memcpy(buff2,(void*)ð->ehd,MAC_HEADER_SIZE_BYTES);
|
memcpy(buff2,(void*)ð->ehd,MAC_HEADER_SIZE_BYTES);
|
||||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t))=1+(i<<1);
|
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t))=1+(i<<1);
|
||||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
|
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
|
||||||
|
|
||||||
int sent_byte;
|
|
||||||
|
|
||||||
|
|
||||||
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
|
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
|
||||||
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
|
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
|
||||||
|
|
||||||
while(bytes_sent < sent_byte) {
|
while(bytes_sent < pktsize) {
|
||||||
#if DEBUG
|
|
||||||
printf("------- TX ------: buff2 current position=%d remaining_bytes=%d bytes_sent=%d \n",
|
|
||||||
(void *)(buff2+bytes_sent),
|
|
||||||
sent_byte - bytes_sent,
|
|
||||||
bytes_sent);
|
|
||||||
#endif
|
|
||||||
/* Send packet */
|
/* Send packet */
|
||||||
|
|
||||||
bytes_sent += send(eth->sockfdd,
|
bytes_sent += send(eth->sockfdd,
|
||||||
buff2,
|
buff2,
|
||||||
sent_byte,
|
pktsize,
|
||||||
sendto_flag);
|
sendto_flag);
|
||||||
if ( bytes_sent == -1) {
|
if ( bytes_sent == -1) {
|
||||||
eth->num_tx_errors++;
|
eth->num_tx_errors++;
|
||||||
perror("ETHERNET WRITE: ");
|
perror("ETHERNET WRITE: ");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} else {
|
} else {
|
||||||
#if DEBUG
|
|
||||||
printf("------- TX ------: nu=%x an_id=%d ts%d bytes_sent=%d\n",
|
|
||||||
*(uint8_t *)(buff2+ETH_ALEN),
|
|
||||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
|
|
||||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
|
|
||||||
bytes_sent);
|
|
||||||
|
|
||||||
dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, sent_byte, TX_FLAG);
|
eth->tx_actual_nsamps=bytes_sent>>2;
|
||||||
|
eth->tx_count++;
|
||||||
#endif
|
|
||||||
eth->tx_actual_nsamps=bytes_sent>>2;
|
|
||||||
eth->tx_count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1381,12 +1381,11 @@ int setup_RU_buffers(RU_t *ru) {
|
|||||||
else if (frame_parms->N_RB_DL == 50) ru->N_TA_offset = 624/2;
|
else if (frame_parms->N_RB_DL == 50) ru->N_TA_offset = 624/2;
|
||||||
else if (frame_parms->N_RB_DL == 25) ru->N_TA_offset = 624/4;
|
else if (frame_parms->N_RB_DL == 25) ru->N_TA_offset = 624/4;
|
||||||
|
|
||||||
if(IS_SOFTMODEM_BASICSIM)
|
if(IS_SOFTMODEM_BASICSIM)
|
||||||
/* this is required for the basic simulator in TDD mode
|
/* this is required for the basic simulator in TDD mode
|
||||||
* TODO: find a proper cleaner solution
|
* TODO: find a proper cleaner solution
|
||||||
*/
|
*/
|
||||||
ru->N_TA_offset = 0;
|
ru->N_TA_offset = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ru->openair0_cfg.mmapped_dma == 1) {
|
if (ru->openair0_cfg.mmapped_dma == 1) {
|
||||||
|
|||||||
@@ -99,9 +99,11 @@ void get_common_options(void) {
|
|||||||
if (basicsim) {
|
if (basicsim) {
|
||||||
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BASIC_SIMULATOR
|
#if BASIC_SIMULATOR
|
||||||
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
||||||
|
|
||||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||||
|
|||||||
@@ -655,10 +655,12 @@ int main( int argc, char **argv ) {
|
|||||||
fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
|
fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
|
||||||
uint32_t pdcp_initmask = ( IS_SOFTMODEM_NOS1 )? ( PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
uint32_t pdcp_initmask = ( IS_SOFTMODEM_NOS1 )? ( PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||||
#
|
#
|
||||||
|
|
||||||
if ( IS_SOFTMODEM_NOS1)
|
if ( IS_SOFTMODEM_NOS1)
|
||||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
|
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
|
||||||
|
|
||||||
pdcp_module_init(pdcp_initmask);
|
pdcp_module_init(pdcp_initmask);
|
||||||
|
|
||||||
if (RC.nb_inst > 0) {
|
if (RC.nb_inst > 0) {
|
||||||
// don't create if node doesn't connect to RRC/S1/GTP
|
// don't create if node doesn't connect to RRC/S1/GTP
|
||||||
if (create_tasks(1) < 0) {
|
if (create_tasks(1) < 0) {
|
||||||
|
|||||||
+1058
-1069
File diff suppressed because it is too large
Load Diff
@@ -760,22 +760,22 @@ int main( int argc, char **argv ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||||
|
|
||||||
init_opt();
|
init_opt();
|
||||||
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1 )? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
|
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1 )? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
|
||||||
|
|
||||||
if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_mode == 3) ) {
|
if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_mode == 3) ) {
|
||||||
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( IS_SOFTMODEM_NOKRNMOD)
|
if ( IS_SOFTMODEM_NOKRNMOD)
|
||||||
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
||||||
|
|
||||||
pdcp_module_init( pdcp_initmask );
|
pdcp_module_init( pdcp_initmask );
|
||||||
//TTN for D2D
|
//TTN for D2D
|
||||||
printf ("RRC control socket\n");
|
printf ("RRC control socket\n");
|
||||||
rrc_control_socket_init();
|
rrc_control_socket_init();
|
||||||
printf ("PDCP PC5S socket\n");
|
printf ("PDCP PC5S socket\n");
|
||||||
pdcp_pc5_socket_init();
|
pdcp_pc5_socket_init();
|
||||||
|
|
||||||
// to make a graceful exit when ctrl-c is pressed
|
// to make a graceful exit when ctrl-c is pressed
|
||||||
signal(SIGSEGV, signal_handler);
|
signal(SIGSEGV, signal_handler);
|
||||||
signal(SIGINT, signal_handler);
|
signal(SIGINT, signal_handler);
|
||||||
|
|||||||
Reference in New Issue
Block a user