diff --git a/src/audio.h b/src/audio.h index 61dec9d..786d27a 100644 --- a/src/audio.h +++ b/src/audio.h @@ -148,7 +148,7 @@ struct audio_s { /* Could all be the same or different. */ - 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; + 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; /* Usual AFSK. */ /* Baseband signal. Not used yet. */ diff --git a/src/demod.c b/src/demod.c index 281367b..ddf3a13 100644 --- a/src/demod.c +++ b/src/demod.c @@ -134,6 +134,7 @@ int demod_init (struct audio_s *pa) case MODEM_AFSK: case MODEM_EAS: + case MODEM_EOTD: // TODO DET if (save_audio_config_p->achan[chan].modem_type == MODEM_EAS) { 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) case MODEM_AFSK: case MODEM_EAS: + case MODEM_EOTD: if (save_audio_config_p->achan[chan].decimate > 1) { @@ -1086,7 +1088,8 @@ alevel_t demod_get_audio_level (int chan, int subchan) alevel.rec = (int) (( D->alevel_rec_peak - D->alevel_rec_valley ) * 50.0f + 0.5f); if (save_audio_config_p->achan[chan].modem_type == MODEM_AFSK || - save_audio_config_p->achan[chan].modem_type == MODEM_EAS) { + save_audio_config_p->achan[chan].modem_type == MODEM_EAS || + save_audio_config_p->achan[chan].modem_type == MODEM_EOTD) { /* For AFSK, we have mark and space amplitudes. */ diff --git a/src/direwolf.c b/src/direwolf.c index 456b16f..40b3d51 100644 --- a/src/direwolf.c +++ b/src/direwolf.c @@ -437,6 +437,9 @@ int main (int argc, char *argv[]) } else if (strcasecmp(optarg, "EAS") == 0) { B_opt = 23456; // See special case below. + } + else if (strcasecmp(optarg, "EOTD") == 0) { + B_opt = 34567; // See special case below. } else { B_opt = atoi(optarg); @@ -760,7 +763,14 @@ int main (int argc, char *argv[]) audio_config.achan[0].space_freq = 1563; // Actually 1562.5 - logic 0. strlcpy (audio_config.achan[0].profiles, "D", sizeof(audio_config.achan[0].profiles)); } - else { + else if (audio_config.achan[0].baud == 34567) { + audio_config.achan[0].modem_type = MODEM_EOTD; + audio_config.achan[0].baud = 1200; + audio_config.achan[0].mark_freq = 1200; + audio_config.achan[0].space_freq = 1800; + strlcpy (audio_config.achan[0].profiles, "D", sizeof(audio_config.achan[0].profiles)); + } + else { audio_config.achan[0].modem_type = MODEM_SCRAMBLE; audio_config.achan[0].mark_freq = 0; audio_config.achan[0].space_freq = 0; @@ -1463,6 +1473,7 @@ static void usage (char **argv) dw_printf (" 9600 bps and up uses K9NG/G3RUH standard.\n"); dw_printf (" AIS for ship Automatic Identification System.\n"); dw_printf (" EAS for Emergency Alert System (EAS) Specific Area Message Encoding (SAME).\n"); + dw_printf (" EOTD for End-of-train devices.\n"); dw_printf (" -g Force G3RUH modem regardless of speed.\n"); dw_printf (" -j 2400 bps QPSK compatible with direwolf <= 1.5.\n"); dw_printf (" -J 2400 bps QPSK compatible with MFJ-2400.\n"); diff --git a/src/hdlc_rec.c b/src/hdlc_rec.c index 6b395be..6db809c 100644 --- a/src/hdlc_rec.c +++ b/src/hdlc_rec.c @@ -399,6 +399,42 @@ a good modem here and providing a result when it is received. */ +/*********************************************************************************** + * + * Name: eotd_rec_bit + * + * Purpose: Extract EOTD trasmissions from a stream of bits. + * + * Inputs: chan - Channel number. + * + * subchan - This allows multiple demodulators per channel. + * + * slice - Allows multiple slicers per demodulator (subchannel). + * + * raw - One bit from the demodulator. + * should be 0 or 1. + * + * future_use - Not implemented yet. PSK already provides it. + * + * + * Description: This is called once for each received bit. + * For each valid transmission, process_rec_frame() + * is called for further processing. + * + ***********************************************************************************/ + + +static void eotd_rec_bit (int chan, int subchan, int slice, int raw, int future_use) +{ + struct hdlc_state_s *H; + +/* + * Different state information for each channel / subchannel / slice. + */ + H = &hdlc_state[chan][subchan][slice]; +fprintf(stderr, "chan=%d subchan=%d slice=%d raw=%d\n", chan, subchan, slice, raw); + return; +} // end eotd_rec_bit /*********************************************************************************** * @@ -463,6 +499,13 @@ void hdlc_rec_bit (int chan, int subchan, int slice, int raw, int is_scrambled, return; } +// EOTD does not use HDLC. + + if (g_audio_p->achan[chan].modem_type == MODEM_EOTD) { + eotd_rec_bit (chan, subchan, slice, raw, not_used_remove); + return; + } + /* * Different state information for each channel / subchannel / slice. */ @@ -564,7 +607,7 @@ void hdlc_rec_bit (int chan, int subchan, int slice, int raw, int is_scrambled, if (actual_fcs == expected_fcs) { alevel_t alevel = demod_get_audio_level (chan, subchan); - multi_modem_process_rec_frame (chan, subchan, slice, H->frame_buf, H->frame_len - 2, alevel, RETRY_NONE, 0); /* len-2 to remove FCS. */ + :ulti_modem_process_rec_frame (chan, subchan, slice, H->frame_buf, H->frame_len - 2, alevel, RETRY_NONE, 0); /* len-2 to remove FCS. */ } else { @@ -802,6 +845,7 @@ int hdlc_rec_data_detect_any (int chan) } /* end hdlc_rec_data_detect_any */ + /* end hdlc_rec.c */