diff --git a/etc/uldaq.conf b/etc/uldaq.conf index cc72d2946..06ead6346 100644 --- a/etc/uldaq.conf +++ b/etc/uldaq.conf @@ -37,7 +37,7 @@ nodes = { }, out = { vectorize = 100 - address = "192.168.104.10:13000" + address = "10.100.1.125:13000" } } } diff --git a/lib/hooks/average.c b/lib/hooks/average.c index f50f8a982..010c76e2d 100644 --- a/lib/hooks/average.c +++ b/lib/hooks/average.c @@ -31,7 +31,7 @@ #include struct average { - int mask; + uint64_t mask; int offset; }; @@ -42,7 +42,7 @@ static int average_parse(struct hook *h, json_t *cfg) int ret; json_error_t err; - ret = json_unpack_ex(cfg, &err, 0, "{ s: i, s: i }", + ret = json_unpack_ex(cfg, &err, 0, "{ s: i, s: I }", "offset", &p->offset, "mask", &p->mask ); @@ -62,7 +62,7 @@ static int average_process(struct hook *h, struct sample *smps[], unsigned *cnt) int n = 0; for (int k = 0; k < smp->length; k++) { - if (!(p->mask & (1 << k))) + if (!(p->mask & (1LL << k))) continue; switch (sample_format(smps[i], k)) { diff --git a/lib/memory.c b/lib/memory.c index a2f0b58d6..9ee08c28d 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -104,7 +104,7 @@ int memory_lock(size_t lock) debug(LOG_MEM | 2, "Increased ressource limit of locked memory to %zd bytes", lock); } #endif /* __arm__ */ -out: + #ifdef _POSIX_MEMLOCK /* Lock all current and future memory allocations */ ret = mlockall(MCL_CURRENT | MCL_FUTURE); diff --git a/lib/nodes/uldaq.c b/lib/nodes/uldaq.c index 67b046f30..79c0ba2b6 100644 --- a/lib/nodes/uldaq.c +++ b/lib/nodes/uldaq.c @@ -598,26 +598,18 @@ int uldaq_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re { struct uldaq *u = (struct uldaq *) n->_vd; - size_t buffer_incr = n->in.vectorize * u->in.channel_count; - pthread_mutex_lock(&u->in.mutex); - /* Wait for data available condition triggered by event callback */ - if (u->in.buffer_pos + buffer_incr < u->in.transfer_status.currentIndex) - pthread_cond_wait(&u->in.cv, &u->in.mutex); - -#if 1 - debug(2, "Total count = %lld", u->in.transfer_status.currentTotalCount); - debug(2, "Index = %lld", u->in.transfer_status.currentIndex); - debug(2, "Scan count = %lld", u->in.transfer_status.currentScanCount); - debug(2, "Buffer pos = %zu", u->in.buffer_pos); -#endif if (u->in.status != SS_RUNNING) return -1; long long start_index = u->in.buffer_pos; + /* Wait for data available condition triggered by event callback */ + if (start_index + n->in.vectorize * u->in.channel_count > u->in.transfer_status.currentScanCount) + pthread_cond_wait(&u->in.cv, &u->in.mutex); + for (int j = 0; j < cnt; j++) { struct sample *smp = smps[j];