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