Merge remote-tracking branch 'origin/develop' into oai_test_fed4fire_old

This commit is contained in:
Javier Morgade
2019-12-14 09:54:10 +01:00
51 changed files with 4833 additions and 3436 deletions
+2 -1
View File
@@ -431,7 +431,8 @@ static bool flushInput(rfsimulator_state_t *t, int timeout) {
}
}
LOG_W(HW,"gap of: %ld in reception\n", b->th.timestamp-b->lastReceivedTS );
if ( abs(b->th.timestamp-b->lastReceivedTS) > 50 )
LOG_W(HW,"gap of: %ld in reception\n", b->th.timestamp-b->lastReceivedTS );
}
b->lastReceivedTS=b->th.timestamp;
+36 -7
View File
@@ -7,6 +7,24 @@
volatile int oai_exit = 0;
int fullread(int fd, void *_buf, int count) {
char *buf = _buf;
int ret = 0;
int l;
while (count) {
l = read(fd, buf, count);
if (l <= 0) return -1;
count -= l;
buf += l;
ret += l;
}
return ret;
}
void fullwrite(int fd, void *_buf, int count) {
char *buf = _buf;
int l;
@@ -63,10 +81,9 @@ sin_addr:
bool connected=false;
while(!connected) {
LOG_I(HW,"rfsimulator: trying to connect to %s:%d\n", IP, port);
//LOG_I(HW,"rfsimulator: trying to connect to %s:%d\n", IP, port);
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
LOG_I(HW,"rfsimulator: connection established\n");
//LOG_I(HW,"rfsimulator: connection established\n");
connected=true;
}
@@ -108,12 +125,13 @@ int main(int argc, char *argv[]) {
if (strcmp(argv[2],"server")==0) {
serviceSock=server_start(atoi(argv[3]));
} else {
client_start(argv[2],atoi(argv[3]));
serviceSock=client_start(argv[2],atoi(argv[3]));
}
samplesBlockHeader_t header;
int bufSize=100000;
void *buff=malloc(bufSize);
uint64_t readTS=0;
while (1) {
//Rewind the file to loop on the samples
@@ -125,9 +143,11 @@ int main(int argc, char *argv[]) {
AssertFatal(read(fd,&header,sizeof(header)), "");
fullwrite(serviceSock, &header, sizeof(header));
int dataSize=sizeof(int32_t)*header.size*header.nbAnt;
uint64_t wroteTS=header.timestamp;
if (dataSize>bufSize) {
void * new_buff = realloc(buff, dataSize);
void *new_buff = realloc(buff, dataSize);
if (new_buff == NULL) {
free(buff);
AssertFatal(1, "Could not reallocate");
@@ -139,9 +159,18 @@ int main(int argc, char *argv[]) {
AssertFatal(read(fd,buff,dataSize) == dataSize, "");
fullwrite(serviceSock, buff, dataSize);
// Purge incoming samples
setblocking(serviceSock, notBlocking);
setblocking(serviceSock, blocking);
while(recv(serviceSock,buff, bufSize, MSG_DONTWAIT) > 0) {
while(readTS < wroteTS) {
if ( fullread(serviceSock, &header,sizeof(header)) != sizeof(header) ||
fullread(serviceSock, buff, sizeof(int32_t)*header.size*header.nbAnt) !=
sizeof(int32_t)*header.size*header.nbAnt
) {
printf("error: %s\n", strerror(errno));
exit(1);
}
readTS=header.timestamp;
}
}
+623 -641
View File
File diff suppressed because it is too large Load Diff