diff --git a/icom/Makefile.am b/icom/Makefile.am index fc1160b82..ebb2ecab6 100644 --- a/icom/Makefile.am +++ b/icom/Makefile.am @@ -5,7 +5,7 @@ ICOMSRC = ic706.c icr8500.c ic735.c ic775.c ic756.c \ ic736.c ic738.c ic7410.c ic746.c ic703.c ic726.c ic271.c \ ic765.c ic781.c ic471.c icr9000.c icr9500.c \ icr10.c icr20.c icr30.c icr6.c icr71.c icr72.c icr75.c icrx7.c icr8600.c \ - id1.c id5100.c perseus.c ic2730.c \ + id1.c id31.c id51.c id4100.c id5100.c perseus.c ic2730.c \ ic707.c ic728.c ic751.c ic761.c \ ic78.c ic7800.c ic785x.c \ ic7000.c ic7100.c ic7200.c ic7300.c ic7600.c ic7610.c ic7700.c \ diff --git a/icom/ic7100.c b/icom/ic7100.c index b8ced4173..d208e190d 100644 --- a/icom/ic7100.c +++ b/icom/ic7100.c @@ -35,7 +35,8 @@ #define IC7100_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|\ RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR|\ - RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM) + RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTAM|RIG_MODE_PKTFM|\ + RIG_MODE_DSTAR) #define IC7100_OTHER_TX_MODES ((IC7100_MODES) & ~(RIG_MODE_AM|RIG_MODE_PKTAM)) diff --git a/icom/icom.c b/icom/icom.c index 9bab129fe..5613d36ce 100644 --- a/icom/icom.c +++ b/icom/icom.c @@ -3657,9 +3657,19 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) fct_len = 0; break; + case RIG_FUNC_CSQL: + fct_cn = C_CTL_FUNC; + fct_sc = S_FUNC_CSQL; + break; + case RIG_FUNC_DSQL: fct_cn = C_CTL_FUNC; - fct_sc = S_FUNC_DSQL; + fct_sc = S_FUNC_DSSQL; + if (status <= 2) { + fctbuf[0] = status; + } else { + fctbuf[0] = 0; + } break; case RIG_FUNC_AFLT: @@ -3838,9 +3848,14 @@ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) fct_sc = S_FUNC_IPPLUS; break; + case RIG_FUNC_CSQL: + fct_cn = C_CTL_FUNC; + fct_sc = S_FUNC_CSQL; + break; + case RIG_FUNC_DSQL: fct_cn = C_CTL_FUNC; - fct_sc = S_FUNC_DSQL; + fct_sc = S_FUNC_DSSQL; break; case RIG_FUNC_AFLT: @@ -5582,6 +5597,9 @@ DECLARE_INITRIG_BACKEND(icom) rig_register(&ic92d_caps); rig_register(&id1_caps); + rig_register(&id31_caps); + rig_register(&id51_caps); + rig_register(&id4100_caps); rig_register(&id5100_caps); rig_register(&ic2730_caps); diff --git a/icom/icom.h b/icom/icom.h index e5ad21181..66472a296 100644 --- a/icom/icom.h +++ b/icom/icom.h @@ -329,6 +329,9 @@ extern const struct rig_caps os535_caps; extern const struct rig_caps ic92d_caps; extern const struct rig_caps id1_caps; +extern const struct rig_caps id31_caps; +extern const struct rig_caps id51_caps; +extern const struct rig_caps id4100_caps; extern const struct rig_caps id5100_caps; extern const struct rig_caps ic2730_caps; diff --git a/icom/icom_defs.h b/icom/icom_defs.h index e7ea02508..de5c5cf00 100644 --- a/icom/icom_defs.h +++ b/icom/icom_defs.h @@ -320,7 +320,7 @@ #define S_FUNC_MN 0x48 /* Manual notch setting */ #define S_FUNC_RF 0x49 /* RTTY Filter setting */ #define S_FUNC_AFC 0x4A /* Auto Frequency Control (AFC) setting */ -#define S_FUNC_DSQL 0x4B /* DTCS tone code squelch setting*/ +#define S_FUNC_CSQL 0x4B /* DTCS tone code squelch setting*/ #define S_FUNC_VSC 0x4C /* voice squelch control useful for scanning*/ #define S_FUNC_MANAGC 0x4D /* manual AGC */ #define S_FUNC_DIGISEL 0x4E /* DIGI-SEL */ @@ -334,7 +334,7 @@ #define S_FUNC_SSBT 0x58 /* SSB Tx bandwidth */ #define S_FUNC_SUBB 0x59 /* Sub band */ #define S_FUNC_SATM 0x5A /* Satellite mode */ -#define S_FUNC_DSSQL 0x5B /* D-STAR squelch */ +#define S_FUNC_DSSQL 0x5B /* D-STAR DSQL */ #define S_FUNC_DPSQL 0x5F /* dPMR DSQL */ #define S_FUNC_NXSQL 0x60 /* NXDN DSQL */ #define S_FUNC_DCSQL 0x61 /* DCR DSQL */ diff --git a/icom/icr30.c b/icom/icr30.c index 373ba4645..24e6ad920 100644 --- a/icom/icr30.c +++ b/icom/icr30.c @@ -31,12 +31,16 @@ #include "icom_defs.h" #include "frame.h" -#define ICR30_MODES (RIG_MODE_LSB|RIG_MODE_USB|RIG_MODE_AM|RIG_MODE_AMN|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_FM|RIG_MODE_FMN|RIG_MODE_WFM|\ - RIG_MODE_RTTYR|RIG_MODE_SAM|RIG_MODE_SAL|RIG_MODE_SAH|RIG_MODE_P25|RIG_MODE_DSTAR|RIG_MODE_DPMR|RIG_MODE_NXDNVN|RIG_MODE_NXDN_N|RIG_MODE_DCR) +#define ICR30_MODES (RIG_MODE_LSB|RIG_MODE_USB|RIG_MODE_AM|RIG_MODE_AMN|\ + RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_FM|RIG_MODE_FMN|RIG_MODE_WFM|\ + RIG_MODE_RTTYR|RIG_MODE_SAM|RIG_MODE_SAL|RIG_MODE_SAH|RIG_MODE_P25|\ + RIG_MODE_DSTAR|RIG_MODE_DPMR|RIG_MODE_NXDNVN|RIG_MODE_NXDN_N|RIG_MODE_DCR) -#define ICR30_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_TSQL|RIG_FUNC_AFC|RIG_FUNC_VSC|RIG_FUNC_DSQL|RIG_FUNC_ANL) +#define ICR30_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_TSQL|RIG_FUNC_AFC|RIG_FUNC_VSC|\ + RIG_FUNC_CSQL|RIG_FUNC_DSQL|RIG_FUNC_ANL|RIG_FUNC_CSQL|RIG_FUNC_SCEN) -#define ICR30_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) +#define ICR30_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_RF|\ + RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) #define ICR30_VFO_ALL (RIG_VFO_A) diff --git a/icom/icr6.c b/icom/icr6.c index fe0476ea1..e0c1dfe59 100644 --- a/icom/icr6.c +++ b/icom/icr6.c @@ -31,7 +31,7 @@ #define ICR6_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) -#define ICR6_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_VSC|RIG_FUNC_DSQL|RIG_FUNC_AFLT) +#define ICR6_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_VSC|RIG_FUNC_CSQL|RIG_FUNC_AFLT|RIG_FUNC_DSQL) #define ICR6_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) diff --git a/icom/icr8600.c b/icom/icr8600.c index c3cc2297c..932c7e476 100644 --- a/icom/icr8600.c +++ b/icom/icr8600.c @@ -43,7 +43,7 @@ #define ICR8600_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_ANF|RIG_FUNC_MN|RIG_FUNC_AFC|\ RIG_FUNC_NR|RIG_FUNC_AIP|RIG_FUNC_LOCK|RIG_FUNC_VSC|RIG_FUNC_RESUME|RIG_FUNC_TSQL|\ - RIG_FUNC_DSQL) + RIG_FUNC_CSQL|RIG_FUNC_DSQL) #define ICR8600_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|\ RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_PREAMP|\ diff --git a/icom/id31.c b/icom/id31.c new file mode 100644 index 000000000..0322d3d47 --- /dev/null +++ b/icom/id31.c @@ -0,0 +1,205 @@ +/* + * Hamlib CI-V backend - description of ID-31 and variations + * Copyright (c) 2015 by Stephane Fillod + * Copyright (c) 2019 by Malcolm Herring + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "hamlib/rig.h" +#include "idx_builtin.h" +#include "icom.h" + +/* + * Specs and protocol details comes from the chapter 11 of ID-31A_E_CD_ENG_1.pdf + * + * NB: while the port labeled "Data" is used for firmware upgrades, + * you have to use the port labeled "SP" for rig control. + * + */ + +#define ID31_MODES (RIG_MODE_FM|RIG_MODE_DSTAR) +#define ID31_ALL_RX_MODES (RIG_MODE_AM|ID31_MODES) + +#define ID31_VFO_ALL (RIG_VFO_MAIN) + +#define ID31_SCAN_OPS RIG_SCAN_NONE + +#define ID31_VFO_OPS RIG_OP_NONE + +#define ID31_FUNC_ALL ( \ + RIG_FUNC_TONE| \ + RIG_FUNC_TSQL| \ + RIG_FUNC_CSQL| \ + RIG_FUNC_DSQL| \ + RIG_FUNC_VOX) + +#define ID31_LEVEL_ALL (RIG_LEVEL_AF| \ + RIG_LEVEL_SQL| \ + RIG_LEVEL_RAWSTR| \ + RIG_LEVEL_RFPOWER| \ + RIG_LEVEL_MICGAIN| \ + RIG_LEVEL_VOXGAIN) + +#define ID31_PARM_ALL RIG_PARM_NONE + + +/* + * FIXME: real measurement + */ +#define ID31_STR_CAL UNKNOWN_IC_STR_CAL + + + +/* + */ +static const struct icom_priv_caps id31_priv_caps = +{ + 0xA0, /* default address */ + 0, /* 731 mode */ + 1, /* no XCHG */ +}; + +const struct rig_caps id31_caps = +{ + .rig_model = RIG_MODEL_ID31, + .model_name = "ID-31", + .mfg_name = "Icom", + .version = BACKEND_VER ".0", + .copyright = "LGPL", + .status = RIG_STATUS_UNTESTED, + .rig_type = RIG_TYPE_MOBILE, + .ptt_type = RIG_PTT_RIG, + .dcd_type = RIG_DCD_RIG, + .port_type = RIG_PORT_SERIAL, + .serial_rate_min = 4800, + .serial_rate_max = 19200, + .serial_data_bits = 8, + .serial_stop_bits = 1, + .serial_parity = RIG_PARITY_NONE, + .serial_handshake = RIG_HANDSHAKE_NONE, + .write_delay = 0, + .post_write_delay = 0, + .timeout = 1000, + .retry = 3, + .has_get_func = ID31_FUNC_ALL, + .has_set_func = ID31_FUNC_ALL, + .has_get_level = ID31_LEVEL_ALL, + .has_set_level = RIG_LEVEL_SET(ID31_LEVEL_ALL), + .has_get_parm = ID31_PARM_ALL, + .has_set_parm = ID31_PARM_ALL, + .level_gran = { + [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, + }, + .parm_gran = {}, + .ctcss_list = common_ctcss_list, + .dcs_list = full_dcs_list, + .preamp = { RIG_DBLST_END, }, + .attenuator = { RIG_DBLST_END, }, + .max_rit = Hz(0), + .max_xit = Hz(0), + .max_ifshift = Hz(0), + .targetable_vfo = 0, + .vfo_ops = ID31_VFO_OPS, + .scan_ops = ID31_SCAN_OPS, + .transceive = RIG_TRN_RIG, + .bank_qty = 0, + .chan_desc_sz = 0, + + .chan_list = { + // There's no memory support through CI-V, + // but there is a clone mode apart. + RIG_CHAN_END, + }, + + .rx_range_list1 = { + {MHz(400), MHz(479), ID31_ALL_RX_MODES, -1, -1, ID31_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list1 = { + {MHz(430), MHz(440), ID31_MODES, W(2.5), W(5), ID31_VFO_ALL}, + RIG_FRNG_END, + }, + + .rx_range_list2 = { + {MHz(400), MHz(479), ID31_ALL_RX_MODES, -1, -1, ID31_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list2 = { + {MHz(440), MHz(450), ID31_MODES, W(2.5), W(5), ID31_VFO_ALL}, + RIG_FRNG_END, + }, + + .tuning_steps = { + // Rem: no support for changing tuning step + RIG_TS_END, + }, + /* mode/filter list, remember: order matters! */ + .filters = { + {RIG_MODE_FM, kHz(12)}, + {RIG_MODE_FM, kHz(6)}, + RIG_FLT_END, + }, + .str_cal = ID31_STR_CAL, + + .cfgparams = icom_cfg_params, + .set_conf = icom_set_conf, + .get_conf = icom_get_conf, + + .priv = (void *)& id31_priv_caps, + .rig_init = icom_init, + .rig_cleanup = icom_cleanup, + .rig_open = NULL, + .rig_close = NULL, + + .set_freq = icom_set_freq, + .get_freq = icom_get_freq, + .set_mode = icom_set_mode, + .get_mode = icom_get_mode, + + .set_powerstat = icom_set_powerstat, + .get_powerstat = icom_get_powerstat, + .decode_event = icom_decode_event, + + .set_func = icom_set_func, + .get_func = icom_get_func, + .set_level = icom_set_level, + .get_level = icom_get_level, + + .set_ptt = icom_set_ptt, + .get_ptt = icom_get_ptt, + .get_dcd = icom_get_dcd, + + .set_rptr_shift = icom_set_rptr_shift, + .get_rptr_shift = icom_get_rptr_shift, + .set_rptr_offs = icom_set_rptr_offs, + .get_rptr_offs = icom_get_rptr_offs, + .set_ctcss_tone = icom_set_ctcss_tone, + .get_ctcss_tone = icom_get_ctcss_tone, + .set_dcs_code = icom_set_dcs_code, + .get_dcs_code = icom_get_dcs_code, + .set_ctcss_sql = icom_set_ctcss_sql, + .get_ctcss_sql = icom_get_ctcss_sql, + .set_dcs_sql = icom_set_dcs_sql, + .get_dcs_sql = icom_get_dcs_sql, +}; diff --git a/icom/id4100.c b/icom/id4100.c new file mode 100644 index 000000000..e322d931d --- /dev/null +++ b/icom/id4100.c @@ -0,0 +1,214 @@ +/* + * Hamlib CI-V backend - description of ID-4100 and variations + * Copyright (c) 2015 by Stephane Fillod + * Copyright (c) 2019 by Malcolm Herring + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "hamlib/rig.h" +#include "idx_builtin.h" +#include "icom.h" + +/* + * Specs and protocol details comes from the chapter 10 of ID-4100A_E_ENG_PU_0.pdf + * + * NB: while the port labeled "Data" is used for firmware upgrades, + * you have to use the port labeled "SP2" for rig control. + * + * TODO: + * - DV mode + * - GPS support + * - Single/dual watch (RIG_LEVEL_BALANCE) + */ + +#define ID4100_MODES (RIG_MODE_FM|RIG_MODE_DSTAR) +#define ID4100_ALL_RX_MODES (RIG_MODE_AM|ID4100_MODES) + +#define ID4100_VFO_ALL (RIG_VFO_MAIN|RIG_VFO_SUB) + +#define ID4100_SCAN_OPS RIG_SCAN_NONE + +#define ID4100_VFO_OPS RIG_OP_NONE + +#define ID4100_FUNC_ALL ( \ + RIG_FUNC_TONE| \ + RIG_FUNC_TSQL| \ + RIG_FUNC_CSQL| \ + RIG_FUNC_DSQL| \ + RIG_FUNC_VOX) + +#define ID4100_LEVEL_ALL (RIG_LEVEL_AF| \ + RIG_LEVEL_SQL| \ + RIG_LEVEL_RAWSTR| \ + RIG_LEVEL_RFPOWER| \ + RIG_LEVEL_MICGAIN| \ + RIG_LEVEL_VOXGAIN) + +#define ID4100_PARM_ALL RIG_PARM_NONE + + +/* + * FIXME: real measurement + */ +#define ID4100_STR_CAL UNKNOWN_IC_STR_CAL + + + +/* + */ +static const struct icom_priv_caps id4100_priv_caps = +{ + 0x9A, /* default address */ + 0, /* 731 mode */ + 1, /* no XCHG */ +}; + +const struct rig_caps id4100_caps = +{ + .rig_model = RIG_MODEL_ID4100, + .model_name = "ID-4100", + .mfg_name = "Icom", + .version = BACKEND_VER ".0", + .copyright = "LGPL", + .status = RIG_STATUS_UNTESTED, + .rig_type = RIG_TYPE_MOBILE, + .ptt_type = RIG_PTT_RIG, + .dcd_type = RIG_DCD_RIG, + .port_type = RIG_PORT_SERIAL, + .serial_rate_min = 4800, + .serial_rate_max = 19200, + .serial_data_bits = 8, + .serial_stop_bits = 1, + .serial_parity = RIG_PARITY_NONE, + .serial_handshake = RIG_HANDSHAKE_NONE, + .write_delay = 0, + .post_write_delay = 0, + .timeout = 1000, + .retry = 3, + .has_get_func = ID4100_FUNC_ALL, + .has_set_func = ID4100_FUNC_ALL, + .has_get_level = ID4100_LEVEL_ALL, + .has_set_level = RIG_LEVEL_SET(ID4100_LEVEL_ALL), + .has_get_parm = ID4100_PARM_ALL, + .has_set_parm = ID4100_PARM_ALL, + .level_gran = { + [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, + }, + .parm_gran = {}, + .ctcss_list = common_ctcss_list, + .dcs_list = full_dcs_list, + .preamp = { RIG_DBLST_END, }, + .attenuator = { RIG_DBLST_END, }, + .max_rit = Hz(0), + .max_xit = Hz(0), + .max_ifshift = Hz(0), + .targetable_vfo = 0, + .vfo_ops = ID4100_VFO_OPS, + .scan_ops = ID4100_SCAN_OPS, + .transceive = RIG_TRN_RIG, + .bank_qty = 0, + .chan_desc_sz = 0, + + .chan_list = { + // There's no memory support through CI-V, + // but there is a clone mode apart. + RIG_CHAN_END, + }, + + .rx_range_list1 = { + {MHz(118), MHz(174), ID4100_ALL_RX_MODES, -1, -1, ID4100_VFO_ALL}, + {MHz(375), MHz(550), ID4100_ALL_RX_MODES, -1, -1, ID4100_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list1 = { + {MHz(144), MHz(146), ID4100_MODES, W(5), W(25), ID4100_VFO_ALL}, + {MHz(430), MHz(440), ID4100_MODES, W(5), W(25), ID4100_VFO_ALL}, + RIG_FRNG_END, + }, + + .rx_range_list2 = { + {MHz(118), MHz(174), ID4100_ALL_RX_MODES, -1, -1, ID4100_VFO_ALL}, + {MHz(375), MHz(550), ID4100_ALL_RX_MODES, -1, -1, ID4100_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list2 = { + {MHz(144), MHz(148), ID4100_MODES, W(5), W(50), ID4100_VFO_ALL}, + {MHz(430), MHz(450), ID4100_MODES, W(5), W(50), ID4100_VFO_ALL}, + RIG_FRNG_END, + }, + + .tuning_steps = { + // Rem: no support for changing tuning step + RIG_TS_END, + }, + /* mode/filter list, remember: order matters! */ + .filters = { + {RIG_MODE_FM | RIG_MODE_AM, kHz(12)}, + {RIG_MODE_FM | RIG_MODE_AM, kHz(6)}, + RIG_FLT_END, + }, + .str_cal = ID4100_STR_CAL, + + .cfgparams = icom_cfg_params, + .set_conf = icom_set_conf, + .get_conf = icom_get_conf, + + .priv = (void *)& id4100_priv_caps, + .rig_init = icom_init, + .rig_cleanup = icom_cleanup, + .rig_open = NULL, + .rig_close = NULL, + + .set_freq = icom_set_freq, + .get_freq = icom_get_freq, + .set_mode = icom_set_mode, + .get_mode = icom_get_mode, + .set_vfo = icom_set_vfo, + + .set_powerstat = icom_set_powerstat, + .get_powerstat = icom_get_powerstat, + .decode_event = icom_decode_event, + + .set_func = icom_set_func, + .get_func = icom_get_func, + .set_level = icom_set_level, + .get_level = icom_get_level, + + .set_ptt = icom_set_ptt, + .get_ptt = icom_get_ptt, + .get_dcd = icom_get_dcd, + + .set_rptr_shift = icom_set_rptr_shift, + .get_rptr_shift = icom_get_rptr_shift, + .set_rptr_offs = icom_set_rptr_offs, + .get_rptr_offs = icom_get_rptr_offs, + .set_ctcss_tone = icom_set_ctcss_tone, + .get_ctcss_tone = icom_get_ctcss_tone, + .set_dcs_code = icom_set_dcs_code, + .get_dcs_code = icom_get_dcs_code, + .set_ctcss_sql = icom_set_ctcss_sql, + .get_ctcss_sql = icom_get_ctcss_sql, + .set_dcs_sql = icom_set_dcs_sql, + .get_dcs_sql = icom_get_dcs_sql, +}; diff --git a/icom/id51.c b/icom/id51.c new file mode 100644 index 000000000..e5f2e4a2d --- /dev/null +++ b/icom/id51.c @@ -0,0 +1,210 @@ +/* + * Hamlib CI-V backend - description of ID-51 and variations + * Copyright (c) 2015 by Stephane Fillod + * Copyright (c) 2019 by Malcolm Herring + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "hamlib/rig.h" +#include "idx_builtin.h" +#include "icom.h" + +/* + * Specs and protocol details comes from the chapter 17 of ID-51A_E_PLUS2_CD_0.pdf + + * NB: while the port labeled "Data" is used for firmware upgrades, + * you have to use the port labeled "SP" for rig control. + * + */ + +#define ID51_MODES (RIG_MODE_FM|RIG_MODE_DSTAR) +#define ID51_ALL_RX_MODES (RIG_MODE_AM|ID51_MODES) + +#define ID51_VFO_ALL (RIG_VFO_MAIN|RIG_VFO_SUB) + +#define ID51_SCAN_OPS RIG_SCAN_NONE + +#define ID51_VFO_OPS RIG_OP_NONE + +#define ID51_FUNC_ALL ( \ + RIG_FUNC_TONE| \ + RIG_FUNC_TSQL| \ + RIG_FUNC_CSQL| \ + RIG_FUNC_DSQL| \ + RIG_FUNC_VOX) + +#define ID51_LEVEL_ALL (RIG_LEVEL_AF| \ + RIG_LEVEL_SQL| \ + RIG_LEVEL_RAWSTR| \ + RIG_LEVEL_RFPOWER| \ + RIG_LEVEL_MICGAIN| \ + RIG_LEVEL_VOXGAIN) + +#define ID51_PARM_ALL RIG_PARM_NONE + + +/* + * FIXME: real measurement + */ +#define ID51_STR_CAL UNKNOWN_IC_STR_CAL + + + +/* + */ +static const struct icom_priv_caps id51_priv_caps = +{ + 0x86, /* default address */ + 0, /* 731 mode */ + 1, /* no XCHG */ +}; + +const struct rig_caps id51_caps = +{ + .rig_model = RIG_MODEL_ID51, + .model_name = "ID-51", + .mfg_name = "Icom", + .version = BACKEND_VER ".0", + .copyright = "LGPL", + .status = RIG_STATUS_UNTESTED, + .rig_type = RIG_TYPE_MOBILE, + .ptt_type = RIG_PTT_RIG, + .dcd_type = RIG_DCD_RIG, + .port_type = RIG_PORT_SERIAL, + .serial_rate_min = 300, + .serial_rate_max = 19200, + .serial_data_bits = 8, + .serial_stop_bits = 1, + .serial_parity = RIG_PARITY_NONE, + .serial_handshake = RIG_HANDSHAKE_NONE, + .write_delay = 0, + .post_write_delay = 0, + .timeout = 1000, + .retry = 3, + .has_get_func = ID51_FUNC_ALL, + .has_set_func = ID51_FUNC_ALL, + .has_get_level = ID51_LEVEL_ALL, + .has_set_level = RIG_LEVEL_SET(ID51_LEVEL_ALL), + .has_get_parm = ID51_PARM_ALL, + .has_set_parm = ID51_PARM_ALL, + .level_gran = { + [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, + }, + .parm_gran = {}, + .ctcss_list = common_ctcss_list, + .dcs_list = full_dcs_list, + .preamp = { RIG_DBLST_END, }, + .attenuator = { RIG_DBLST_END, }, + .max_rit = Hz(0), + .max_xit = Hz(0), + .max_ifshift = Hz(0), + .targetable_vfo = 0, + .vfo_ops = ID51_VFO_OPS, + .scan_ops = ID51_SCAN_OPS, + .transceive = RIG_TRN_RIG, + .bank_qty = 0, + .chan_desc_sz = 0, + + .chan_list = { + // There's no memory support through CI-V, + // but there is a clone mode apart. + RIG_CHAN_END, + }, + + .rx_range_list1 = { + {MHz(118), MHz(174), ID51_ALL_RX_MODES, -1, -1, ID51_VFO_ALL}, + {MHz(375), MHz(550), ID51_ALL_RX_MODES, -1, -1, ID51_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list1 = { + {MHz(144), MHz(146), ID51_MODES, W(5), W(25), ID51_VFO_ALL}, + {MHz(430), MHz(440), ID51_MODES, W(5), W(25), ID51_VFO_ALL}, + RIG_FRNG_END, + }, + + .rx_range_list2 = { + {MHz(118), MHz(174), ID51_ALL_RX_MODES, -1, -1, ID51_VFO_ALL}, + {MHz(375), MHz(550), ID51_ALL_RX_MODES, -1, -1, ID51_VFO_ALL}, + RIG_FRNG_END, + }, + .tx_range_list2 = { + {MHz(144), MHz(148), ID51_MODES, W(5), W(50), ID51_VFO_ALL}, + {MHz(430), MHz(450), ID51_MODES, W(5), W(50), ID51_VFO_ALL}, + RIG_FRNG_END, + }, + + .tuning_steps = { + // Rem: no support for changing tuning step + RIG_TS_END, + }, + /* mode/filter list, remember: order matters! */ + .filters = { + {RIG_MODE_FM | RIG_MODE_AM, kHz(12)}, + {RIG_MODE_FM | RIG_MODE_AM, kHz(6)}, + RIG_FLT_END, + }, + .str_cal = ID51_STR_CAL, + + .cfgparams = icom_cfg_params, + .set_conf = icom_set_conf, + .get_conf = icom_get_conf, + + .priv = (void *)& id51_priv_caps, + .rig_init = icom_init, + .rig_cleanup = icom_cleanup, + .rig_open = NULL, + .rig_close = NULL, + + .set_freq = icom_set_freq, + .get_freq = icom_get_freq, + .set_mode = icom_set_mode, + .get_mode = icom_get_mode, + .set_vfo = icom_set_vfo, + + .set_powerstat = icom_set_powerstat, + .get_powerstat = icom_get_powerstat, + .decode_event = icom_decode_event, + + .set_func = icom_set_func, + .get_func = icom_get_func, + .set_level = icom_set_level, + .get_level = icom_get_level, + + .set_ptt = icom_set_ptt, + .get_ptt = icom_get_ptt, + .get_dcd = icom_get_dcd, + + .set_rptr_shift = icom_set_rptr_shift, + .get_rptr_shift = icom_get_rptr_shift, + .set_rptr_offs = icom_set_rptr_offs, + .get_rptr_offs = icom_get_rptr_offs, + .set_ctcss_tone = icom_set_ctcss_tone, + .get_ctcss_tone = icom_get_ctcss_tone, + .set_dcs_code = icom_set_dcs_code, + .get_dcs_code = icom_get_dcs_code, + .set_ctcss_sql = icom_set_ctcss_sql, + .get_ctcss_sql = icom_get_ctcss_sql, + .set_dcs_sql = icom_set_dcs_sql, + .get_dcs_sql = icom_get_dcs_sql, +}; diff --git a/icom/id5100.c b/icom/id5100.c index 775734bcd..899e9aee6 100644 --- a/icom/id5100.c +++ b/icom/id5100.c @@ -1,6 +1,7 @@ /* * Hamlib CI-V backend - description of ID-5100 and variations * Copyright (c) 2015 by Stephane Fillod + * Copyright (c) 2019 by Malcolm Herring * * * This library is free software; you can redistribute it and/or @@ -41,7 +42,7 @@ * - Single/dual watch (RIG_LEVEL_BALANCE) */ -#define ID5100_MODES (RIG_MODE_FM) +#define ID5100_MODES (RIG_MODE_FM|RIG_MODE_DSTAR) #define ID5100_ALL_RX_MODES (RIG_MODE_AM|ID5100_MODES) #define ID5100_VFO_ALL (RIG_VFO_MAIN|RIG_VFO_SUB) @@ -53,10 +54,11 @@ #define ID5100_FUNC_ALL ( \ RIG_FUNC_TONE| \ RIG_FUNC_TSQL| \ + RIG_FUNC_CSQL| \ + RIG_FUNC_DSQL| \ RIG_FUNC_VOX) #define ID5100_LEVEL_ALL (RIG_LEVEL_AF| \ - RIG_LEVEL_BALANCE| /* TODO 0x16 0x59 */\ RIG_LEVEL_SQL| \ RIG_LEVEL_RAWSTR| \ RIG_LEVEL_RFPOWER| \ @@ -158,17 +160,6 @@ const struct rig_caps id5100_caps = .tuning_steps = { // Rem: no support for changing tuning step - {ID5100_ALL_RX_MODES, kHz(5)}, - {ID5100_ALL_RX_MODES, kHz(6.25)}, - // The 8.33 kHz step is not selectable, depending on the operating band or mode. - {ID5100_ALL_RX_MODES, kHz(8.33)}, - {ID5100_ALL_RX_MODES, kHz(10)}, - {ID5100_ALL_RX_MODES, 12500}, - {ID5100_ALL_RX_MODES, kHz(15)}, - {ID5100_ALL_RX_MODES, kHz(20)}, - {ID5100_ALL_RX_MODES, kHz(25)}, - {ID5100_ALL_RX_MODES, kHz(30)}, - {ID5100_ALL_RX_MODES, kHz(50)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ @@ -214,16 +205,10 @@ const struct rig_caps id5100_caps = .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, + .set_dcs_code = icom_set_dcs_code, + .get_dcs_code = icom_get_dcs_code, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, - .set_dcs_sql = icom_set_dcs_code, - .get_dcs_sql = icom_get_dcs_code, - - .set_split_vfo = icom_set_split_vfo, - .get_split_vfo = icom_get_split_vfo, - .set_split_freq = icom_set_split_freq, - .get_split_freq = icom_get_split_freq, - .set_split_mode = icom_set_split_mode, - .get_split_mode = icom_get_split_mode, - + .set_dcs_sql = icom_set_dcs_sql, + .get_dcs_sql = icom_get_dcs_sql, }; diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 740b2748c..856b6e2ce 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -875,14 +875,14 @@ typedef uint64_t setting_t; #ifndef SWIGLUA /* Hide the top 32 bits from the Lua binding as they can't be represented */ #define RIG_FUNC_NB2 CONSTANT_64BIT_FLAG (32) /*!< \c NB2 -- 2nd Noise Blanker */ -#define RIG_FUNC_DSQL CONSTANT_64BIT_FLAG (33) /*!< \c DSQL -- DCS Squelch setting */ +#define RIG_FUNC_CSQL CONSTANT_64BIT_FLAG (33) /*!< \c CSQL -- DCS Squelch setting */ #define RIG_FUNC_AFLT CONSTANT_64BIT_FLAG (34) /*!< \c AFLT -- AF Filter setting */ #define RIG_FUNC_ANL CONSTANT_64BIT_FLAG (35) /*!< \c ANL -- Noise limiter setting */ #define RIG_FUNC_BC2 CONSTANT_64BIT_FLAG (36) /*!< \c BC2 -- 2nd Beat Cancel */ #define RIG_FUNC_DUAL_WATCH CONSTANT_64BIT_FLAG (37) /*!< \c DUAL_WATCH -- Dual Watch / Sub Receiver */ #define RIG_FUNC_DIVERSITY CONSTANT_64BIT_FLAG (38) /*!< \c DIVERSITY -- Diversity receive */ -#define RIG_FUNC_BIT39 CONSTANT_64BIT_FLAG (39) /* available for future RIG_FUNC items */ -#define RIG_FUNC_BIT40 CONSTANT_64BIT_FLAG (40) /* available for future RIG_FUNC items */ +#define RIG_FUNC_DSQL CONSTANT_64BIT_FLAG (39) /*!< \c DSQL -- Digital modes squelch */ +#define RIG_FUNC_SCEN CONSTANT_64BIT_FLAG (40) /*!< \c SCEN -- scrambler/encryption */ #define RIG_FUNC_BIT41 CONSTANT_64BIT_FLAG (41) /* available for future RIG_FUNC items */ #define RIG_FUNC_BIT42 CONSTANT_64BIT_FLAG (42) /* available for future RIG_FUNC items */ #define RIG_FUNC_BIT43 CONSTANT_64BIT_FLAG (43) /* available for future RIG_FUNC items */ diff --git a/include/hamlib/riglist.h b/include/hamlib/riglist.h index bc7c126b7..592381c42 100644 --- a/include/hamlib/riglist.h +++ b/include/hamlib/riglist.h @@ -241,7 +241,10 @@ #define RIG_MODEL_ICR8600 RIG_MAKE_MODEL(RIG_ICOM, 79) #define RIG_MODEL_ICR30 RIG_MAKE_MODEL(RIG_ICOM, 80) #define RIG_MODEL_IC9700 RIG_MAKE_MODEL(RIG_ICOM, 81) -/* next one is 82 */ +#define RIG_MODEL_ID4100 RIG_MAKE_MODEL(RIG_ICOM, 82) +#define RIG_MODEL_ID31 RIG_MAKE_MODEL(RIG_ICOM, 83) +#define RIG_MODEL_ID51 RIG_MAKE_MODEL(RIG_ICOM, 84) +/* next one is 85 */ /* diff --git a/src/misc.c b/src/misc.c index 480a98240..3ea9e8925 100644 --- a/src/misc.c +++ b/src/misc.c @@ -529,6 +529,8 @@ static struct { RIG_FUNC_BC2, "BC2" }, { RIG_FUNC_DUAL_WATCH, "DUAL_WATCH"}, { RIG_FUNC_DIVERSITY, "DIVERSITY"}, + { RIG_FUNC_CSQL, "CSQL" }, + { RIG_FUNC_SCEN, "SCEN" }, { RIG_FUNC_NONE, "" }, };