Loopback of encode TX and decode in RX test working

This commit is contained in:
Ed Gonzalez 2015-05-29 14:22:37 -05:00
parent d618652579
commit d1218b7346
2 changed files with 13 additions and 12 deletions

View file

@ -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);
}
}

View file

@ -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);