From d51d5deeaca2378cea73758a1e05d6aa519eabf0 Mon Sep 17 00:00:00 2001 From: "S. Sandeep Kumar" <ee13b1025@iith.ac.in> Date: Wed, 8 Jun 2016 04:00:13 +0530 Subject: [PATCH] fix some structures and add more details to if4 functions --- openair1/PHY/LTE_TRANSPORT/if4_tools.c | 209 +++++++++++-------------- openair1/PHY/LTE_TRANSPORT/if4_tools.h | 55 ++++--- 2 files changed, 129 insertions(+), 135 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index a42eae8798..e75a8675e9 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -45,153 +45,132 @@ #include "PHY/LTE_TRANSPORT/if4_tools.h" #endif -// Define how data blocks are stored and transferred - -//void send_IF4(PHY_VARS_eNB *eNB, int subframe){ - //eNB_proc_t *proc = &eNB->proc; - //int frame=proc->frame_tx; - //int subframe=proc->subframe_tx; - - //LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; - - //uint32_t i,j; - //float *data_block = malloc(length*sizeof(long)); - - // Generate IF4 packet (for now DL) with frame status information - //dl_packet = gen_IF4_dl_packet( /* ADD INFO and data_block pointer */ ); +void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc) { + int frame = proc->frame_tx; + int subframe = proc->subframe_tx; + LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - //for(i=0; i<fp->symbols_per_tti; i++) { - - // Do compression of the two parts and generate data blocks - - //symbol = eNB->common_vars.txdataF[0][0 /*antenna number*/][subframe*fp->ofdm_symbol_size*(fp->symbols_per_tti)] - //data_block[j] = Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j -1])<<16 + Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j]); - //data_block[j+NrOfNonZeroValues] = Atan(subframe[i][j+1])<<16 + Atan(subframe[i][j+2]); - - // Set data blocks and update subframe no./other information to generated packet - - - // Write the packet(s) to the fronthaul - - //} + uint16_t i; + + float_t data_block_length = 1200*(fp->ofdm_symbol_size/2048); + uint16_t *data_block = (uint16_t*)malloc(data_block_length*sizeof(uint16_t)); + + // Caller: RCC - DL *** handle RRU case - UL and PRACH *** + if (eNB->node_function == NGFI_RCC_IF4) { + IF4_dl_packet_t *dl_packet = (IF4_dl_packet_t*)malloc(sizeof_IF4_dl_packet_t); + gen_IF4_dl_packet(dl_packet, proc); + + dl_packet->data_block = data_block; + + for(i=0; i<fp->symbols_per_tti; i++) { + + //Do compression of the two parts and generate data blocks + + //symbol = eNB->common_vars.txdataF[0][0 /*antenna number*/][subframe*fp->ofdm_symbol_size*(fp->symbols_per_tti)] + //data_block[j] = Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j -1])<<16 + Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j]); + //data_block[j+NrOfNonZeroValues] = Atan(subframe[i][j+1])<<16 + Atan(subframe[i][j+2]); + + // Update information in generated packet + dl_packet->frame_status.sym_num = i; + + // Write the packet(s) to the fronthaul + + } + }else { + IF4_ul_packet_t *ul_packet = (IF4_ul_packet_t*)malloc(sizeof_IF4_ul_packet_t); + gen_IF4_ul_packet(ul_packet, proc); + + ul_packet->data_block = data_block; + + for(i=0; i<fp->symbols_per_tti; i++) { + + //Do compression of the two parts and generate data blocks + + //symbol = eNB->common_vars.txdataF[0][0 /*antenna number*/][subframe*fp->ofdm_symbol_size*(fp->symbols_per_tti)] + //data_block[j] = Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j -1])<<16 + Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j]); + //data_block[j+NrOfNonZeroValues] = Atan(subframe[i][j+1])<<16 + Atan(subframe[i][j+2]); + + // Update information in generated packet + ul_packet->frame_status.sym_num = i; + + // Write the packet(s) to the fronthaul + + } + } -//} +} -void recv_IF4( /* ADD INFO and data_block pointer */ ) { +void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc) { // Read packet(s) from the fronthaul // Apply reverse processing - decompression // Generate and return the OFDM symbols (txdataF) - + + // Caller: RRU - DL *** handle RCC case - UL and PRACH *** + } -struct IF4_dl_packet gen_IF4_dl_packet( /* ADD INFO and data_block pointer */ ) { - struct IF4_dl_packet dl_packet; - - // Set destination and source address - +void gen_IF4_dl_packet(IF4_dl_packet_t *dl_packet, eNB_rxtx_proc_t *proc) { // Set Type and Sub-Type - dl_packet.type = 0x080A; - dl_packet.sub_type = 0x0020; + dl_packet->type = 0x080A; + dl_packet->sub_type = 0x0020; // Leave reserved as it is - //dl_packet.rsvd = ; + dl_packet->rsvd = 0; // Set frame status - dl_packet.frame_status.ant_num = 0; - dl_packet.frame_status.ant_start = 0; - dl_packet.frame_status.rf_num = 0; - dl_packet.frame_status.sf_num = 0; - dl_packet.frame_status.sym_num = 0; - //dl_packet.frame_status.rsvd = ; - - // Set data blocks if sent - //if (data_block != NULL) { - // - //} else { - // - //} - + dl_packet->frame_status.ant_num = 0; + dl_packet->frame_status.ant_start = 0; + dl_packet->frame_status.rf_num = proc->frame_tx; + dl_packet->frame_status.sf_num = proc->subframe_tx; + dl_packet->frame_status.sym_num = 0; + dl_packet->frame_status.rsvd = 0; + // Set frame check sequence - dl_packet.fcs = 0; - - return dl_packet; + dl_packet->fcs = 0; } -struct IF4_ul_packet gen_IF4_ul_packet( /* ADD INFO and data_block pointer */ ) { - struct IF4_ul_packet ul_packet; - - // Set destination and source address - +void gen_IF4_ul_packet(IF4_ul_packet_t *ul_packet, eNB_rxtx_proc_t *proc) { // Set Type and Sub-Type - ul_packet.type = 0x080A; - ul_packet.sub_type = 0x0019; + ul_packet->type = 0x080A; + ul_packet->sub_type = 0x0019; // Leave reserved as it is - //ul_packet.rsvd = ; + ul_packet->rsvd = 0; // Set frame status - ul_packet.frame_status.ant_num = 0; - ul_packet.frame_status.ant_start = 0; - ul_packet.frame_status.rf_num = 0; - ul_packet.frame_status.sf_num = 0; - ul_packet.frame_status.sym_num = 0; - //ul_packet.frame_status.rsvd = ; + ul_packet->frame_status.ant_num = 0; + ul_packet->frame_status.ant_start = 0; + ul_packet->frame_status.rf_num = proc->frame_rx; + ul_packet->frame_status.sf_num = proc->subframe_rx; + ul_packet->frame_status.sym_num = 0; + ul_packet->frame_status.rsvd = 0; + + // Set antenna specific gain *** set other antenna gain *** + ul_packet->gain0.exponent = 0; + ul_packet->gain0.rsvd = 0; - // Set antenna specific gain - ul_packet.gain0.exponent = 0; - //ul_packet.gain0.rsvd = ; - - // Set data blocks if sent - //if (data_block != NULL) { - // - //} else { - // - //} - // Set frame check sequence - ul_packet.fcs = 0; - - return ul_packet; + ul_packet->fcs = 0; } -struct IF4_prach_packet gen_IF4_prach_packet( /* ADD INFO and data_block pointer */ ) { - struct IF4_prach_packet prach_packet; - - // Set destination and source address - +void gen_IF4_prach_packet(IF4_prach_packet_t *prach_packet, eNB_rxtx_proc_t *proc) { // Set Type and Sub-Type - prach_packet.type = 0x080A; - prach_packet.sub_type = 0x0021; + prach_packet->type = 0x080A; + prach_packet->sub_type = 0x0021; // Leave reserved as it is - //prach_packet.rsvd = ; + prach_packet->rsvd = 0; // Set LTE Prach configuration - //prach_packet.prach_conf.rsvd = ; - prach_packet.prach_conf.ant = 0; - prach_packet.prach_conf.rf_num = 0; - prach_packet.prach_conf.sf_num = 0; - prach_packet.prach_conf.exponent = 0; - - // Set data blocks if sent - //if (data_block != NULL) { - // - //} else { - // - //} - + prach_packet->prach_conf.rsvd = 0; + prach_packet->prach_conf.ant = 0; + prach_packet->prach_conf.rf_num = proc->frame_rx; + prach_packet->prach_conf.sf_num = proc->subframe_rx; + prach_packet->prach_conf.exponent = 0; + // Set frame check sequence - prach_packet.fcs = 0; - - return prach_packet; + prach_packet->fcs = 0; } - -int main(){ - - uint32_t i=0; - - return 0; -} diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.h b/openair1/PHY/LTE_TRANSPORT/if4_tools.h index c5bb46576c..819aca58d6 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.h +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.h @@ -54,6 +54,9 @@ struct IF4_frame_status { uint32_t rsvd:2; }; +typedef struct IF4_frame_status IF4_frame_status_t; +#define sizeof_IF4_frame_status_t 4 + /// IF4 Antenna Gain (16 bits) struct IF4_gain { /// Reserved @@ -62,6 +65,9 @@ struct IF4_gain { uint16_t exponent:6; }; +typedef struct IF4_gain IF4_gain_t; +#define sizeof_IF_gain_t 2 + /// IF4 LTE PRACH Configuration (32 bits) struct IF4_lte_prach_conf { /// Reserved @@ -76,6 +82,9 @@ struct IF4_lte_prach_conf { uint32_t exponent:6; }; +typedef struct IF4_lte_prach_conf IF4_lte_prach_conf_t; +#define sizeof_IF4_lte_prach_conf_t 4 + struct IF4_dl_packet { /// Destination Address @@ -88,13 +97,15 @@ struct IF4_dl_packet { /// Reserved uint32_t rsvd; /// Frame Status - struct IF4_frame_status frame_status; + IF4_frame_status_t frame_status; /// Data Blocks - + uint16_t *data_block; /// Frame Check Sequence uint32_t fcs; }; +typedef struct IF4_dl_packet IF4_dl_packet_t; +#define sizeof_IF4_dl_packet_t 18 struct IF4_ul_packet { /// Destination Address @@ -108,29 +119,32 @@ struct IF4_ul_packet { /// Reserved uint32_t rsvd; /// Frame Status - struct IF4_frame_status frame_status; + IF4_frame_status_t frame_status; /// Gain 0 - struct IF4_gain gain0; + IF4_gain_t gain0; /// Gain 1 - struct IF4_gain gain1; + IF4_gain_t gain1; /// Gain 2 - struct IF4_gain gain2; + IF4_gain_t gain2; /// Gain 3 - struct IF4_gain gain3; + IF4_gain_t gain3; /// Gain 4 - struct IF4_gain gain4; + IF4_gain_t gain4; /// Gain 5 - struct IF4_gain gain5; + IF4_gain_t gain5; /// Gain 6 - struct IF4_gain gain6; + IF4_gain_t gain6; /// Gain 7 - struct IF4_gain gain7; + IF4_gain_t gain7; /// Data Blocks - + uint16_t *data_block; /// Frame Check Sequence uint32_t fcs; }; +typedef struct IF4_ul_packet IF4_ul_packet_t; +#define sizeof_IF4_ul_packet_t 34 + struct IF4_prach_packet { /// Destination Address @@ -143,21 +157,22 @@ struct IF4_prach_packet { /// Reserved uint32_t rsvd; /// LTE Prach Configuration - struct IF4_lte_prach_conf prach_conf; + IF4_lte_prach_conf_t prach_conf; /// Prach Data Block (one antenna) - + uint16_t *data_block; /// Frame Check Sequence uint32_t fcs; }; -// Needs to be checked +typedef struct IF4_prach_packet IF4_prach_packet_t; +#define sizeof_IF4_prach_packet_t 18 -struct IF4_dl_packet gen_IF4_dl_packet(); +void gen_IF4_dl_packet(IF4_dl_packet_t*, eNB_rxtx_proc_t*); -struct IF4_ul_packet gen_IF4_ul_packet(); +void gen_IF4_ul_packet(IF4_ul_packet_t*, eNB_rxtx_proc_t*); -struct IF4_prach_packet gen_IF4_prach_packet(); +void gen_IF4_prach_packet(IF4_prach_packet_t*, eNB_rxtx_proc_t*); -void send_IF4( /* ADD INFO */ ); +void send_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*); -void recv_IF4( /* ADD INFO */ ); +void recv_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*); -- GitLab