Commit aa579a91 authored by Joanne Hugé's avatar Joanne Hugé

WIP

parent e3cbb609
......@@ -429,7 +429,7 @@ static void trace_handler(struct timespec initial, TRXEcpriState * s) {
sprintf(n, "%s/trxw.trace", s->log_directory);
f = fopen(n, "wb+");
start = (TRACE) % trxw_rbuf[0].buf_len;
log_info("TRACE", "Writing %d frames to trxw.trace", trxw_rbuf[0].write_index + trxw_rbuf.buf_len - start);
log_info("TRACE", "Writing %d frames to trxw.trace", trxw_rbuf[0].write_index + trxw_rbuf[0].buf_len - start);
for(int i = start; i != trxw_rbuf[0].write_index; i = (i + 1) % trxw_rbuf[0].buf_len) {
for(int j = 0; j < TX_N_CHANNEL; j++)
fwrite((uint8_t *) (((Complex *) trxw_rbuf[j].buffer) + i * trxw_rbuf[0].len), trxw_rbuf[0].len * sizeof(Complex), 1, f);
......@@ -454,7 +454,7 @@ static void trace_handler(struct timespec initial, TRXEcpriState * s) {
memset(n, '\0', 256);
sprintf(n, "%s/trxr.trace", s->log_directory);
f = fopen(n, "wb+");
start = (TRACE + decode_counter_prev) % trxr_rbuf.buf_len;
start = (TRACE + decode_counter_prev) % trxr_rbuf[0].buf_len;
log_info("TRACE", "Writing %d frames to trxr.trace", trxr_rbuf[0].write_index + trxr_rbuf[0].buf_len - start);
for(int i = start; i != trxr_rbuf[0].write_index; i = (i + 1) % trxr_rbuf[0].buf_len) {
for(int j = 0; j < RX_N_CHANNEL; j++)
......@@ -549,7 +549,7 @@ static void *recv_thread(void *p) {
while((nc = rbuf_contiguous_copy(NULL, &rx_rbuf, nr))) {
#ifdef TRACE
#if TRACE_RX
#ifdef TRACE_RX
if((recv_counter.counter + nc) >= (rx_rbuf.buf_len + TRACE)) {
rx_trace_ready = 1;
log_info("RECV_THREAD", "RX Trace ready");
......@@ -704,7 +704,7 @@ static void *encode_thread(void *p) {
nb_frames = g->count > n ? n : g->count;
g->count -= nb_frames;
#ifdef TRACE
#if TRACE_TX
#ifdef TRACE_TX
if(sync_complete && (encode_counter.counter + nb_frames) >= (tx_rbuf.buf_len + TRACE)) {
tx_trace_ready = 1;
log_info("ENCODE_THREAD", "TX Trace ready");
......@@ -790,30 +790,26 @@ static void *decode_thread(void *p) {
}
n = EFREQ;
for(int j = 0; j < n; j++)
rbuf_update_write_index(&trxr_rbuf);
rbuf_update_write_index(&trxr_rbuf[0]);
update_counter(&decode_counter, n);
continue;
}
else if (reset_decode_counter) {
decode_counter_prev = decode_counter.counter
decode_counter_prev = decode_counter.counter;
decode_counter.counter = 0;
reset_decode_counter = 0;
}
#endif
while(!(n = rbuf_read_amount(&rx_rbuf)));
while(rbuf_write_amount(&trxr_rbuf[0]) < n);
#ifdef TRACE
trxr_trace_index_start = trxr_rbuf.write_index;
#endif
while(!(n = rbuf_read_amount(&rx_rbuf))) {};
while(rbuf_write_amount(&trxr_rbuf[0]) < n) {};
while((nc = rbuf_contiguous_copy(&rx_rbuf, &trxr_rbuf[0], n))) {
uint8_t * buf = ((uint8_t *) rx_rbuf.buffer) + (rx_rbuf.read_index * rx_rbuf.len) + 22;
#ifdef TRACE
#if TRACE_RX
#ifdef TRACE_RX
if(received_pkts && ((decode_counter.counter + nc) >= (trxr_rbuf[0].buf_len + TRACE))) {
rx_trace_ready = 1;
log_info("DECODE_THREAD", "RX Trace ready");
......@@ -1164,7 +1160,7 @@ static void trx_ecpri_write(TRXState *s1, trx_timestamp_t timestamp, const void
}
#ifdef TRACE
#if TRACE_TX
#ifdef TRACE_TX
if((write_counter.counter + write_count) >= (trxw_rbuf[0].buf_len + TRACE)) {
tx_trace_ready = 1;
log_info("TRX_ECPRI_WRITE", "TX Trace ready");
......
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