From c6f2e63ccb32c1cb4ab914acd945ab08688f6db7 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Tue, 17 Apr 2018 20:27:51 +0000 Subject: [PATCH] rename sync states for more compact logging git-svn-id: https://svn.code.sf.net/p/freetel/code@3497 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/octave/ofdm_ldpc_rx.m | 8 ++++---- codec2-dev/octave/ofdm_lib.m | 14 +++++++------- codec2-dev/src/ofdm.c | 24 ++++++++++++------------ codec2-dev/src/ofdm_demod.c | 8 ++++---- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/codec2-dev/octave/ofdm_ldpc_rx.m b/codec2-dev/octave/ofdm_ldpc_rx.m index 17b4c975..1e4a4745 100644 --- a/codec2-dev/octave/ofdm_ldpc_rx.m +++ b/codec2-dev/octave/ofdm_ldpc_rx.m @@ -121,11 +121,11 @@ function ofdm_ldpc_rx(filename, interleave_frames = 1, error_pattern_filename) % state machine(s) for modem and interleaver sync ------------------------------------ - if strcmp(states.sync_state,'searching') + if strcmp(states.sync_state,'search') [timing_valid states] = ofdm_sync_search(states, rxbuf_in); end - if strcmp(states.sync_state,'synced') || strcmp(states.sync_state,'trial_sync') + if strcmp(states.sync_state,'synced') || strcmp(states.sync_state,'trial') [rx_bits states aphase_est_pilot_log arx_np arx_amp] = ofdm_demod(states, rxbuf_in); rx_uw = rx_bits(1:states.Nuwbits); @@ -157,7 +157,7 @@ function ofdm_ldpc_rx(filename, interleave_frames = 1, error_pattern_filename) next_sync_state_interleaver = states.sync_state_interleaver; - if strcmp(states.sync_state_interleaver,'searching') + if strcmp(states.sync_state_interleaver,'search') st = 1; en = Ncodedbitsperframe/bps; [rx_codeword parity_checks] = ldpc_dec(code_param, max_iterations, demod_type, decoder_type, rx_np_de(st:en), min(EsNo,30), rx_amp_de(st:en)); Nerrs = code_param.data_bits_per_frame - max(parity_checks); @@ -238,7 +238,7 @@ function ofdm_ldpc_rx(filename, interleave_frames = 1, error_pattern_filename) if states.verbose r = mod(states.frame_count_interleaver, interleave_frames)+1; - printf("f: %2d st: %-10s uw_errs: %2d %1d inter_st: %-10s inter_fr: %2d Nerrs_raw: %3d Nerrs_coded: %3d foff: %4.1f\n", + printf("f: %3d st: %-6s uw_errs: %2d %1d inter_st: %-6s inter_fr: %2d Nerrs_raw: %3d Nerrs_coded: %3d foff: %4.1f\n", f, states.last_sync_state, states.uw_errors, states.sync_counter, states.last_sync_state_interleaver, states.frame_count_interleaver, Nerrs_raw(r), Nerrs_coded(r), states.foff_est_hz); end diff --git a/codec2-dev/octave/ofdm_lib.m b/codec2-dev/octave/ofdm_lib.m index 8a0ad22c..89587ab3 100644 --- a/codec2-dev/octave/ofdm_lib.m +++ b/codec2-dev/octave/ofdm_lib.m @@ -195,13 +195,13 @@ function states = ofdm_init(bps, Rs, Tcp, Ns, Nc) % sync state machine - states.sync_state = states.last_sync_state = 'searching'; + states.sync_state = states.last_sync_state = 'search'; states.uw_errors = 0; states.sync_counter = 0; states.frame_count = 0; states.sync_start = 0; states.sync_end = 0; - states.sync_state_interleaver = 'searching'; + states.sync_state_interleaver = 'search'; states.frame_count_interleaver = 0; % LDPC code is optionally enabled @@ -602,7 +602,7 @@ function states = sync_state_machine(states, rx_uw) next_state = states.sync_state; states.sync_start = states.sync_end = 0; - if strcmp(states.sync_state,'searching') + if strcmp(states.sync_state,'search') if states.timing_valid @@ -618,11 +618,11 @@ function states = sync_state_machine(states, rx_uw) states.frame_count = 0; states.sync_counter = 0; states.sync_start = 1; - next_state = 'trial_sync'; + next_state = 'trial'; end end - if strcmp(states.sync_state,'synced') || strcmp(states.sync_state,'trial_sync') + if strcmp(states.sync_state,'synced') || strcmp(states.sync_state,'trial') states.frame_count++; states.frame_count_interleaver++; @@ -650,8 +650,8 @@ function states = sync_state_machine(states, rx_uw) if (states.uw_errors > uw_thresh) states.sync_counter++; if states.sync_counter == sync_counter_thresh - next_state = 'searching'; - states.sync_state_interleaver = 'searching'; + next_state = 'search'; + states.sync_state_interleaver = 'search'; end else states.sync_counter = 0; diff --git a/codec2-dev/src/ofdm.c b/codec2-dev/src/ofdm.c index c92bc7bf..12f13dc3 100644 --- a/codec2-dev/src/ofdm.c +++ b/codec2-dev/src/ofdm.c @@ -385,16 +385,16 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) { /* sync state machine */ - strcpy(ofdm->sync_state,"searching"); - strcpy(ofdm->last_sync_state,"searching"); + strcpy(ofdm->sync_state,"search"); + strcpy(ofdm->last_sync_state,"search"); ofdm->uw_errors = 0; ofdm->sync_counter = 0; ofdm->frame_count = 0; ofdm->sync_start = 0; ofdm->sync_end = 0; - strcpy(ofdm->sync_state_interleaver,"searching"); - strcpy(ofdm->last_sync_state_interleaver,"searching"); + strcpy(ofdm->sync_state_interleaver,"search"); + strcpy(ofdm->last_sync_state_interleaver,"search"); ofdm->frame_count_interleaver = 0; /* create the OFDM waveform */ @@ -964,7 +964,7 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) { strcpy(next_state, ofdm->sync_state); ofdm->sync_start = ofdm->sync_end = 0; - if (strcmp(ofdm->sync_state,"searching") == 0) { + if (strcmp(ofdm->sync_state,"search") == 0) { if (ofdm->timing_valid) { @@ -989,11 +989,11 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) { ofdm->frame_count = 0; ofdm->sync_counter = 0; ofdm->sync_start = 1; - strcpy(next_state, "trial_sync"); + strcpy(next_state, "trial"); } } - if (!strcmp(ofdm->sync_state,"synced") || !strcmp(ofdm->sync_state, "trial_sync")) { + if (!strcmp(ofdm->sync_state,"synced") || !strcmp(ofdm->sync_state, "trial")) { ofdm->frame_count++; ofdm->frame_count_interleaver++; @@ -1011,7 +1011,7 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) { for 3 consecutive frames with low error rate to confirm sync */ - if (!strcmp(ofdm->sync_state, "trial_sync")) { + if (!strcmp(ofdm->sync_state, "trial")) { if (ofdm->uw_errors > 1) { /* if we exceed thresh stay in trial sync */ ofdm->sync_counter++; @@ -1019,8 +1019,8 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) { } if (ofdm->sync_counter == 2) { /* if we get two bad frames drop sync and start again */ - strcpy(next_state, "searching"); - strcpy(ofdm->sync_state_interleaver, "searching"); + strcpy(next_state, "search"); + strcpy(ofdm->sync_state_interleaver, "search"); } if (ofdm->frame_count == 4) { @@ -1040,8 +1040,8 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) { if (ofdm->sync_counter == 6) { /* run of consective bad frames ... drop sync */ - strcpy(next_state, "searching"); - strcpy(ofdm->sync_state_interleaver, "searching"); + strcpy(next_state, "search"); + strcpy(ofdm->sync_state_interleaver, "search"); } } } diff --git a/codec2-dev/src/ofdm_demod.c b/codec2-dev/src/ofdm_demod.c index 10907a7b..ad651c4a 100644 --- a/codec2-dev/src/ofdm_demod.c +++ b/codec2-dev/src/ofdm_demod.c @@ -226,11 +226,11 @@ int main(int argc, char *argv[]) rxbuf_in[i].imag = 0.0; } - if (strcmp(ofdm->sync_state,"searching") == 0) { + if (strcmp(ofdm->sync_state,"search") == 0) { ofdm_sync_search(ofdm, rxbuf_in); } - if ((strcmp(ofdm->sync_state,"synced") == 0) || (strcmp(ofdm->sync_state,"trial_sync") == 0) ) { + if ((strcmp(ofdm->sync_state,"synced") == 0) || (strcmp(ofdm->sync_state,"trial") == 0) ) { ofdm_demod(ofdm, rx_bits, rxbuf_in); if (llr_en) { @@ -277,7 +277,7 @@ int main(int argc, char *argv[]) char next_sync_state_interleaver[OFDM_STATE_STR]; strcpy(next_sync_state_interleaver, ofdm->sync_state_interleaver); - if (strcmp(ofdm->sync_state_interleaver,"searching") == 0) { + if (strcmp(ofdm->sync_state_interleaver,"search") == 0) { symbols_to_llrs(llr, codeword_symbols_de, codeword_amps_de, EsNo, CODED_SYMSPERFRAME); iter = run_ldpc_decoder(&ldpc, out_char, llr, &parityCheckCount); Nerrs = DATA_BITSPERFRAME - parityCheckCount; @@ -398,7 +398,7 @@ int main(int argc, char *argv[]) if (ofdm->verbose) { int r = ofdm->frame_count_interleaver % interleave_frames; - fprintf(stderr, "f: %2d st: %-10s uw_errs: %2d %1d inter_st: %-10s inter_fr: %2d Nerrs_raw: %3d Nerrs_coded: %3d foff: %4.1f", + fprintf(stderr, "f: %3d st: %-6s uw_errs: %2d %1d inter_st: %-6s inter_fr: %2d Nerrs_raw: %3d Nerrs_coded: %3d foff: %4.1f", f, ofdm->last_sync_state, ofdm->uw_errors, ofdm->sync_counter, ofdm->last_sync_state_interleaver, ofdm->frame_count_interleaver, Nerrs_raw[r], Nerrs_coded[r], ofdm->foff_est_hz); -- 2.25.1