HFDL: work with 3-channel/20.25 kHz mode Kiwis

pull/561/head
jks-prv 2021-11-17 10:43:15 +13:00
parent ff716575bb
commit bae5247d77
15 changed files with 24 additions and 34 deletions

View File

@ -173,9 +173,7 @@ static void dumphfdl_task(void *param)
int rx_chan = (int) FROM_VOID_PARAM(param);
hfdl_chan_t *e = &hfdl_chan[rx_chan];
//real_printf("dumphfdl_task START ----------------------------------------------\n");
dumphfdl_main(ARRAY_LEN(hfdl_argv), (char **) hfdl_argv, rx_chan);
//real_printf("dumphfdl_task EXIT ==============================================\n");
dumphfdl_main(ARRAY_LEN(hfdl_argv), (char **) hfdl_argv, rx_chan, e->outputBlockSize * NIQ);
e->dumphfdl_tid = 0;
}
@ -206,7 +204,7 @@ bool hfdl_msgs(char *msg, int rx_chan)
ext_register_receive_iq_samps_task(e->tid, rx_chan, POST_AGC);
e->outputBlockSize = e->CHFDLResample.setup(HFDL_TEST_FILE_RATE, HFDL_OUTBUF_SIZE);
e->outputBlockSize = e->CHFDLResample.setup(snd_rate, HFDL_OUTBUF_SIZE);
if (!e->dumphfdl_tid)
e->dumphfdl_tid = CreateTaskF(dumphfdl_task, TO_VOID_PARAM(rx_chan), EXT_PRIORITY, CTF_RX_CHANNEL | (rx_chan & CTF_CHANNEL));
@ -261,10 +259,6 @@ bool hfdl_msgs(char *msg, int rx_chan)
if (test) {
// misuse ext_register_receive_iq_samps() to pushback audio samples from the test file
ext_register_receive_iq_samps(hfdl_pushback_file_data, rx_chan, PRE_AGC);
//e->outputBlockSize = e->CHFDLResample.setup(HFDL_TEST_FILE_RATE, HFDL_OUTBUF_SIZE);
//if (!e->dumphfdl_tid)
// e->dumphfdl_tid = CreateTaskF(dumphfdl_task, TO_VOID_PARAM(rx_chan), EXT_PRIORITY, CTF_RX_CHANNEL | (rx_chan & CTF_CHANNEL));
e->test = true;
} else {
e->test = false;

View File

@ -15,10 +15,9 @@
#include <sys/mman.h>
#define HFDL_TEST_FILE_RATE 12000
// use of MIN_SND_RATE here gives the largest possible buffer needed
#define HFDL_OUTBUF_SIZE FASTFIR_OUTBUF_SIZE
#define HFDL_RESAMPLE_RATIO (HFDL_MIN_SRATE / HFDL_TEST_FILE_RATE)
#define HFDL_N_SAMPS (HFDL_OUTBUF_SIZE * HFDL_RESAMPLE_RATIO * NIQ)
#define HFDL_N_SAMPS ((((HFDL_OUTBUF_SIZE * HFDL_MIN_SRATE) / MIN_SND_RATE) + 1) * NIQ)
typedef struct {
u4_t nom_rate;
@ -54,7 +53,7 @@ typedef struct {
// server => dumphfdl
C_LINKAGE(void dumphfdl_init());
C_LINKAGE(int dumphfdl_main(int argc, char **argv, int rx_chan));
C_LINKAGE(int dumphfdl_main(int argc, char **argv, int rx_chan, int outputBlockSize));
C_LINKAGE(void dumphfdl_set_freq(int rx_chan, double freq_kHz));
// dumphfdl => server

View File

@ -16,12 +16,13 @@ hfdl_t *hfdl_f()
return (hfdl_t *) FROM_VOID_PARAM(TaskGetUserParam());
}
void instance_init(uint32_t rx_chan)
void instance_init(uint32_t rx_chan, int outputBlockSize)
{
TaskSetUserParam(TO_VOID_PARAM(&hfdl_d[rx_chan]));
//printf("rx_chan=%d hfdl=%p/%p\n", rx_chan, &hfdl_d[rx_chan], hfdl);
memset(hfdl, 0, sizeof(hfdl_t));
hfdl->rx_chan = rx_chan;
hfdl->outputBlockSize = outputBlockSize;
}
void dumphfdl_set_freq(int rx_chan, double freq_kHz)

View File

@ -45,13 +45,14 @@ struct dumphfdl_config {
#define AC_cache_lock() do { pthr_mutex_lock(&hfdl->AC_cache_lock); } while(0)
#define AC_cache_unlock() do { pthr_mutex_unlock(&hfdl->AC_cache_lock); } while(0)
void instance_init(uint32_t rx_chan);
void instance_init(uint32_t rx_chan, int outputBlockSize);
// reentrancy
typedef struct {
int32_t rx_chan;
int outputBlockSize;
double freq_kHz;
struct dumphfdl_config Config;

View File

@ -317,7 +317,7 @@ void dumphfdl_init()
hfdl_init_globals();
}
int32_t dumphfdl_main(int32_t argc, char **argv, int rx_chan) {
int32_t dumphfdl_main(int32_t argc, char **argv, int rx_chan, int outputBlockSize) {
#define OPT_VERSION 1
#define OPT_HELP 2
@ -410,7 +410,7 @@ int32_t dumphfdl_main(int32_t argc, char **argv, int rx_chan) {
{ 0, 0, 0, 0 }
};
instance_init(rx_chan);
instance_init(rx_chan, outputBlockSize);
pthr_mutex_init("Systable_lock", &hfdl->Systable_lock, NULL);
pthr_mutex_init("AC_cache_lock", &hfdl->AC_cache_lock, NULL);

View File

@ -14,8 +14,8 @@
#include <fcntl.h>
#include "kiwi-hfdl.h"
#define buf_BUFSIZE (HFDL_N_SAMPS * sizeof(float))
//#define buf_BUFSIZE (HFDL_N_SAMPS * sizeof(uint16_t))
#define buf_BUFSIZE (hfdl->outputBlockSize * sizeof(float))
//#define buf_BUFSIZE (hfdl->outputBlockSize * sizeof(uint16_t))
struct buf_input {
struct input input;

View File

@ -11,15 +11,6 @@ extern "C" {
#define STRINGIFY(x) #x
#define FASTFIR_OUTBUF_SIZE 512
#define NIQ 2
#define HFDL_TEST_FILE_RATE 12000
#define HFDL_MIN_SRATE (18000*2)
#define HFDL_OUTBUF_SIZE FASTFIR_OUTBUF_SIZE
#define HFDL_RESAMPLE_RATIO (HFDL_MIN_SRATE / HFDL_TEST_FILE_RATE)
#define HFDL_N_SAMPS (HFDL_OUTBUF_SIZE * HFDL_RESAMPLE_RATIO * NIQ)
bool hfdl_msgs(char *msg, int rx_chan);
int ext_send_msg_encoded(int rx_chan, bool debug, const char *dst, const char *cmd, const char *fmt, ...);

View File

@ -99,6 +99,8 @@
DEFp RX2_STD_DECIM 11 // 505*11 = 5555, 66.6666M/5555 = 12001.188 Hz
DEFp MAX_SND_RATE 20250
DEFp MIN_SND_RATE 12000
DEFp SND_RATE_3CH 20250
DEFp SND_RATE_4CH 12000
DEFp SND_RATE_8CH 12000

View File

@ -64,6 +64,8 @@
`define DEF_RX2_STD_DECIM
localparam MAX_SND_RATE = 20250; // DEFp 0x4f1a
`define DEF_MAX_SND_RATE
localparam MIN_SND_RATE = 12000; // DEFp 0x2ee0
`define DEF_MIN_SND_RATE
localparam SND_RATE_3CH = 20250; // DEFp 0x4f1a
`define DEF_SND_RATE_3CH
localparam SND_RATE_4CH = 12000; // DEFp 0x2ee0

View File

@ -302,8 +302,8 @@ function ale_2g_controls_setup()
w3_button('w3-padding-smaller', 'Prev', 'w3_select_next_prev_cb', { dir:w3_MENU_PREV, id:'ale.menu', isNumeric:true, func:'ale_2g_np_pre_select_cb' }),
w3_button('id-ale_2g-scan-button w3-padding-smaller w3-green', 'Scan', 'ale_2g_scan_button_cb'),
w3_button('id-ale_2g-clear-button w3-padding-smaller w3-css-yellow', 'Clear', 'ale_2g_clear_button_cb'),
w3_button('id-button-log w3-padding-smaller w3-purple', 'Log', 'ale_2g_log_cb'),
w3_button('id-button-test w3-padding-smaller w3-aqua', 'Test', 'ale_2g_test_cb', 1),
w3_button('id-ale_2g-log w3-padding-smaller w3-purple', 'Log', 'ale_2g_log_cb'),
w3_button('id-ale_2g-test w3-padding-smaller w3-aqua', 'Test', 'ale_2g_test_cb', 1),
w3_div('id-ale_2g-bar-container w3-progress-container w3-round-large w3-white w3-hide|width:70px; height:16px',
w3_div('id-ale_2g-bar w3-progressbar w3-round-large w3-light-green|width:0%', '&nbsp;')
),
@ -337,7 +337,7 @@ function ale_2g_controls_setup()
// our sample file is 12k only
if (ext_nom_sample_rate() != 12000)
w3_add('id-button-test', 'w3-disabled');
w3_add('id-ale_2g-test', 'w3-disabled');
w3_do_when_rendered('id-ale_2g-menus', function() {
ext_send('SET reset');

File diff suppressed because one or more lines are too long

View File

@ -235,7 +235,7 @@ function hfdl_controls_setup()
w3_button('w3-padding-smaller', 'Next', 'w3_select_next_prev_cb', { dir:w3_MENU_NEXT, id:'hfdl.menu', isNumeric:true, func:'hfdl_np_pre_select_cb' }),
w3_button('w3-padding-smaller', 'Prev', 'w3_select_next_prev_cb', { dir:w3_MENU_PREV, id:'hfdl.menu', isNumeric:true, func:'hfdl_np_pre_select_cb' }),
w3_button('id-hfdl-clear-button w3-padding-smaller w3-css-yellow', 'Clear', 'hfdl_clear_button_cb'),
w3_button('id-button-test w3-padding-smaller w3-aqua', 'Test', 'hfdl_test_cb', 1),
w3_button('id-id-hfdl-test w3-padding-smaller w3-aqua', 'Test', 'hfdl_test_cb', 1),
w3_div('id-hfdl-bar-container w3-progress-container w3-round-large w3-white w3-hide|width:70px; height:16px',
w3_div('id-hfdl-bar w3-progressbar w3-round-large w3-light-green|width:0%', '&nbsp;')
),
@ -260,7 +260,7 @@ function hfdl_controls_setup()
// our sample file is 12k only
if (ext_nom_sample_rate() != 12000)
w3_add('id-button-test', 'w3-disabled');
w3_add('id-hfdl-test', 'w3-disabled');
w3_do_when_rendered('id-hfdl-menus', function() {
ext_send('SET reset');

File diff suppressed because one or more lines are too long

Binary file not shown.