Commit 7a60be4d authored by Raymond Knopp's avatar Raymond Knopp

modifications for eCPRI framing in IF5 UDP only

parent 8e86edc3
...@@ -71,6 +71,8 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t ...@@ -71,6 +71,8 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF5, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF5, 1 );
if (packet_type == IF5_RRH_GW_DL) { if (packet_type == IF5_RRH_GW_DL) {
if (eth->compression == ALAW_COMPRESS) { if (eth->compression == ALAW_COMPRESS) {
AssertFatal(1==0,"IF5 compression needs reworking\n");
/*
if (eth->flags == ETH_RAW_MODE) { if (eth->flags == ETH_RAW_MODE) {
data_block = (uint16_t*)(alaw_buffer + APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES); data_block = (uint16_t*)(alaw_buffer + APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES);
} else { } else {
...@@ -101,20 +103,22 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t ...@@ -101,20 +103,22 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t
LOG_D(HW,"[SF %d] IF_Write_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_comp, end_comp)); LOG_D(HW,"[SF %d] IF_Write_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_comp, end_comp));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 0 );
} }
*/
} else if (eth->compression == NO_COMPRESS) { } else if (eth->compression == NO_COMPRESS) {
for (i=0; i < fp->nb_antennas_tx; i++) for (i=0; i < ru->nb_tx; i++)
txp[i] = (void*)&ru->common.txdata[i][subframe*fp->samples_per_tti]; txp[i] = (void*)&ru->common.txdata[i][subframe*fp->samples_per_tti];
for (packet_id=0; packet_id < spsf / spp_eth; packet_id++) { for (packet_id=0; packet_id < spsf / spp_eth; packet_id++) {
for (int aid=0; aid<ru->nb_tx;aid++) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF5_PKT_ID, packet_id ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF5_PKT_ID, packet_id );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 1 );
clock_gettime( CLOCK_MONOTONIC, &start_comp); clock_gettime( CLOCK_MONOTONIC, &start_comp);
ru->ifdevice.trx_write_func(&ru->ifdevice, ru->ifdevice.trx_write_func2(&ru->ifdevice,
(proc_timestamp + packet_id*spp_eth), (proc_timestamp + packet_id*spp_eth),
(void**)txp, (void*)txp[aid],
spp_eth, spp_eth,
fp->nb_antennas_tx, aid,
0); 0);
clock_gettime( CLOCK_MONOTONIC, &end_comp); clock_gettime( CLOCK_MONOTONIC, &end_comp);
LOG_D(HW,"[SF %d] IF_Write_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_comp, end_comp)); LOG_D(HW,"[SF %d] IF_Write_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_comp, end_comp));
...@@ -124,6 +128,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t ...@@ -124,6 +128,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t
} }
} }
}
} else if (packet_type == IF5_RRH_GW_UL) { } else if (packet_type == IF5_RRH_GW_UL) {
if (eth->compression == ALAW_COMPRESS) { if (eth->compression == ALAW_COMPRESS) {
if (eth->flags == ETH_RAW_MODE) { if (eth->flags == ETH_RAW_MODE) {
...@@ -326,7 +331,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16 ...@@ -326,7 +331,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
uint16_t *data_block = NULL; uint16_t *data_block = NULL;
uint16_t *j = NULL; uint16_t *j = NULL;
openair0_timestamp timestamp[spsf / spp_eth]; openair0_timestamp timestamp[ru->nb_rx*spsf / spp_eth];
memset(timestamp, 0, sizeof(timestamp)); memset(timestamp, 0, sizeof(timestamp));
eth_state_t *eth = (eth_state_t*) (ru->ifdevice.priv); eth_state_t *eth = (eth_state_t*) (ru->ifdevice.priv);
...@@ -334,6 +339,9 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16 ...@@ -334,6 +339,9 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
if (packet_type == IF5_RRH_GW_DL) { if (packet_type == IF5_RRH_GW_DL) {
if (eth->compression == ALAW_COMPRESS) { if (eth->compression == ALAW_COMPRESS) {
AssertFatal(1==0,"IF5 compression needs reworking\n");
/*
if (eth->flags == ETH_RAW_MODE) { if (eth->flags == ETH_RAW_MODE) {
data_block = (uint16_t*)(alaw_buffer + APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES); data_block = (uint16_t*)(alaw_buffer + APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES);
} else { } else {
...@@ -365,6 +373,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16 ...@@ -365,6 +373,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
LOG_D(HW,"[SF %d] Decomperss_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_decomp, end_decomp)); LOG_D(HW,"[SF %d] Decomperss_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_decomp, end_decomp));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );
} }
*/
} else if (eth->compression == NO_COMPRESS) { } else if (eth->compression == NO_COMPRESS) {
for (i=0; i < fp->nb_antennas_tx; i++) for (i=0; i < fp->nb_antennas_tx; i++)
txp[i] = (void*)&ru->common.txdata[i][subframe*fp->samples_per_tti]; txp[i] = (void*)&ru->common.txdata[i][subframe*fp->samples_per_tti];
...@@ -390,6 +399,8 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16 ...@@ -390,6 +399,8 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
} else if (packet_type == IF5_RRH_GW_UL) { } else if (packet_type == IF5_RRH_GW_UL) {
if (eth->compression == ALAW_COMPRESS) { if (eth->compression == ALAW_COMPRESS) {
AssertFatal(1==0,"IF5 compression needs reworking\n");
/*
if (eth->flags == ETH_RAW_MODE) { if (eth->flags == ETH_RAW_MODE) {
data_block = (uint16_t*)(alaw_buffer + APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES); data_block = (uint16_t*)(alaw_buffer + APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES);
} else { } else {
...@@ -420,19 +431,28 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16 ...@@ -420,19 +431,28 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
LOG_D(HW,"[SF %d] Decomperss_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_decomp, end_decomp)); LOG_D(HW,"[SF %d] Decomperss_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_decomp, end_decomp));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );
} }
*/
} else if (eth->compression == NO_COMPRESS) { } else if (eth->compression == NO_COMPRESS) {
for (i=0; i < fp->nb_antennas_rx; i++) int16_t temp_rx[spp_eth*2];
for (i=0; i < ru->nb_rx; i++)
rxp[i] = (void*)&ru->common.rxdata[i][subframe*fp->samples_per_tti]; rxp[i] = (void*)&ru->common.rxdata[i][subframe*fp->samples_per_tti];
int aid;
for (packet_id=0; packet_id < spsf / spp_eth; packet_id++) { for (packet_id=0; packet_id < ru->nb_rx*spsf / spp_eth; packet_id++) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF5_PKT_ID, packet_id ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF5_PKT_ID, packet_id );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF0, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF0, 1 );
clock_gettime( CLOCK_MONOTONIC, &start_decomp); clock_gettime( CLOCK_MONOTONIC, &start_decomp);
ru->ifdevice.trx_read_func(&ru->ifdevice, ru->ifdevice.trx_read_func2(&ru->ifdevice,
&timestamp[packet_id], &timestamp[packet_id],
(void**)rxp, (void*)temp_rx,
spp_eth, spp_eth,
fp->nb_antennas_rx); &aid);
// HYPOTHESIS: first packet per subframe has lowest timestamp of subframe
// should detect out of order and act accordingly ....
memcpy(rxp[aid]+((timestamp[packet_id]-timestamp[0])<<2)),
(void*)temp_rx,
spp_eth);
clock_gettime( CLOCK_MONOTONIC, &end_decomp); clock_gettime( CLOCK_MONOTONIC, &end_decomp);
LOG_D(HW,"[SF %d] IF_Read_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_decomp, end_decomp)); LOG_D(HW,"[SF %d] IF_Read_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_decomp, end_decomp));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF0, 0 );
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "common_lib.h" #include "common_lib.h"
#include "msc.h" /*#include "msc.h" * mofied salvo 10-09-19*/
#include "defs_common.h" #include "defs_common.h"
......
...@@ -331,13 +331,23 @@ struct openair0_device_t { ...@@ -331,13 +331,23 @@ struct openair0_device_t {
/*! \brief Called to send samples to the RF target /*! \brief Called to send samples to the RF target
@param device pointer to the device structure specific to the RF hardware target @param device pointer to the device structure specific to the RF hardware target
@param timestamp The timestamp at whicch the first sample MUST be sent @param timestamp The timestamp at whicch the first sample MUST be sent
@param buff Buffer which holds the samples @param buff Buffer which holds the samples (2 dimensional)
@param nsamps number of samples to be sent @param nsamps number of samples to be sent
@param antenna_id index of the antenna if the device has multiple anteannas @param number of antennas
@param flags flags must be set to TRUE if timestamp parameter needs to be applied @param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/ */
int (*trx_write_func)(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int antenna_id, int flags); int (*trx_write_func)(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int antenna_id, int flags);
/*! \brief Called to send samples to the RF target
@param device pointer to the device structure specific to the RF hardware target
@param timestamp The timestamp at whicch the first sample MUST be sent
@param buff Buffer which holds the samples (1 dimensional)
@param nsamps number of samples to be sent
@param antenna_id index of the antenna if the device has multiple anteannas
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/
int (*trx_write_func2)(openair0_device *device, openair0_timestamp timestamp, void *buff, int nsamps,int antenna_id, int flags);
/*! \brief Receive samples from hardware. /*! \brief Receive samples from hardware.
* Read \ref nsamps samples from each channel to buffers. buff[0] is the array for * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
* the first channel. *ptimestamp is the time at which the first sample * the first channel. *ptimestamp is the time at which the first sample
...@@ -346,10 +356,24 @@ struct openair0_device_t { ...@@ -346,10 +356,24 @@ struct openair0_device_t {
* \param[out] ptimestamp the time at which the first sample was received. * \param[out] ptimestamp the time at which the first sample was received.
* \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps.
* \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte.
* \param antenna_id Index of antenna for which to receive samples * \param num_antennas number of antennas from which to receive samples
* \returns the number of sample read * \returns the number of sample read
*/ */
int (*trx_read_func)(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps,int antenna_id);
int (*trx_read_func)(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps,int num_antennas);
/*! \brief Receive samples from hardware, this version provides a single antenna at a time and returns.
* Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
* the first channel. *ptimestamp is the time at which the first sample
* was received.
* \param device the hardware to use
* \param[out] ptimestamp the time at which the first sample was received.
* \param[out] buff A pointers to a buffer for received samples. The buffer must be large enough to hold the number of samples \ref nsamps.
* \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte.
* \param antenna_id Index of antenna from which samples were received
* \returns the number of sample read
*/
int (*trx_read_func2)(openair0_device *device, openair0_timestamp *ptimestamp, void *buff, int nsamps,int *antenna_id);
/*! \brief print the device statistics /*! \brief print the device statistics
* \param device the hardware to use * \param device the hardware to use
...@@ -394,6 +418,12 @@ struct openair0_device_t { ...@@ -394,6 +418,12 @@ struct openair0_device_t {
* \param arg pointer to capabilities or configuration * \param arg pointer to capabilities or configuration
*/ */
void (*configure_rru)(int idx, void *arg); void (*configure_rru)(int idx, void *arg);
/*! \brief Pointer to generic RRU private information
*/
void *thirdparty_priv;
/*! \brief Callback for Third-party RRU Initialization routine /*! \brief Callback for Third-party RRU Initialization routine
\param device the hardware configuration to use \param device the hardware configuration to use
*/ */
......
...@@ -264,36 +264,41 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam ...@@ -264,36 +264,41 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
return (bytes_sent); return (bytes_sent);
} }
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags) { int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void *buff, int nsamps,int cc, int flags) {
int bytes_sent=0; int bytes_sent=0;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int sendto_flag =0; int sendto_flag =0;
int i=0; char temp0[APP_HEADER_SIZE_BYTES];
//sendto_flag|=flags; //sendto_flag|=flags;
eth->tx_nsamps=nsamps; eth->tx_nsamps=nsamps;
for (i=0;i<cc;i++) {
/* buff[i] points to the position in tx buffer where the payload to be sent is /* buff[i] points to the position in tx buffer where the payload to be sent is
buff2 points to the position in tx buffer where the packet header will be placed */ buff2 points to the position in tx buffer where the packet header will be placed */
void *buff2 = (void*)(buff[i]- APP_HEADER_SIZE_BYTES); void *buff2 = (void*)(buff- APP_HEADER_SIZE_BYTES);
/* we don't want to ovewrite with the header info the previous tx buffer data so we store it*/ /* we don't want to ovewrite with the header info the previous tx buffer data so we store it*/
int32_t temp0 = *(int32_t *)buff2;
openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + sizeof(int32_t)); memcpy((void *)temp0,(void *)buff2,APP_HEADER_SIZE_BYTES);
bytes_sent = 0; bytes_sent = 0;
/* constract application header */ /* constract application header */
// eth->pck_header.seq_num = pck_seq_num; // ECPRI Protocol revision + reserved bits (1 byte)
//eth->pck_header.antenna_id = 1+(i<<1); *(uint8_t *)buff2 = ECPRIREV;
//eth->pck_header.timestamp = timestamp; // ECPRI Message type (1 byte)
*(uint16_t *)buff2 = eth->pck_seq_num; *(uint8_t *)(buff2 + 1) = 0;
*(uint16_t *)(buff2 + sizeof(uint16_t)) = 1+(i<<1); // ECPRI Payload Size (2 bytes)
*(openair0_timestamp *)(buff2 + sizeof(int32_t)) = timestamp; AssertFatal(nsamps<16381,"nsamps > 16381\n");
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM, eth->pck_seq_num); *(uint16_t *)(buff2 + 2) = (nsamps<<2);
// ECPRI PC_ID (2 bytes)
*(uint16_t *)(buff2 + 4) = cc;
// OAI modified SEQ_ID (4 bytes)
*(uint64_t *)(buff2 + 6) = (uint64_t )timestamp;
int sent_byte; int sent_byte;
if (eth->compression == ALAW_COMPRESS) { if (eth->compression == ALAW_COMPRESS) {
...@@ -311,7 +316,7 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -311,7 +316,7 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
bytes_sent); bytes_sent);
#endif #endif
/* Send packet */ /* Send packet */
bytes_sent += sendto(eth->sockfdd, bytes_sent = sendto(eth->sockfdd,
buff2, buff2,
sent_byte, sent_byte,
sendto_flag, sendto_flag,
...@@ -340,16 +345,14 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -340,16 +345,14 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
//} //}
/* tx buffer values restored */ /* tx buffer values restored */
*(int32_t *)buff2 = temp0; memcpy((void *)buff2,(void *)temp0,APP_HEADER_SIZE_BYTES);
*(openair0_timestamp *)(buff2 + sizeof(int32_t)) = temp1;
}
return (bytes_sent-APP_HEADER_SIZE_BYTES)>>2; return (bytes_sent-APP_HEADER_SIZE_BYTES)>>2;
} }
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void *buff, int nsamps, int *cc) {
int bytes_received=0; int bytes_received=0;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
...@@ -357,18 +360,16 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -357,18 +360,16 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
int rcvfrom_flag =0; int rcvfrom_flag =0;
int block_cnt=0; int block_cnt=0;
int again_cnt=0; int again_cnt=0;
int i=0; char temp0[APP_HEADER_SIZE_BYTES];
eth->rx_nsamps=nsamps; eth->rx_nsamps=256;
for (i=0;i<cc;i++) {
/* buff[i] points to the position in rx buffer where the payload to be received will be placed /* buff[i] points to the position in rx buffer where the payload to be received will be placed
buff2 points to the position in rx buffer where the packet header will be placed */ buff2 points to the position in rx buffer where the packet header will be placed */
void *buff2 = (void*)(buff[i]- APP_HEADER_SIZE_BYTES); void *buff2 = (void*)(buff- APP_HEADER_SIZE_BYTES);
/* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/ /* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/
int32_t temp0 = *(int32_t *)buff2; memcpy((void *)temp0,(void *)buff2,APP_HEADER_SIZE_BYTES);
openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + sizeof(int32_t));
bytes_received=0; bytes_received=0;
block_cnt=0; block_cnt=0;
...@@ -429,19 +430,8 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -429,19 +430,8 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
#endif #endif
/* store the timestamp value from packet's header */ /* store the timestamp value from packet's header */
*timestamp = *(openair0_timestamp *)(buff2 + sizeof(int32_t)); *timestamp = *(openair0_timestamp *)(buff2 + ECPRICOMMON_BYTES+ECPRIPCID_BYTES);
/* store the sequence number of the previous packet received */ *cc = *(uint16_t*)(buff2 + ECPRICOMMON_BYTES);
if (eth->pck_seq_num_cur == 0) {
eth->pck_seq_num_prev = *(uint16_t *)buff2;
} else {
eth->pck_seq_num_prev = eth->pck_seq_num_cur;
}
/* get the packet sequence number from packet's header */
eth->pck_seq_num_cur = *(uint16_t *)buff2;
if ( ( eth->pck_seq_num_cur != (eth->pck_seq_num_prev + 1) ) && !((eth->pck_seq_num_prev==MAX_PACKET_SEQ_NUM(nsamps,device->openair0_cfg->samples_per_frame)) && (eth->pck_seq_num_cur==1 )) && !((eth->pck_seq_num_prev==1) && (eth->pck_seq_num_cur==1))) {
//#if DEBUG
printf("Out of order packet received: current_packet=%d previous_packet=%d timestamp=%"PRId64"\n",eth->pck_seq_num_cur,eth->pck_seq_num_prev,*timestamp);
//#endif
} }
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,eth->pck_seq_num_cur); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,eth->pck_seq_num_cur);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM_PRV,eth->pck_seq_num_prev); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM_PRV,eth->pck_seq_num_prev);
...@@ -449,12 +439,9 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -449,12 +439,9 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
eth->rx_count++; eth->rx_count++;
} }
}
/* tx buffer values restored */ /* tx buffer values restored */
*(int32_t *)buff2 = temp0; memcpy((void *)buff2,(void *)temp0,APP_HEADER_SIZE_BYTES);
*(openair0_timestamp *)(buff2 + sizeof(int32_t)) = temp1;
}
return (bytes_received-APP_HEADER_SIZE_BYTES)>>2; return (bytes_received-APP_HEADER_SIZE_BYTES)>>2;
} }
......
...@@ -166,6 +166,8 @@ void trx_eth_end(openair0_device *device) { ...@@ -166,6 +166,8 @@ void trx_eth_end(openair0_device *device) {
int trx_eth_stop(openair0_device *device) { int trx_eth_stop(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv;
if (eth->flags == ETH_UDP_IF5_ORI_MODE) { if (eth->flags == ETH_UDP_IF5_ORI_MODE) {
AssertFatal(device->thirdparty_cleanup != NULL, "device->thirdparty_cleanup is null\n"); AssertFatal(device->thirdparty_cleanup != NULL, "device->thirdparty_cleanup is null\n");
AssertFatal(device->thirdparty_cleanup(device) == 0, "third-party cleanup failed\n"); AssertFatal(device->thirdparty_cleanup(device) == 0, "third-party cleanup failed\n");
...@@ -398,12 +400,17 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -398,12 +400,17 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
device->trx_set_freq_func = trx_eth_set_freq; device->trx_set_freq_func = trx_eth_set_freq;
device->trx_set_gains_func = trx_eth_set_gains; device->trx_set_gains_func = trx_eth_set_gains;
device->trx_read_func2 = NULL;
device->trx_read_func = NULL;
device->trx_write_func2 = NULL;
device->trx_write_func = NULL;
if (eth->flags == ETH_RAW_MODE) { if (eth->flags == ETH_RAW_MODE) {
device->trx_write_func = trx_eth_write_raw; device->trx_write_func = trx_eth_write_raw;
device->trx_read_func = trx_eth_read_raw; device->trx_read_func = trx_eth_read_raw;
} else if (eth->flags == ETH_UDP_MODE || eth->flags == ETH_UDP_IF5_ORI_MODE) { } else if (eth->flags == ETH_UDP_MODE || eth->flags == ETH_UDP_IF5_ORI_MODE) {
device->trx_write_func = trx_eth_write_udp; device->trx_write_func2 = trx_eth_write_udp;
device->trx_read_func = trx_eth_read_udp; device->trx_read_func2 = trx_eth_read_udp;
device->trx_ctlsend_func = trx_eth_ctlsend_udp; device->trx_ctlsend_func = trx_eth_ctlsend_udp;
device->trx_ctlrecv_func = trx_eth_ctlrecv_udp; device->trx_ctlrecv_func = trx_eth_ctlrecv_udp;
} else if (eth->flags == ETH_RAW_IF4p5_MODE) { } else if (eth->flags == ETH_RAW_IF4p5_MODE) {
......
...@@ -49,7 +49,10 @@ ...@@ -49,7 +49,10 @@
#define RX_FLAG 0 #define RX_FLAG 0
#include "if_defs.h" #include "if_defs.h"
#define APP_HEADER_SIZE_BYTES (sizeof(int32_t) + sizeof(openair0_timestamp)) #define ECPRICOMMON_BYTES 4
#define ECPRIPCID_BYTES 2
#define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp))
#define ECPRIREV 16 // ECPRI Version 1, C=0 - single ECPRI message per OAI TX packet
/*!\brief opaque ethernet data structure */ /*!\brief opaque ethernet data structure */
typedef struct { typedef struct {
...@@ -234,8 +237,8 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value); ...@@ -234,8 +237,8 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value);
* @ingroup _oai * @ingroup _oai
*/ */
int eth_socket_init_udp(openair0_device *device); int eth_socket_init_udp(openair0_device *device);
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags); int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void *buff, int nsamps,int cc, int flags);
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void *buff, int nsamps, int *cc);
int eth_socket_init_raw(openair0_device *device); int eth_socket_init_raw(openair0_device *device);
......
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