From b2311e5a967e09e5b293578bb596c83c50af536d Mon Sep 17 00:00:00 2001 From: drowe67 Date: Sat, 4 May 2024 07:16:26 +0930 Subject: [PATCH] custom config debugging: dump ofdm config from a FreeDV API function --- src/freedv_api.c | 4 ++++ src/freedv_api.h | 3 +++ src/freedv_data_raw_tx.c | 5 +++++ src/ofdm.c | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/src/freedv_api.c b/src/freedv_api.c index d04dd7c8..3c812cac 100644 --- a/src/freedv_api.c +++ b/src/freedv_api.c @@ -1626,3 +1626,7 @@ unsigned short freedv_gen_crc16(unsigned char *data_p, int length) { return crc; } + +void freedv_ofdm_print_info(struct freedv *freedv) { + ofdm_print_info(freedv->ofdm); +} diff --git a/src/freedv_api.h b/src/freedv_api.h index 9f72c8f9..0ca80ce1 100644 --- a/src/freedv_api.h +++ b/src/freedv_api.h @@ -341,6 +341,9 @@ int freedv_get_bits_per_modem_frame(struct freedv *freedv); int freedv_get_sz_error_pattern(struct freedv *freedv); int freedv_get_protocol_bits(struct freedv *freedv); +// dump OFDM modem config +void freedv_ofdm_print_info(struct freedv *freedv); + #ifdef __cplusplus } #endif diff --git a/src/freedv_data_raw_tx.c b/src/freedv_data_raw_tx.c index ce5da562..7fa1e842 100644 --- a/src/freedv_data_raw_tx.c +++ b/src/freedv_data_raw_tx.c @@ -278,8 +278,13 @@ int main(int argc, char *argv[]) { memcpy(ofdm_config.tx_uw, uw, sizeof(uw)); memcpy(&ofdm_config.tx_uw[ofdm_config.nuwbits - sizeof(uw)], uw, sizeof(uw)); + /* set up a trivial Tx band pass filter as a demo */ + static float tx_bpf[] = {1.0, 1.0, 1.0}; + ofdm_config.tx_bpf_proto = tx_bpf; + ofdm_config.tx_bpf_proto_n = 3; adv.config = (void *)&ofdm_config; freedv = freedv_open_advanced(mode, &adv); + freedv_ofdm_print_info(freedv); } else { freedv = freedv_open(mode); } diff --git a/src/ofdm.c b/src/ofdm.c index 8d7a6dfc..953179fe 100644 --- a/src/ofdm.c +++ b/src/ofdm.c @@ -2669,6 +2669,11 @@ void ofdm_print_info(struct OFDM *ofdm) { ofdm->phase_est_en ? "true" : "false"); fprintf(stderr, "ofdm->tx_bpf_en = %s\n", ofdm->tx_bpf_en ? "true" : "false"); fprintf(stderr, "ofdm->rx_bpf_en = %s\n", ofdm->rx_bpf_en ? "true" : "false"); + fprintf(stderr, "ofdm->tx_bpf_proto_n = %d\n", ofdm->tx_bpf_proto_n); + fprintf(stderr, "ofdm->tx_bpf_proto:\n"); + for (int i = 0; i < ofdm->tx_bpf_proto_n; i++) + fprintf(stderr, "%f\t", ofdm->tx_bpf_proto[i]); + fprintf(stderr, "\n"); fprintf(stderr, "ofdm->dpsk_en = %s\n", ofdm->dpsk_en ? "true" : "false"); fprintf(stderr, "ofdm->phase_est_bandwidth_mode = %s\n", phase_est_bandwidth_mode[ofdm->phase_est_bandwidth_mode]);