From d1218b73468433d67e03e98780f7b95cb70b4802 Mon Sep 17 00:00:00 2001 From: Ed Gonzalez Date: Fri, 29 May 2015 14:22:37 -0500 Subject: [PATCH] Loopback of encode TX and decode in RX test working --- DSP_API/SmartSDR_Interface/sched_waveform.c | 17 +++++++++-------- DSP_API/ThumbDV/thumbDV.c | 8 ++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/DSP_API/SmartSDR_Interface/sched_waveform.c b/DSP_API/SmartSDR_Interface/sched_waveform.c index 8aa2b38..bb85500 100644 --- a/DSP_API/SmartSDR_Interface/sched_waveform.c +++ b/DSP_API/SmartSDR_Interface/sched_waveform.c @@ -362,19 +362,20 @@ static void* _sched_waveform_thread(void* param) /********* ENCODE */////////////// //nout = freedv_rx(_freedvS, speech_out, demod_in); // - nout = thumbDV_encode(_dv_serial_fd, demod_in, packet_out, nin); - nout = 0; + //nout = thumbDV_encode(_dv_serial_fd, demod_in, packet_out, nin); + //nout = 0; // if (nout == 0 ) { // output("x"); // } else { // nout = thumbDV_decode(_dv_serial_fd, packet_out, speech_out, nout); // if (nout == 0 ) output("y"); // } + nout = thumbDV_decode(_dv_serial_fd, NULL, speech_out, nout); for( i=0 ; i < nout ; i++) { - //cbWriteShort(RX3_cb, speech_out[i]); - cbWriteShort(RX3_cb, demod_in[i]); + cbWriteShort(RX3_cb, speech_out[i]); + //cbWriteShort(RX3_cb, demod_in[i]); } } @@ -498,13 +499,13 @@ static void* _sched_waveform_thread(void* param) /* DECODE */ uint32 decode_out = 0; - //decode_out = thumbDV_encode(_dv_serial_fd, speech_in, (unsigned char * )mod_out, 160); - decode_out = thumbDV_decode(_dv_serial_fd, NULL, mod_out, 160); + decode_out = thumbDV_encode(_dv_serial_fd, speech_in, (unsigned char * )mod_out, 160); + //decode_out = thumbDV_decode(_dv_serial_fd, NULL, mod_out, 160); for( i=0 ; i < 160 ; i++) { - cbWriteShort(TX3_cb, mod_out[i]); - //cbWriteShort(TX3_cb, 0); + //cbWriteShort(TX3_cb, mod_out[i]); + cbWriteShort(TX3_cb, 0); } } diff --git a/DSP_API/ThumbDV/thumbDV.c b/DSP_API/ThumbDV/thumbDV.c index 9be8111..f5fbf9c 100644 --- a/DSP_API/ThumbDV/thumbDV.c +++ b/DSP_API/ThumbDV/thumbDV.c @@ -382,14 +382,14 @@ int thumbDV_processSerial(int serial_fd) } else if ( packet_type == AMBE3000_CHAN_PKT_TYPE ) { desc = hal_BufferRequest(respLen, sizeof(unsigned char) ); memcpy(desc->buf_ptr, buffer, respLen); - dump("Coded Packet", buffer, respLen); + //dump("Coded Packet", buffer, respLen); /* Encoded data */ _thumbDVEncodedList_LinkTail(desc); } else if ( packet_type == AMBE3000_SPEECH_PKT_TYPE ) { output("s"); desc = hal_BufferRequest(respLen, sizeof(unsigned char)); memcpy(desc->buf_ptr, buffer, respLen); - dump("SPEECH Packet", buffer, respLen); + //dump("SPEECH Packet", buffer, respLen); /* Speech data */ _thumbDVDecodedList_LinkTail(desc); @@ -438,7 +438,7 @@ int thumbDV_decode(int serial_fd, unsigned char * packet_in, short * speech_out, } int32 samples_returned = 0; - BufferDescriptor desc = NULL;//_thumbDVDecodedList_UnlinkHead(); + BufferDescriptor desc = _thumbDVDecodedList_UnlinkHead(); uint32 samples_in_speech_packet = 0; if ( desc != NULL ) { @@ -503,7 +503,7 @@ int thumbDV_encode(int serial_fd, short * speech_in, unsigned char * packet_out, thumbDV_writeSerial(serial_fd, packet, length + 3); int32 samples_returned = 0; - BufferDescriptor desc = NULL ;//_thumbDVEncodedList_UnlinkHead(); + BufferDescriptor desc = NULL;//_thumbDVEncodedList_UnlinkHead(); if ( desc != NULL ) { memcpy(packet_out, desc->buf_ptr, desc->sample_size * desc->num_samples);