Commit fc13e200 authored by Sandeep Kumar's avatar Sandeep Kumar

if header and data blocks seperated

parent 5541cafd
......@@ -48,21 +48,29 @@
void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t packet_type) {
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 symbol_id, element_id;
uint16_t db_fulllength = 12*fp->N_RB_DL;
uint16_t db_halflength = db_fulllength>>1;
int slotoffsetF = (proc->subframe_tx)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
int blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
IF4_dl_header_t *dl_header=NULL;
IF4_ul_header_t *ul_header=NULL;
IF4_prach_header_t *prach_header=NULL;
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) {
IF4_dl_packet_t *dl_packet = (IF4_dl_packet_t*)malloc(sizeof_IF4_dl_packet_t);
gen_IF4_dl_packet(dl_packet, proc);
dl_header = (IF4_dl_header_t*)malloc(sizeof_IF4_dl_header_t);
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++) {
......@@ -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
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
// if ((bytes_sent = eNB->ifdevice.trx_write_func(&eNB->ifdevice,
// (proc->timestamp_tx-eNB->ifdevice.openair0_cfg.tx_sample_advance),
// dl_packet,
// eNB->frame_parms.samples_per_tti,
// eNB->frame_parms.nb_antennas_tx,
// 0)) < 0) {
// perror("RCC : ETHERNET write");
//}
if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice,
symbol_id,
&data_block,
1,
1,
0)) < 0) {
perror("RCC : ETHERNET write");
}
slotoffsetF += fp->ofdm_symbol_size;
blockoffsetF += fp->ofdm_symbol_size;
}
} else if (packet_type == IF4_PULFFT) {
IF4_ul_packet_t *ul_packet = (IF4_ul_packet_t*)malloc(sizeof_IF4_ul_packet_t);
gen_IF4_ul_packet(ul_packet, proc);
ul_header = (IF4_ul_header_t*)malloc(sizeof_IF4_ul_header_t);
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++) {
// Do compression of the two parts and generate data blocks - rxdataF
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]>>16) + 32768 ]<<8;
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+db_halflength] = lin2alaw[ (txdataF[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] & 0xffff) + 32768 ];
data_block[element_id+db_halflength] |= lin2alaw[ (rxdataF[0][slotoffsetF+element_id]>>16) + 32768 ]<<8;
}
// 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
......@@ -131,7 +144,7 @@ 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) {
*packet_type = 0;
int16_t *data_block=NULL;
//int16_t *data_block=NULL;
// Read packet(s) from the fronthaul
// for(i=0; i<fp->symbols_per_tti; i++) {
......@@ -166,7 +179,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t *packet_type, u
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
dl_packet->type = IF4_PACKET_TYPE;
dl_packet->sub_type = IF4_PDLFFT;
......@@ -183,10 +196,10 @@ void gen_IF4_dl_packet(IF4_dl_packet_t *dl_packet, eNB_rxtx_proc_t *proc) {
dl_packet->frame_status.rsvd = 0;
// 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
ul_packet->type = IF4_PACKET_TYPE;
ul_packet->sub_type = IF4_PULFFT;
......@@ -207,10 +220,10 @@ void gen_IF4_ul_packet(IF4_ul_packet_t *ul_packet, eNB_rxtx_proc_t *proc) {
ul_packet->gain0.rsvd = 0;
// 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
prach_packet->type = IF4_PACKET_TYPE;
prach_packet->sub_type = IF4_PRACH;
......@@ -226,5 +239,5 @@ void gen_IF4_prach_packet(IF4_prach_packet_t *prach_packet, eNB_rxtx_proc_t *pro
prach_packet->prach_conf.exponent = 0;
// Set frame check sequence
prach_packet->fcs = 0;
}
......@@ -93,7 +93,7 @@ struct IF4_lte_prach_conf {
typedef struct IF4_lte_prach_conf IF4_lte_prach_conf_t;
#define sizeof_IF4_lte_prach_conf_t 4
struct IF4_dl_packet {
struct IF4_dl_header {
/// Destination Address
/// Source Address
......@@ -107,15 +107,15 @@ struct IF4_dl_packet {
/// Frame Status
IF4_frame_status_t frame_status;
/// Data Blocks
int16_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
typedef struct IF4_dl_header IF4_dl_header_t;
#define sizeof_IF4_dl_header_t 12
struct IF4_ul_packet {
struct IF4_ul_header {
/// Destination Address
/// Source Address
......@@ -145,15 +145,15 @@ struct IF4_ul_packet {
/// Gain 7
IF4_gain_t gain7;
/// Data Blocks
int16_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
typedef struct IF4_ul_header IF4_ul_header_t;
#define sizeof_IF4_ul_header_t 28
struct IF4_prach_packet {
struct IF4_prach_header {
/// Destination Address
/// Source Address
......@@ -167,19 +167,19 @@ struct IF4_prach_packet {
/// LTE Prach Configuration
IF4_lte_prach_conf_t prach_conf;
/// Prach Data Block (one antenna)
int16_t *data_block;
/// Frame Check Sequence
uint32_t fcs;
};
typedef struct IF4_prach_packet IF4_prach_packet_t;
#define sizeof_IF4_prach_packet_t 18
typedef struct IF4_prach_header IF4_prach_header_t;
#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);
......
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