Skip to content

Commit 925a8ed

Browse files
committed
--source option, which somehow was lost
1 parent acaed6b commit 925a8ed

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/freedv_data_raw_tx.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ int main(int argc, char *argv[]) {
5757
int Nbursts = 1, sequence_numbers = 0;
5858
int inter_burst_delay_ms = 0;
5959
int postdelay_ms = 0;
60-
60+
uint8_t source_byte = 0;
61+
6162
if (argc < 4) {
6263
helpmsg:
6364
fprintf(stderr, "\nusage: %s [options] FSK_LDPC|DATAC0|DATAC1|DATAC3 InputBinaryDataFile OutputModemRawFile\n"
@@ -71,6 +72,7 @@ int main(int argc, char *argv[]) {
7172
" --clip 0|1 clipping for reduced PAPR\n"
7273
" --txbpf 0|1 bandpass filter\n"
7374
" --seq send packet sequence numbers (breaks testframe BER counting)\n"
75+
" --source Byte insert a (non-zero) source address att byte[0]\n"
7476
" --complexout complex sample output (default real)\n"
7577
" --quiet\n"
7678
"\n"
@@ -109,13 +111,14 @@ int main(int argc, char *argv[]) {
109111
{"delay", required_argument, 0, 'j'},
110112
{"postdelay", required_argument, 0, 'k'},
111113
{"seq", no_argument, 0, 'd'},
114+
{"source", required_argument, 0, 'i'},
112115
{"amp", required_argument, 0, 'a'},
113116
{"quiet", no_argument, 0, 'q'},
114117
{"complexout", no_argument, 0, 'c'},
115118
{0, 0, 0, 0}
116119
};
117120

118-
o = getopt_long(argc,argv,"a:cdt:hb:l:e:f:g:r:1:s:m:q",long_opts,&opt_idx);
121+
o = getopt_long(argc,argv,"a:cdt:hb:l:e:f:g:r:1:s:m:qi:",long_opts,&opt_idx);
119122

120123
switch(o) {
121124
case 'a':
@@ -131,6 +134,10 @@ int main(int argc, char *argv[]) {
131134
case 'd':
132135
sequence_numbers = 1;
133136
break;
137+
case 'i':
138+
source_byte = strtol(optarg, NULL, 0);
139+
fprintf(stderr,"source byte: 0x%02x\n", source_byte);
140+
break;
134141
case 'e':
135142
burst_mode = 1;
136143
Nbursts = atoi(optarg);
@@ -280,7 +287,8 @@ int main(int argc, char *argv[]) {
280287
while(fread(bytes_in, sizeof(uint8_t), payload_bytes_per_modem_frame, fin) == payload_bytes_per_modem_frame) {
281288
if (testframes) {
282289
memcpy(bytes_in, testframe_bytes, bytes_per_modem_frame);
283-
if (sequence_numbers) bytes_in[0] = (frames+1) & 0xff;
290+
if (source_byte) bytes_in[0] = source_byte;
291+
if (sequence_numbers) bytes_in[1] = (frames+1) & 0xff;
284292
}
285293

286294
/* The raw data modes requires a CRC in the last two bytes. TODO: consider moving inside freedv_rawdatatx(),

0 commit comments

Comments
 (0)