diff --git a/icom/Makefile.am b/icom/Makefile.am index 3be4574dc..fc1160b82 100644 --- a/icom/Makefile.am +++ b/icom/Makefile.am @@ -4,7 +4,7 @@ ICOMSRC = ic706.c icr8500.c ic735.c ic775.c ic756.c \ os535.c os456.c omni.c delta2.c ic92d.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 icr6.c icr71.c icr72.c icr75.c icrx7.c icr8600.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 \ ic707.c ic728.c ic751.c ic761.c \ ic78.c ic7800.c ic785x.c \ diff --git a/icom/frame.c b/icom/frame.c index c6d3a3320..a7d57d40b 100644 --- a/icom/frame.c +++ b/icom/frame.c @@ -326,6 +326,7 @@ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width, switch (mode) { case RIG_MODE_AM: icmode = S_AM; break; + case RIG_MODE_AMN: icmode = S_AMN; break; case RIG_MODE_AMS: icmode = S_AMS; break; case RIG_MODE_CW: icmode = S_CW; break; case RIG_MODE_CWR: icmode = S_CWR; break; @@ -335,6 +336,12 @@ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width, case RIG_MODE_RTTYR: icmode = S_RTTYR; break; case RIG_MODE_FM: icmode = S_FM; break; case RIG_MODE_WFM: icmode = S_WFM; break; + case RIG_MODE_P25: icmode = S_P25; break; + case RIG_MODE_DSTAR: icmode = S_DSTAR; break; + case RIG_MODE_DPMR: icmode = S_DPMR; break; + case RIG_MODE_NXDNVN: icmode = S_NXDNVN; break; + case RIG_MODE_NXDN_N: icmode = S_NXDN_N; break; + case RIG_MODE_DCR: icmode = S_DCR; break; default: rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Hamlib mode %d\n",mode); return -RIG_EINVAL; diff --git a/icom/icom.c b/icom/icom.c index 3ebbe5b2c..d23391a29 100644 --- a/icom/icom.c +++ b/icom/icom.c @@ -379,6 +379,7 @@ static const struct icom_addr icom_addr_list[] = { { RIG_MODEL_PERSEUS, 0xE1 }, { RIG_MODEL_X108G, 0x70 }, { RIG_MODEL_ICR8600, 0x96 }, + { RIG_MODEL_ICR30, 0x9c }, { RIG_MODEL_NONE, 0 }, }; @@ -742,7 +743,7 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) unsigned char icmode; signed char icmode_ext; int ack_len=sizeof(ackbuf), retval, err; - + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; @@ -3930,6 +3931,7 @@ DECLARE_INITRIG_BACKEND(icom) rig_register(&icr6_caps); rig_register(&icr10_caps); rig_register(&icr20_caps); + rig_register(&icr30_caps); rig_register(&icr71_caps); rig_register(&icr72_caps); rig_register(&icr75_caps); diff --git a/icom/icom.h b/icom/icom.h index 1920086c3..176dfc7fa 100644 --- a/icom/icom.h +++ b/icom/icom.h @@ -282,5 +282,6 @@ extern const struct rig_caps perseus_caps; extern const struct rig_caps x108g_caps; extern const struct rig_caps icr8600_caps; +extern const struct rig_caps icr30_caps; #endif /* _ICOM_H */ diff --git a/icom/icom_defs.h b/icom/icom_defs.h index bc34c88a9..8c364207e 100644 --- a/icom/icom_defs.h +++ b/icom/icom_defs.h @@ -106,6 +106,7 @@ #define S_LSB 0x00 /* Set to LSB */ #define S_USB 0x01 /* Set to USB */ #define S_AM 0x02 /* Set to AM */ +#define S_AMN 0x02 /* Set to AM-N */ #define S_CW 0x03 /* Set to CW */ #define S_RTTY 0x04 /* Set to RTTY */ #define S_FM 0x05 /* Set to FM */ @@ -115,6 +116,14 @@ #define S_AMS 0x11 /* Set to AMS */ #define S_PSK 0x12 /* 7800 PSK USB */ #define S_PSKR 0x13 /* 7800 PSK LSB */ +#define S_SAML 0x14 /* Set to AMS-L */ +#define S_SAMU 0x15 /* Set to AMS-U */ +#define S_P25 0x16 /* Set to P25 */ +#define S_DSTAR 0x17 /* Set to D-STAR */ +#define S_DPMR 0x18 /* Set to dPMR */ +#define S_NXDNVN 0x19 /* Set to NXDN_VN */ +#define S_NXDN_N 0x20 /* Set to NXDN-N */ +#define S_DCR 0x21 /* Set to DCR */ #define S_R7000_SSB 0x05 /* Set to SSB on R-7000 */ diff --git a/icom/icr30.c b/icom/icr30.c new file mode 100644 index 000000000..6770f3bc0 --- /dev/null +++ b/icom/icr30.c @@ -0,0 +1,172 @@ +/* + * Hamlib CI-V backend - description of IC-R30 + * Copyright (c) 2018 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 "icom.h" +#include "idx_builtin.h" + +#define ICR30_MODES (RIG_MODE_LSB|RIG_MODE_USB|RIG_MODE_AM|RIG_MODE_AMN|RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_FM|RIG_MODE_WFM|RIG_MODE_CWR|\ + 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_TSQL|RIG_FUNC_VSC) + +#define ICR30_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) + +#define ICR30_VFO_ALL (RIG_VFO_A) + +#define ICR30_VFO_OPS (RIG_OP_NONE) +#define ICR30_SCAN_OPS (RIG_SCAN_NONE) + +#define ICR30_STR_CAL { 2, \ + { \ + { 0, -60 }, /* S0 */ \ + { 255, 60 } /* +60 */ \ + } } + +static const struct icom_priv_caps icr30_priv_caps = { + 0x9c, /* default address */ + 0, /* 731 mode */ + 0, /* no XCHG */ + r8500_ts_sc_list /* wrong, but don't have set_ts anyway */ +}; + +const struct rig_caps icr30_caps = { +.rig_model = RIG_MODEL_ICR30, +.model_name = "IC-R30", +.mfg_name = "Icom", +.version = BACKEND_VER, +.copyright = "LGPL", +.status = RIG_STATUS_ALPHA, +.rig_type = RIG_TYPE_RECEIVER|RIG_FLAG_HANDHELD, +.ptt_type = RIG_PTT_NONE, +.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 = ICR30_FUNC_ALL, +.has_set_func = ICR30_FUNC_ALL, +.has_get_level = ICR30_LEVEL_ALL, +.has_set_level = RIG_LEVEL_SET(ICR30_LEVEL_ALL), +.has_get_parm = RIG_PARM_NONE, +.has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ +.level_gran = { + [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, +}, +.parm_gran = {}, +.ctcss_list = NULL, +.dcs_list = NULL, +.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 = ICR30_VFO_OPS, +.scan_ops = ICR30_SCAN_OPS, +.transceive = RIG_TRN_RIG, +.bank_qty = 0, +.chan_desc_sz = 0, + +.chan_list = { + { 1, 999, RIG_MTYPE_MEM }, /* TBC */ + { 1000, 1199, RIG_MTYPE_MEM }, /* auto-write */ + { 1200, 1299, RIG_MTYPE_EDGE }, /* two by two */ + RIG_CHAN_END, + }, + +.rx_range_list1 = { /* Other countries but France */ + {kHz(100),GHz(3.3049999),ICR30_MODES,-1,-1,ICR30_VFO_ALL}, + RIG_FRNG_END, }, +.tx_range_list1 = { RIG_FRNG_END, }, + +.rx_range_list2 = { /* USA */ + {kHz(100),MHz(821.995),ICR30_MODES,-1,-1,ICR30_VFO_ALL}, + {MHz(851),MHz(866.995),ICR30_MODES,-1,-1,ICR30_VFO_ALL}, + {MHz(896),GHz(3.3049999),ICR30_MODES,-1,-1,ICR30_VFO_ALL}, + RIG_FRNG_END, }, +.tx_range_list2 = { RIG_FRNG_END, }, + +.tuning_steps = { + {ICR30_MODES,Hz(5000)}, + {ICR30_MODES,Hz(6250)}, + {ICR30_MODES,Hz(10000)}, + {ICR30_MODES,Hz(12500)}, + {ICR30_MODES,kHz(15)}, + {ICR30_MODES,kHz(20)}, + {ICR30_MODES,kHz(25)}, + {ICR30_MODES,kHz(30)}, + {ICR30_MODES,kHz(50)}, + {ICR30_MODES,kHz(100)}, + /* Air band only */ + {ICR30_MODES,Hz(8330)}, + /* AM broadcast band only */ + {ICR30_MODES,Hz(9000)}, + RIG_TS_END, + }, + /* mode/filter list, remember: order matters! */ +.filters = { + {RIG_MODE_AM|RIG_MODE_FM, kHz(12)}, + {RIG_MODE_WFM, kHz(150)}, + RIG_FLT_END, + }, +.str_cal = ICR30_STR_CAL, + +.cfgparams = icom_cfg_params, +.set_conf = icom_set_conf, +.get_conf = icom_get_conf, + +.priv = (void*)&icr30_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_ant = icom_set_ant, +.get_ant = icom_get_ant, +.decode_event = icom_decode_event, +.set_level = icom_set_level, +.get_level = icom_get_level, +.set_func = icom_set_func, +.get_func = icom_get_func, +.get_dcd = icom_get_dcd, +.set_ctcss_sql = icom_set_ctcss_sql, +.get_ctcss_sql = icom_get_ctcss_sql, +.set_dcs_code = icom_set_dcs_code, +.get_dcs_code = icom_get_dcs_code, +}; diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 3b6be3cce..95b48030b 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -908,7 +908,7 @@ typedef unsigned long long rmode_t; #define RIG_MODE_NXDNVN (1ULL << 26) /*!< \c NXDN-VN -- VHF,UHF digital mode IC-R8600 */ #define RIG_MODE_NXDN_N (1ULL << 27) /*!< \c NXDN-N -- VHF,UHF digital mode IC-R8600 */ #define RIG_MODE_DCR (1ULL << 28) /*!< \c DCR -- VHF,UHF digital mode IC-R8600 */ -#define RIG_MODE_BIT29 (1ULL << 29) /* reserved for future expansion */ +#define RIG_MODE_AMN (1ULL << 29) /*!< \c AM-N -- Narrow band AM mode IC-R30 */ #define RIG_MODE_BIT30 (1ULL << 30) /* reserved for future expansion */ #define RIG_MODE_BIT31 (1ULL << 31) /* reserved for future expansion */ #define RIG_MODE_BIT32 (1ULL << 32) /* reserved for future expansion */ @@ -942,8 +942,7 @@ typedef unsigned long long rmode_t; #define RIG_MODE_BIT60 (1ULL << 60) /* reserved for future expansion */ #define RIG_MODE_BIT61 (1ULL << 61) /* reserved for future expansion */ #define RIG_MODE_BIT62 (1ULL << 62) /* reserved for future expansion */ -#define RIG_MODE_TESTS_MAX (1ULL << 63) /*!< \c last bit available for 64-bit enum MUST ALWAYS BE LAST, Max Count for dumpcaps.c */ - +#define RIG_MODE_TESTS_MAX (1ULL << 63) /*!< \c last bit available for 64-bit enum MUST ALWAYS BE LAST, Max Count for dumpcaps.c */ /** * \brief macro for backends, not to be used by rig_set_mode et al. diff --git a/include/hamlib/riglist.h b/include/hamlib/riglist.h index 8d323add2..a1f1a8673 100644 --- a/include/hamlib/riglist.h +++ b/include/hamlib/riglist.h @@ -231,7 +231,8 @@ #define RIG_MODEL_ICR6 RIG_MAKE_MODEL(RIG_ICOM, 77) #define RIG_MODEL_IC7610 RIG_MAKE_MODEL(RIG_ICOM, 78) #define RIG_MODEL_ICR8600 RIG_MAKE_MODEL(RIG_ICOM, 79) -/* next one is 80 */ +#define RIG_MODEL_ICR30 RIG_MAKE_MODEL(RIG_ICOM, 80) +/* next one is 81 */ /* diff --git a/src/misc.c b/src/misc.c index 77c46f12d..51140abcd 100644 --- a/src/misc.c +++ b/src/misc.c @@ -334,6 +334,13 @@ static struct { RIG_MODE_SAL, "SAL" }, { RIG_MODE_SAH, "SAH" }, { RIG_MODE_DSB, "DSB"}, + { RIG_MODE_AMN, "AM-N"}, + { RIG_MODE_P25, "P25"}, + { RIG_MODE_DSTAR, "D-STAR"}, + { RIG_MODE_DPMR, "dPMR"}, + { RIG_MODE_NXDNVN, "NXDN-VN"}, + { RIG_MODE_NXDN_N, "NXDN-N"}, + { RIG_MODE_DCR, "DCR"}, { RIG_MODE_NONE, "" }, };