Commit 808494dd authored by Sandeep Kumar's avatar Sandeep Kumar

unified if4 header

parent 9f0a76e8
......@@ -67,9 +67,9 @@ void send_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type,
slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
tx_buffer = malloc(MAC_HEADER_SIZE_BYTES + sizeof_IF4_dl_header_t + db_fulllength*sizeof(int16_t));
IF4_dl_header_t *dl_header = (IF4_dl_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4_dl_header_t);
tx_buffer = malloc(MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + db_fulllength*sizeof(int16_t));
IF4_header_t *dl_header = (IF4_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t);
gen_IF4_dl_header(dl_header, frame, subframe);
......@@ -106,9 +106,9 @@ void send_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type,
slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
tx_buffer = malloc(MAC_HEADER_SIZE_BYTES + sizeof_IF4_ul_header_t + db_fulllength*sizeof(int16_t));
IF4_ul_header_t *ul_header = (IF4_ul_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4_ul_header_t);
tx_buffer = malloc(MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + db_fulllength*sizeof(int16_t));
IF4_header_t *ul_header = (IF4_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t);
gen_IF4_ul_header(ul_header, frame, subframe);
......@@ -143,9 +143,9 @@ void send_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type,
// FIX: hard coded prach samples length
db_fulllength = 839*2;
tx_buffer = malloc(MAC_HEADER_SIZE_BYTES + sizeof_IF4_prach_header_t + db_fulllength*sizeof(int16_t));
IF4_prach_header_t *prach_header = (IF4_prach_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4_prach_header_t);
tx_buffer = malloc(MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + db_fulllength*sizeof(int16_t));
IF4_header_t *prach_header = (IF4_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t);
gen_IF4_prach_header(prach_header, frame, subframe);
......@@ -208,10 +208,9 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
}
*packet_type = (uint16_t) *ret_type;
data_block = (int16_t*) (rx_buffer+sizeof_IF4_header_t);
if (*packet_type == IF4_PDLFFT) {
data_block = (int16_t*) (rx_buffer+sizeof_IF4_dl_header_t);
if (*packet_type == IF4_PDLFFT) {
// Calculate from received packet
slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
......@@ -226,11 +225,9 @@ 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)>>26)&0x000f;
*symbol_number = ((((IF4_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);
} else if (*packet_type == IF4_PULFFT) {
// Calculate from received packet
slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
......@@ -245,11 +242,9 @@ 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)>>26)&0x000f;
} else if (*packet_type == IF4_PRACH) {
data_block = (int16_t*) (rx_buffer+sizeof_IF4_prach_header_t);
*symbol_number = ((((IF4_header_t*)(rx_buffer))->frame_status)>>26)&0x000f;
} else if (*packet_type == IF4_PRACH) {
// FIX: hard coded prach samples length
db_fulllength = 839*2;
......@@ -265,7 +260,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
}
void gen_IF4_dl_header(IF4_dl_header_t *dl_packet, int frame, int subframe) {
void gen_IF4_dl_header(IF4_header_t *dl_packet, int frame, int subframe) {
// Set Type and Sub-Type
dl_packet->type = IF4_PACKET_TYPE;
dl_packet->sub_type = IF4_PDLFFT;
......@@ -281,7 +276,7 @@ void gen_IF4_dl_header(IF4_dl_header_t *dl_packet, int frame, int subframe) {
}
void gen_IF4_ul_header(IF4_ul_header_t *ul_packet, int frame, int subframe) {
void gen_IF4_ul_header(IF4_header_t *ul_packet, int frame, int subframe) {
// Set Type and Sub-Type
ul_packet->type = IF4_PACKET_TYPE;
ul_packet->sub_type = IF4_PULFFT;
......@@ -294,20 +289,10 @@ void gen_IF4_ul_header(IF4_ul_header_t *ul_packet, int frame, int subframe) {
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 = 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;
}
void gen_IF4_prach_header(IF4_prach_header_t *prach_packet, int frame, int subframe) {
void gen_IF4_prach_header(IF4_header_t *prach_packet, int frame, int subframe) {
// Set Type and Sub-Type
prach_packet->type = IF4_PACKET_TYPE;
prach_packet->sub_type = IF4_PRACH;
......@@ -316,8 +301,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 = 0;
prach_packet->prach_conf |= (frame&0xffff)<<6;
prach_packet->prach_conf |= (subframe&0x000f)<<22;
prach_packet->frame_status = 0;
prach_packet->frame_status |= (frame&0xffff)<<6;
prach_packet->frame_status |= (subframe&0x000f)<<22;
}
......@@ -47,55 +47,7 @@
#define IF4_PDLFFT 0x0020
#define IF4_PRACH 0x0021
/*
Bit-field reference
/// IF4 Frame Status (32 bits)
struct IF4_frame_status {
/// Antenna Numbers
uint32_t ant_num:3;
/// Antenna Start
uint32_t ant_start:3;
/// Radio Frame Number
uint32_t rf_num:16;
/// Sub-frame Number
uint32_t sf_num:4;
/// Symbol Number
uint32_t sym_num:4;
/// Reserved
uint32_t rsvd:2;
};
/// IF4 Antenna Gain (16 bits)
struct IF4_gain {
/// Reserved
uint16_t rsvd:10;
/// FFT Exponent Output
uint16_t exponent:6;
};
/// IF4 LTE PRACH Configuration (32 bits)
struct IF4_lte_prach_conf {
/// Reserved
uint32_t rsvd:3;
/// Antenna Indication
uint32_t ant:3;
/// Radio Frame Number
uint32_t rf_num:16;
/// Sub-frame Number
uint32_t sf_num:4;
/// FFT Exponent Output
uint32_t exponent:6;
};
*/
struct IF4_dl_header {
/// Destination Address
/// Source Address
struct IF4_header {
/// Type
uint16_t type;
/// Sub-Type
......@@ -104,80 +56,17 @@ struct IF4_dl_header {
uint32_t rsvd;
/// Frame Status
uint32_t frame_status;
/// Data Blocks
/// Frame Check Sequence
};
typedef struct IF4_dl_header IF4_dl_header_t;
#define sizeof_IF4_dl_header_t 12
struct IF4_ul_header {
/// Destination Address
/// Source Address
/// Type
uint16_t type;
/// Sub-Type
uint16_t sub_type;
/// Reserved
uint32_t rsvd;
/// Frame Status
uint32_t frame_status;
/// Gain 0
uint16_t gain0;
/// Gain 1
uint16_t gain1;
/// Gain 2
uint16_t gain2;
/// Gain 3
uint16_t gain3;
/// Gain 4
uint16_t gain4;
/// Gain 5
uint16_t gain5;
/// Gain 6
uint16_t gain6;
/// Gain 7
uint16_t gain7;
/// Data Blocks
/// Frame Check Sequence
};
typedef struct IF4_ul_header IF4_ul_header_t;
#define sizeof_IF4_ul_header_t 28
struct IF4_prach_header {
/// Destination Address
/// Source Address
/// Type
uint16_t type;
/// Sub-Type
uint16_t sub_type;
/// Reserved
uint32_t rsvd;
/// LTE Prach Configuration
uint32_t prach_conf;
/// Prach Data Block (one antenna)
/// Frame Check Sequence
};
typedef struct IF4_prach_header IF4_prach_header_t;
#define sizeof_IF4_prach_header_t 12
typedef struct IF4_header IF4_header_t;
#define sizeof_IF4_header_t 12
void gen_IF4_dl_header(IF4_dl_header_t*, int, int);
void gen_IF4_dl_header(IF4_header_t*, int, int);
void gen_IF4_ul_header(IF4_ul_header_t*, int, int);
void gen_IF4_ul_header(IF4_header_t*, int, int);
void gen_IF4_prach_header(IF4_prach_header_t*, int, int);
void gen_IF4_prach_header(IF4_header_t*, int, int);
void send_IF4(PHY_VARS_eNB*, int, int, uint16_t, int);
......
......@@ -2522,7 +2522,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
int prach_rx;
uint16_t packet_type;
uint32_t symbol_number;
uint32_t symbol_number=0;
uint32_t symbol_mask, symbol_mask_full;
struct timespec time_req, time_rem;
......@@ -2649,21 +2649,22 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
} else if (eNB->node_function == NGFI_RCC_IF4) {
/// **** recv_IF4 of rxdataF from RRU **** ///
/// **** recv_IF4 of prachF from RRU **** ///
/// **** recv_IF4 of rxsigF from RRU **** ///
// get frame/subframe information from IF4 interface
// timed loop (200 us)
symbol_number = 0;
symbol_mask = 0;
symbol_mask_full = (1<<fp->symbols_per_tti)-1;
prach_rx = 0;
// Block from loop while testing
symbol_mask = symbol_mask_full;
nanosleep(&time_req, &time_rem);
//symbol_mask = symbol_mask_full;
//nanosleep(&time_req, &time_rem);
do {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 );
//recv_IF4(eNB, frame, subframe, &packet_type, &symbol_number);
recv_IF4(eNB, proc->frame_rx, proc->subframe_rx, &packet_type, &symbol_number);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 0 );
if (packet_type == IF4_PULFFT) {
......
......@@ -309,11 +309,11 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
ssize_t packet_size = MAC_HEADER_SIZE_BYTES + sizeof_IF4_dl_header_t;
ssize_t packet_size = MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t;
void *test_buffer = (void*)malloc(packet_size);
void *rx_buffer=NULL;
IF4_dl_header_t *test_header = (IF4_dl_header_t*)(test_buffer + MAC_HEADER_SIZE_BYTES);
IF4_header_t *test_header = (IF4_header_t*)(test_buffer + MAC_HEADER_SIZE_BYTES);
bytes_received = recv(eth->sockfd[Mod_id],
test_buffer,
......@@ -324,7 +324,7 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
perror("ETHERNET READ: ");
exit(-1);
}
*timestamp = test_header->sub_type;
if (test_header->sub_type == IF4_PDLFFT) {
......@@ -337,11 +337,12 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
} else {
buff[0] = (void*)malloc(RAW_IF4_PRACH_SIZE_BYTES - MAC_HEADER_SIZE_BYTES);
packet_size = RAW_IF4_PRACH_SIZE_BYTES - packet_size;
packet_size = RAW_IF4_PRACH_SIZE_BYTES - packet_size;
printf(" Came for prach\n");
}
memcpy(buff[0], test_header, sizeof_IF4_dl_header_t);
rx_buffer = (void*)(buff[0]+sizeof_IF4_dl_header_t);
memcpy(buff[0], test_header, sizeof_IF4_header_t);
rx_buffer = (void*)(buff[0]+sizeof_IF4_header_t);
bytes_received = 0;
......
......@@ -58,6 +58,6 @@
#define DATA_BLOCK_SIZE_BYTES(scaled_nblocks) (sizeof(int16_t)*scaled_nblocks)
#define PRACH_BLOCK_SIZE_BYTES (sizeof(int16_t)*839*2) // FIX hard coded prach size (uncompressed)
#define RAW_IF4_PDLFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_dl_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_ul_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4_PRACH_SIZE_BYTES (MAC_HEADER_SIZE_BYTES + sizeof_IF4_prach_header_t + PRACH_BLOCK_SIZE_BYTES)
#define RAW_IF4_PDLFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4_PRACH_SIZE_BYTES (MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + PRACH_BLOCK_SIZE_BYTES)
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