Initial release

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1582 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.0
Stéphane Fillod, F8CFE 2003-11-16 16:58:35 +00:00
rodzic 732f267468
commit f81b00a700
14 zmienionych plików z 2282 dodań i 0 usunięć

155
icom/icr10.c 100644
Wyświetl plik

@ -0,0 +1,155 @@
/*
* Hamlib CI-V backend - description of IC-R10
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: icr10.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include "hamlib/rig.h"
#include "icom.h"
#include "idx_builtin.h"
#define ICR10_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM)
#define ICR10_FUNC_ALL (RIG_FUNC_NONE)
#define ICR10_LEVEL_ALL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR)
#define ICR10_VFO_ALL (RIG_VFO_A)
#define ICR10_VFO_OPS (RIG_OP_NONE)
#define ICR10_SCAN_OPS (RIG_SCAN_NONE)
/*
* FIXME: S-meter measurement
*/
#define ICR10_STR_CAL { 2, \
{ \
{ 0, -60 }, /* S0 */ \
{ 255, 60 } /* +60 */ \
} }
static const struct icom_priv_caps icr10_priv_caps = {
0x52, /* default address */
0, /* 731 mode */
r8500_ts_sc_list /* wrong, but don't have set_ts anyway */
};
const struct rig_caps icr10_caps = {
.rig_model = RIG_MODEL_ICR10,
.model_name = "IC-R10",
.mfg_name = "Icom",
.version = "0.2",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.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 = 200,
.retry = 3,
.has_get_func = ICR10_FUNC_ALL,
.has_set_func = ICR10_FUNC_ALL,
.has_get_level = ICR10_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ICR10_LEVEL_ALL),
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE, /* FIXME: parms */
.level_gran = {
[LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].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 = ICR10_VFO_OPS,
.scan_ops = ICR10_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
RIG_CHAN_END,
},
.rx_range_list1 = {
{kHz(500),GHz(1.3),ICR10_MODES,-1,-1,ICR10_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = { RIG_FRNG_END, },
.rx_range_list2 = {
{kHz(500),MHz(823.9999),ICR10_MODES,-1,-1,ICR10_VFO_ALL},
{MHz(849),MHz(868.9999),ICR10_MODES,-1,-1,ICR10_VFO_ALL},
{MHz(894),GHz(1.3),ICR10_MODES,-1,-1,ICR10_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = { RIG_FRNG_END, },
.tuning_steps = {
{ICR10_MODES,Hz(100)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW, kHz(4)},
{RIG_MODE_AM|RIG_MODE_FM, kHz(15)},
{RIG_MODE_WFM, kHz(150)},
RIG_FLT_END,
},
.str_cal = ICR10_STR_CAL,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&icr10_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, /* TODO: do not pass bandwidth data */
.get_mode = icom_get_mode,
/* .set_vfo = icom_set_vfo, */
.decode_event = icom_decode_event,
.get_level = icom_get_level,
.get_dcd = icom_get_dcd,
};

142
icom/icr71.c 100644
Wyświetl plik

@ -0,0 +1,142 @@
/*
* Hamlib CI-V backend - description of IC-R71
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: icr71.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include "hamlib/rig.h"
#include "icom.h"
/* FM optional */
#define ICR71_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY)
#define ICR71_FUNC_ALL (RIG_FUNC_NONE)
#define ICR71_LEVEL_ALL (RIG_LEVEL_NONE)
#define ICR71_VFO_ALL (RIG_VFO_A)
#define ICR71_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO)
#define ICR71_SCAN_OPS (RIG_SCAN_NONE)
static const struct icom_priv_caps icr71_priv_caps = {
0x1a, /* default address */
0, /* 731 mode */
ic737_ts_sc_list /* none actually */
};
const struct rig_caps icr71_caps = {
.rig_model = RIG_MODEL_ICR71,
.model_name = "IC-R71",
.mfg_name = "Icom",
.version = "0.2",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_RECEIVER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 300,
.serial_rate_max = 1200,
.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 = ICR71_FUNC_ALL,
.has_set_func = ICR71_FUNC_ALL,
.has_get_level = ICR71_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ICR71_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),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = ICR71_VFO_OPS,
.scan_ops = ICR71_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
{ 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP },
RIG_CHAN_END,
},
.rx_range_list1 = {
{kHz(100),MHz(30),ICR71_MODES,-1,-1,ICR71_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = { RIG_FRNG_END, },
.rx_range_list2 = {
{kHz(100),MHz(30),ICR71_MODES,-1,-1,ICR71_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = { RIG_FRNG_END, },
.tuning_steps = {
{ICR71_MODES,Hz(10)}, /* resolution */
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.3)},
{RIG_MODE_AM, kHz(6)},
{RIG_MODE_FM, kHz(15)}, /* optional w/ IC-EX257 unit */
RIG_FLT_END,
},
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&icr71_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,
.decode_event = icom_decode_event,
.set_mem = icom_set_mem,
.vfo_op = icom_vfo_op,
};

157
icom/icr72.c 100644
Wyświetl plik

@ -0,0 +1,157 @@
/*
* Hamlib CI-V backend - description of IC-R72
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: icr72.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include "hamlib/rig.h"
#include "icom.h"
#define ICR72_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY)
#define ICR72_FUNC_ALL (RIG_FUNC_NONE)
#define ICR72_LEVEL_ALL (RIG_LEVEL_SQLSTAT)
#define ICR72_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_MCL)
#define ICR72_VFO_ALL (RIG_VFO_A)
#define ICR71_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL)
#define ICR72_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_SLCT|RIG_SCAN_PRIO)
static const struct icom_priv_caps icr72_priv_caps = {
0x32, /* default address */
0, /* 731 mode */
ic737_ts_sc_list
};
const struct rig_caps icr72_caps = {
.rig_model = RIG_MODEL_ICR72,
.model_name = "IC-R72",
.mfg_name = "Icom",
.version = "0.2",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_RECEIVER,
.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 = 200,
.retry = 3,
.has_get_func = ICR72_FUNC_ALL,
.has_set_func = ICR72_FUNC_ALL,
.has_get_level = ICR72_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ICR72_LEVEL_ALL),
.has_get_parm = RIG_PARM_ANN,
.has_set_parm = RIG_PARM_ANN,
.level_gran = {}, /* granularity */
.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 = ICR72_VFO_OPS,
.scan_ops = ICR72_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
{ 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP },
RIG_CHAN_END,
},
.rx_range_list1 = {
{kHz(100),MHz(30),ICR72_MODES,-1,-1,ICR72_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = { RIG_FRNG_END, },
.rx_range_list2 = {
{kHz(100),MHz(30),ICR72_MODES,-1,-1,ICR72_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = { RIG_FRNG_END, },
.tuning_steps = {
{ICR72_MODES,Hz(10)},
{ICR72_MODES,kHz(1)},
{ICR72_MODES,kHz(2)},
{ICR72_MODES,kHz(3)},
{ICR72_MODES,kHz(4)},
{ICR72_MODES,kHz(5)},
{ICR72_MODES,kHz(6)},
{ICR72_MODES,kHz(7)},
{ICR72_MODES,kHz(8)},
{ICR72_MODES,kHz(9)},
{ICR72_MODES,kHz(10)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.3)},
{RIG_MODE_AM, kHz(6)},
{RIG_MODE_FM, kHz(15)},
RIG_FLT_END,
},
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&icr72_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,
.decode_event = icom_decode_event,
.get_level = icom_get_level,
.set_mem = icom_set_mem,
.vfo_op = icom_vfo_op,
.get_dcd = icom_get_dcd,
.set_ts = icom_set_ts,
.get_ts = icom_get_ts,
.scan = icom_scan,
};

331
icom/icr75.c 100644
Wyświetl plik

@ -0,0 +1,331 @@
/*
* Hamlib CI-V backend - description of IC-R75
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: icr75.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include <string.h>
#include "hamlib/rig.h"
#include "misc.h"
#include "idx_builtin.h"
#include "icom.h"
#include "icom_defs.h"
#include "frame.h"
/*
* IC-R75
*
* TODO:
* $1A command:
* - set_parm, set_trn, IF filter setting, etc.
*/
#define ICR75_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_AMS)
#define ICR75_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_ANF|RIG_FUNC_APF)
#define ICR75_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR)
#define ICR75_VFO_ALL (RIG_VFO_A)
#define ICR75_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL)
#define ICR75_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO)
#define ICR75_ANTS (RIG_ANT_1|RIG_ANT_2)
/*
* FIXME: S-meter measurement
*/
#define ICR75_STR_CAL { 2, \
{ \
{ 0, -60 }, /* S0 */ \
{ 255, 60 } /* +60 */ \
} }
/*
* channel caps.
*/
#define ICR75_MEM_CAP { \
.freq = 1, \
.mode = 1, \
.width = 1, \
.ant = 1, \
.levels = RIG_LEVEL_ATT|RIG_LEVEL_PREAMP, \
.channel_desc = 1, \
.flags = 1, \
}
static int icr75_set_channel(RIG *rig, const channel_t *chan);
static int icr75_get_channel(RIG *rig, channel_t *chan);
static const struct icom_priv_caps icr75_priv_caps = {
0x5a, /* default address */
0, /* 731 mode */
r75_ts_sc_list
};
const struct rig_caps icr75_caps = {
.rig_model = RIG_MODEL_ICR75,
.model_name = "IC-R75",
.mfg_name = "Icom",
.version = "0.2",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_RECEIVER,
.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 = 200,
.retry = 3,
.has_get_func = ICR75_FUNC_ALL,
.has_set_func = ICR75_FUNC_ALL,
.has_get_level = ICR75_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ICR75_LEVEL_ALL),
.has_get_parm = RIG_PARM_ANN,
.has_set_parm = RIG_PARM_ANN, /* FIXME: parms */
.level_gran = {
[LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255,
},
.parm_gran = {},
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { 20, RIG_DBLST_END, }, /* TBC */
.attenuator = { 20, RIG_DBLST_END, }, /* TBC */
.max_rit = Hz(0),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = ICR75_VFO_OPS,
.scan_ops = ICR75_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 8,
.chan_list = {
{ 1, 99, RIG_MTYPE_MEM, ICR75_MEM_CAP },
{ 100, 101, RIG_MTYPE_EDGE, ICR75_MEM_CAP },
RIG_CHAN_END,
},
.rx_range_list1 = {
{kHz(30),MHz(60),ICR75_MODES,-1,-1,ICR75_VFO_ALL,ICR75_ANTS},
RIG_FRNG_END, },
.tx_range_list1 = { RIG_FRNG_END, },
.rx_range_list2 = {
{kHz(30),MHz(60),ICR75_MODES,-1,-1,ICR75_VFO_ALL,ICR75_ANTS},
RIG_FRNG_END, },
.tx_range_list2 = { RIG_FRNG_END, },
.tuning_steps = {
{ICR75_MODES,Hz(10)},
{ICR75_MODES,Hz(100)},
{ICR75_MODES,kHz(1)},
{ICR75_MODES,kHz(5)},
{ICR75_MODES,kHz(6.25)},
{ICR75_MODES,kHz(9)},
{ICR75_MODES,kHz(10)},
{ICR75_MODES,kHz(12.5)},
{ICR75_MODES,kHz(20)},
{ICR75_MODES,kHz(25)},
{ICR75_MODES,kHz(100)},
{ICR75_MODES,MHz(1)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)},
{RIG_MODE_AM|RIG_MODE_AMS, kHz(6)},
{RIG_MODE_FM, kHz(15)},
RIG_FLT_END,
},
.str_cal = ICR75_STR_CAL,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&icr75_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_ant = icom_set_ant,
.get_ant = icom_get_ant,
.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,
.get_dcd = icom_get_dcd,
.set_mem = icom_set_mem,
.vfo_op = icom_vfo_op,
.scan = icom_scan,
.set_ts = icom_set_ts,
.get_ts = icom_get_ts,
.set_powerstat = icom_set_powerstat,
.get_powerstat = icom_get_powerstat,
.set_channel = icr75_set_channel,
.get_channel = icr75_get_channel,
};
/*
* icr75_set_channel
* Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL
* TODO: still a WIP --SF
*/
int icr75_set_channel(RIG *rig, const channel_t *chan)
{
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char chanbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
int chan_len, freq_len, ack_len, retval;
unsigned char icmode;
signed char icmode_ext;
int err;
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
to_bcd_be(chanbuf,chan->channel_num,4);
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);
chan_len = 3+freq_len+1;
err = rig2icom_mode(rig, chan->mode, RIG_PASSBAND_NORMAL,
&icmode, &icmode_ext);/* FIXME */
if (err != RIG_OK)
return err;
chanbuf[chan_len++] = icmode;
chanbuf[chan_len++] = icmode_ext; /* FIXME */
to_bcd_be(chanbuf+chan_len++,
chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i, 2);
to_bcd_be(chanbuf+chan_len++,
chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i, 2);
to_bcd_be(chanbuf+chan_len++,chan->ant,2);
memset(chanbuf+chan_len, 0, 8);
strncpy(chanbuf+chan_len, chan->channel_desc, 8);
chan_len += 8;
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT,
chanbuf, chan_len, ackbuf, &ack_len);
if (retval != RIG_OK)
return retval;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_channel: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
return RIG_OK;
}
/*
* icr75_get_channel
* Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL
* TODO: still a WIP --SF
*/
int icr75_get_channel(RIG *rig, channel_t *chan)
{
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char chanbuf[24];
int chan_len, freq_len, retval;
pbwidth_t width; /* FIXME */
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
to_bcd_be(chanbuf,chan->channel_num,4);
chan_len = 2;
freq_len = priv->civ_731_mode ? 4:5;
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT,
chanbuf, chan_len, chanbuf, &chan_len);
if (retval != RIG_OK)
return retval;
/*
* freqbuf should contain Cn,Data area
*/
chan_len--;
if (freq_len != freq_len+16) {
rig_debug(RIG_DEBUG_ERR,"icr75_get_channel: wrong frame len=%d\n",
chan_len);
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],
&chan->mode, &width);
chan_len += 2;
chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i =
from_bcd_be(chanbuf+chan_len++,2);
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);
return RIG_OK;
}

190
icom/icr9000.c 100644
Wyświetl plik

@ -0,0 +1,190 @@
/*
* Hamlib CI-V backend - IC-R9000 descriptions
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: icr9000.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include <hamlib/rig.h>
#include "serial.h"
#include "misc.h"
#include "idx_builtin.h"
#include "icom.h"
#include "icom_defs.h"
#include "frame.h"
#define ICR9000_MODES (RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_CW|RIG_MODE_WFM)
#define ICR9000_OPS (RIG_OP_FROM_VFO|RIG_OP_MCL)
#define ICR9000_FUNCS (RIG_FUNC_VSC)
#define ICR9000_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR)
#define ICR9000_PARMS (RIG_PARM_ANN)
#define ICR9000_SCAN_OPS (RIG_SCAN_MEM) /* TBC */
#define ICR9000_ANTS (RIG_ANT_1|RIG_ANT_2)
/* FIXME: S-Meter measurements */
#define ICR9000_STR_CAL { 2, { \
{ 0, -60 }, /* S0 */ \
{ 255, 60 }, /* +60 */ \
} }
static const struct icom_priv_caps icr9000_priv_caps = {
0x2a, /* default address */
0, /* 731 mode */
r9000_ts_sc_list
};
/*
* ICR9000A rig capabilities.
*/
const struct rig_caps icr9000_caps = {
.rig_model = RIG_MODEL_ICR9000,
.model_name = "IC-R9000",
.mfg_name = "Icom",
.version = "0.2.1",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_RECEIVER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 300,
.serial_rate_max = 1200,
.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 = ICR9000_FUNCS,
.has_set_func = ICR9000_FUNCS,
.has_get_level = ICR9000_LEVELS,
.has_set_level = RIG_LEVEL_SET(ICR9000_LEVELS),
.has_get_parm = ICR9000_PARMS,
.has_set_parm = RIG_PARM_SET(ICR9000_PARMS),
.level_gran = {
[LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255,
},
.parm_gran = {},
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END },
.attenuator = { 10, 20, 30, RIG_DBLST_END },
.max_rit = Hz(0),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
.vfo_ops = ICR9000_OPS,
.scan_ops = ICR9000_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
{ 1, 99, RIG_MTYPE_MEM }, /* TBC */
{ 0x1000, 0x1009, RIG_MTYPE_EDGE }, /* 2 by 2 */
{ 0x1010, 0x1019, RIG_MTYPE_EDGE }, /* 2 by 2 */
RIG_CHAN_END, },
.rx_range_list1 = {
{kHz(100),MHz(1999.8),ICR9000_MODES,-1,-1, RIG_VFO_A, ICR9000_ANTS},
RIG_FRNG_END, },
.tx_range_list1 = { RIG_FRNG_END, },
.rx_range_list2 = {
{kHz(100),MHz(1999.8),ICR9000_MODES,-1,-1, RIG_VFO_A, ICR9000_ANTS},
RIG_FRNG_END, },
.tx_range_list2 = { RIG_FRNG_END, }, /* no TX ranges, this is a receiver */
.tuning_steps = {
{ICR9000_MODES,10}, /* resolution */
{ICR9000_MODES,100},
{ICR9000_MODES,kHz(1)},
{ICR9000_MODES,kHz(5)},
{ICR9000_MODES,kHz(9)},
{ICR9000_MODES,kHz(10)},
{ICR9000_MODES,12500},
{ICR9000_MODES,kHz(20)},
{ICR9000_MODES,kHz(25)},
{ICR9000_MODES,kHz(100)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)},
{RIG_MODE_AM, kHz(6)},
{RIG_MODE_FM, kHz(15)},
{RIG_MODE_WFM, kHz(150)},
RIG_FLT_END,
},
.str_cal = ICR9000_STR_CAL,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&icr9000_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_ant = icom_set_ant,
.get_ant = icom_get_ant,
.set_ts = icom_set_ts,
.get_ts = icom_get_ts,
.set_func = icom_set_func,
.get_func = icom_get_func,
.set_level = icom_set_level,
.get_level = icom_get_level,
#if 0
.set_parm = icom_set_parm,
.get_parm = icom_get_parm,
#endif
.decode_event = icom_decode_event,
.set_mem = icom_set_mem,
.vfo_op = icom_vfo_op,
.scan = icom_scan,
};
/*
* Function definitions below
*/

198
icom/id1.c 100644
Wyświetl plik

@ -0,0 +1,198 @@
/*
* Hamlib CI-V backend - description of ID-1 and variations
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: id1.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include "hamlib/rig.h"
#include "idx_builtin.h"
#include "icom.h"
#define ID1_MODES (RIG_MODE_FM /* |RIG_MODE_DIGVOICE|RIG_MODE_DIGDATA*/ )
#define ID1_FUNC_ALL (RIG_FUNC_MUTE|RIG_FUNC_MON|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|RIG_FUNC_AFC)
#define ID1_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_RFPOWER|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR)
#define ID1_PARM_ALL (RIG_PARM_BEEP|RIG_PARM_BACKLIGHT /* |RIG_PARM_FAN */)
#define ID1_VFO_ALL (RIG_VFO_A)
#define ID1_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL)
#define ID1_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM)
/*
* FIXME:
*/
#define ID1_STR_CAL { 2, \
{ \
{ 45, -60 }, \
{ 204, 60 } /* +60 */ \
} }
const struct ts_sc_list id1_ts_sc_list[] = {
{ kHz(5), 0x00 },
{ kHz(10), 0x01 },
{ 12500, 0x02 },
{ kHz(20), 0x03 },
{ kHz(25), 0x04 },
{ kHz(50), 0x05 },
{ kHz(100), 0x06 },
{ kHz(6.25), 0x07 },
{ 0, 0 },
};
/*
*/
static const struct icom_priv_caps id1_priv_caps = {
0x01, /* default address */
0, /* 731 mode */
id1_ts_sc_list
};
const struct rig_caps id1_caps = {
.rig_model = RIG_MODEL_ICID1,
.model_name = "IC ID-1",
.mfg_name = "Icom",
.version = "0.2",
.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 = 19200,
.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 = ID1_FUNC_ALL,
.has_set_func = ID1_FUNC_ALL,
.has_get_level = ID1_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(ID1_LEVEL_ALL),
.has_get_parm = ID1_PARM_ALL,
.has_set_parm = ID1_PARM_ALL,
.level_gran = {
[LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].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 = ID1_VFO_OPS,
.scan_ops = ID1_SCAN_OPS,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
{ 1, 99, RIG_MTYPE_MEM, IC_MEM_CAP },
{ 100, 101, RIG_MTYPE_EDGE, IC_MEM_CAP }, /* two by two */
{ 102, 104, RIG_MTYPE_CALL, IC_MEM_CAP },
RIG_CHAN_END,
},
.rx_range_list1 = {
{GHz(1.240),GHz(1.3),ID1_MODES,-1,-1,ID1_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list1 = {
{GHz(1.240),GHz(1.3),ID1_MODES,W(1),W(10),ID1_VFO_ALL},
RIG_FRNG_END, },
.rx_range_list2 = {
{GHz(1.240),GHz(1.3),ID1_MODES,-1,-1,ID1_VFO_ALL},
RIG_FRNG_END, },
.tx_range_list2 = {
{GHz(1.240),GHz(1.3),ID1_MODES,W(1),W(10),ID1_VFO_ALL},
RIG_FRNG_END, },
.tuning_steps = {
{ID1_MODES,kHz(5)},
{ID1_MODES,kHz(10)},
{ID1_MODES,12500},
{ID1_MODES,kHz(20)},
{ID1_MODES,kHz(25)},
{ID1_MODES,kHz(25)},
{ID1_MODES,kHz(100)},
{ID1_MODES,kHz(6.25)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_FM, kHz(12)},
#if 0
{RIG_MODE_DIGVOICE, kHz(6)},
{RIG_MODE_DIGDATA, kHz(140)},
#endif
RIG_FLT_END,
},
.str_cal = ID1_STR_CAL,
.cfgparams = icom_cfg_params,
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void*)&id1_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,
.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,
.set_mem = icom_set_mem,
.vfo_op = icom_vfo_op,
.scan = icom_scan,
.set_ptt = icom_set_ptt,
.get_ptt = icom_get_ptt,
.get_dcd = icom_get_dcd,
.set_ts = icom_set_ts,
.set_rptr_shift = icom_set_rptr_shift,
.set_rptr_offs = icom_set_rptr_offs,
.get_rptr_offs = icom_get_rptr_offs,
};

180
jrc/nrd535.c 100644
Wyświetl plik

@ -0,0 +1,180 @@
/*
* Hamlib JRC backend - NRD-535 DSP description
* Copyright (c) 2001-2003 by Stephane Fillod
*
* $Id: nrd535.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include <hamlib/rig.h>
#include "idx_builtin.h"
#include "jrc.h"
#define NRD535_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) /* + FAX */
#define NRD535_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_LOCK|RIG_FUNC_ABM|RIG_FUNC_BC|RIG_FUNC_NR)
#define NRD535_LEVEL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_AGC|RIG_LEVEL_IF|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL)
/* FIXME: add more from "U" command */
#define NRD535_PARM (RIG_PARM_TIME|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP)
#define NRD535_VFO (RIG_VFO_A)
/*
* NRD-535, specs from http://mods.dk
*
* FIXME: measure S-meter levels
*/
#define NRD535_STR_CAL { 8, { \
{ 0, 60 }, \
{ 72, 50 }, \
{ 81, 30 }, \
{ 93, 10 }, \
{ 100, 0 }, \
{ 106, -12 }, \
{ 118, -24 }, \
{ 255, -60 }, \
} }
/*
* channel caps.
*/
#define NRD535_MEM_CAP { \
.freq = 1, \
.mode = 1, \
.width = 1, \
.levels = RIG_LEVEL_ATT|RIG_LEVEL_AGC, \
}
/*
* NRD-535 rig capabilities.
*
*/
const struct rig_caps nrd535_caps = {
.rig_model = RIG_MODEL_NRD535,
.model_name = "NRD-535 DSP",
.mfg_name = "JRC",
.version = "0.1",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_RECEIVER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.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 = NRD535_FUNC,
.has_set_func = NRD535_FUNC,
.has_get_level = NRD535_LEVEL,
.has_set_level = RIG_LEVEL_SET(NRD535_LEVEL),
.has_get_parm = RIG_PARM_TIME,
.has_set_parm = RIG_PARM_SET(NRD535_PARM),
.level_gran = {
[LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255,
},
.parm_gran = {},
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END },
.attenuator = { 20, RIG_DBLST_END },
.max_rit = Hz(0),
.max_xit = Hz(0),
.max_ifshift = kHz(2),
.targetable_vfo = 0,
.transceive = RIG_TRN_RIG,
.vfo_ops = RIG_OP_FROM_VFO,
.scan_ops = RIG_SCAN_STOP|RIG_SCAN_SLCT,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
{ 0, 199, RIG_MTYPE_MEM, NRD535_MEM_CAP },
RIG_CHAN_END,
},
.rx_range_list1 = {
{kHz(100),MHz(30),NRD535_MODES,-1,-1,NRD535_VFO},
RIG_FRNG_END,
},
.tx_range_list1 = { RIG_FRNG_END, },
.rx_range_list2 = {
{kHz(100),MHz(30),NRD535_MODES,-1,-1,NRD535_VFO},
RIG_FRNG_END,
},
.tx_range_list2 = { RIG_FRNG_END, },
.tuning_steps = {
{NRD535_MODES,1},
{NRD535_MODES,10},
{NRD535_MODES,100},
RIG_TS_END,
},
/* mode/filter list, .remember = order matters! */
.filters = {
{RIG_MODE_AM|RIG_MODE_FM, kHz(12)},
{NRD535_MODES, kHz(2)},
{NRD535_MODES, kHz(1)},
{NRD535_MODES, kHz(4)},
RIG_FLT_END,
},
.str_cal = NRD535_STR_CAL,
.rig_open = jrc_open,
.rig_close = jrc_close,
.set_freq = jrc_set_freq,
.get_freq = jrc_get_freq,
.set_mode = jrc_set_mode,
.set_func = jrc_set_func,
.get_func = jrc_get_func,
.set_level = jrc_set_level,
.get_level = jrc_get_level,
.set_parm = jrc_set_parm,
.get_parm = jrc_get_parm,
.get_dcd = jrc_get_dcd,
.set_trn = jrc_set_trn,
.reset = jrc_reset,
.set_mem = jrc_set_mem,
.vfo_op = jrc_vfo_op,
.scan = jrc_scan,
.set_powerstat = jrc_set_powerstat,
.decode_event = jrc_decode_event,
};
/*
* Function definitions below
*/

184
kenwood/ts140.c 100644
Wyświetl plik

@ -0,0 +1,184 @@
/*
* Hamlib Kenwood backend - TS140 description
* Copyright (c) 2000-2003 by Stephane Fillod
*
* $Id: ts140.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include <hamlib/rig.h>
#include "kenwood.h"
#include "bandplan.h"
#define TS140_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM)
#define TS140_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_NR|RIG_FUNC_BC|RIG_FUNC_LOCK)
#define TS140_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_SQL|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_AGC)
#define TS140_VFO (RIG_VFO_A|RIG_VFO_B)
#define TS140_ANTS (RIG_ANT_1)
static const struct kenwood_priv_caps ts140_priv_caps = {
.cmdtrm = EOM_KEN,
};
/*
* ts140 rig capabilities, roughly guessed, never tested!
*
* specs from http://www.qsl.net/sm7vhs/radio/kenwood/ts140/specs.htm
*/
const struct rig_caps ts140_caps = {
.rig_model = RIG_MODEL_TS140S,
.model_name = "TS-140S",
.mfg_name = "Kenwood",
.version = "0.2.1",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 1200,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 2,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.retry = 3,
.has_get_func = TS140_FUNC_ALL,
.has_set_func = TS140_FUNC_ALL,
.has_get_level = TS140_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(TS140_LEVEL_ALL),
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE, /* FIXME: parms */
.level_gran = {}, /* FIXME: granularity */
.parm_gran = {},
.ctcss_list = NULL,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END, }, /* FIXME: preamp list */
.attenuator = { RIG_DBLST_END, },
.max_rit = kHz(1.2),
.max_xit = kHz(2.4),
.max_ifshift = Hz(0),
.targetable_vfo = RIG_TARGETABLE_FREQ,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 0,
.chan_list = {
{ 0, 89, RIG_MTYPE_MEM }, /* TBC */
{ 90, 99, RIG_MTYPE_EDGE },
RIG_CHAN_END,
},
.rx_range_list1 = {
{kHz(500),MHz(30),TS140_ALL_MODES,-1,-1,TS140_VFO},
RIG_FRNG_END,
}, /* rx range */
.tx_range_list1 = {
FRQ_RNG_HF(1,RIG_MODE_SSB|RIG_MODE_CW, W(5),W(100),TS140_VFO,TS140_ANTS), /* SSB actually 110W */
FRQ_RNG_HF(1,RIG_MODE_FM, W(5),W(50),TS140_VFO,TS140_ANTS),
FRQ_RNG_HF(1,RIG_MODE_AM, W(4),W(40),TS140_VFO,TS140_ANTS), /* AM class */
RIG_FRNG_END,
},
.rx_range_list2 = {
{kHz(500),MHz(30),TS140_ALL_MODES,-1,-1,TS140_VFO},
RIG_FRNG_END,
}, /* rx range */
.tx_range_list2 = {
FRQ_RNG_HF(2,RIG_MODE_SSB|RIG_MODE_CW, W(5),W(100),TS140_VFO,TS140_ANTS), /* SSB actually 110W */
FRQ_RNG_HF(2,RIG_MODE_FM, W(5),W(50),TS140_VFO,TS140_ANTS),
FRQ_RNG_HF(2,RIG_MODE_AM, W(4),W(40),TS140_VFO,TS140_ANTS), /* AM class */
RIG_FRNG_END,
}, /* tx range */
.tuning_steps = {
{TS140_ALL_MODES,50},
{TS140_ALL_MODES,100},
{TS140_ALL_MODES,kHz(1)},
{TS140_ALL_MODES,kHz(5)},
{TS140_ALL_MODES,kHz(9)},
{TS140_ALL_MODES,kHz(10)},
{TS140_ALL_MODES,12500},
{TS140_ALL_MODES,kHz(20)},
{TS140_ALL_MODES,kHz(25)},
{TS140_ALL_MODES,kHz(100)},
{TS140_ALL_MODES,MHz(1)},
{TS140_ALL_MODES,0}, /* any tuning step */
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW, kHz(2.2)},
{RIG_MODE_AM, kHz(6)},
{RIG_MODE_FM, kHz(12)},
RIG_FLT_END,
},
.priv = (void *)&ts140_priv_caps,
.set_freq = kenwood_set_freq,
.get_freq = kenwood_get_freq,
.set_rit = kenwood_set_rit,
.get_rit = kenwood_get_rit,
.set_xit = kenwood_set_xit,
.get_xit = kenwood_get_xit,
.set_mode = kenwood_set_mode,
.get_mode = kenwood_get_mode,
.set_vfo = kenwood_set_vfo,
.get_vfo = kenwood_get_vfo,
.set_ctcss_tone = kenwood_set_ctcss_tone,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.get_ptt = kenwood_get_ptt,
.set_ptt = kenwood_set_ptt,
.get_dcd = kenwood_get_dcd,
.set_func = kenwood_set_func,
.get_func = kenwood_get_func,
.set_level = kenwood_set_level,
.get_level = kenwood_get_level,
.vfo_op = kenwood_vfo_op,
.set_mem = kenwood_set_mem,
.get_mem = kenwood_get_mem,
.set_trn = kenwood_set_trn,
.get_trn = kenwood_get_trn,
.set_powerstat = kenwood_set_powerstat,
.get_powerstat = kenwood_get_powerstat,
.reset = kenwood_reset,
};
/*
* Function definitions below
*/

Wyświetl plik

@ -0,0 +1,190 @@
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
dnl
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthread or
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
[Define to the necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_RESULT(${ok})
if test x"$ok" = xunknown; then
AC_MSG_WARN([we do not know how to create joinable pthreads])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD

Wyświetl plik

@ -0,0 +1,56 @@
dnl
dnl Copyright 2003 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
dnl GNU Radio is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl GNU Radio is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with GNU Radio; see the file COPYING. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl Boston, MA 02111-1307, USA.
dnl
AC_DEFUN(GR_CHECK_DOXYGEN,[
AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (auto)])
AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)])
AC_ARG_ENABLE(html-docs, [ --enable-html-docs enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes])
AC_ARG_ENABLE(latex-docs, [ --enable-latex-docs enable LaTeX doc generation with doxygen (no)], [], [ enable_latex_docs=no])
if test "x$enable_doxygen" = xno; then
enable_doc=no
else
AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
if test x$DOXYGEN = x; then
if test "x$enable_doxygen" = xyes; then
AC_MSG_ERROR([could not find doxygen])
fi
enable_doc=no
else
enable_doc=yes
AC_PATH_PROG(DOT, dot, , $PATH)
fi
fi
AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
if test x$DOT = x; then
if test "x$enable_dot" = xyes; then
AC_MSG_ERROR([could not find dot])
fi
enable_dot=no
else
enable_dot=yes
fi
AC_SUBST(enable_dot)
AC_SUBST(enable_html_docs)
AC_SUBST(enable_latex_docs)
])

114
macros/gr_swig.m4 100644
Wyświetl plik

@ -0,0 +1,114 @@
dnl
dnl Copyright 2003 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
dnl GNU Radio is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl GNU Radio is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with GNU Radio; see the file COPYING. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl Boston, MA 02111-1307, USA.
dnl
# SWIG_PROG([required-version])
#
# Checks for the SWIG program. If found you can (and should) call SWIG via $(SWIG).
# You can use the optional first argument to check if the version of the available SWIG
# is greater or equal to the value of the argument. It should have the format:
# N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.)
AC_DEFUN([SWIG_PROG],[
AC_REQUIRE([AC_PROG_MAKE_SET])
AC_CHECK_PROG(SWIG,swig,[`which swig`])
if test -z "$SWIG" ; then
AC_MSG_WARN([cannot find 'swig' program])
SWIG=false
elif test -n "$1" ; then
AC_MSG_CHECKING([for SWIG version])
swig_version=`$SWIG -version 2>&1 | \
awk '/^SWIG Version [[0-9]+\.[0-9]+\.[0-9]]+.*$/ { split($[3],a,"[[^.0-9]]"); print a[[1]] }'`
AC_MSG_RESULT([$swig_version])
if test -n "$swig_version" ; then
swig_version=`echo $swig_version | \
awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
swig_required_version=`echo $1 | \
awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
if test $swig_required_version -gt $swig_version ; then
AC_MSG_WARN([SWIG version $1 required])
fi
else
AC_MSG_WARN([cannot determine SWIG version])
fi
fi
])
# SWIG_ENABLE_CXX()
#
# Enable swig C++ support. This effects all invocations of $(SWIG).
AC_DEFUN([SWIG_ENABLE_CXX],[
AC_REQUIRE([SWIG_PROG])
AC_REQUIRE([AC_PROG_CXX])
if test "$SWIG" != "false" ; then
SWIG="$SWIG -c++"
fi
])
# SWIG_MULTI_MODULE_SUPPORT()
#
# Enable support for multiple modules. This effects all invocations of $(SWIG).
# You have to link all generated modules against the appropriate SWIG library.
# If you want to build Python modules for example, use the SWIG_PYTHON() macro
# and link the modules against $(SWIG_PYTHON_LIB). The $(SWIG_LDFLAGS) variable
# can be used to help the linker to find this library.
AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
AC_REQUIRE([SWIG_PROG])
if test "$SWIG" != "false" ; then
SWIG="$SWIG -c"
# Check for SWIG library path
AC_MSG_CHECKING([for SWIG library path])
swig_path=${SWIG%/bin*}/lib
swig_path=`find $swig_path -type f -name libswig*.a -o -name libswig*.so -print`
for i in $swig_path ; do
swig_path=${i%/libswig*}
break
done
AC_MSG_RESULT([$swig_path])
if test -n "$swig_path" ; then
AC_SUBST(SWIG_LDFLAGS,[-L$swig_path])
else
AC_MSG_WARN([cannot find SWIG library path])
fi
fi
])
# SWIG_PYTHON([use-shadow-classes])
#
# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
# $(SWIG_PYTHON_LIB) and $(SWIG_PYTHON_OPT) output variables.
# $(SWIG_PYTHON_OPT) contains all necessary swig options to generate
# code for Python. If you need multi module support use
# $(SWIG_PYTHON_LIB) (provided by the SWIG_MULTI_MODULE_SUPPORT()
# macro) to link against the appropriate library. It contains the
# SWIG Python runtime library that is needed by the type check system
# for example.
AC_DEFUN([SWIG_PYTHON],[
AC_REQUIRE([SWIG_PROG])
AC_REQUIRE([PYTHON_DEVEL])
if test "$SWIG" != "false" ; then
AC_SUBST(SWIG_PYTHON_LIB,[-lswigpy])
dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
AC_SUBST(SWIG_PYTHON_OPT,[-python])
fi
AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS])
])

Wyświetl plik

@ -0,0 +1,128 @@
dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl
dnl As a special exception to the GNU General Public License, if you
dnl distribute this file as part of a program that contains a configuration
dnl script generated by Autoconf, you may include it under the same
dnl distribution terms that you use for the rest of that program.
# --------------------------------------------------------------------------
# Check whether the C++ compiler accepts a certain flag
# If it does it adds the flag to CXXFLAGS
# If it does not then it returns an error to lf_ok
# Usage:
# LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...)
# -------------------------------------------------------------------------
AC_DEFUN([LF_CHECK_CXX_FLAG],[
echo 'void f(){}' > conftest.cc
for i in $1
do
AC_MSG_CHECKING([whether $CXX accepts $i])
if test -z "`${CXX} $i -c conftest.cc 2>&1`"
then
CXXFLAGS="${CXXFLAGS} $i"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
done
rm -f conftest.cc conftest.o
])
# --------------------------------------------------------------------------
# Check whether the C compiler accepts a certain flag
# If it does it adds the flag to CFLAGS
# If it does not then it returns an error to lf_ok
# Usage:
# LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...)
# -------------------------------------------------------------------------
AC_DEFUN([LF_CHECK_CC_FLAG],[
echo 'void f(){}' > conftest.c
for i in $1
do
AC_MSG_CHECKING([whether $CC accepts $i])
if test -z "`${CC} $i -c conftest.c 2>&1`"
then
CFLAGS="${CFLAGS} $i"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
done
rm -f conftest.c conftest.o
])
# --------------------------------------------------------------------------
# Check whether the Fortran compiler accepts a certain flag
# If it does it adds the flag to FFLAGS
# If it does not then it returns an error to lf_ok
# Usage:
# LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...)
# -------------------------------------------------------------------------
AC_DEFUN([LF_CHECK_F77_FLAG],[
cat << EOF > conftest.f
c....:++++++++++++++++++++++++
PROGRAM MAIN
PRINT*,'Hello World!'
END
EOF
for i in $1
do
AC_MSG_CHECKING([whether $F77 accepts $i])
if test -z "`${F77} $i -c conftest.f 2>&1`"
then
FFLAGS="${FFLAGS} $i"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
done
rm -f conftest.f conftest.o
])
# ----------------------------------------------------------------------
# Provide the configure script with an --with-warnings option that
# turns on warnings. Call this command AFTER you have configured ALL your
# compilers.
# ----------------------------------------------------------------------
AC_DEFUN([LF_SET_WARNINGS],[
dnl Check for --with-warnings
AC_MSG_CHECKING([whether user wants warnings])
AC_ARG_WITH(warnings,
[ --with-warnings Turn on warnings],
[ lf_warnings=yes ], [ lf_warnings=no ])
lf_warnings=yes # hard code for now -eb
AC_MSG_RESULT($lf_warnings)
dnl Warnings for the two main compilers
cc_warning_flags="-Wall"
cxx_warning_flags="-Wall -Woverloaded-virtual"
if test $lf_warnings = yes
then
if test -n "${CC}"
then
LF_CHECK_CC_FLAG($cc_warning_flags)
fi
if test -n "${CXX}"
then
LF_CHECK_CXX_FLAG($cxx_warning_flags)
fi
fi
])

214
tests/sprintflst.c 100644
Wyświetl plik

@ -0,0 +1,214 @@
/*
* Hamlib Interface - sprintf toolbox
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
*
* $Id: sprintflst.c,v 1.1 2003-11-16 16:58:35 fillods 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 <stdlib.h>
#include <stdarg.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <sys/types.h>
#include <unistd.h>
#include <hamlib/rig.h>
#include "sprintflst.h"
#include "misc.h"
#define DUMMY_ALL 0x7ffffffffffffffLL
int sprintf_mode(char *str, rmode_t mode)
{
int i, len=0;
*str = '\0';
if (mode == RIG_MODE_NONE)
return 0;
for (i = 0; i < 30; i++) {
const char *ms = strrmode(mode & (1UL<<i));
if (!ms || !ms[0])
continue; /* unknown, FIXME! */
strcat(str, ms);
strcat(str, " ");
len += strlen(ms) + 1;
}
return len;
}
int sprintf_func(char *str, setting_t func)
{
int i, len=0;
*str = '\0';
if (func == RIG_FUNC_NONE)
return 0;
for (i = 0; i < RIG_SETTING_MAX; i++) {
const char *ms = strfunc(func & rig_idx2setting(i));
if (!ms || !ms[0])
continue; /* unknown, FIXME! */
strcat(str, ms);
strcat(str, " ");
len += strlen(ms) + 1;
}
return len;
}
int sprintf_level(char *str, setting_t level)
{
int i, len=0;
*str = '\0';
if (level == RIG_LEVEL_NONE)
return 0;
for (i = 0; i < RIG_SETTING_MAX; i++) {
const char *ms = strlevel(level & rig_idx2setting(i));
if (!ms || !ms[0])
continue; /* unknown, FIXME! */
strcat(str, ms);
strcat(str, " ");
len += strlen(ms) + 1;
}
return len;
}
int sprintf_level_gran(char *str, setting_t level, const gran_t gran[])
{
int i, len=0;
*str = '\0';
if (level == RIG_LEVEL_NONE)
return 0;
for (i = 0; i < RIG_SETTING_MAX; i++) {
if (!(level & rig_idx2setting(i)))
continue;
const char *ms = strlevel(level & rig_idx2setting(i));
if (!ms || !ms[0]) {
if (level != DUMMY_ALL && level != RIG_LEVEL_SET(DUMMY_ALL))
rig_debug(RIG_DEBUG_BUG, "unkown level idx %d\n", i);
continue;
}
if (RIG_LEVEL_IS_FLOAT(rig_idx2setting(i)))
len += sprintf(str+len, "%s(%g..%g/%g) ", ms,
gran[i].min.f,gran[i].max.f,gran[i].step.f);
else
len += sprintf(str+len, "%s(%d..%d/%d) ", ms,
gran[i].min.i,gran[i].max.i,gran[i].step.i);
}
return len;
}
int sprintf_parm(char *str, setting_t parm)
{
int i, len=0;
*str = '\0';
if (parm == RIG_PARM_NONE)
return 0;
for (i = 0; i < RIG_SETTING_MAX; i++) {
const char *ms = strparm(parm & rig_idx2setting(i));
if (!ms || !ms[0])
continue; /* unknown, FIXME! */
strcat(str, ms);
strcat(str, " ");
len += strlen(ms) + 1;
}
return len;
}
int sprintf_parm_gran(char *str, setting_t parm, const gran_t gran[])
{
int i, len=0;
*str = '\0';
if (parm == RIG_PARM_NONE)
return 0;
for (i = 0; i < RIG_SETTING_MAX; i++) {
if (!(parm & rig_idx2setting(i)))
continue;
const char *ms = strparm(parm & rig_idx2setting(i));
if (!ms || !ms[0]) {
if (parm != DUMMY_ALL && parm != RIG_PARM_SET(DUMMY_ALL))
rig_debug(RIG_DEBUG_BUG, "unkown parm idx %d\n", i);
continue;
}
if (RIG_PARM_IS_FLOAT(rig_idx2setting(i)))
len += sprintf(str+len, "%s(%g..%g/%g) ", ms,
gran[i].min.f,gran[i].max.f,gran[i].step.f);
else
len += sprintf(str+len, "%s(%d..%d/%d) ", ms,
gran[i].min.i,gran[i].max.i,gran[i].step.i);
}
return len;
}
int sprintf_vfop(char *str, vfo_op_t op)
{
int i, len=0;
*str = '\0';
if (op == RIG_OP_NONE)
return 0;
for (i = 0; i < 30; i++) {
const char *ms = strvfop(op & (1UL<<i));
if (!ms || !ms[0])
continue; /* unknown, FIXME! */
strcat(str, ms);
strcat(str, " ");
len += strlen(ms) + 1;
}
return len;
}
int sprintf_scan(char *str, scan_t rscan)
{
int i, len=0;
*str = '\0';
if (rscan == RIG_SCAN_NONE)
return 0;
for (i = 0; i < 30; i++) {
const char *ms = strscan(rscan & (1UL<<i));
if (!ms || !ms[0])
continue; /* unknown, FIXME! */
strcat(str, ms);
strcat(str, " ");
len += strlen(ms) + 1;
}
return len;
}

43
tests/sprintflst.h 100644
Wyświetl plik

@ -0,0 +1,43 @@
/*
* Hamlib Interface - sprintf toolbox header
* Copyright (c) 2003 by Stephane Fillod
*
* $Id: sprintflst.h,v 1.1 2003-11-16 16:58:35 fillods 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.
*
*/
#ifndef _SPRINTFLST_H
#define _SPRINTFLST_H 1
#include <hamlib/rig.h>
__BEGIN_DECLS
extern int sprintf_mode(char *str, rmode_t);
extern int sprintf_vfo(char *str, vfo_t);
extern int sprintf_func(char *str, setting_t);
extern int sprintf_level(char *str, setting_t);
extern int sprintf_level_gran(char *str, setting_t, const gran_t gran[]);
extern int sprintf_parm(char *str, setting_t);
extern int sprintf_parm_gran(char *str, setting_t, const gran_t gran[]);
extern int sprintf_vfop(char *str, vfo_op_t);
extern int sprintf_scan(char *str, scan_t);
__END_DECLS
#endif /* _SPRINTFLST_H */