Commit 8390977e authored by Sandeep Kumar's avatar Sandeep Kumar

getting rid of bit-fields

parent 89052325
......@@ -84,7 +84,8 @@ void send_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type,
}
// Update information in generated packet
dl_header->frame_status.sym_num = symbol_id;
dl_header->frame_status &= ~(0x000f<<26);
dl_header->frame_status |= (symbol_id&0x000f)<<26;
// Write the packet to the fronthaul
if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice,
......@@ -122,7 +123,8 @@ void send_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type,
}
// Update information in generated packet
ul_header->frame_status.sym_num = symbol_id;
ul_header->frame_status &= ~(0x000f<<26);
ul_header->frame_status |= (symbol_id&0x000f)<<26;
// Write the packet(s) to the fronthaul
if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice,
......@@ -174,7 +176,7 @@ void send_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type,
}
void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type, uint32_t *symbol_number, uint16_t expected_packet) {
void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, 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];
......@@ -182,9 +184,9 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
uint16_t element_id;
uint16_t db_fulllength, db_halflength;
int slotoffsetF, blockoffsetF;
int slotoffsetF=0, blockoffsetF=0;
if (expected_packet == IF4_PDLFFT) {
if (eNB->node_function == NGFI_RRU_IF4) {
db_fulllength = (12*fp->N_RB_DL);
} else {
db_fulllength = (12*fp->N_RB_UL);
......@@ -194,6 +196,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
int64_t *ret_type=(int64_t*)malloc(sizeof(int64_t));
void *rx_buffer=NULL;
int16_t *data_block=NULL;
// Read packet(s) from the fronthaul
if (eNB->ifdevice.trx_read_func(&eNB->ifdevice,
......@@ -204,7 +207,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
perror("ETHERNET read");
}
*packet_type = *ret_type;
*packet_type = (uint16_t) *ret_type;
if (*packet_type == IF4_PDLFFT) {
data_block = (int16_t*) (rx_buffer+sizeof_IF4_dl_header_t);
......@@ -223,7 +226,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
}
// Find and return symbol_number
*symbol_number = ((IF4_dl_header_t*)(rx_buffer))->frame_status.sym_num;
*symbol_number = ((((IF4_dl_header_t*)(rx_buffer))->frame_status)>>26)&0x000f;
} else if (*packet_type == IF4_PULFFT) {
data_block = (int16_t*) (rx_buffer+sizeof_IF4_ul_header_t);
......@@ -242,12 +245,16 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
}
// Find and return symbol_number
*symbol_number = ((IF4_ul_header_t*)(rx_buffer))->frame_status.sym_num;
*symbol_number = ((((IF4_ul_header_t*)(rx_buffer))->frame_status)>>26)&0x000f;
} else if (*packet_type == IF4_PRACH) {
data_block = (int16_t*) (rx_buffer+sizeof_IF4_prach_header_t);
db_fulllength = 839; // hard coded
// FIX: hard coded prach samples length
db_fulllength = 839*2;
// Generate uncompressed data blocks
memcpy((rxsigF[0]+slotoffsetF), data_block, db_fulllength*sizeof(int16_t));
} else {
AssertFatal(1==0, "recv_IF4 - Unknown packet_type %x", *packet_type);
......@@ -263,18 +270,13 @@ void gen_IF4_dl_header(IF4_dl_header_t *dl_packet, int frame, int subframe) {
dl_packet->type = IF4_PACKET_TYPE;
dl_packet->sub_type = IF4_PDLFFT;
// Leave reserved as it is
// Reset frame status
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 = frame;
dl_packet->frame_status.sf_num = subframe;
dl_packet->frame_status.sym_num = 0;
dl_packet->frame_status.rsvd = 0;
// Set frame check sequence
dl_packet->frame_status = 0;
dl_packet->frame_status |= (frame&0xffff)<<6;
dl_packet->frame_status |= (subframe&0x000f)<<22;
}
......@@ -288,19 +290,20 @@ void gen_IF4_ul_header(IF4_ul_header_t *ul_packet, int frame, int subframe) {
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 = frame;
ul_packet->frame_status.sf_num = subframe;
ul_packet->frame_status.sym_num = 0;
ul_packet->frame_status.rsvd = 0;
ul_packet->frame_status = 0;
ul_packet->frame_status |= (frame&0xffff)<<6;
ul_packet->frame_status |= (subframe&0x000f)<<22;
// Set antenna specific gain *** set other antenna gain ***
ul_packet->gain0.exponent = 0;
ul_packet->gain0.rsvd = 0;
// Set frame check sequence
ul_packet->gain0 = 0;
ul_packet->gain1 = 0;
ul_packet->gain2 = 0;
ul_packet->gain3 = 0;
ul_packet->gain4 = 0;
ul_packet->gain5 = 0;
ul_packet->gain6 = 0;
ul_packet->gain7 = 0;
}
......@@ -313,12 +316,8 @@ void gen_IF4_prach_header(IF4_prach_header_t *prach_packet, int frame, int subfr
prach_packet->rsvd = 0;
// Set LTE Prach configuration
prach_packet->prach_conf.rsvd = 0;
prach_packet->prach_conf.ant = 0;
prach_packet->prach_conf.rf_num = frame;
prach_packet->prach_conf.sf_num = subframe;
prach_packet->prach_conf.exponent = 0;
prach_packet->prach_conf = 0;
prach_packet->prach_conf |= (frame&0xffff)<<6;
prach_packet->prach_conf |= (subframe&0x000f)<<22;
// Set frame check sequence
}
......@@ -47,6 +47,10 @@
#define IF4_PDLFFT 0x0020
#define IF4_PRACH 0x0021
/*
Bit-field reference
/// IF4 Frame Status (32 bits)
struct IF4_frame_status {
/// Antenna Numbers
......@@ -63,9 +67,6 @@ 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
......@@ -74,9 +75,6 @@ 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
......@@ -91,8 +89,7 @@ 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_header {
/// Destination Address
......@@ -106,7 +103,7 @@ struct IF4_dl_header {
/// Reserved
uint32_t rsvd;
/// Frame Status
IF4_frame_status_t frame_status;
uint32_t frame_status;
/// Data Blocks
/// Frame Check Sequence
......@@ -128,23 +125,23 @@ struct IF4_ul_header {
/// Reserved
uint32_t rsvd;
/// Frame Status
IF4_frame_status_t frame_status;
uint32_t frame_status;
/// Gain 0
IF4_gain_t gain0;
uint16_t gain0;
/// Gain 1
IF4_gain_t gain1;
uint16_t gain1;
/// Gain 2
IF4_gain_t gain2;
uint16_t gain2;
/// Gain 3
IF4_gain_t gain3;
uint16_t gain3;
/// Gain 4
IF4_gain_t gain4;
uint16_t gain4;
/// Gain 5
IF4_gain_t gain5;
uint16_t gain5;
/// Gain 6
IF4_gain_t gain6;
uint16_t gain6;
/// Gain 7
IF4_gain_t gain7;
uint16_t gain7;
/// Data Blocks
/// Frame Check Sequence
......@@ -166,7 +163,7 @@ struct IF4_prach_header {
/// Reserved
uint32_t rsvd;
/// LTE Prach Configuration
IF4_lte_prach_conf_t prach_conf;
uint32_t prach_conf;
/// Prach Data Block (one antenna)
/// Frame Check Sequence
......@@ -184,4 +181,4 @@ void gen_IF4_prach_header(IF4_prach_header_t*, int, int);
void send_IF4(PHY_VARS_eNB*, int, int, uint16_t, int);
void recv_IF4(PHY_VARS_eNB*, int, int, uint16_t*, uint32_t*, uint16_t);
void recv_IF4(PHY_VARS_eNB*, int, int, 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