Commit 32e19dbb authored by laurent's avatar laurent

removed all frame/subframe copies distributed update, replace by a single function

parent 88d57390
This diff is collapsed.
...@@ -632,10 +632,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -632,10 +632,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
} }
if (proc->first_rx == 1) { if (proc->first_rx == 1) {
ru->ts_offset = proc->timestamp_rx; //ru->ts_offset = proc->timestamp_rx;
proc->timestamp_rx = 0; //proc->timestamp_rx = 0;
proc->first_rx = false;
} else { } else {
if (proc->timestamp_rx - old_ts != fp->samples_per_tti) { if (proc->timestamp_rx - old_ts != fp->samples_per_tti) {
LOG_E(HW,"impossible shift in RFSIM\n");
ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti); ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti);
proc->timestamp_rx = ts-ru->ts_offset; proc->timestamp_rx = ts-ru->ts_offset;
} }
......
...@@ -4,11 +4,18 @@ ...@@ -4,11 +4,18 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <openair1/PHY/defs_eNB.h> #include <openair1/PHY/defs_eNB.h>
#define CU_IP "127.0.0.1"
#define CU_PORT "7878"
#define DU_IP "127.0.0.1"
#define DU_PORT "8787"
#define MTU 65536 #define MTU 65536
#define UDP_TIMEOUT 100000L // in nano second #define UDP_TIMEOUT 100000L // in nano second
#define MAX_BLOCKS 16 #define MAX_BLOCKS 16
#define blockAlign 32 //bytes #define blockAlign 32 //bytes
typedef struct { typedef struct {
char *sourceIP; char *sourceIP;
char *sourcePort; char *sourcePort;
...@@ -38,8 +45,6 @@ typedef struct frequency_s { ...@@ -38,8 +45,6 @@ typedef struct frequency_s {
} frequency_t; } frequency_t;
typedef struct { typedef struct {
int frame;
int subframe;
uint16_t max_preamble[4]; uint16_t max_preamble[4];
uint16_t max_preamble_energy[4]; uint16_t max_preamble_energy[4];
uint16_t max_preamble_delay[4]; uint16_t max_preamble_delay[4];
...@@ -47,10 +52,6 @@ typedef struct { ...@@ -47,10 +52,6 @@ typedef struct {
} fs6_ul_t; } fs6_ul_t;
typedef struct { typedef struct {
int frame;
int subframe;
int ul_frame;
int ul_subframe;
int num_pdcch_symbols; int num_pdcch_symbols;
int num_dci; int num_dci;
DCI_ALLOC_t dci_alloc[32]; DCI_ALLOC_t dci_alloc[32];
...@@ -70,15 +71,17 @@ typedef struct { ...@@ -70,15 +71,17 @@ typedef struct {
} fs6_dl_uespec_t; } fs6_dl_uespec_t;
bool createUDPsock (char *sourceIP, char *sourcePort, char *destIP, char *destPort, UDPsock_t *result); bool createUDPsock (char *sourceIP, char *sourcePort, char *destIP, char *destPort, UDPsock_t *result);
int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int bufferSize, uint16_t contentType); int receiveSubFrame(UDPsock_t *sock, void *bufferZone, int bufferSize, uint16_t contentType);
int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize, uint16_t contentType); int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize, uint16_t contentType);
#define initBufferZone(xBuf) \ #define initBufferZone(xBuf) \
uint8_t xBuf[FS6_BUF_SIZE];\ uint8_t xBuf[FS6_BUF_SIZE]; \
((commonUDP_t *)xBuf)->nbBlocks=0; ((commonUDP_t *)xBuf)->nbBlocks=0;
#define hUDP(xBuf) ((commonUDP_t *)xBuf) #define hUDP(xBuf) ((commonUDP_t *)xBuf)
#define hDL(xBuf) (((fs6_dl_t*)((commonUDP_t *)xBuf)+1)) #define hDL(xBuf) ((fs6_dl_t*)(((commonUDP_t *)xBuf)+1))
#define hUL(xBuf) ((fs6_ul_t*)(((commonUDP_t *)xBuf)+1))
#define hDLUE(xBuf) ((fs6_dl_uespec_t*) (((fs6_dl_t*)(((commonUDP_t *)xBuf)+1))+1))
static inline size_t alignedSize(uint8_t *ptr) { static inline size_t alignedSize(uint8_t *ptr) {
commonUDP_t *header=(commonUDP_t *) ptr; commonUDP_t *header=(commonUDP_t *) ptr;
...@@ -115,4 +118,5 @@ void phy_init_RU(RU_t *); ...@@ -115,4 +118,5 @@ void phy_init_RU(RU_t *);
void feptx_prec(RU_t *); void feptx_prec(RU_t *);
void feptx_ofdm(RU_t *); void feptx_ofdm(RU_t *);
void oai_subframe_ind(uint16_t sfn, uint16_t sf); void oai_subframe_ind(uint16_t sfn, uint16_t sf);
extern uint16_t sf_ahead;
#endif #endif
...@@ -68,11 +68,20 @@ bool createUDPsock (char *sourceIP, char *sourcePort, char *destIP, char *destPo ...@@ -68,11 +68,20 @@ bool createUDPsock (char *sourceIP, char *sourcePort, char *destIP, char *destPo
} }
// sock: udp socket // sock: udp socket
// expectedTS: the expected timestamp, 0 if unknown
// bufferZone: a reception area of bufferSize // bufferZone: a reception area of bufferSize
int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int bufferSize, uint16_t contentType) { int receiveSubFrame(UDPsock_t *sock, void *bufferZone, int bufferSize, uint16_t contentType) {
int rcved=0; int rcved=0;
commonUDP_t *bufOrigin=(commonUDP_t *)bufferZone; commonUDP_t *bufOrigin=(commonUDP_t *)bufferZone;
static uint8_t crossData[65536];
static int crossDataSize=0;
if (crossDataSize) {
LOG_D(HW,"copy a block received in previous subframe\n");
memcpy(bufferZone, crossData, crossDataSize);
rcved=1;
bufferZone+=crossDataSize;
crossDataSize=0;
}
do { do {
//read all subframe data from the control unit //read all subframe data from the control unit
...@@ -80,7 +89,8 @@ int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int ...@@ -80,7 +89,8 @@ int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int
if ( ret==-1) { if ( ret==-1) {
if ( errno == EWOULDBLOCK || errno== EINTR ) { if ( errno == EWOULDBLOCK || errno== EINTR ) {
return rcved; // Timeout, subframe incomplete LOG_I(HW,"Received: Timeout, subframe incomplete\n");
return rcved;
} else { } else {
LOG_E(HW,"Critical issue in socket: %s\n", strerror(errno)); LOG_E(HW,"Critical issue in socket: %s\n", strerror(errno));
return -1; return -1;
...@@ -89,28 +99,26 @@ int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int ...@@ -89,28 +99,26 @@ int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int
if (hUDP(bufferZone)->contentType != contentType) if (hUDP(bufferZone)->contentType != contentType)
abort(); abort();
if ( hUDP(bufferZone)->timestamp != expectedTS) { if (rcved && bufOrigin->timestamp != hUDP(bufferZone)->timestamp ) {
if ( hUDP(bufferZone)->timestamp < expectedTS) { if ( hUDP(bufferZone)->timestamp > bufOrigin->timestamp ) {
LOG_W(HW,"Received a paquet from past subframes, dropping it\n"); LOG_W(HW,"Received data for TS: %lu before end of TS : %lu completion\n",
hUDP(bufferZone)->timestamp,
bufOrigin->timestamp);
memcpy(crossData, bufferZone, ret );
crossDataSize=ret;
return rcved;
} else { } else {
LOG_W(HW,"Received a paquet in future subframes\n"); LOG_W(HW,"Dropping late packet\n");
continue;
if ( rcved == 0 ) {
LOG_W(HW,"First paquet in the sub-frame, keeping it\n");
rcved++;
bufferZone+=ret;
expectedTS=hUDP(bufferZone)->timestamp;
} }
} }
} else {
rcved++; rcved++;
bufferZone+=ret; bufferZone+=ret;
} }
} } while ( rcved == 0 || rcved < bufOrigin->nbBlocks );
} while ( !rcved || rcved < hUDP(bufferZone)->nbBlocks );
LOG_D(HW,"Received: nb_blocks: %d, TS: %lu, frame: %d, subframe: %d\n", LOG_D(HW,"Received: nb_blocks: %d, TS: %lu\n",rcved, bufOrigin->timestamp);
rcved, bufOrigin->timestamp, *(((int *)bufOrigin)+1), *(((int *)bufOrigin)+2));
return rcved; return rcved;
} }
......
...@@ -195,7 +195,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, ...@@ -195,7 +195,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
pbch_E = (frame_parms->Ncp==NORMAL) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK) pbch_E = (frame_parms->Ncp==NORMAL) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
// pbch_E_bytes = pbch_coded_bits>>3; // pbch_E_bytes = pbch_coded_bits>>3;
LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4==0); LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4);
if (frame_mod4==0) { if (frame_mod4==0) {
bzero(pbch_a,PBCH_A>>3); bzero(pbch_a,PBCH_A>>3);
......
...@@ -162,7 +162,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) { ...@@ -162,7 +162,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
int **txdataF = eNB->common_vars.txdataF; int **txdataF = eNB->common_vars.txdataF;
uint8_t *pbch_pdu=&eNB->pbch_pdu[0]; uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
//LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?"); LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?");
// generate Cell-Specific Reference Signals for both slots // generate Cell-Specific Reference Signals for both slots
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
......
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