Skip to content
Snippets Groups Projects
Commit 19922715 authored by Sandeep Kumar's avatar Sandeep Kumar
Browse files

rcc recv and send work (not sync with rru yet)

parent 808494dd
Branches
Tags
No related merge requests found
......@@ -193,22 +193,21 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
}
db_halflength = db_fulllength>>1;
int64_t *ret_type=(int64_t*)malloc(sizeof(int64_t));
void *rx_buffer=NULL;
IF4_header_t *packet_header=NULL;
int16_t *data_block=NULL;
// Read packet(s) from the fronthaul
if (eNB->ifdevice.trx_read_func(&eNB->ifdevice,
ret_type,
(int64_t*) packet_type,
&rx_buffer,
db_fulllength,
0) < 0) {
perror("ETHERNET read");
}
*packet_type = (uint16_t) *ret_type;
data_block = (int16_t*) (rx_buffer+sizeof_IF4_header_t);
packet_header = (IF4_header_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES);
data_block = (int16_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES+sizeof_IF4_header_t);
if (*packet_type == IF4_PDLFFT) {
// Calculate from received packet
......@@ -225,7 +224,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
}
// Find and return symbol_number
*symbol_number = ((((IF4_header_t*)(rx_buffer))->frame_status)>>26)&0x000f;
*symbol_number = ((packet_header->frame_status)>>26)&0x000f;
} else if (*packet_type == IF4_PULFFT) {
// Calculate from received packet
......@@ -242,7 +241,7 @@ void recv_IF4(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t *packet_type,
}
// Find and return symbol_number
*symbol_number = ((((IF4_header_t*)(rx_buffer))->frame_status)>>26)&0x000f;
*symbol_number = ((packet_header->frame_status)>>26)&0x000f;
} else if (*packet_type == IF4_PRACH) {
// FIX: hard coded prach samples length
......
......@@ -312,13 +312,12 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
ssize_t packet_size = MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t;
void *test_buffer = (void*)malloc(packet_size);
void *rx_buffer=NULL;
IF4_header_t *test_header = (IF4_header_t*)(test_buffer + MAC_HEADER_SIZE_BYTES);
bytes_received = recv(eth->sockfd[Mod_id],
test_buffer,
packet_size,
0);
MSG_PEEK);
if (bytes_received ==-1) {
eth->num_rx_errors++;
perror("ETHERNET READ: ");
......@@ -328,28 +327,21 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
*timestamp = test_header->sub_type;
if (test_header->sub_type == IF4_PDLFFT) {
buff[0] = (void*)malloc(RAW_IF4_PDLFFT_SIZE_BYTES(nblocks) - MAC_HEADER_SIZE_BYTES);
packet_size = RAW_IF4_PDLFFT_SIZE_BYTES(nblocks) - packet_size;
packet_size = RAW_IF4_PDLFFT_SIZE_BYTES(nblocks);
} else if (test_header->sub_type == IF4_PULFFT) {
buff[0] = (void*)malloc(RAW_IF4_PULFFT_SIZE_BYTES(nblocks) - MAC_HEADER_SIZE_BYTES);
packet_size = RAW_IF4_PULFFT_SIZE_BYTES(nblocks) - packet_size;
packet_size = RAW_IF4_PULFFT_SIZE_BYTES(nblocks);
} else {
buff[0] = (void*)malloc(RAW_IF4_PRACH_SIZE_BYTES - MAC_HEADER_SIZE_BYTES);
packet_size = RAW_IF4_PRACH_SIZE_BYTES - packet_size;
printf(" Came for prach\n");
packet_size = RAW_IF4_PRACH_SIZE_BYTES;
}
memcpy(buff[0], test_header, sizeof_IF4_header_t);
rx_buffer = (void*)(buff[0]+sizeof_IF4_header_t);
buff[0] = (void*)malloc(packet_size);
bytes_received = 0;
while(bytes_received < packet_size) {
bytes_received += recv(eth->sockfd[Mod_id],
rx_buffer,
packet_size-bytes_received,
bytes_received = recv(eth->sockfd[Mod_id],
buff[0],
packet_size,
0);
if (bytes_received ==-1) {
eth->num_rx_errors++;
......@@ -362,9 +354,8 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
}
eth->rx_nsamps = nsamps;
free(test_buffer);
return (bytes_received-MAC_HEADER_SIZE_BYTES)>>1;
return(bytes_received);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment