Unify and streamline Icom backend logic for freq/mode and split commands. Allow use of targeted freq/mode whenever possible. Move certain Icom-specific caps to the icom_priv_caps struct to remove rig-specific conditions in generic backend code.

pull/1481/head
Mikael Nousiainen 2023-11-09 09:57:23 +02:00
rodzic 0ece468b49
commit c90c675add
18 zmienionych plików z 906 dodań i 1067 usunięć

Wyświetl plik

@ -426,7 +426,6 @@ typedef enum {
typedef enum {
RIG_SPLIT_OFF = 0, /*!< Split mode disabled */
RIG_SPLIT_ON, /*!< Split mode enabled */
RIG_SPLIT_SIMPLEX = 0x10, /*< Split mode simples for ID-5100 */
} split_t;

Wyświetl plik

@ -200,7 +200,14 @@ static const struct icom_priv_caps ic7100_priv_caps =
},
.extcmds = ic7100_extcmds,
.antack_len = 2,
.ant_count = 2
.ant_count = 2,
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
// if hour < 0 then only date will be set
@ -371,7 +378,7 @@ const struct rig_caps ic7100_caps =
.max_ifshift = Hz(0),
.agc_level_count = 3,
.agc_levels = { RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW },
.targetable_vfo = 0,
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
.vfo_ops = IC7100_VFO_OPS,
.scan_ops = IC7100_SCAN_OPS,
.transceive = RIG_TRN_RIG,
@ -477,8 +484,8 @@ const struct rig_caps ic7100_caps =
.get_freq = icom_get_freq,
.set_freq = icom_set_freq,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,

Wyświetl plik

@ -116,6 +116,13 @@ static const struct icom_priv_caps IC7200_priv_caps =
{ .level = RIG_AGC_SLOW, .icom_level = 2 },
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.x25x26_always = 0,
.x25x26_possibly = 0,
.x1cx03_always = 0,
.x1cx03_possibly = 0,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
const struct rig_caps ic7200_caps =
@ -246,8 +253,8 @@ const struct rig_caps ic7200_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = NULL, /*automatically set by rig depending band */

Wyświetl plik

@ -392,7 +392,13 @@ static const struct icom_priv_caps IC7300_priv_caps =
},
},
.extcmds = ic7300_extcmds, /* Custom op parameters */
.x25_always = 1
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
static const struct icom_priv_caps IC9700_priv_caps =
@ -441,7 +447,13 @@ static const struct icom_priv_caps IC9700_priv_caps =
},
},
.extcmds = ic9700_extcmds, /* Custom op parameters */
.x25_always = 1
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
static const struct icom_priv_caps IC705_priv_caps =
@ -565,6 +577,13 @@ static const struct icom_priv_caps IC705_priv_caps =
},
},
.extcmds = ic705_extcmds, /* Custom parameters */
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
static const struct icom_priv_caps IC905_priv_caps =
@ -687,6 +706,13 @@ static const struct icom_priv_caps IC905_priv_caps =
},
},
.extcmds = ic705_extcmds, /* Custom parameters */
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
const struct rig_caps ic7300_caps =
@ -878,8 +904,8 @@ const struct rig_caps ic7300_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,
.set_ant = NULL,
@ -1202,8 +1228,8 @@ struct rig_caps ic9700_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = ic9700_set_vfo,
.set_ant = NULL,
@ -1474,8 +1500,8 @@ const struct rig_caps ic705_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,
.set_ant = NULL,
@ -1744,8 +1770,8 @@ const struct rig_caps ic905_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,
.set_ant = NULL,

Wyświetl plik

@ -115,6 +115,7 @@ static const struct icom_priv_caps ic7410_priv_caps =
{ .level = RIG_AGC_FAST, .icom_level = 3 },
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.data_mode_supported = 1,
};
@ -250,8 +251,8 @@ const struct rig_caps ic7410_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -558,8 +558,8 @@ const struct rig_caps ic746pro_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -473,6 +473,7 @@ static const struct icom_priv_caps ic756pro2_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic756pro_cmdparms, /* Custom op parameters */
.data_mode_supported = 1
};
/*
@ -655,8 +656,8 @@ const struct rig_caps ic756pro2_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,
@ -906,6 +907,7 @@ static const struct icom_priv_caps ic756pro3_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic756pro_cmdparms, /* Custom op parameters */
.data_mode_supported = 1
};
@ -1108,8 +1110,8 @@ const struct rig_caps ic756pro3_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -161,6 +161,13 @@ static const struct icom_priv_caps ic7600_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic7600_extcmds, /* Custom op parameters */
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
@ -331,7 +338,7 @@ struct rig_caps ic7600_caps =
.max_ifshift = Hz(0),
.agc_level_count = 3,
.agc_levels = { RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW },
.targetable_vfo = 0,
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
.vfo_ops = IC7600_VFO_OPS,
.scan_ops = IC7600_SCAN_OPS,
.transceive = RIG_TRN_RIG,
@ -421,8 +428,8 @@ struct rig_caps ic7600_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -242,7 +242,13 @@ static const struct icom_priv_caps ic7610_priv_caps =
},
},
.extcmds = ic7610_extcmds,
.x25_always = 1,
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
@ -558,8 +564,8 @@ struct rig_caps ic7610_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -143,6 +143,13 @@ static const struct icom_priv_caps ic7700_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic7700_extcmds,
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
// if hour < 0 then only date will be set
@ -306,7 +313,7 @@ const struct rig_caps ic7700_caps =
.agc_level_count = 4,
.agc_levels = { RIG_AGC_OFF, RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW },
// 7700 can have a different mode on VFOB but requires VFO swap
.targetable_vfo = RIG_TARGETABLE_MODE,
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
.vfo_ops = IC7700_VFO_OPS,
.scan_ops = IC7700_SCAN_OPS,
.transceive = RIG_TRN_RIG,
@ -396,8 +403,8 @@ const struct rig_caps ic7700_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -151,6 +151,13 @@ static const struct icom_priv_caps ic7800_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic7800_extcmds,
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
const struct rig_caps ic7800_caps =
@ -295,8 +302,8 @@ const struct rig_caps ic7800_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -235,7 +235,13 @@ static struct icom_priv_caps ic785x_priv_caps =
},
},
.extcmds = ic785x_extcmds,
.x25_always = 1,
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
const struct rig_caps ic785x_caps =
@ -443,8 +449,8 @@ const struct rig_caps ic785x_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -56,7 +56,6 @@ static const struct icom_priv_caps ic821h_priv_caps =
// If Main/Sub we assume we're doing satmode
int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv;
int retval = -RIG_EINTERNAL;
ENTERFUNC;

Wyświetl plik

@ -102,6 +102,13 @@ static const struct icom_priv_caps ic9100_priv_caps =
.antack_len = 2,
.ant_count = 2,
.extcmds = ic9100_extcmds,
.x25x26_always = 0,
.x25x26_possibly = 0,
.x1cx03_always = 0,
.x1cx03_possibly = 0,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
const struct rig_caps ic9100_caps =
@ -243,8 +250,8 @@ const struct rig_caps ic9100_caps =
.get_freq = icom_get_freq,
.set_freq = icom_set_freq,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,

Plik diff jest za duży Load Diff

Wyświetl plik

@ -55,7 +55,7 @@
* parameters and levels.
*/
#define STR_CAL_LENGTH 16
#define STR_CAL_S0 -54
#define STR_CAL_S0 (-54)
#define MULTIB_SUBCMD
/*
@ -244,7 +244,13 @@ struct icom_priv_caps
struct icom_spectrum_edge_frequency_range spectrum_edge_frequency_ranges[ICOM_MAX_SPECTRUM_FREQ_RANGES]; /*!< Icom spectrum scope edge frequencies, if supported by the rig. Last entry should have zeros in all fields. */
struct cmdparams *extcmds; /*!< Pointer to extended operations array */
int dualwatch_split; /*!< Rig supports dual watch for split ops -- e.g. ID-5100 */
int x25_always; /*!< Means the rig should use 0x25 and 0x26 commands always */
int x25x26_always; /*!< Rig should use 0x25 and 0x26 commands always */
int x25x26_possibly; /*!< Rig might support 0x25 and 0x26 commands if the firmware is upgraded */
int x1cx03_always; /*!< Rig should use 0x1C 0x03 command for getting TX frequency */
int x1cx03_possibly; /*!< Rig might support 0x1C 0x03 command if the firmware is upgraded TODO: is this added by FW upgrade ever? */
int x1ax03_supported; /*!< Rig supports setting/getting filter width */
int mode_with_filter; /*!< Rig mode commands include filter selection */
int data_mode_supported; /*!< Rig supports data mode flag */
};
struct icom_priv_data
@ -252,7 +258,7 @@ struct icom_priv_data
unsigned char re_civ_addr; /*!< The remote equipment's CI-V address */
int civ_731_mode; /*!< Off: freqs on 10 digits, On: freqs on 8 digits */
int no_xchg; /*!< Off: use VFO XCHG to set other VFO, On: use set VFO to set other VFO */
int no_1a_03_cmd; /*!< Rig doesn't tell IF widths */
int no_1a_03_cmd; /*!< Rig does not support setting/getting filter width */
int split_on_deprecated; /*!< @deprecated Use rig_cache.split - Record split state */
pltstate_t *pltstate; /*!< Only on optoscan */
int serial_USB_echo_off; /*!< USB is not set to echo */
@ -321,16 +327,9 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int icom_get_rit_new(RIG *rig, vfo_t vfo, shortfreq_t *ts);
int icom_set_rit_new(RIG *rig, vfo_t vfo, shortfreq_t ts);
int icom_set_xit_new(RIG *rig, vfo_t vfo, shortfreq_t ts);
int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width);
int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
#if 1 // see icom_get_vfo in icom.c
int icom_get_vfo(RIG *rig, vfo_t *vfo);
#else
#define icom_get_vfo NULL
#endif
int icom_set_vfo(RIG *rig, vfo_t vfo);
int icom_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
int icom_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift);
@ -598,5 +597,4 @@ extern const struct rig_caps icr30_caps;
#define RIG_IS_X5105 (rig->state.rig_model == RIG_MODEL_X5105)
#define RIG_IS_X6100 (rig->state.rig_model == RIG_MODEL_X6100)
#endif /* _ICOM_H */

Wyświetl plik

@ -141,7 +141,7 @@ static struct icom_priv_caps x108g_priv_caps =
0x70, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7200_ts_sc_list
ic7200_ts_sc_list,
};
@ -321,6 +321,21 @@ const struct rig_caps x108g_caps =
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
};
static struct icom_priv_caps x6100_priv_caps =
{
0x70, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7200_ts_sc_list,
.x25x26_always = 0,
.x25x26_possibly = 0,
.x1cx03_always = 0,
.x1cx03_possibly = 0,
.x1ax03_supported = 0,
.mode_with_filter = 1,
.data_mode_supported = 1
};
const struct rig_caps x6100_caps =
{
RIG_MODEL(RIG_MODEL_X6100),
@ -445,7 +460,7 @@ const struct rig_caps x6100_caps =
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void *)& x108g_priv_caps,
.priv = (void *) &x6100_priv_caps,
.rig_init = icom_init,
.rig_cleanup = icom_cleanup,
.rig_open = icom_rig_open,
@ -453,8 +468,8 @@ const struct rig_caps x6100_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
.set_ant = NULL, /*automatically set by rig depending band */
.get_ant = NULL,

Wyświetl plik

@ -4758,7 +4758,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
}
// Use set_split_mode directly if implemented and mode is targetable
if (caps->set_split_mode)
if (caps->set_split_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE))
{
HAMLIB_TRACE;
retcode = caps->set_split_mode(rig, tx_vfo, tx_mode, tx_width);