Initial checkin for EOTD support.

This commit is contained in:
David E. Tiller 2022-03-18 14:30:32 -04:00
parent fe6cba2b0d
commit 709f229d83
4 changed files with 62 additions and 4 deletions

View File

@ -148,7 +148,7 @@ struct audio_s {
/* Could all be the same or different. */ /* 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. */ /* Usual AFSK. */
/* Baseband signal. Not used yet. */ /* Baseband signal. Not used yet. */

View File

@ -134,6 +134,7 @@ int demod_init (struct audio_s *pa)
case MODEM_AFSK: case MODEM_AFSK:
case MODEM_EAS: 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].modem_type == MODEM_EAS) {
if (save_audio_config_p->achan[chan].fix_bits != RETRY_NONE) { 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_AFSK:
case MODEM_EAS: case MODEM_EAS:
case MODEM_EOTD:
if (save_audio_config_p->achan[chan].decimate > 1) { 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); 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 || 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. */ /* For AFSK, we have mark and space amplitudes. */

View File

@ -438,6 +438,9 @@ int main (int argc, char *argv[])
else if (strcasecmp(optarg, "EAS") == 0) { else if (strcasecmp(optarg, "EAS") == 0) {
B_opt = 23456; // See special case below. B_opt = 23456; // See special case below.
} }
else if (strcasecmp(optarg, "EOTD") == 0) {
B_opt = 34567; // See special case below.
}
else { else {
B_opt = atoi(optarg); B_opt = atoi(optarg);
} }
@ -760,6 +763,13 @@ int main (int argc, char *argv[])
audio_config.achan[0].space_freq = 1563; // Actually 1562.5 - logic 0. 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)); strlcpy (audio_config.achan[0].profiles, "D", sizeof(audio_config.achan[0].profiles));
} }
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 { else {
audio_config.achan[0].modem_type = MODEM_SCRAMBLE; audio_config.achan[0].modem_type = MODEM_SCRAMBLE;
audio_config.achan[0].mark_freq = 0; audio_config.achan[0].mark_freq = 0;
@ -1463,6 +1473,7 @@ static void usage (char **argv)
dw_printf (" 9600 bps and up uses K9NG/G3RUH standard.\n"); dw_printf (" 9600 bps and up uses K9NG/G3RUH standard.\n");
dw_printf (" AIS for ship Automatic Identification System.\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 (" 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 (" -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 direwolf <= 1.5.\n");
dw_printf (" -J 2400 bps QPSK compatible with MFJ-2400.\n"); dw_printf (" -J 2400 bps QPSK compatible with MFJ-2400.\n");

View File

@ -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; 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. * 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) { if (actual_fcs == expected_fcs) {
alevel_t alevel = demod_get_audio_level (chan, subchan); 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 { else {
@ -802,6 +845,7 @@ int hdlc_rec_data_detect_any (int chan)
} /* end hdlc_rec_data_detect_any */ } /* end hdlc_rec_data_detect_any */
/* end hdlc_rec.c */ /* end hdlc_rec.c */