From 468384fc6868e32349e2f0cd25c0d1d2aa51ff37 Mon Sep 17 00:00:00 2001 From: Francois Retief Date: Thu, 28 Feb 2002 10:59:46 +0000 Subject: [PATCH] Added IC-910 rig. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@979 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- icom/Makefile.am | 2 +- icom/Makefile.in | 10 ++- icom/ic910.c | 217 +++++++++++++++++++++++++++++++++++++++++++++ icom/icom.c | 223 ++++++++++++++++++++++++++++++----------------- icom/icom.h | 6 +- icom/icom_defs.h | 16 +++- 6 files changed, 387 insertions(+), 87 deletions(-) create mode 100644 icom/ic910.c diff --git a/icom/Makefile.am b/icom/Makefile.am index b21f57583..335104be6 100644 --- a/icom/Makefile.am +++ b/icom/Makefile.am @@ -1,5 +1,5 @@ ICOMSRCLIST = ic706.c icr8500.c ic735.c ic775.c ic756.c icall.c \ - ic275.c ic475.c ic821h.c icr7000.c + ic275.c ic475.c ic821h.c icr7000.c ic910.c lib_LTLIBRARIES = libhamlib-icom.la libhamlib_icom_la_SOURCES = $(ICOMSRCLIST) icom.c frame.c diff --git a/icom/Makefile.in b/icom/Makefile.in index 341541130..41273bed9 100644 --- a/icom/Makefile.in +++ b/icom/Makefile.in @@ -104,7 +104,7 @@ hamlibdocdir = @hamlibdocdir@ install_sh = @install_sh@ ICOMSRCLIST = ic706.c icr8500.c ic735.c ic775.c ic756.c icall.c \ - ic275.c ic475.c ic821h.c icr7000.c + ic275.c ic475.c ic821h.c icr7000.c ic910.c lib_LTLIBRARIES = libhamlib-icom.la @@ -122,7 +122,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES) libhamlib_icom_la_DEPENDENCIES = ../src/libhamlib.la am_libhamlib_icom_la_OBJECTS = ic706.lo icr8500.lo ic735.lo ic775.lo \ ic756.lo icall.lo ic275.lo ic475.lo ic821h.lo icr7000.lo \ - icom.lo frame.lo + ic910.lo icom.lo frame.lo libhamlib_icom_la_OBJECTS = $(am_libhamlib_icom_la_OBJECTS) DEFS = @DEFS@ @@ -135,8 +135,9 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp @AMDEP_TRUE@ $(DEPDIR)/ic475.Plo $(DEPDIR)/ic706.Plo \ @AMDEP_TRUE@ $(DEPDIR)/ic735.Plo $(DEPDIR)/ic756.Plo \ @AMDEP_TRUE@ $(DEPDIR)/ic775.Plo $(DEPDIR)/ic821h.Plo \ -@AMDEP_TRUE@ $(DEPDIR)/icall.Plo $(DEPDIR)/icom.Plo \ -@AMDEP_TRUE@ $(DEPDIR)/icr7000.Plo $(DEPDIR)/icr8500.Plo +@AMDEP_TRUE@ $(DEPDIR)/ic910.Plo $(DEPDIR)/icall.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/icom.Plo $(DEPDIR)/icr7000.Plo \ +@AMDEP_TRUE@ $(DEPDIR)/icr8500.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ @@ -207,6 +208,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ic756.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ic775.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ic821h.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ic910.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/icall.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/icom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/icr7000.Plo@am__quote@ diff --git a/icom/ic910.c b/icom/ic910.c new file mode 100644 index 000000000..8e89297b1 --- /dev/null +++ b/icom/ic910.c @@ -0,0 +1,217 @@ +/* + * Hamlib CI-V backend - description of IC-910 (VHF/UHF All-Mode Tranceiver) + * Contributed by Francois Retief + * Copyright (c) 2000,2001 by Stephane Fillod + * + * $Id: ic910.c,v 1.1 2002-02-28 10:59:46 fgretief Exp $ + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "icom.h" + +int ic910_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) +{ + /* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */ + if (mode == RIG_MODE_FM) { + mode = RIG_MODE_RTTY; + } + return icom_set_mode(rig, vfo, mode, width); +} + +int ic910_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) +{ + /* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */ + int retval = icom_get_mode(rig, vfo, mode, width); + if (*mode == RIG_MODE_RTTY) { + *mode = RIG_MODE_FM; + } + return retval; +} + +#define IC910_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_FM) + +#define IC910_VFO_ALL (RIG_VFO_A|RIG_VFO_C) + +#define IC910_SCAN_OPS (RIG_SCAN_MEM) + +#define IC910_VFO_OPS (RIG_OP_FROM_VFO| \ + RIG_OP_TO_VFO| \ + RIG_OP_CPY| \ + RIG_OP_MCL) + +#define IC910_FUNC_ALL (RIG_FUNC_FAGC| \ + RIG_FUNC_NB| \ + RIG_FUNC_NR| \ + RIG_FUNC_ANF| \ + RIG_FUNC_TONE| \ + RIG_FUNC_TSQL| \ + RIG_FUNC_COMP| \ + RIG_FUNC_VOX| \ + RIG_FUNC_FBKIN| \ + RIG_FUNC_AFC| \ + RIG_FUNC_SATMODE| \ + RIG_FUNC_SCOPE) + +#define IC910_LEVEL_ALL (RIG_LEVEL_AF| \ + RIG_LEVEL_RF| \ + RIG_LEVEL_SQL| \ + RIG_LEVEL_IF| \ + RIG_LEVEL_NR| \ + RIG_LEVEL_CWPITCH| \ + RIG_LEVEL_RFPOWER| \ + RIG_LEVEL_MICGAIN| \ + RIG_LEVEL_KEYSPD| \ + RIG_LEVEL_COMP| \ + RIG_LEVEL_VOXGAIN| \ + RIG_LEVEL_VOXDELAY| \ + RIG_LEVEL_ANTIVOX| \ + RIG_LEVEL_ATT) + +#define IC910_STR_CAL { 0, { } } +/* + */ +static const struct icom_priv_caps ic910_priv_caps = { + 0x60, /* default address */ + 1, /* 731 mode */ + ic910_ts_sc_list, + IC910_STR_CAL +}; + +const struct rig_caps ic910_caps = { +rig_model: RIG_MODEL_IC910, +model_name:"IC-910", +mfg_name: "Icom", +version: "0.1", +copyright: "LGPL", +status: RIG_STATUS_ALPHA, +rig_type: RIG_TYPE_TRANSCEIVER, +ptt_type: RIG_PTT_NONE, +dcd_type: RIG_DCD_NONE, +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: 200, +retry: 3, +has_get_func: IC910_FUNC_ALL, +has_set_func: IC910_FUNC_ALL, +has_get_level: IC910_LEVEL_ALL | (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH), +has_set_level: IC910_LEVEL_ALL, +has_get_parm: RIG_PARM_NONE, +has_set_parm: RIG_PARM_NONE, +level_gran: {}, +parm_gran: {}, +ctcss_list: NULL, +dcs_list: NULL, +preamp: { RIG_DBLST_END, }, +attenuator: { RIG_DBLST_END, }, +max_rit: Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ +max_xit: Hz(0), +max_ifshift: Hz(0), /* 1.2kHz manual knob */ +targetable_vfo: 0, +vfo_ops: IC910_VFO_OPS, +scan_ops: IC910_SCAN_OPS, +transceive: RIG_TRN_RIG, +bank_qty: 0, +chan_desc_sz: 0, + +chan_list: { + { 1, 99, RIG_MTYPE_MEM, 0 }, + { 100, 105, RIG_MTYPE_EDGE, 0 }, + { 106, 106, RIG_MTYPE_CALL, 0 }, + RIG_CHAN_END, }, + +rx_range_list1: { /* USA */ + {MHz(144),MHz(148),IC910_MODES,-1,-1,IC910_VFO_ALL}, + {MHz(430),MHz(450),IC910_MODES,-1,-1,IC910_VFO_ALL}, + RIG_FRNG_END, }, +tx_range_list1: { + {MHz(144),MHz(148),IC910_MODES,W(5),W(100),IC910_VFO_ALL}, + {MHz(430),MHz(450),IC910_MODES,W(5),W(75),IC910_VFO_ALL}, + RIG_FRNG_END, }, + +rx_range_list2: { /* Europe */ + {MHz(144),MHz(146),IC910_MODES,-1,-1,IC910_VFO_ALL}, + {MHz(430),MHz(440),IC910_MODES,-1,-1,IC910_VFO_ALL}, + RIG_FRNG_END, }, +tx_range_list2: { + {MHz(144),MHz(146),IC910_MODES,W(5),W(100),IC910_VFO_ALL}, + {MHz(430),MHz(440),IC910_MODES,W(5),W(75),IC910_VFO_ALL}, + RIG_FRNG_END, }, + +tuning_steps: { + {RIG_MODE_SSB|RIG_MODE_CW,1}, + {RIG_MODE_SSB|RIG_MODE_CW,10}, + {RIG_MODE_SSB|RIG_MODE_CW,50}, + {RIG_MODE_SSB|RIG_MODE_CW,100}, + {RIG_MODE_FM,kHz(0.1)}, + {RIG_MODE_FM,kHz(5)}, + {RIG_MODE_FM,kHz(6.25)}, + {RIG_MODE_FM,kHz(10)}, + {RIG_MODE_FM,kHz(12.5)}, + {RIG_MODE_FM,kHz(20)}, + {RIG_MODE_FM,kHz(25)}, + {RIG_MODE_FM,kHz(100)}, + RIG_TS_END, }, + /* mode/filter list, remember: order matters! */ +filters: { + {RIG_MODE_CW|RIG_MODE_SSB, kHz(2.3)}, /* buildin */ + {RIG_MODE_FM, kHz(15)}, /* buildin */ + RIG_FLT_END, }, + +priv: (void*)&ic910_priv_caps, +rig_init: icom_init, +rig_cleanup: icom_cleanup, +rig_open: NULL, +rig_close: NULL, + +cfgparams: icom_cfg_params, +set_conf: icom_set_conf, +get_conf: icom_get_conf, + +get_freq: icom_get_freq, +set_freq: icom_set_freq, +get_mode: ic910_get_mode, +set_mode: ic910_set_mode, +get_vfo: NULL, +set_vfo: icom_set_vfo, +get_ts: icom_get_ts, +set_ts: icom_set_ts, +get_channel: icom_get_channel, +set_channel: icom_set_channel, +get_func: icom_get_func, +set_func: icom_set_func, +get_level: icom_get_level, +set_level: icom_set_level, + +set_mem: icom_set_mem, +vfo_op: icom_vfo_op, +scan: icom_scan, +decode_event: icom_decode_event, +}; + +/* end of file */ diff --git a/icom/icom.c b/icom/icom.c index 72c010770..c67352f26 100644 --- a/icom/icom.c +++ b/icom/icom.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - main file * Copyright (c) 2000,2001,2002 by Stephane Fillod * - * $Id: icom.c,v 1.50 2002-02-27 23:17:17 fillods Exp $ + * $Id: icom.c,v 1.51 2002-02-28 10:59:46 fgretief Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -156,7 +156,21 @@ const struct ts_sc_list ic706_ts_sc_list[] = { { 0, 0 }, }; - +const struct ts_sc_list ic910_ts_sc_list[] = { + { Hz(1), 0x00 }, + { Hz(10), 0x01 }, + { Hz(50), 0x02 }, + { Hz(100), 0x03 }, + { kHz(1), 0x04 }, + { kHz(5), 0x05 }, + { kHz(6.25), 0x06 }, + { kHz(10), 0x07 }, + { kHz(12.5), 0x08 }, + { kHz(20), 0x09 }, + { kHz(25), 0x10 }, + { kHz(100), 0x11 }, + { 0, 0 }, +}; struct icom_addr { rig_model_t model; @@ -168,11 +182,11 @@ struct icom_addr { #define TOK_MODE731 TOKEN_BACKEND(2) const struct confparams icom_cfg_params[] = { - { TOK_CIVADDR, "civaddr", "CI-V address", "Transceiver's CI-V address", + { TOK_CIVADDR, "civaddr", "CI-V address", "Transceiver's CI-V address", "0", RIG_CONF_NUMERIC, { n: { 0, 0xff, 1 } } }, { TOK_MODE731, "mode731", "CI-V 731 mode", "CI-V operating frequency " - "data length, needed for IC731 and IC735", + "data length, needed for IC731 and IC735", "0", RIG_CONF_CHECKBUTTON }, { RIG_CONF_END, NULL, } @@ -239,7 +253,7 @@ static const struct icom_addr icom_addr_list[] = { * This is a generic icom_init function. * You might want to define yours, so you can customize it for your rig * - * Basically, it sets up *priv + * Basically, it sets up *priv * REM: serial port is already open (rig->state.rigport.fd) */ int icom_init(RIG *rig) @@ -269,7 +283,7 @@ int icom_init(RIG *rig) /* TODO: CI-V address should be customizable */ /* - * init the priv_data from static struct + * init the priv_data from static struct * + override with preferences */ @@ -315,12 +329,12 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) freq_len = priv->civ_731_mode ? 4:5; - /* + /* * to_bcd requires nibble len */ to_bcd(freqbuf, freq, freq_len*2); - retval = icom_transaction (rig, C_SET_FREQ, -1, freqbuf, freq_len, + retval = icom_transaction (rig, C_SET_FREQ, -1, freqbuf, freq_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -349,7 +363,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - retval = icom_transaction (rig, C_RD_FREQ, -1, NULL, 0, + retval = icom_transaction (rig, C_RD_FREQ, -1, NULL, 0, freqbuf, &freq_len); if (retval != RIG_OK) return retval; @@ -378,7 +392,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) return -RIG_ERJCTED; } - /* + /* * from_bcd requires nibble len */ *freq = from_bcd(freqbuf+1, freq_len*2); @@ -403,7 +417,7 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) icmode = rig2icom_mode(rig, mode,width); icmode_ext[0] = (icmode>>8) & 0xff; - retval = icom_transaction (rig, C_SET_MODE, icmode & 0xff, icmode_ext, + retval = icom_transaction (rig, C_SET_MODE, icmode & 0xff, icmode_ext, icmode_ext[0]?1:0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -435,7 +449,7 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - retval = icom_transaction (rig, C_RD_MODE, -1, NULL, 0, + retval = icom_transaction (rig, C_RD_MODE, -1, NULL, 0, modebuf, &mode_len); if (retval != RIG_OK) return retval; @@ -474,8 +488,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) case RIG_VFO_B: icvfo = S_VFOB; break; case RIG_VFO_MAIN: icvfo = S_MAIN; break; case RIG_VFO_SUB: icvfo = S_SUB; break; - case RIG_VFO_VFO: - retval = icom_transaction (rig, C_SET_VFO, -1, NULL, 0, + case RIG_VFO_VFO: + retval = icom_transaction (rig, C_SET_VFO, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -485,8 +499,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) return -RIG_ERJCTED; } return RIG_OK; - case RIG_VFO_MEM: - retval = icom_transaction (rig, C_SET_MEM, -1, NULL, 0, + case RIG_VFO_MEM: + retval = icom_transaction (rig, C_SET_MEM, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -501,7 +515,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) vfo); return -RIG_EINVAL; } - retval = icom_transaction (rig, C_SET_VFO, icvfo, NULL, 0, + retval = icom_transaction (rig, C_SET_VFO, icvfo, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -541,7 +555,7 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) else icom_val = val.i; - /* + /* * Most of the time, the data field is a 3 digit BCD, * but in *big endian* order: 0000..0255 * (from_bcd is little endian) @@ -566,7 +580,7 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) break; } if (i==MAXDBLSTSIZ || rs->preamp[i] == 0) { - rig_debug(RIG_DEBUG_ERR,"Unsupported preamp set_level %ddB", + rig_debug(RIG_DEBUG_ERR,"Unsupported preamp set_level %ddB", val.i); return -RIG_EINVAL; } @@ -645,13 +659,24 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_BALANCE; break; - + case RIG_LEVEL_VOXGAIN: /* IC-910H */ + lvl_cn = C_CTL_MEM; + lvl_sc = S_MEM_VOXGAIN; + break; + case RIG_LEVEL_VOXDELAY: /* IC-910H */ + lvl_cn = C_CTL_MEM; + lvl_sc = S_MEM_VOXDELAY; + break; + case RIG_LEVEL_ANTIVOX: /* IC-910H */ + lvl_cn = C_CTL_MEM; + lvl_sc = S_MEM_ANTIVOX; + break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d", level); return -RIG_EINVAL; } - retval = icom_transaction (rig, lvl_cn, lvl_sc, lvlbuf, lvl_len, + retval = icom_transaction (rig, lvl_cn, lvl_sc, lvlbuf, lvl_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -773,13 +798,24 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_BALANCE; break; - + case RIG_LEVEL_VOXGAIN: /* IC-910H */ + lvl_cn = C_CTL_MEM; + lvl_sc = S_MEM_VOXGAIN; + break; + case RIG_LEVEL_VOXDELAY: /* IC-910H */ + lvl_cn = C_CTL_MEM; + lvl_sc = S_MEM_VOXDELAY; + break; + case RIG_LEVEL_ANTIVOX: /* IC-910H */ + lvl_cn = C_CTL_MEM; + lvl_sc = S_MEM_ANTIVOX; + break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level); return -RIG_EINVAL; } - retval = icom_transaction (rig, lvl_cn, lvl_sc, NULL, 0, + retval = icom_transaction (rig, lvl_cn, lvl_sc, NULL, 0, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; @@ -796,7 +832,7 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return -RIG_ERJCTED; } - /* + /* * The result is a 3 digit BCD, but in *big endian* order: 0000..0255 * (from_bcd is little endian) */ @@ -810,7 +846,7 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_SQLSTAT: /* * 0x00=sql closed, 0x01=sql open - */ + */ val->i = icom_val; break; @@ -820,7 +856,7 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; } if (icom_val > MAXDBLSTSIZ || rs->preamp[icom_val-1]==0) { - rig_debug(RIG_DEBUG_ERR,"Unsupported preamp get_level %ddB", + rig_debug(RIG_DEBUG_ERR,"Unsupported preamp get_level %ddB", icom_val); return -RIG_EPROTO; } @@ -834,7 +870,7 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) val->i = icom_val; } - rig_debug(RIG_DEBUG_VERBOSE,"get_level: %d %d %d %f\n", lvl_len, + rig_debug(RIG_DEBUG_VERBOSE,"get_level: %d %d %d %f\n", lvl_len, icom_val, val->i, val->f); return RIG_OK; @@ -910,7 +946,7 @@ int icom_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) ptt_sc = ptt == RIG_PTT_ON ? S_PTT_ON:S_PTT_OFF; - retval = icom_transaction (rig, C_CTL_PTT, ptt_sc, NULL, 0, + retval = icom_transaction (rig, C_CTL_PTT, ptt_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -938,7 +974,7 @@ int icom_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - retval = icom_transaction (rig, C_CTL_PTT, -1, NULL, 0, + retval = icom_transaction (rig, C_CTL_PTT, -1, NULL, 0, pttbuf, &ptt_len); if (retval != RIG_OK) return retval; @@ -973,7 +1009,7 @@ int icom_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - retval = icom_transaction (rig, C_RD_SQSM, S_SQL, NULL, 0, + retval = icom_transaction (rig, C_RD_SQSM, S_SQL, NULL, 0, dcdbuf, &dcd_len); if (retval != RIG_OK) return retval; @@ -988,7 +1024,7 @@ int icom_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) return -RIG_ERJCTED; } - /* + /* * The result is a 3 digit BCD, but in *big endian* order: 0000..0255 * (from_bcd is little endian) */ @@ -997,7 +1033,7 @@ int icom_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) * 0x00=sql closed, 0x01=sql open * * TODO: replace icom_val by dcdbuf[2] ? - */ + */ *dcd = (icom_val==0x01) ? RIG_DCD_ON : RIG_DCD_OFF; return RIG_OK; @@ -1032,7 +1068,7 @@ int icom_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) return -RIG_EINVAL; } - retval = icom_transaction (rig, C_CTL_SPLT, rptr_sc, NULL, 0, + retval = icom_transaction (rig, C_CTL_SPLT, rptr_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1062,7 +1098,7 @@ int icom_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - retval = icom_transaction (rig, C_CTL_SPLT, -1, NULL, 0, + retval = icom_transaction (rig, C_CTL_SPLT, -1, NULL, 0, rptrbuf, &rptr_len); if (retval != RIG_OK) return retval; @@ -1110,11 +1146,11 @@ int icom_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) priv = (struct icom_priv_data*)rs->priv; /* - * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF + * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF */ to_bcd(offsbuf, rptr_offs/100, OFFS_LEN*2); - retval = icom_transaction (rig, C_SET_OFFS, -1, offsbuf, OFFS_LEN, + retval = icom_transaction (rig, C_SET_OFFS, -1, offsbuf, OFFS_LEN, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1143,7 +1179,7 @@ int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - retval = icom_transaction (rig, C_RD_OFFS, -1, NULL, 0, + retval = icom_transaction (rig, C_RD_OFFS, -1, NULL, 0, offsbuf, &offs_len); if (retval != RIG_OK) return retval; @@ -1159,7 +1195,7 @@ int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) } /* - * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF + * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF */ *rptr_offs = from_bcd(offsbuf+1, offs_len*2)*100; @@ -1169,7 +1205,7 @@ int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) /* * icom_set_split_freq - * Assumes rig!=NULL, rig->state.priv!=NULL, + * Assumes rig!=NULL, rig->state.priv!=NULL, * icom_set_vfo,icom_set_freq works for this rig * FIXME: status */ @@ -1220,7 +1256,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) /* * icom_set_split_mode - * Assumes rig!=NULL, rig->state.priv!=NULL, + * Assumes rig!=NULL, rig->state.priv!=NULL, * icom_set_vfo,icom_set_mode works for this rig * FIXME: status */ @@ -1245,7 +1281,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width /* * icom_get_split_mode - * Assumes rig!=NULL, rig->state.priv!=NULL, + * Assumes rig!=NULL, rig->state.priv!=NULL, * rx_mode!=NULL, rx_width!=NULL, tx_mode!=NULL, tx_width!=NULL * icom_set_vfo,icom_get_mode works for this rig * FIXME: status @@ -1297,7 +1333,7 @@ int icom_set_split(RIG *rig, vfo_t vfo, split_t split) return -RIG_EINVAL; } - retval = icom_transaction (rig, C_CTL_SPLT, split_sc, NULL, 0, + retval = icom_transaction (rig, C_CTL_SPLT, split_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1326,7 +1362,7 @@ int icom_get_split(RIG *rig, vfo_t vfo, split_t *split) rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; - retval = icom_transaction (rig, C_CTL_SPLT, -1, NULL, 0, + retval = icom_transaction (rig, C_CTL_SPLT, -1, NULL, 0, splitbuf, &split_len); if (retval != RIG_OK) return retval; @@ -1379,7 +1415,7 @@ int icom_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) return -RIG_EINVAL; /* not found, unsupported */ } - retval = icom_transaction (rig, C_SET_TS, ts_sc, NULL, 0, + retval = icom_transaction (rig, C_SET_TS, ts_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1507,13 +1543,24 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_RNF; break; - + case RIG_FUNC_AFC: /* IC-910H */ + fct_cn = C_CTL_FUNC; + fct_sc = S_FUNC_AFC; + break; + case RIG_FUNC_SATMODE: /* IC-910H */ + fct_cn = C_CTL_MEM; + fct_sc = S_MEM_SATMODE; + break; + case RIG_FUNC_SCOPE: /* IC-910H */ + fct_cn = C_CTL_MEM; + fct_sc = S_MEM_BANDSCOPE; + break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_func %d", func); return -RIG_EINVAL; } - retval = icom_transaction(rig, fct_cn, fct_sc, fctbuf, fct_len, + retval = icom_transaction(rig, fct_cn, fct_sc, fctbuf, fct_len, ackbuf, &acklen); if (retval != RIG_OK) return retval; @@ -1592,16 +1639,27 @@ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) fct_sc = S_FUNC_MN; break; case RIG_FUNC_RNF: - fct_cn = C_CTL_FUNC; - fct_sc = S_FUNC_RNF; - break; - + fct_cn = C_CTL_FUNC; + fct_sc = S_FUNC_RNF; + break; + case RIG_FUNC_AFC: /* IC-910H */ + fct_cn = C_CTL_FUNC; + fct_sc = S_FUNC_AFC; + break; + case RIG_FUNC_SATMODE: /* IC-910H */ + fct_cn = C_CTL_MEM; + fct_sc = S_MEM_SATMODE; + break; + case RIG_FUNC_SCOPE: /* IC-910H */ + fct_cn = C_CTL_MEM; + fct_sc = S_MEM_BANDSCOPE; + break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_func %d", func); return -RIG_EINVAL; } - retval = icom_transaction (rig, fct_cn, fct_sc, NULL, 0, + retval = icom_transaction (rig, fct_cn, fct_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1637,7 +1695,7 @@ int icom_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) * I don't have documentation for this function, * and I can't experiment (no hardware), so let's guess. * Most probably, it might be the index of the CTCSS subaudible - * tone, and not the tone itself, starting from zero. + * tone, and not the tone itself, starting from zero. * * Something in the range of 00..51, BCD big endian * Please someone let me know if it works this way. --SF @@ -1652,7 +1710,7 @@ int icom_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) tone_len = 1; to_bcd_be(tonebuf, (long long)i, tone_len*2); - retval = icom_transaction(rig, C_SET_TONE, S_TONE_RPTR, + retval = icom_transaction(rig, C_SET_TONE, S_TONE_RPTR, tonebuf, tone_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1683,7 +1741,7 @@ int icom_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) * see icom_set_ctcss for discussion on the untested status! */ - retval = icom_transaction(rig, C_SET_TONE, S_TONE_RPTR, NULL, 0, + retval = icom_transaction(rig, C_SET_TONE, S_TONE_RPTR, NULL, 0, tonebuf, &tone_len); if (retval != RIG_OK) return retval; @@ -1740,7 +1798,7 @@ int icom_set_ctcss_sql(RIG *rig, vfo_t vfo, unsigned int tone) tone_len = 1; to_bcd_be(tonebuf, (long long)i, tone_len*2); - retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL, + retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL, tonebuf, tone_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1771,7 +1829,7 @@ int icom_get_ctcss_sql(RIG *rig, vfo_t vfo, unsigned int *tone) * see icom_set_ctcss for discussion on the untested status! */ - retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL, NULL, 0, + retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL, NULL, 0, tonebuf, &tone_len); if (retval != RIG_OK) return retval; @@ -1819,7 +1877,7 @@ int icom_set_channel(RIG *rig, const channel_t *chan) chanbuf[2] = S_MEM_CNTNT_SLCT; freq_len = priv->civ_731_mode ? 4:5; - /* + /* * to_bcd requires nibble len */ to_bcd(chanbuf+3, chan->freq, freq_len*2); @@ -1840,7 +1898,7 @@ int icom_set_channel(RIG *rig, const channel_t *chan) strncpy(chanbuf+chan_len, chan->channel_desc, 8); chan_len += 8; - retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT, + retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT, chanbuf, chan_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1875,7 +1933,7 @@ int icom_get_channel(RIG *rig, channel_t *chan) freq_len = priv->civ_731_mode ? 4:5; - retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT, + retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT, chanbuf, chan_len, chanbuf, &chan_len); if (retval != RIG_OK) return retval; @@ -1890,19 +1948,19 @@ int icom_get_channel(RIG *rig, channel_t *chan) return -RIG_ERJCTED; } - /* + /* * from_bcd requires nibble len */ chan->freq = from_bcd(chanbuf+4, freq_len*2); chan_len = 4+freq_len+1; - icom2rig_mode(rig, chanbuf[chan_len] | chanbuf[chan_len+1], + icom2rig_mode(rig, chanbuf[chan_len] | chanbuf[chan_len+1], &chan->mode, &width); chan_len += 2; - chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = + chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = from_bcd_be(chanbuf+chan_len++,2); - chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = + chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = from_bcd_be(chanbuf+chan_len++,2); chan->ant = from_bcd_be(chanbuf+chan_len++,2); strncpy(chan->channel_desc, chanbuf+chan_len, 8); @@ -1923,7 +1981,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) pwr_sc = status==RIG_POWER_ON ? S_PWR_ON:S_PWR_OFF; - retval = icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, + retval = icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1946,7 +2004,7 @@ int icom_get_powerstat(RIG *rig, powerstat_t *status) unsigned char ackbuf[16]; int ack_len, retval; - retval = icom_transaction(rig, C_SET_PWR, -1, NULL, 0, + retval = icom_transaction(rig, C_SET_PWR, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -1978,7 +2036,7 @@ int icom_set_mem(RIG *rig, vfo_t vfo, int ch) priv = (struct icom_priv_data*)rs->priv; to_bcd_be(membuf, ch, CHAN_NB_LEN*2); - retval = icom_transaction (rig, C_SET_MEM, -1, membuf, CHAN_NB_LEN, + retval = icom_transaction (rig, C_SET_MEM, -1, membuf, CHAN_NB_LEN, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -2008,7 +2066,7 @@ int icom_set_bank(RIG *rig, vfo_t vfo, int bank) priv = (struct icom_priv_data*)rs->priv; to_bcd_be(bankbuf, bank, BANK_NB_LEN*2); - retval = icom_transaction (rig, C_SET_MEM, S_BANK, + retval = icom_transaction (rig, C_SET_MEM, S_BANK, bankbuf, CHAN_NB_LEN, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -2086,7 +2144,7 @@ int icom_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) return -RIG_EINVAL; } - retval = icom_transaction (rig, mv_cn, mv_sc, mvbuf, mv_len, + retval = icom_transaction (rig, mv_cn, mv_sc, mvbuf, mv_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -2150,12 +2208,18 @@ int icom_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) case RIG_SCAN_DELTA: scan_sc = S_SCAN_DELTA; /* TODO: delta-f support */ break; + case RIG_SCAN_RESUME_ON: + scan_sc = S_SCAN_RSMON; + break; + case RIG_SCAN_RESUME_OFF: + scan_sc = S_SCAN_RSMOFF; + break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported scan %#x", scan); return -RIG_EINVAL; } - retval = icom_transaction (rig, scan_cn, scan_sc, scanbuf, scan_len, + retval = icom_transaction (rig, scan_cn, scan_sc, scanbuf, scan_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; @@ -2181,7 +2245,7 @@ int icom_decode_event(RIG *rig) int frm_len; freq_t freq; rmode_t mode; - pbwidth_t width; + pbwidth_t width; rig_debug(RIG_DEBUG_VERBOSE, "icom: icom_decode called\n"); @@ -2221,7 +2285,7 @@ int icom_decode_event(RIG *rig) case C_SND_MODE: if (rig->callbacks.mode_event) { icom2rig_mode(rig, buf[5]| buf[6]<<8, &mode, &width); - return rig->callbacks.mode_event(rig, RIG_VFO_CURR, + return rig->callbacks.mode_event(rig, RIG_VFO_CURR, mode, width, rig->callbacks.mode_arg); } else @@ -2262,13 +2326,13 @@ rig_model_t probe_icom(port_t *p) /* try all possible addresses on the CI-V bus */ for (civ_addr=0x01; civ_addr<=0x7f; civ_addr++) { - frm_len = make_cmd_frame(buf, civ_addr, C_RD_TRXID, S_RD_TRXID, + frm_len = make_cmd_frame(buf, civ_addr, C_RD_TRXID, S_RD_TRXID, NULL, 0); write_block(p, buf, frm_len); - /* read out the bytes we just sent - * TODO: check this is what we expect + /* read out the bytes we just sent + * TODO: check this is what we expect */ frm_len = read_icom_block(p, buf, frm_len); @@ -2281,12 +2345,12 @@ rig_model_t probe_icom(port_t *p) if (buf[7] != FI && buf[5] != FI) { /* protocol error, unexpected reply. - * is this a CI-V device? + * is this a CI-V device? */ close(p->fd); return RIG_MODEL_NONE; } else if (buf[4] == NAK) { - /* + /* * this is an Icom, but it does not support transceiver ID * try to guess from the return address */ @@ -2304,7 +2368,7 @@ rig_model_t probe_icom(port_t *p) } } /* - * not found in known table.... + * not found in known table.... * update icom_addr_list[]! */ rig_debug(RIG_DEBUG_WARN,"probe_icom: found unknown device " @@ -2333,8 +2397,9 @@ int initrigs_icom(void *be_handle) rig_register(&ic756pro_caps); rig_register(&ic821h_caps); - - rig_register(&icr7000_caps); + rig_register(&ic910_caps); + + rig_register(&icr7000_caps); rig_register(&icr8500_caps); rig_register(&ic275_caps); diff --git a/icom/icom.h b/icom/icom.h index c5e76e992..a2a1f3c84 100644 --- a/icom/icom.h +++ b/icom/icom.h @@ -2,7 +2,7 @@ * Hamlib CI-V backend - main header * Copyright (c) 2000,2001,2002 by Stephane Fillod * - * $Id: icom.h,v 1.38 2002-02-27 23:17:17 fillods Exp $ + * $Id: icom.h,v 1.39 2002-02-28 10:59:46 fgretief Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -28,7 +28,7 @@ #include /* - * defines used by comp_cal_str in rig.c + * defines used by comp_cal_str in rig.c * STR_CAL_LENGTH is the lenght of the S Meter calibration table * STR_CAL_S0 is the value in dB of the lowest value (not even in table) */ @@ -63,6 +63,7 @@ extern const struct ts_sc_list r9000_ts_sc_list[]; extern const struct ts_sc_list ic756_ts_sc_list[]; extern const struct ts_sc_list ic756pro_ts_sc_list[]; extern const struct ts_sc_list ic706_ts_sc_list[]; +extern const struct ts_sc_list ic910_ts_sc_list[]; int icom_init(RIG *rig); int icom_cleanup(RIG *rig); @@ -116,6 +117,7 @@ extern const struct rig_caps ic756_caps; extern const struct rig_caps ic756pro_caps; extern const struct rig_caps ic775_caps; extern const struct rig_caps ic821h_caps; +extern const struct rig_caps ic910_caps; extern const struct rig_caps icr7000_caps; extern const struct rig_caps icr8500_caps; extern const struct rig_caps icall_caps; diff --git a/icom/icom_defs.h b/icom/icom_defs.h index 5a47e8433..1116c9f62 100644 --- a/icom/icom_defs.h +++ b/icom/icom_defs.h @@ -2,7 +2,7 @@ * Hamlib CI-V backend - defines for the ICOM "CI-V" interface. * Copyright (c) 2000,2001 by Stephane Fillod * - * $Id: icom_defs.h,v 1.11 2001-07-13 19:08:15 f4cfe Exp $ + * $Id: icom_defs.h,v 1.12 2002-02-28 10:59:46 fgretief Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -137,6 +137,8 @@ #define S_SCAN_SLCTN 0x23 /* Selected number memory scan */ #define S_SCAN_SLCTM 0x24 /* Selected mode memory scan */ #define S_SCAN_PRIO 0x42 /* Priority / window scan */ +#define S_SCAN_RSMOFF 0xD0 /* Set scan resume OFF */ +#define S_SCAN_RSMON 0xD3 /* Set scan resume ON */ /* @@ -179,6 +181,7 @@ */ #define S_ANN_ALL 0x00 /* Announce all */ #define S_ANN_FREQ 0x01 /* Announce freq */ +#define S_ANN_MODE 0x02 /* Announce operating mode */ /* * Function settings (C_CTL_LVL) subcommands @@ -229,6 +232,7 @@ #define S_FUNC_BKIN 0x47 /* BK-IN setting */ #define S_FUNC_MN 0x48 /* Manual notch setting */ #define S_FUNC_RNF 0x49 /* RTTY Filter Notch setting */ +#define S_FUNC_AFC 0x4A /* Auto Frequency Control (AFC) setting */ /* * Transceiver ID (C_RD_TRXID) subcommands @@ -252,6 +256,16 @@ */ #define S_MEM_CNTNT 0x00 #define S_MEM_CNTNT_SLCT 0x01 + /* For IC-910H rig. */ +#define S_MEM_RDWR_MEM 0x00 /* Read/write memory channel */ +#define S_MEM_SATMEM 0x01 /* Satellite memory */ +#define S_MEM_VOXGAIN 0x02 /* VOX gain level (0=0%, 255=100%) */ +#define S_MEM_VOXDELAY 0x03 /* VOX delay (0=0.0 sec, 20=2.0 sec) */ +#define S_MEM_ANTIVOX 0x04 /* anti VOX setting */ +#define S_MEM_ATTLEVEL 0x05 /* Attenuation level (0=0%, 255=100%) */ +#define S_MEM_RIT 0x06 /* RIT (0=off, 1=on, 2=sub dial) */ +#define S_MEM_SATMODE 0x07 /* Satellite mode (on/off) */ +#define S_MEM_BANDSCOPE 0x08 /* Simple bandscope (on/off) */ /* * Tone control (C_SET_TONE) subcommands