Commit 981655cc authored by Sandeep Kumar's avatar Sandeep Kumar

integrate send_IF4 with alaw lut

parent a33bb694
......@@ -29,7 +29,7 @@
/*! \file PHY/LTE_TRANSPORT/if4_tools.c
* \brief
* \author Mauricio Gunther, S. Sandeep Kumar, Raymond Knopp
* \author Fredrik Skretteberg, Tobias Schuster, Mauricio Gunther, S. Sandeep Kumar, Raymond Knopp
* \date 2016
* \version 0.1
* \company Eurecom
......@@ -43,6 +43,7 @@
#include <stdint.h>
#else
#include "PHY/LTE_TRANSPORT/if4_tools.h"
#include "PHY/TOOLS/ALAW/alaw_lut.h"
#endif
// Get device information
......@@ -50,11 +51,15 @@ 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;
int32_t **txdataF = eNB->common_vars.txdataF[0];
uint16_t i;
uint16_t symbol_id, element_id;
uint16_t db_fulllength = 12*fp->N_RB_DL;
uint16_t db_halflength = db_fulllength>>1;
int slotoffsetF = (subframe_tx)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
int blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
float_t data_block_length = 1200*(fp->ofdm_symbol_size/2048);
uint16_t *data_block = (uint16_t*)malloc(data_block_length*sizeof(uint16_t));
int16_t *data_block = (int16_t*)malloc(db_fulllength*sizeof(int16_t));
// Caller: RCC - DL *** handle RRU case - UL and PRACH ***
if (eNB->node_function == NGFI_RCC_IF4) {
......@@ -63,13 +68,16 @@ void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc) {
dl_packet->data_block = data_block;
for(i=0; i<fp->symbols_per_tti; i++) {
for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) {
//Do compression of the two parts and generate data blocks
// Do compression of the two parts and generate data blocks
for (element_id=0; element_id<db_halflength; element_id++) {
data_block[element_id] = lin2alaw[ (txdataF[0][blockoffsetF+element_id])&0xffff + 32768 ];
data_block[element_id] |= lin2alaw[ (txdataF[0][blockoffsetF+element_id])>>16 + 32768 ]<<8;
//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]);
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;
}
// Update information in generated packet
dl_packet->frame_status.sym_num = i;
......@@ -83,6 +91,9 @@ void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc) {
// 0)) < 0) {
// perror("RCC : ETHERNET write");
//}
slotoffsetF += fp->ofdm_symbol_size;
blockoffsetF += fp->ofdm_symbol_size;
}
}else {
IF4_ul_packet_t *ul_packet = (IF4_ul_packet_t*)malloc(sizeof_IF4_ul_packet_t);
......@@ -90,32 +101,34 @@ void send_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc) {
ul_packet->data_block = data_block;
for(i=0; i<fp->symbols_per_tti; i++) {
for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) {
//Do compression of the two parts and generate data blocks
// Do compression of the two parts and generate data blocks
for (element_id=0; element_id<db_halflength; element_id++) {
data_block[element_id] = lin2alaw[ (txdataF[0][blockoffsetF+element_id])&0xffff + 32768 ];
data_block[element_id] |= lin2alaw[ (txdataF[0][blockoffsetF+element_id])>>16 + 32768 ]<<8;
//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]);
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;
}
// Update information in generated packet
ul_packet->frame_status.sym_num = i;
// Write the packet(s) to the fronthaul
slotoffsetF += fp->ofdm_symbol_size;
blockoffsetF += fp->ofdm_symbol_size;
}
}
}
void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc) {
void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint16_t *packet_type, uint32_t *symbol_number) {
// Caller: RRU - DL *** handle RCC case - UL and PRACH ***
if (eNB->node_function == NGFI_RRU_IF4) {
for(i=0; i<fp->symbols_per_tti; i++) {
// Read packet(s) from the fronthaul
if (dev->eth_dev.trx_read_func (&dev->eth_dev,
......@@ -140,7 +153,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc) {
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->type = IF4_PACKET_TYPE;
dl_packet->sub_type = IF4_PDLFFT;
// Leave reserved as it is
......@@ -160,7 +173,7 @@ void gen_IF4_dl_packet(IF4_dl_packet_t *dl_packet, eNB_rxtx_proc_t *proc) {
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->type = IF4_PACKET_TYPE;
ul_packet->sub_type = IF4_PULFFT;
// Leave reserved as it is
......@@ -184,7 +197,7 @@ void gen_IF4_ul_packet(IF4_ul_packet_t *ul_packet, eNB_rxtx_proc_t *proc) {
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->type = IF4_PACKET_TYPE;
prach_packet->sub_type = IF4_PRACH;
// Leave reserved as it is
......
......@@ -38,6 +38,8 @@
* \warning
*/
/// Macro for IF4 packet type
#define IF4_PACKET_TYPE 0x080A
#define IF4_PULFFT 0x0019
#define IF4_PDLFFT 0x0020
#define IF4_PRACH 0x0021
......@@ -179,4 +181,4 @@ void gen_IF4_prach_packet(IF4_prach_packet_t*, eNB_rxtx_proc_t*);
void send_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*);
void recv_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*, int*, int*);
void recv_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*, uint16_t*, uint32_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