aboutsummaryrefslogtreecommitdiff
path: root/stm32/unittest/scripts/tst_api_demod_setup
blob: 79d33ed19ddf370e3df49c25fdc85a26696be2dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
#
# tst_api_demod_setup
#
# Setup input and reference data for one of several versions of this test.

# Find the scripts directory
SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

# Setup common variables
source $SCRIPTS/run_tests_common.sh

# RUN_DIR - Directory where test will be run
RUN_DIR="${UNITTEST_BASE}/test_run/${FULL_TEST_NAME}"

# Call common setup function to make the directory
setup_common "${RUN_DIR}"

# Change to test directory
cd "${RUN_DIR}"


#####################################################################
## Test SETUP actions:

case "${TEST_OPT}" in

    700D_plain_test )
    	# Config is <mode>, <teswtframes> 
    	echo "71000010" > stm_cfg.txt
	#
        # Copy N frames of a raw audio file to stm_in.raw. 
        dd bs=1280 count=100 if=../../../../raw/hts1.raw of=spch_in.raw \
		> setup.log 2>&1
	freedv_tx 700D spch_in.raw stm_in.raw --testframes --txbpf 0 \
		>> setup.log 2>&1
	#
        # Reference
        freedv_rx 700D stm_in.raw ref_demod.raw -v --testframes \
		> ref_gen.log 2>&1
	;;

    700D_AWGN_test )
    	# Config is <mode>, <teswtframes> 
    	echo "71000010" > stm_cfg.txt
	#
        # Copy N frames of a raw audio file to stm_in.raw. 
        dd bs=1280 count=96 if=../../../../raw/hts1.raw of=spch_in.raw \
		> setup.log 2>&1
	freedv_tx 700D spch_in.raw mod_bits.raw --testframes --txbpf 0 \
		  >> setup.log 2>&1
	ch mod_bits.raw stm_in.raw --No -20 -f -5 2>&1 | tee setup.log
	
        # Reference: - When the OFDM modem initially syncs, it often
	#              has residual freq offset that causes abnormally
	#              high LDPC decoder bit errors forthe first few
	#              seconds.  This leads to a high coded BER being
	#              reported for short duration tests.  This
	#              settles down after a few seconds, and we get
	#              the expected coded BER when averaging over
	#              longer periods (e.g. 60s). However this
	#              particular test is necessarily short due to the
	#              slow speed of the semihosting system.  It is
	#              therefore sufficient to check that the
	#              performance is similar to the x86 C version,
	#              rather than expecting a low coded BER for a
	#              short run.
	
        freedv_rx 700D stm_in.raw ref_demod.raw -v --testframes  2>&1 --discard | tee ref_gen.log
	;;

    700D_AWGN_codec )
    	# Config is <mode>, <teswtframes> 
    	echo "70000020" > stm_cfg.txt
	#
        # Copy N frames of a raw audio file to stm_in.raw. 
        dd bs=1280 count=48 if=../../../../raw/hts1.raw of=spch_in.raw \
		> setup.log 2>&1
	freedv_tx 700D spch_in.raw mod_bits.raw --txbpf 0 \
		>> setup.log 2>&1
	#
        # Reference - give it a hard time with some noise to exercise the LDPC codec and get us to max CPU
	ch mod_bits.raw stm_in.raw --No -20 -f -5 2>&1 | tee setup.log
        freedv_rx 700D stm_in.raw ref_demod.raw -v \
		> ref_gen.log 2>&1
	;;

    700E_plain_test )
    	# Config is <mode>, <teswtframes> 
    	echo "81000010" > stm_cfg.txt
	#
        # Copy N frames of a raw audio file to stm_in.raw. 
        dd bs=1280 count=100 if=../../../../raw/hts1.raw of=spch_in.raw \
		> setup.log 2>&1
	freedv_tx 700E spch_in.raw stm_in.raw --testframes --txbpf 1 \
		>> setup.log 2>&1
	#
        # Reference
        freedv_rx 700E stm_in.raw ref_demod.raw -v --testframes \
		> ref_gen.log 2>&1
	;;

    700E_AWGN_test )
    	# Config is <mode>, <teswtframes> 
    	echo "81000010" > stm_cfg.txt
	#
        # Copy N frames of a raw audio file to stm_in.raw. 
        dd bs=1280 count=96 if=../../../../raw/hts1.raw of=spch_in.raw \
		> setup.log 2>&1
	freedv_tx 700E spch_in.raw mod_bits.raw --testframes --txbpf 1 \
		  >> setup.log 2>&1
	ch mod_bits.raw stm_in.raw --No -22 -f -5  2>&1 | tee setup.log
	
        freedv_rx 700E stm_in.raw ref_demod.raw -v --testframes  2>&1 --discard | tee ref_gen.log
	;;

    700E_AWGN_codec )
    	# Config is <mode>, <teswtframes> 
    	echo "80000020" > stm_cfg.txt
	#
        # Copy N frames of a raw audio file to stm_in.raw. 
        dd bs=1280 count=48 if=../../../../raw/hts1.raw of=spch_in.raw \
		> setup.log 2>&1
	freedv_tx 700E spch_in.raw mod_bits.raw --txbpf 1 \
		>> setup.log 2>&1
	#
        # Reference - give it a hard time with some noise to exercise the LDPC codec and get us to max CPU
	ch mod_bits.raw stm_in.raw --No -20 -f -5  2>&1 | tee setup.log
        freedv_rx 700E stm_in.raw ref_demod.raw -v \
		> ref_gen.log 2>&1
	;;

    1600_plain_codec )
    	# Config is <mode>, <teswtframes> 
    	echo "00000010" > stm_cfg.txt
	#
        # Copy N frames of a raw audio file to stm_in.raw. 
        dd bs=320 count=100 if=../../../../raw/hts1.raw of=spch_in.raw > setup.log 2>&1
	freedv_tx 1600 spch_in.raw stm_in.raw >> setup.log 2>&1
	#
        # Reference
        freedv_rx 1600 stm_in.raw ref_demod.raw -v \
		> ref_gen.log 2>&1
	;;
    
    *)
	printf "ERROR: invalid test option. Valid options are:\n  700[DE]_plain_test\n  700[DE]_AWGN_test\n  700[DE]_AWGN_codec\n  1600_plain_codec\n"
	exit 1
      	;;

    esac