continue timestamp
This commit is contained in:
+23
-18
@@ -653,6 +653,8 @@ void phy_procedures_eNB_TX_extract(uint8_t *bufferZone, PHY_VARS_eNB *eNB, L1_rx
|
||||
hDL(bufferZone)->amp=AMP;
|
||||
}
|
||||
|
||||
if (num_mdci) abort();
|
||||
|
||||
if (do_meas==1) stop_meas(&eNB->dlsch_common_and_dci);
|
||||
|
||||
if (do_meas==1) start_meas(&eNB->dlsch_ue_specific);
|
||||
@@ -741,21 +743,21 @@ void phy_procedures_eNB_TX_extract(uint8_t *bufferZone, PHY_VARS_eNB *eNB, L1_rx
|
||||
return;
|
||||
}
|
||||
|
||||
void DL_du_fs6(RU_t *ru, int frame, int subframe, uint64_t TS) {
|
||||
void DL_du_fs6(RU_t *ru) {
|
||||
RU_proc_t *ru_proc=&ru->proc;
|
||||
|
||||
for (int i=0; i<ru->num_eNB; i++) {
|
||||
initBufferZone(bufferZone);
|
||||
int nb_blocks=receiveSubFrame(&sockFS6, TS, bufferZone, sizeof(bufferZone) );
|
||||
L1_rxtx_proc_t *L1_proc = &ru->eNB_list[i]->proc.L1_proc_tx;
|
||||
L1_proc->timestamp_tx=hUDP(bufferZone)->timestamp;
|
||||
L1_proc->frame_tx=hDL(bufferZone)->frame;
|
||||
L1_proc->subframe_tx=hDL(bufferZone)->subframe;
|
||||
int nb_blocks=receiveSubFrame(&sockFS6, ru_proc->timestamp_tx, bufferZone, sizeof(bufferZone), CTsentCUv0 );
|
||||
|
||||
if (nb_blocks>0)
|
||||
if (nb_blocks > 0) {
|
||||
L1_rxtx_proc_t *L1_proc = &ru->eNB_list[i]->proc.L1_proc_tx;
|
||||
L1_proc->timestamp_tx=hUDP(bufferZone)->timestamp;
|
||||
L1_proc->frame_tx=hDL(bufferZone)->frame;
|
||||
L1_proc->subframe_tx=hDL(bufferZone)->subframe;
|
||||
phy_procedures_eNB_TX_process( bufferZone, nb_blocks, ru->eNB_list[i], &ru->eNB_list[i]->proc.L1_proc, 1);
|
||||
else
|
||||
LOG_E(PHY,"DL not received for subframe: %d\n", subframe);
|
||||
} else
|
||||
LOG_E(PHY,"DL not received for subframe\n");
|
||||
}
|
||||
|
||||
/* OAI data model is wrong: hardcode link ru to enb index 0*/
|
||||
@@ -799,8 +801,14 @@ void UL_du_fs6(RU_t *ru, int frame, int subframe) {
|
||||
phy_procedures_eNB_uespec_RX_extract(bufferZone, FS6_BUF_SIZE, eNB, &proc->L1_proc );
|
||||
}
|
||||
|
||||
if (hUDP(bufferZone)->nbBlocks==0) {
|
||||
hUDP(bufferZone)->nbBlocks=1; // We have to send the signaling, even is there is no user plan data (no UE)
|
||||
hUDP(bufferZone)->blockID=0;
|
||||
hUDP(bufferZone)->contentBytes=sizeof(fs6_ul_t);
|
||||
}
|
||||
|
||||
for (int i=0; i<ru->num_eNB; i++) {
|
||||
sendSubFrame(&sockFS6,bufferZone, sizeof(fs6_ul_t));
|
||||
sendSubFrame(&sockFS6, bufferZone, sizeof(fs6_ul_t), CTsentDUv0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -827,12 +835,12 @@ void DL_cu_fs6(RU_t *ru,int frame, int subframe) {
|
||||
hUDP(bufferZone)->contentBytes=sizeof(fs6_dl_t);
|
||||
}
|
||||
|
||||
sendSubFrame(&sockFS6, bufferZone, sizeof(fs6_dl_t) );
|
||||
sendSubFrame(&sockFS6, bufferZone, sizeof(fs6_dl_t), CTsentCUv0 );
|
||||
}
|
||||
|
||||
void UL_cu_fs6(RU_t *ru,int frame, int subframe, uint64_t TS) {
|
||||
initBufferZone(bufferZone);
|
||||
int nb_blocks=receiveSubFrame(&sockFS6, TS, bufferZone, sizeof(bufferZone) );
|
||||
int nb_blocks=receiveSubFrame(&sockFS6, TS, bufferZone, sizeof(bufferZone), CTsentDUv0 );
|
||||
|
||||
if (nb_blocks ==0) {
|
||||
LOG_W(PHY, "CU lost a subframe\n");
|
||||
@@ -878,7 +886,6 @@ void *cu_fs6(void *arg) {
|
||||
void *du_fs6(void *arg) {
|
||||
RU_t *ru = (RU_t *)arg;
|
||||
//RU_proc_t *proc = &ru->proc;
|
||||
int64_t AbsoluteSubframe=-1;
|
||||
fill_rf_config(ru,ru->rf_config_file);
|
||||
init_frame_parms(&ru->frame_parms,1);
|
||||
phy_init_RU(ru);
|
||||
@@ -887,11 +894,9 @@ void *du_fs6(void *arg) {
|
||||
AssertFatal(createUDPsock(NULL, "7777", "127.0.0.1", "8888", &sockFS6),"");
|
||||
|
||||
while(1) {
|
||||
AbsoluteSubframe++;
|
||||
int subframe=AbsoluteSubframe%10;
|
||||
int frame=(AbsoluteSubframe/10)%1024;
|
||||
UL_du_fs6(ru, frame,subframe);
|
||||
DL_du_fs6(ru, frame,subframe, AbsoluteSubframe);
|
||||
L1_rxtx_proc_t *proc = &ru->eNB_list[0]->proc;
|
||||
UL_du_fs6(ru, proc->frame_rx,proc->subframe_rx);
|
||||
DL_du_fs6(ru);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
+1
-13
@@ -582,13 +582,11 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
return(0);
|
||||
}
|
||||
|
||||
void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t *ru) {
|
||||
void eNB_top(PHY_VARS_eNB *eNB, int dummy1, int dummy2, char *string,RU_t *ru) {
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
L1_rxtx_proc_t *L1_proc = &proc->L1_proc;
|
||||
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
|
||||
RU_proc_t *ru_proc=&ru->proc;
|
||||
proc->frame_rx = frame_rx;
|
||||
proc->subframe_rx = subframe_rx;
|
||||
|
||||
if (!oai_exit) {
|
||||
L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti);
|
||||
@@ -650,16 +648,6 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
|
||||
proc->subframe_tx = (proc->subframe_rx+sf_ahead)%10;
|
||||
proc->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
|
||||
|
||||
if (proc->first_rx == 0) {
|
||||
AssertFatal( proc->subframe_rx == *subframe && proc->frame_rx == *frame,
|
||||
"Received Timestamp (%llu) doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d) (proc->frame_rx %d frame %d)\n",
|
||||
(long long unsigned int)proc->timestamp_rx,proc->subframe_rx,*subframe, proc->frame_rx,*frame);
|
||||
} else {
|
||||
proc->first_rx = 0;
|
||||
*frame = proc->frame_rx;
|
||||
*subframe = proc->subframe_rx;
|
||||
}
|
||||
|
||||
if (rxs != fp->samples_per_tti) {
|
||||
#if defined(USRP_REC_PLAY)
|
||||
exit_fun("Exiting IQ record/playback");
|
||||
|
||||
@@ -18,6 +18,9 @@ typedef struct {
|
||||
int sockHandler;
|
||||
} UDPsock_t;
|
||||
|
||||
#define CTsentCUv0 0xA500
|
||||
#define CTsentDUv0 0x5A00
|
||||
|
||||
typedef struct commonUDP_s {
|
||||
uint64_t timestamp; // id of the group (subframe for LTE)
|
||||
uint16_t nbBlocks; // total number of blocks for this timestamp
|
||||
@@ -67,8 +70,8 @@ typedef struct {
|
||||
} fs6_dl_uespec_t;
|
||||
|
||||
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);
|
||||
int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize);
|
||||
int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int bufferSize, uint16_t contentType);
|
||||
int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize, uint16_t contentType);
|
||||
|
||||
#define initBufferZone(xBuf) \
|
||||
uint8_t xBuf[FS6_BUF_SIZE];\
|
||||
@@ -77,12 +80,12 @@ int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize);
|
||||
#define hUDP(xBuf) ((commonUDP_t *)xBuf)
|
||||
#define hDL(xBuf) (((fs6_dl_t*)((commonUDP_t *)xBuf)+1))
|
||||
|
||||
inline size_t alignedSize(uint8_t *ptr) {
|
||||
static inline size_t alignedSize(uint8_t *ptr) {
|
||||
commonUDP_t *header=(commonUDP_t *) ptr;
|
||||
return ((header->contentBytes+sizeof(commonUDP_t)+blockAlign-1)/blockAlign)*blockAlign;
|
||||
}
|
||||
|
||||
inline void *commonUDPdata(uint8_t *ptr) {
|
||||
static inline void *commonUDPdata(uint8_t *ptr) {
|
||||
return (void *) (((commonUDP_t *)ptr)+1);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ bool createUDPsock (char *sourceIP, char *sourcePort, char *destIP, char *destPo
|
||||
|
||||
int enable=1;
|
||||
AssertFatal(setsockopt(result->sockHandler, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable))==0,"");
|
||||
struct timeval tv= {0,UDP_TIMEOUT};
|
||||
//struct timeval tv= {0,UDP_TIMEOUT};
|
||||
struct timeval tv= {2,UDP_TIMEOUT}; //debug: wait 2 seconds for human understanding
|
||||
AssertFatal(setsockopt(result->sockHandler, SOL_SOCKET, SO_RCVTIMEO,&tv,sizeof(tv)) ==0,"");
|
||||
// Make a send/recv buffer larger than a a couple of subframe
|
||||
// so the kernel will store for us in and out paquets
|
||||
@@ -69,9 +70,9 @@ bool createUDPsock (char *sourceIP, char *sourcePort, char *destIP, char *destPo
|
||||
// sock: udp socket
|
||||
// expectedTS: the expected timestamp, 0 if unknown
|
||||
// bufferZone: a reception area of bufferSize
|
||||
int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int bufferSize) {
|
||||
int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int bufferSize, uint16_t contentType) {
|
||||
int rcved=0;
|
||||
commonUDP_t *tmp=NULL;
|
||||
commonUDP_t *bufOrigin=(commonUDP_t *)bufferZone;
|
||||
|
||||
do {
|
||||
//read all subframe data from the control unit
|
||||
@@ -85,22 +86,37 @@ int receiveSubFrame(UDPsock_t *sock, uint64_t expectedTS, void *bufferZone, int
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
tmp=(commonUDP_t *)bufferZone;
|
||||
if (hUDP(bufferZone)->contentType != contentType)
|
||||
abort();
|
||||
|
||||
if ( expectedTS && tmp->timestamp != expectedTS) {
|
||||
LOG_W(HW,"Received a paquet in mixed subframes, dropping it\n");
|
||||
if ( hUDP(bufferZone)->timestamp != expectedTS) {
|
||||
if ( hUDP(bufferZone)->timestamp < expectedTS) {
|
||||
LOG_W(HW,"Received a paquet from past subframes, dropping it\n");
|
||||
} else {
|
||||
LOG_W(HW,"Received a paquet in future subframes\n");
|
||||
|
||||
if ( rcved == 0 ) {
|
||||
LOG_W(HW,"First paquet in the sub-frame, keeping it\n");
|
||||
rcved++;
|
||||
bufferZone+=ret;
|
||||
expectedTS=hUDP(bufferZone)->timestamp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rcved++;
|
||||
bufferZone+=ret;
|
||||
}
|
||||
}
|
||||
} while ( !rcved || rcved < tmp->nbBlocks );
|
||||
} while ( !rcved || rcved < hUDP(bufferZone)->nbBlocks );
|
||||
|
||||
LOG_D(HW,"Received: nb_blocks: %d, TS: %lu, frame: %d, subframe: %d\n",
|
||||
rcved, bufOrigin->timestamp, *(((int *)bufOrigin)+1), *(((int *)bufOrigin)+2));
|
||||
return rcved;
|
||||
}
|
||||
|
||||
int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize) {
|
||||
int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize, uint16_t contentType) {
|
||||
commonUDP_t *UDPheader=(commonUDP_t *)bufferZone ;
|
||||
UDPheader->contentType=contentType;
|
||||
int nbBlocks=UDPheader->nbBlocks;
|
||||
int blockId=0;
|
||||
|
||||
@@ -131,5 +147,7 @@ int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize) {
|
||||
nbBlocks--;
|
||||
} while (nbBlocks);
|
||||
|
||||
LOG_D(HW,"Sent: TS: %lu, frame: %d, subframe: %d\n",
|
||||
UDPheader->timestamp, *(((int *)UDPheader)+1), *(((int *)UDPheader)+2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user