Skip to content

Commit 709f229

Browse files
committed
Initial checkin for EOTD support.
1 parent fe6cba2 commit 709f229

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

Diff for: src/audio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct audio_s {
148148
/* Could all be the same or different. */
149149

150150

151-
enum modem_t { MODEM_AFSK, MODEM_BASEBAND, MODEM_SCRAMBLE, MODEM_QPSK, MODEM_8PSK, MODEM_OFF, MODEM_16_QAM, MODEM_64_QAM, MODEM_AIS, MODEM_EAS } modem_type;
151+
enum modem_t { MODEM_AFSK, MODEM_BASEBAND, MODEM_SCRAMBLE, MODEM_QPSK, MODEM_8PSK, MODEM_OFF, MODEM_16_QAM, MODEM_64_QAM, MODEM_AIS, MODEM_EAS, MODEM_EOTD } modem_type;
152152

153153
/* Usual AFSK. */
154154
/* Baseband signal. Not used yet. */

Diff for: src/demod.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ int demod_init (struct audio_s *pa)
134134

135135
case MODEM_AFSK:
136136
case MODEM_EAS:
137+
case MODEM_EOTD: // TODO DET
137138

138139
if (save_audio_config_p->achan[chan].modem_type == MODEM_EAS) {
139140
if (save_audio_config_p->achan[chan].fix_bits != RETRY_NONE) {
@@ -969,6 +970,7 @@ void demod_process_sample (int chan, int subchan, int sam)
969970

970971
case MODEM_AFSK:
971972
case MODEM_EAS:
973+
case MODEM_EOTD:
972974

973975
if (save_audio_config_p->achan[chan].decimate > 1) {
974976

@@ -1086,7 +1088,8 @@ alevel_t demod_get_audio_level (int chan, int subchan)
10861088
alevel.rec = (int) (( D->alevel_rec_peak - D->alevel_rec_valley ) * 50.0f + 0.5f);
10871089

10881090
if (save_audio_config_p->achan[chan].modem_type == MODEM_AFSK ||
1089-
save_audio_config_p->achan[chan].modem_type == MODEM_EAS) {
1091+
save_audio_config_p->achan[chan].modem_type == MODEM_EAS ||
1092+
save_audio_config_p->achan[chan].modem_type == MODEM_EOTD) {
10901093

10911094
/* For AFSK, we have mark and space amplitudes. */
10921095

Diff for: src/direwolf.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ int main (int argc, char *argv[])
437437
}
438438
else if (strcasecmp(optarg, "EAS") == 0) {
439439
B_opt = 23456; // See special case below.
440+
}
441+
else if (strcasecmp(optarg, "EOTD") == 0) {
442+
B_opt = 34567; // See special case below.
440443
}
441444
else {
442445
B_opt = atoi(optarg);
@@ -760,7 +763,14 @@ int main (int argc, char *argv[])
760763
audio_config.achan[0].space_freq = 1563; // Actually 1562.5 - logic 0.
761764
strlcpy (audio_config.achan[0].profiles, "D", sizeof(audio_config.achan[0].profiles));
762765
}
763-
else {
766+
else if (audio_config.achan[0].baud == 34567) {
767+
audio_config.achan[0].modem_type = MODEM_EOTD;
768+
audio_config.achan[0].baud = 1200;
769+
audio_config.achan[0].mark_freq = 1200;
770+
audio_config.achan[0].space_freq = 1800;
771+
strlcpy (audio_config.achan[0].profiles, "D", sizeof(audio_config.achan[0].profiles));
772+
}
773+
else {
764774
audio_config.achan[0].modem_type = MODEM_SCRAMBLE;
765775
audio_config.achan[0].mark_freq = 0;
766776
audio_config.achan[0].space_freq = 0;
@@ -1463,6 +1473,7 @@ static void usage (char **argv)
14631473
dw_printf (" 9600 bps and up uses K9NG/G3RUH standard.\n");
14641474
dw_printf (" AIS for ship Automatic Identification System.\n");
14651475
dw_printf (" EAS for Emergency Alert System (EAS) Specific Area Message Encoding (SAME).\n");
1476+
dw_printf (" EOTD for End-of-train devices.\n");
14661477
dw_printf (" -g Force G3RUH modem regardless of speed.\n");
14671478
dw_printf (" -j 2400 bps QPSK compatible with direwolf <= 1.5.\n");
14681479
dw_printf (" -J 2400 bps QPSK compatible with MFJ-2400.\n");

Diff for: src/hdlc_rec.c

+45-1
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,42 @@ a good modem here and providing a result when it is received.
399399
400400
*/
401401

402+
/***********************************************************************************
403+
*
404+
* Name: eotd_rec_bit
405+
*
406+
* Purpose: Extract EOTD trasmissions from a stream of bits.
407+
*
408+
* Inputs: chan - Channel number.
409+
*
410+
* subchan - This allows multiple demodulators per channel.
411+
*
412+
* slice - Allows multiple slicers per demodulator (subchannel).
413+
*
414+
* raw - One bit from the demodulator.
415+
* should be 0 or 1.
416+
*
417+
* future_use - Not implemented yet. PSK already provides it.
418+
*
419+
*
420+
* Description: This is called once for each received bit.
421+
* For each valid transmission, process_rec_frame()
422+
* is called for further processing.
423+
*
424+
***********************************************************************************/
425+
426+
427+
static void eotd_rec_bit (int chan, int subchan, int slice, int raw, int future_use)
428+
{
429+
struct hdlc_state_s *H;
430+
431+
/*
432+
* Different state information for each channel / subchannel / slice.
433+
*/
434+
H = &hdlc_state[chan][subchan][slice];
435+
fprintf(stderr, "chan=%d subchan=%d slice=%d raw=%d\n", chan, subchan, slice, raw);
436+
return;
437+
} // end eotd_rec_bit
402438

403439
/***********************************************************************************
404440
*
@@ -463,6 +499,13 @@ void hdlc_rec_bit (int chan, int subchan, int slice, int raw, int is_scrambled,
463499
return;
464500
}
465501

502+
// EOTD does not use HDLC.
503+
504+
if (g_audio_p->achan[chan].modem_type == MODEM_EOTD) {
505+
eotd_rec_bit (chan, subchan, slice, raw, not_used_remove);
506+
return;
507+
}
508+
466509
/*
467510
* Different state information for each channel / subchannel / slice.
468511
*/
@@ -564,7 +607,7 @@ void hdlc_rec_bit (int chan, int subchan, int slice, int raw, int is_scrambled,
564607
if (actual_fcs == expected_fcs) {
565608
alevel_t alevel = demod_get_audio_level (chan, subchan);
566609

567-
multi_modem_process_rec_frame (chan, subchan, slice, H->frame_buf, H->frame_len - 2, alevel, RETRY_NONE, 0); /* len-2 to remove FCS. */
610+
:ulti_modem_process_rec_frame (chan, subchan, slice, H->frame_buf, H->frame_len - 2, alevel, RETRY_NONE, 0); /* len-2 to remove FCS. */
568611
}
569612
else {
570613

@@ -802,6 +845,7 @@ int hdlc_rec_data_detect_any (int chan)
802845

803846
} /* end hdlc_rec_data_detect_any */
804847

848+
805849
/* end hdlc_rec.c */
806850

807851

0 commit comments

Comments
 (0)