Commit 94fd52a4 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'enhancement-10-harmony' of...

Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony
parents 21aff80b 9246b16c
...@@ -48,21 +48,29 @@ ...@@ -48,21 +48,29 @@
void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t packet_type) { void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t packet_type) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
int32_t **txdataF = eNB->common_vars.txdataF[0]; int32_t **txdataF = eNB->common_vars.txdataF[0];
int32_t **rxdataF = eNB->common_vars.rxdataF[0];
uint16_t symbol_id, element_id; IF4_dl_header_t *dl_header=NULL;
uint16_t db_fulllength = 12*fp->N_RB_DL; IF4_ul_header_t *ul_header=NULL;
uint16_t db_halflength = db_fulllength>>1; IF4_prach_header_t *prach_header=NULL;
int slotoffsetF = (proc->subframe_tx)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
int blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
int16_t *data_block = (int16_t*)malloc(db_fulllength*sizeof(int16_t)); uint16_t symbol_id, element_id;
uint16_t db_halflength;
int slotoffsetF, blockoffsetF;
int16_t *data_block=NULL;
// int16_t *txbuffer = (int16_t*)malloc(db_halflength*sizeof(int16_t));
// Caller: RCC - DL *** handle RRU case - UL and PRACH ***
if (packet_type == IF4_PDLFFT) { if (packet_type == IF4_PDLFFT) {
IF4_dl_packet_t *dl_packet = (IF4_dl_packet_t*)malloc(sizeof_IF4_dl_packet_t); dl_header = (IF4_dl_header_t*)malloc(sizeof_IF4_dl_header_t);
gen_IF4_dl_packet(dl_packet, proc); gen_IF4_dl_header(dl_header, proc);
dl_packet->data_block = data_block; db_halflength = (12*fp->N_RB_DL)>>1;
slotoffsetF = (proc->subframe_tx)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
printf("Problem here - db_half %d\n", db_halflength);
data_block = (int16_t*)malloc(db_halflength*sizeof(int16_t));
for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) { for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) {
...@@ -78,40 +86,45 @@ void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t packet_type) { ...@@ -78,40 +86,45 @@ void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t packet_type) {
} }
// Update information in generated packet // Update information in generated packet
dl_packet->frame_status.sym_num = symbol_id; dl_header->frame_status.sym_num = symbol_id;
printf("\n Not even here !!\n");
// Write the packet(s) to the fronthaul // Write the packet(s) to the fronthaul
// if ((bytes_sent = eNB->ifdevice.trx_write_func(&eNB->ifdevice, if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice,
// (proc->timestamp_tx-eNB->ifdevice.openair0_cfg.tx_sample_advance), symbol_id,
// dl_packet, &data_block,
// eNB->frame_parms.samples_per_tti, 1,
// eNB->frame_parms.nb_antennas_tx, 1,
// 0)) < 0) { 0)) < 0) {
// perror("RCC : ETHERNET write"); perror("ETHERNET write");
//} }
slotoffsetF += fp->ofdm_symbol_size; slotoffsetF += fp->ofdm_symbol_size;
blockoffsetF += fp->ofdm_symbol_size; blockoffsetF += fp->ofdm_symbol_size;
} }
} else if (packet_type == IF4_PULFFT) { } else if (packet_type == IF4_PULFFT) {
IF4_ul_packet_t *ul_packet = (IF4_ul_packet_t*)malloc(sizeof_IF4_ul_packet_t); ul_header = (IF4_ul_header_t*)malloc(sizeof_IF4_ul_header_t);
gen_IF4_ul_packet(ul_packet, proc); gen_IF4_ul_header(ul_header, proc);
db_halflength = (12*fp->N_RB_UL)>>1;
slotoffsetF = (proc->subframe_rx)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
ul_packet->data_block = data_block; data_block = (int16_t*)malloc(db_halflength*sizeof(int16_t));
for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) { for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) {
// Do compression of the two parts and generate data blocks - rxdataF // Do compression of the two parts and generate data blocks - rxdataF
for (element_id=0; element_id<db_halflength; element_id++) { for (element_id=0; element_id<db_halflength; element_id++) {
//data_block[element_id] = lin2alaw[ (rxdataF[0][blockoffsetF+element_id] & 0xffff) + 32768 ]; data_block[element_id] = lin2alaw[ (rxdataF[0][blockoffsetF+element_id] & 0xffff) + 32768 ];
//data_block[element_id] |= lin2alaw[ (rxdataF[0][blockoffsetF+element_id]>>16) + 32768 ]<<8; data_block[element_id] |= lin2alaw[ (rxdataF[0][blockoffsetF+element_id]>>16) + 32768 ]<<8;
//data_block[element_id+db_halflength] = lin2alaw[ (txdataF[0][slotoffsetF+element_id] & 0xffff) + 32768 ]; data_block[element_id+db_halflength] = lin2alaw[ (rxdataF[0][slotoffsetF+element_id] & 0xffff) + 32768 ];
//data_block[element_id+db_halflength] |= lin2alaw[ (txdataF[0][slotoffsetF+element_id]>>16) + 32768 ]<<8; data_block[element_id+db_halflength] |= lin2alaw[ (rxdataF[0][slotoffsetF+element_id]>>16) + 32768 ]<<8;
} }
// Update information in generated packet // Update information in generated packet
ul_packet->frame_status.sym_num = symbol_id; ul_header->frame_status.sym_num = symbol_id;
// Write the packet(s) to the fronthaul // Write the packet(s) to the fronthaul
...@@ -129,35 +142,78 @@ void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t packet_type) { ...@@ -129,35 +142,78 @@ void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t packet_type) {
} }
void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t *packet_type, uint32_t *symbol_number) { void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t *packet_type, uint32_t *symbol_number) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
int32_t **txdataF = eNB->common_vars.txdataF[0];
int32_t **rxdataF = eNB->common_vars.rxdataF[0];
uint16_t element_id;
uint16_t db_halflength;
int slotoffsetF, blockoffsetF;
*packet_type = 0; *packet_type = 0;
void *rxbuffer=NULL;
int16_t *data_block=NULL; int16_t *data_block=NULL;
// Read packet(s) from the fronthaul // Read packet(s) from the fronthaul
// for(i=0; i<fp->symbols_per_tti; i++) { if (eNB->ifdevice.trx_read_func (&eNB->ifdevice,
// if (dev->eth_dev.trx_read_func (&dev->eth_dev, symbol_number,
// timestamp_rx, rxbuffer,
// rx_eNB, fp->symbols_per_tti,
// spp_eth, eNB->ifdevice.openair0_cfg->rx_num_channels
// dev->eth_dev.openair0_cfg->rx_num_channels ) < 0) {
// ) < 0) { perror("ETHERNET read");
// perror("RRU : ETHERNET read"); }
// }
// printf("\n Recv IF4 for frame %d, subframe %d and symbol %d\n", proc->frame_tx, proc->subframe_tx, symbol_id); packet_type = (uint16_t*) (rxbuffer+2);
//*packet_type = ;
if (*packet_type == IF4_PDLFFT) { if (*packet_type == IF4_PDLFFT) {
data_block = (int16_t*) (rxbuffer+sizeof_IF4_dl_header_t);
// Apply reverse processing - decompression db_halflength = (12*fp->N_RB_DL)>>1;
// txAlawtolinear( Datablock )
// Calculate from received packet
// Generate and return the OFDM symbols (txdataF) slotoffsetF = (proc->subframe_tx)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
// txDataF blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
data_block = (int16_t*)malloc(db_halflength*sizeof(int16_t));
// Do decompression of the two parts and generate data blocks
for (element_id=0; element_id<db_halflength; element_id++) {
txdataF[0][blockoffsetF+element_id] = alaw2lin[ (data_block[element_id] & 0xff) ];
txdataF[0][blockoffsetF+element_id] |= alaw2lin[ (data_block[element_id]>>8) ]<<16;
txdataF[0][slotoffsetF+element_id] = alaw2lin[ (data_block[element_id+db_halflength] & 0xff) ];
txdataF[0][slotoffsetF+element_id] |= alaw2lin[ (data_block[element_id+db_halflength]>>8) ]<<16;
}
// Find and return symbol_number
*symbol_number = 0;
} else if (*packet_type == IF4_PULFFT) { } else if (*packet_type == IF4_PULFFT) {
data_block = (int16_t*) (rxbuffer+sizeof_IF4_ul_header_t);
db_halflength = (12*fp->N_RB_UL)>>1;
// Calculate from received packet
slotoffsetF = (proc->subframe_rx)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
data_block = (int16_t*)malloc(db_halflength*sizeof(int16_t));
// Do decompression of the two parts and generate data blocks
for (element_id=0; element_id<db_halflength; element_id++) {
rxdataF[0][blockoffsetF+element_id] = alaw2lin[ (data_block[element_id] & 0xff) ];
rxdataF[0][blockoffsetF+element_id] |= alaw2lin[ (data_block[element_id]>>8) ]<<16;
rxdataF[0][slotoffsetF+element_id] = alaw2lin[ (data_block[element_id+db_halflength] & 0xff) ];
rxdataF[0][slotoffsetF+element_id] |= alaw2lin[ (data_block[element_id+db_halflength]>>8) ]<<16;
}
// Find and return symbol_number
*symbol_number = 0;
} else if (*packet_type == IF4_PRACH) { } else if (*packet_type == IF4_PRACH) {
data_block = (int16_t*) (rxbuffer+sizeof_IF4_prach_header_t);
} else { } else {
AssertFatal(1==0, "recv_IF4 - Unknown packet_type %x", *packet_type); AssertFatal(1==0, "recv_IF4 - Unknown packet_type %x", *packet_type);
...@@ -166,7 +222,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t *packet_type, u ...@@ -166,7 +222,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t *packet_type, u
return; return;
} }
void gen_IF4_dl_packet(IF4_dl_packet_t *dl_packet, eNB_rxtx_proc_t *proc) { void gen_IF4_dl_header(IF4_dl_header_t *dl_packet, eNB_rxtx_proc_t *proc) {
// Set Type and Sub-Type // Set Type and Sub-Type
dl_packet->type = IF4_PACKET_TYPE; dl_packet->type = IF4_PACKET_TYPE;
dl_packet->sub_type = IF4_PDLFFT; dl_packet->sub_type = IF4_PDLFFT;
...@@ -183,10 +239,10 @@ void gen_IF4_dl_packet(IF4_dl_packet_t *dl_packet, eNB_rxtx_proc_t *proc) { ...@@ -183,10 +239,10 @@ void gen_IF4_dl_packet(IF4_dl_packet_t *dl_packet, eNB_rxtx_proc_t *proc) {
dl_packet->frame_status.rsvd = 0; dl_packet->frame_status.rsvd = 0;
// Set frame check sequence // Set frame check sequence
dl_packet->fcs = 0;
} }
void gen_IF4_ul_packet(IF4_ul_packet_t *ul_packet, eNB_rxtx_proc_t *proc) { void gen_IF4_ul_header(IF4_ul_header_t *ul_packet, eNB_rxtx_proc_t *proc) {
// Set Type and Sub-Type // Set Type and Sub-Type
ul_packet->type = IF4_PACKET_TYPE; ul_packet->type = IF4_PACKET_TYPE;
ul_packet->sub_type = IF4_PULFFT; ul_packet->sub_type = IF4_PULFFT;
...@@ -207,10 +263,10 @@ void gen_IF4_ul_packet(IF4_ul_packet_t *ul_packet, eNB_rxtx_proc_t *proc) { ...@@ -207,10 +263,10 @@ void gen_IF4_ul_packet(IF4_ul_packet_t *ul_packet, eNB_rxtx_proc_t *proc) {
ul_packet->gain0.rsvd = 0; ul_packet->gain0.rsvd = 0;
// Set frame check sequence // Set frame check sequence
ul_packet->fcs = 0;
} }
void gen_IF4_prach_packet(IF4_prach_packet_t *prach_packet, eNB_rxtx_proc_t *proc) { void gen_IF4_prach_header(IF4_prach_header_t *prach_packet, eNB_rxtx_proc_t *proc) {
// Set Type and Sub-Type // Set Type and Sub-Type
prach_packet->type = IF4_PACKET_TYPE; prach_packet->type = IF4_PACKET_TYPE;
prach_packet->sub_type = IF4_PRACH; prach_packet->sub_type = IF4_PRACH;
...@@ -226,5 +282,5 @@ void gen_IF4_prach_packet(IF4_prach_packet_t *prach_packet, eNB_rxtx_proc_t *pro ...@@ -226,5 +282,5 @@ void gen_IF4_prach_packet(IF4_prach_packet_t *prach_packet, eNB_rxtx_proc_t *pro
prach_packet->prach_conf.exponent = 0; prach_packet->prach_conf.exponent = 0;
// Set frame check sequence // Set frame check sequence
prach_packet->fcs = 0;
} }
...@@ -93,7 +93,7 @@ struct IF4_lte_prach_conf { ...@@ -93,7 +93,7 @@ struct IF4_lte_prach_conf {
typedef struct IF4_lte_prach_conf IF4_lte_prach_conf_t; typedef struct IF4_lte_prach_conf IF4_lte_prach_conf_t;
#define sizeof_IF4_lte_prach_conf_t 4 #define sizeof_IF4_lte_prach_conf_t 4
struct IF4_dl_packet { struct IF4_dl_header {
/// Destination Address /// Destination Address
/// Source Address /// Source Address
...@@ -107,15 +107,15 @@ struct IF4_dl_packet { ...@@ -107,15 +107,15 @@ struct IF4_dl_packet {
/// Frame Status /// Frame Status
IF4_frame_status_t frame_status; IF4_frame_status_t frame_status;
/// Data Blocks /// Data Blocks
int16_t *data_block;
/// Frame Check Sequence /// Frame Check Sequence
uint32_t fcs;
}; };
typedef struct IF4_dl_packet IF4_dl_packet_t; typedef struct IF4_dl_header IF4_dl_header_t;
#define sizeof_IF4_dl_packet_t 18 #define sizeof_IF4_dl_header_t 12
struct IF4_ul_packet { struct IF4_ul_header {
/// Destination Address /// Destination Address
/// Source Address /// Source Address
...@@ -145,15 +145,15 @@ struct IF4_ul_packet { ...@@ -145,15 +145,15 @@ struct IF4_ul_packet {
/// Gain 7 /// Gain 7
IF4_gain_t gain7; IF4_gain_t gain7;
/// Data Blocks /// Data Blocks
int16_t *data_block;
/// Frame Check Sequence /// Frame Check Sequence
uint32_t fcs;
}; };
typedef struct IF4_ul_packet IF4_ul_packet_t; typedef struct IF4_ul_header IF4_ul_header_t;
#define sizeof_IF4_ul_packet_t 34 #define sizeof_IF4_ul_header_t 28
struct IF4_prach_packet { struct IF4_prach_header {
/// Destination Address /// Destination Address
/// Source Address /// Source Address
...@@ -167,19 +167,19 @@ struct IF4_prach_packet { ...@@ -167,19 +167,19 @@ struct IF4_prach_packet {
/// LTE Prach Configuration /// LTE Prach Configuration
IF4_lte_prach_conf_t prach_conf; IF4_lte_prach_conf_t prach_conf;
/// Prach Data Block (one antenna) /// Prach Data Block (one antenna)
int16_t *data_block;
/// Frame Check Sequence /// Frame Check Sequence
uint32_t fcs;
}; };
typedef struct IF4_prach_packet IF4_prach_packet_t; typedef struct IF4_prach_header IF4_prach_header_t;
#define sizeof_IF4_prach_packet_t 18 #define sizeof_IF4_prach_header_t 12
void gen_IF4_dl_packet(IF4_dl_packet_t*, eNB_rxtx_proc_t*); void gen_IF4_dl_header(IF4_dl_header_t*, eNB_rxtx_proc_t*);
void gen_IF4_ul_packet(IF4_ul_packet_t*, eNB_rxtx_proc_t*); void gen_IF4_ul_header(IF4_ul_header_t*, eNB_rxtx_proc_t*);
void gen_IF4_prach_packet(IF4_prach_packet_t*, eNB_rxtx_proc_t*); void gen_IF4_prach_header(IF4_prach_header_t*, eNB_rxtx_proc_t*);
void send_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*, uint16_t); void send_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*, uint16_t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment