From b618fcb1fd62bdb2bd8ab8326aff85e3fe6b90d4 Mon Sep 17 00:00:00 2001 From: mlhnet Date: Sun, 30 Aug 2015 19:16:48 -0400 Subject: [PATCH] Add RX=END waveform message, bug fixes --- DSP_API/.cproject | 266 ++++++------------- DSP_API/Release/CODEC2_FREEDV/codebook.d | 4 - DSP_API/Release/CODEC2_FREEDV/subdir.mk | 96 ------- DSP_API/Release/SmartSDR_Interface/subdir.mk | 60 ----- DSP_API/Release/makefile | 51 ---- DSP_API/Release/objects.mk | 8 - DSP_API/Release/sources.mk | 19 -- DSP_API/Release/subdir.mk | 30 --- DSP_API/SmartSDR_Interface/sched_waveform.c | 59 ++-- DSP_API/ThumbDV/dstar.c | 18 +- 10 files changed, 128 insertions(+), 483 deletions(-) delete mode 100644 DSP_API/Release/CODEC2_FREEDV/codebook.d delete mode 100644 DSP_API/Release/CODEC2_FREEDV/subdir.mk delete mode 100644 DSP_API/Release/SmartSDR_Interface/subdir.mk delete mode 100644 DSP_API/Release/makefile delete mode 100644 DSP_API/Release/objects.mk delete mode 100644 DSP_API/Release/sources.mk delete mode 100644 DSP_API/Release/subdir.mk diff --git a/DSP_API/.cproject b/DSP_API/.cproject index 13dbe50..91dc741 100644 --- a/DSP_API/.cproject +++ b/DSP_API/.cproject @@ -1,182 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -190,7 +14,7 @@ - + @@ -201,21 +25,21 @@ @@ -267,7 +91,7 @@ - + @@ -282,13 +106,12 @@ - + - + - + @@ -354,6 +178,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -418,4 +309,5 @@ + diff --git a/DSP_API/Release/CODEC2_FREEDV/codebook.d b/DSP_API/Release/CODEC2_FREEDV/codebook.d deleted file mode 100644 index dc5f6f2..0000000 --- a/DSP_API/Release/CODEC2_FREEDV/codebook.d +++ /dev/null @@ -1,4 +0,0 @@ -CODEC2_FREEDV/codebook.d: ../CODEC2_FREEDV/codebook.c \ - ../CODEC2_FREEDV/defines.h - -../CODEC2_FREEDV/defines.h: diff --git a/DSP_API/Release/CODEC2_FREEDV/subdir.mk b/DSP_API/Release/CODEC2_FREEDV/subdir.mk deleted file mode 100644 index 01a752c..0000000 --- a/DSP_API/Release/CODEC2_FREEDV/subdir.mk +++ /dev/null @@ -1,96 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit! -################################################################################ - -# Add inputs and outputs from these tool invocations to the build variables -C_SRCS += \ -../CODEC2_FREEDV/codebook.c \ -../CODEC2_FREEDV/codebookd.c \ -../CODEC2_FREEDV/codebookdt.c \ -../CODEC2_FREEDV/codebookge.c \ -../CODEC2_FREEDV/codebookjnd.c \ -../CODEC2_FREEDV/codebookjvm.c \ -../CODEC2_FREEDV/codebookvq.c \ -../CODEC2_FREEDV/codebookvqanssi.c \ -../CODEC2_FREEDV/codec2.c \ -../CODEC2_FREEDV/dump.c \ -../CODEC2_FREEDV/fdmdv.c \ -../CODEC2_FREEDV/fifo.c \ -../CODEC2_FREEDV/freedv_api.c \ -../CODEC2_FREEDV/golay23.c \ -../CODEC2_FREEDV/interp.c \ -../CODEC2_FREEDV/kiss_fft.c \ -../CODEC2_FREEDV/lpc.c \ -../CODEC2_FREEDV/lsp.c \ -../CODEC2_FREEDV/nlp.c \ -../CODEC2_FREEDV/pack.c \ -../CODEC2_FREEDV/phase.c \ -../CODEC2_FREEDV/postfilter.c \ -../CODEC2_FREEDV/quantise.c \ -../CODEC2_FREEDV/sine.c \ -../CODEC2_FREEDV/varicode.c - -OBJS += \ -./CODEC2_FREEDV/codebook.o \ -./CODEC2_FREEDV/codebookd.o \ -./CODEC2_FREEDV/codebookdt.o \ -./CODEC2_FREEDV/codebookge.o \ -./CODEC2_FREEDV/codebookjnd.o \ -./CODEC2_FREEDV/codebookjvm.o \ -./CODEC2_FREEDV/codebookvq.o \ -./CODEC2_FREEDV/codebookvqanssi.o \ -./CODEC2_FREEDV/codec2.o \ -./CODEC2_FREEDV/dump.o \ -./CODEC2_FREEDV/fdmdv.o \ -./CODEC2_FREEDV/fifo.o \ -./CODEC2_FREEDV/freedv_api.o \ -./CODEC2_FREEDV/golay23.o \ -./CODEC2_FREEDV/interp.o \ -./CODEC2_FREEDV/kiss_fft.o \ -./CODEC2_FREEDV/lpc.o \ -./CODEC2_FREEDV/lsp.o \ -./CODEC2_FREEDV/nlp.o \ -./CODEC2_FREEDV/pack.o \ -./CODEC2_FREEDV/phase.o \ -./CODEC2_FREEDV/postfilter.o \ -./CODEC2_FREEDV/quantise.o \ -./CODEC2_FREEDV/sine.o \ -./CODEC2_FREEDV/varicode.o - -C_DEPS += \ -./CODEC2_FREEDV/codebook.d \ -./CODEC2_FREEDV/codebookd.d \ -./CODEC2_FREEDV/codebookdt.d \ -./CODEC2_FREEDV/codebookge.d \ -./CODEC2_FREEDV/codebookjnd.d \ -./CODEC2_FREEDV/codebookjvm.d \ -./CODEC2_FREEDV/codebookvq.d \ -./CODEC2_FREEDV/codebookvqanssi.d \ -./CODEC2_FREEDV/codec2.d \ -./CODEC2_FREEDV/dump.d \ -./CODEC2_FREEDV/fdmdv.d \ -./CODEC2_FREEDV/fifo.d \ -./CODEC2_FREEDV/freedv_api.d \ -./CODEC2_FREEDV/golay23.d \ -./CODEC2_FREEDV/interp.d \ -./CODEC2_FREEDV/kiss_fft.d \ -./CODEC2_FREEDV/lpc.d \ -./CODEC2_FREEDV/lsp.d \ -./CODEC2_FREEDV/nlp.d \ -./CODEC2_FREEDV/pack.d \ -./CODEC2_FREEDV/phase.d \ -./CODEC2_FREEDV/postfilter.d \ -./CODEC2_FREEDV/quantise.d \ -./CODEC2_FREEDV/sine.d \ -./CODEC2_FREEDV/varicode.d - - -# Each subdirectory must supply rules for building sources it contributes -CODEC2_FREEDV/%.o: ../CODEC2_FREEDV/%.c - @echo 'Building file: $<' - @echo 'Invoking: GCC C Compiler' - arm-linux-gnueabihf-gcc -static -I"/home/graham/workspace/smartsdr-dsp/DSP_API" -I"/home/graham/workspace/smartsdr-dsp/DSP_API/SmartSDR_Interface" -I"/home/graham/workspace/smartsdr-dsp/DSP_API/CODEC2_FREEDV" -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" - @echo 'Finished building: $<' - @echo ' ' - - diff --git a/DSP_API/Release/SmartSDR_Interface/subdir.mk b/DSP_API/Release/SmartSDR_Interface/subdir.mk deleted file mode 100644 index 80b1a54..0000000 --- a/DSP_API/Release/SmartSDR_Interface/subdir.mk +++ /dev/null @@ -1,60 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit! -################################################################################ - -# Add inputs and outputs from these tool invocations to the build variables -C_SRCS += \ -../SmartSDR_Interface/cmd_basics.c \ -../SmartSDR_Interface/cmd_engine.c \ -../SmartSDR_Interface/discovery_client.c \ -../SmartSDR_Interface/hal_buffer.c \ -../SmartSDR_Interface/hal_listener.c \ -../SmartSDR_Interface/hal_vita.c \ -../SmartSDR_Interface/io_utils.c \ -../SmartSDR_Interface/sched_waveform.c \ -../SmartSDR_Interface/smartsdr_dsp_api.c \ -../SmartSDR_Interface/status_processor.c \ -../SmartSDR_Interface/traffic_cop.c \ -../SmartSDR_Interface/utils.c \ -../SmartSDR_Interface/vita_output.c - -OBJS += \ -./SmartSDR_Interface/cmd_basics.o \ -./SmartSDR_Interface/cmd_engine.o \ -./SmartSDR_Interface/discovery_client.o \ -./SmartSDR_Interface/hal_buffer.o \ -./SmartSDR_Interface/hal_listener.o \ -./SmartSDR_Interface/hal_vita.o \ -./SmartSDR_Interface/io_utils.o \ -./SmartSDR_Interface/sched_waveform.o \ -./SmartSDR_Interface/smartsdr_dsp_api.o \ -./SmartSDR_Interface/status_processor.o \ -./SmartSDR_Interface/traffic_cop.o \ -./SmartSDR_Interface/utils.o \ -./SmartSDR_Interface/vita_output.o - -C_DEPS += \ -./SmartSDR_Interface/cmd_basics.d \ -./SmartSDR_Interface/cmd_engine.d \ -./SmartSDR_Interface/discovery_client.d \ -./SmartSDR_Interface/hal_buffer.d \ -./SmartSDR_Interface/hal_listener.d \ -./SmartSDR_Interface/hal_vita.d \ -./SmartSDR_Interface/io_utils.d \ -./SmartSDR_Interface/sched_waveform.d \ -./SmartSDR_Interface/smartsdr_dsp_api.d \ -./SmartSDR_Interface/status_processor.d \ -./SmartSDR_Interface/traffic_cop.d \ -./SmartSDR_Interface/utils.d \ -./SmartSDR_Interface/vita_output.d - - -# Each subdirectory must supply rules for building sources it contributes -SmartSDR_Interface/%.o: ../SmartSDR_Interface/%.c - @echo 'Building file: $<' - @echo 'Invoking: GCC C Compiler' - arm-linux-gnueabihf-gcc -static -I"/home/graham/workspace/smartsdr-dsp/DSP_API" -I"/home/graham/workspace/smartsdr-dsp/DSP_API/SmartSDR_Interface" -I"/home/graham/workspace/smartsdr-dsp/DSP_API/CODEC2_FREEDV" -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" - @echo 'Finished building: $<' - @echo ' ' - - diff --git a/DSP_API/Release/makefile b/DSP_API/Release/makefile deleted file mode 100644 index 2872af3..0000000 --- a/DSP_API/Release/makefile +++ /dev/null @@ -1,51 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit! -################################################################################ - --include ../makefile.init - -RM := rm -rf - -# All of the sources participating in the build are defined here --include sources.mk --include SmartSDR_Interface/subdir.mk --include CODEC2_FREEDV/subdir.mk --include subdir.mk --include objects.mk - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(strip $(C_DEPS)),) --include $(C_DEPS) -endif -endif - --include ../makefile.defs - -# Add inputs and outputs from these tool invocations to the build variables - -# All Target -all: freedv - -# Tool invocations -freedv: $(OBJS) $(USER_OBJS) - @echo 'Building target: $@' - @echo 'Invoking: GCC C Linker' - arm-linux-gnueabihf-gcc -static -o "freedv" $(OBJS) $(USER_OBJS) $(LIBS) - @echo 'Finished building target: $@' - @echo ' ' - $(MAKE) --no-print-directory post-build - -# Other Targets -clean: - -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) freedv - -@echo ' ' - -post-build: - -@echo 'Install in BeagleBone at /home/debian/bin' - -scp freedv root@192.168.20.33:/home/debian/bin/ - -@echo ' ' - -.PHONY: all clean dependents -.SECONDARY: post-build - --include ../makefile.targets diff --git a/DSP_API/Release/objects.mk b/DSP_API/Release/objects.mk deleted file mode 100644 index 61d364b..0000000 --- a/DSP_API/Release/objects.mk +++ /dev/null @@ -1,8 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit! -################################################################################ - -USER_OBJS := - -LIBS := -lm -lpthread -lrt - diff --git a/DSP_API/Release/sources.mk b/DSP_API/Release/sources.mk deleted file mode 100644 index 7dc98a2..0000000 --- a/DSP_API/Release/sources.mk +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit! -################################################################################ - -O_SRCS := -C_SRCS := -S_UPPER_SRCS := -OBJ_SRCS := -ASM_SRCS := -OBJS := -C_DEPS := -EXECUTABLES := - -# Every subdirectory with source files must be described here -SUBDIRS := \ -. \ -SmartSDR_Interface \ -CODEC2_FREEDV \ - diff --git a/DSP_API/Release/subdir.mk b/DSP_API/Release/subdir.mk deleted file mode 100644 index d466154..0000000 --- a/DSP_API/Release/subdir.mk +++ /dev/null @@ -1,30 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit! -################################################################################ - -# Add inputs and outputs from these tool invocations to the build variables -C_SRCS += \ -../circular_buffer.c \ -../main.c \ -../resampler.c - -OBJS += \ -./circular_buffer.o \ -./main.o \ -./resampler.o - -C_DEPS += \ -./circular_buffer.d \ -./main.d \ -./resampler.d - - -# Each subdirectory must supply rules for building sources it contributes -%.o: ../%.c - @echo 'Building file: $<' - @echo 'Invoking: GCC C Compiler' - arm-linux-gnueabihf-gcc -static -I"/home/graham/workspace/smartsdr-dsp/DSP_API" -I"/home/graham/workspace/smartsdr-dsp/DSP_API/SmartSDR_Interface" -I"/home/graham/workspace/smartsdr-dsp/DSP_API/CODEC2_FREEDV" -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" - @echo 'Finished building: $<' - @echo ' ' - - diff --git a/DSP_API/SmartSDR_Interface/sched_waveform.c b/DSP_API/SmartSDR_Interface/sched_waveform.c index 01d189e..485529c 100644 --- a/DSP_API/SmartSDR_Interface/sched_waveform.c +++ b/DSP_API/SmartSDR_Interface/sched_waveform.c @@ -304,52 +304,53 @@ void sched_waveform_setOwnCall1( uint32 slice , const char * owncall1 ) { } void sched_waveform_setOwnCall2( uint32 slice , const char * owncall2 ) { - /* Ignore slice for now */ - char string[10]; - strncpy( string, owncall2, 5 ); - charReplace( string, ' ', ( char ) 0x7F ); - memset( _dstar->outgoing_header.own_call2, ' ', 4 ); /* We limit the copy to the string length so that * we can fill the rest of the string with spaces to * comply with DSTAR */ - uint32 copy_len = strlen( owncall2 ); - - if ( copy_len > 5 ) - copy_len = 5; - - strncpy( _dstar->outgoing_header.own_call2, string, copy_len ); - + memset( _dstar->outgoing_header.own_call2, ' ', 4 ); /* Enforce termination */ _dstar->outgoing_header.own_call2[4] = '\0'; + if (strlen(owncall2) > 0) + { + strncpy( string, owncall2, 4); + string[4] = 0; + charReplace( string, ( char ) 0x7F, ' ' ); + uint32 copy_len = strlen( owncall2 ); + if ( copy_len > 4 ) + copy_len = 4; + strncpy( _dstar->outgoing_header.own_call2, string, copy_len ); + } + dstar_dumpHeader( &( _dstar->outgoing_header ) ); } void sched_waveform_setMessage( uint32 slice, const char * message) { - /* Ignore slice for now */ char string[SLOW_DATA_MESSAGE_LENGTH_BYTES + 1 ]; - strncpy( string, message, SLOW_DATA_MESSAGE_LENGTH_BYTES + 1); - charReplace( string, ' ', ( char ) 0x7F ); - memset(_dstar->slow_encoder->message, ' ', SLOW_DATA_MESSAGE_LENGTH_BYTES); - /* We limit the copy to the string length so that * we can fill the rest of the string with spaces to * comply with DSTAR */ - - uint32 copy_len = strlen( string ); - - if ( copy_len > SLOW_DATA_MESSAGE_LENGTH_BYTES ) - copy_len = SLOW_DATA_MESSAGE_LENGTH_BYTES; - - strncpy(_dstar->slow_encoder->message, string, copy_len); - + memset(_dstar->slow_encoder->message, ' ', SLOW_DATA_MESSAGE_LENGTH_BYTES); /* Enforce termination */ _dstar->slow_encoder->message[SLOW_DATA_MESSAGE_LENGTH_BYTES] = '\0'; + /* Ignore slice for now */ + if (strlen(message) > 0) + { + strncpy( string, message, SLOW_DATA_MESSAGE_LENGTH_BYTES); + string[SLOW_DATA_MESSAGE_LENGTH_BYTES] = 0; + charReplace( string, ( char ) 0x7F, ' ' ); + uint32 copy_len = strlen( string ); + if ( copy_len > SLOW_DATA_MESSAGE_LENGTH_BYTES ) + copy_len = SLOW_DATA_MESSAGE_LENGTH_BYTES; + strncpy(_dstar->slow_encoder->message, string, copy_len); + } + + output( "TX Message: '%s'\n", _dstar->slow_encoder->message ); } void sched_waveform_setFD( int fd ) { @@ -520,8 +521,16 @@ static void * _sched_waveform_thread( void * param ) { for ( j = 0 ; j < nout ; j++ ) cbWriteShort( RX3_cb, speech_out[j] ); } + + if (_dstar->rx_state == END_PATTERN) + { + char msg[64]; + sprintf( msg, "waveform status slice=%d RX=END", _dstar->slice); + tc_sendSmartSDRcommand( msg, FALSE, NULL ); + } } + // Check for >= 160 samples in RX3_cb, convert to floats // and spin the upsampler. Move output to RX4_cb. diff --git a/DSP_API/ThumbDV/dstar.c b/DSP_API/ThumbDV/dstar.c index e3a82bd..300e619 100644 --- a/DSP_API/ThumbDV/dstar.c +++ b/DSP_API/ThumbDV/dstar.c @@ -603,7 +603,8 @@ void dstar_updateStatus( DSTAR_MACHINE machine, uint32 slice, enum STATUS_TYPE } char status[200] = {0}; - char header_string[200] = {0}; + char header_string[256] = {0}; + char message_string[21]; /* Make copy to replace spaces with special char */ @@ -634,19 +635,30 @@ void dstar_updateStatus( DSTAR_MACHINE machine, uint32 slice, enum STATUS_TYPE charReplace( ( char * )h.destination_rptr, ' ', ( char ) 0x7F ); charReplace( ( char * )h.departure_rptr, ' ', ( char ) 0x7F ); - charReplace( ( char * )h.companion_call, ' ', ( char ) 0x7F ); + charReplace((char *) h.companion_call, ' ', ( char ) 0x7F ); charReplace( ( char * )h.own_call1, ' ', ( char ) 0x7F ); charReplace( ( char * )h.own_call2, ' ', ( char ) 0x7F ); sprintf( header_string, "destination_rptr_tx=%s departure_rptr_tx=%s companion_call_tx=%s own_call1_tx=%s own_call2_tx=%s", h.destination_rptr, h.departure_rptr, h.companion_call, h.own_call1, h.own_call2 ); + if (machine->slow_encoder != NULL && machine->slow_encoder->message[0] != 0) + { + memcpy( message_string, machine->slow_encoder->message, sizeof( message_string ) ); + message_string[sizeof( message_string ) - 1] = 0; + charReplace( message_string, ' ', ( char ) 0x7F ); + sprintf( header_string + strlen(header_string), " message_tx=%s", message_string); + } + sprintf( status, "waveform status slice=%d %s", slice, header_string ); tc_sendSmartSDRcommand( status, FALSE, NULL ); break; case STATUS_SLOW_DATA_MESSAGE: - sprintf( status, "waveform status slice=%d message=%s", slice, machine->slow_decoder->message_string); + memcpy( message_string, machine->slow_decoder->message_string, sizeof( message_string ) ); + message_string[sizeof( message_string ) - 1] = 0; + charReplace( message_string, ' ', ( char ) 0x7F ); + sprintf( status, "waveform status slice=%d message=%s", slice, message_string); tc_sendSmartSDRcommand( status, FALSE, NULL ); break; }