kopia lustrzana https://github.com/Hamlib/Hamlib
added skelton for new backends: tapr(DSP10) and rft(EKD500).
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1559 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.0
rodzic
e78317adfb
commit
2acf79bcee
|
@ -18,7 +18,7 @@ SUBDIRS = macros include lib libltdl src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \
|
||||||
DIST_SUBDIRS = macros include lib libltdl src c++ kylix bindings tests doc \
|
DIST_SUBDIRS = macros include lib libltdl src c++ kylix bindings tests doc \
|
||||||
icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \
|
icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \
|
||||||
rpcrig winradio easycomm fodtrack rpcrot gnuradio drake rotorez \
|
rpcrig winradio easycomm fodtrack rpcrot gnuradio drake rotorez \
|
||||||
microtune flexradio sartek lowe
|
microtune flexradio sartek lowe rft tapr
|
||||||
|
|
||||||
rpm: Makefile
|
rpm: Makefile
|
||||||
make dist
|
make dist
|
||||||
|
|
|
@ -198,7 +198,7 @@ fi
|
||||||
AC_SUBST(RIGMATRIX)
|
AC_SUBST(RIGMATRIX)
|
||||||
|
|
||||||
|
|
||||||
BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe flexradio"
|
BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe rft tapr flexradio"
|
||||||
ROT_BACKEND_LIST="dummy easycomm rotorez sartek fodtrack"
|
ROT_BACKEND_LIST="dummy easycomm rotorez sartek fodtrack"
|
||||||
BINDINGS=""
|
BINDINGS=""
|
||||||
BINDING_LIST=""
|
BINDING_LIST=""
|
||||||
|
@ -422,6 +422,8 @@ kachina/Makefile
|
||||||
jrc/Makefile
|
jrc/Makefile
|
||||||
drake/Makefile
|
drake/Makefile
|
||||||
lowe/Makefile
|
lowe/Makefile
|
||||||
|
rft/Makefile
|
||||||
|
tapr/Makefile
|
||||||
gnuradio/Makefile
|
gnuradio/Makefile
|
||||||
easycomm/Makefile
|
easycomm/Makefile
|
||||||
fodtrack/Makefile
|
fodtrack/Makefile
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
RFTSRC = ekd500.c
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = hamlib-rft.la
|
||||||
|
hamlib_rft_la_SOURCES = $(RFTSRC) rft.c
|
||||||
|
hamlib_rft_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||||
|
hamlib_rft_la_LIBADD = $(top_builddir)/src/libhamlib.la
|
||||||
|
|
||||||
|
noinst_HEADERS = rft.h
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* Hamlib RFT backend - EKD-500 description
|
||||||
|
* Copyright (c) 2003 by Thomas B. Ruecker
|
||||||
|
*
|
||||||
|
* $Id: ekd500.c,v 1.1 2003-10-07 22:15:49 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 "rft.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define EKD500_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM|RIG_MODE_FM)
|
||||||
|
|
||||||
|
#define EKD500_FUNC (RIG_FUNC_NONE)
|
||||||
|
|
||||||
|
#define EKD500_LEVEL_ALL (RIG_LEVEL_NONE)
|
||||||
|
|
||||||
|
#define EKD500_PARM_ALL (RIG_PARM_NONE)
|
||||||
|
|
||||||
|
#define EKD500_VFO (RIG_VFO_A)
|
||||||
|
|
||||||
|
#define EKD500_VFO_OPS (RIG_OP_NONE)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EKD-500 rig capabilities.
|
||||||
|
*
|
||||||
|
* Documentation:
|
||||||
|
* http://kahuna.sdsu.edu/~mechtron/PremRxPage/ekd500.htm
|
||||||
|
*/
|
||||||
|
|
||||||
|
const struct rig_caps ekd500_caps = {
|
||||||
|
.rig_model = RIG_MODEL_EKD500,
|
||||||
|
.model_name = "EKD-500",
|
||||||
|
.mfg_name = "RFT",
|
||||||
|
.version = "0.1",
|
||||||
|
.copyright = "LGPL",
|
||||||
|
.status = RIG_STATUS_NEW,
|
||||||
|
.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 = 2400,
|
||||||
|
.serial_data_bits = 7,
|
||||||
|
.serial_stop_bits = 1,
|
||||||
|
.serial_parity = RIG_PARITY_EVEN,
|
||||||
|
.serial_handshake = RIG_HANDSHAKE_HARDWARE,
|
||||||
|
.write_delay = 0,
|
||||||
|
.post_write_delay = 1,
|
||||||
|
.timeout = 200,
|
||||||
|
.retry = 3,
|
||||||
|
|
||||||
|
.has_get_func = EKD500_FUNC,
|
||||||
|
.has_set_func = EKD500_FUNC,
|
||||||
|
.has_get_level = EKD500_LEVEL_ALL,
|
||||||
|
.has_set_level = RIG_LEVEL_SET(EKD500_LEVEL_ALL),
|
||||||
|
.has_get_parm = EKD500_PARM_ALL,
|
||||||
|
.has_set_parm = RIG_PARM_SET(EKD500_PARM_ALL),
|
||||||
|
.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,
|
||||||
|
.transceive = RIG_TRN_OFF,
|
||||||
|
.bank_qty = 0,
|
||||||
|
.chan_desc_sz = 7,
|
||||||
|
.vfo_ops = EKD500_VFO_OPS,
|
||||||
|
|
||||||
|
.chan_list = {
|
||||||
|
RIG_CHAN_END, /* FIXME */
|
||||||
|
},
|
||||||
|
|
||||||
|
.rx_range_list1 = {
|
||||||
|
{kHz(10),MHz(30),EKD500_MODES,-1,-1,EKD500_VFO},
|
||||||
|
RIG_FRNG_END,
|
||||||
|
},
|
||||||
|
.tx_range_list1 = { RIG_FRNG_END, },
|
||||||
|
.rx_range_list2 = {
|
||||||
|
{kHz(10),MHz(30),EKD500_MODES,-1,-1,EKD500_VFO},
|
||||||
|
RIG_FRNG_END,
|
||||||
|
},
|
||||||
|
.tx_range_list2 = { RIG_FRNG_END, },
|
||||||
|
|
||||||
|
.tuning_steps = {
|
||||||
|
{EKD500_MODES,10},
|
||||||
|
RIG_TS_END,
|
||||||
|
},
|
||||||
|
/* mode/filter list, remember: order matters! */
|
||||||
|
.filters = {
|
||||||
|
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.2)},
|
||||||
|
{RIG_MODE_FM, kHz(12)},
|
||||||
|
RIG_FLT_END,
|
||||||
|
},
|
||||||
|
.priv = NULL,
|
||||||
|
|
||||||
|
.set_freq = rft_set_freq,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function definitions below
|
||||||
|
*/
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Hamlib RFT backend - main file
|
||||||
|
* Copyright (c) 2003 by Thomas B. Ruecker
|
||||||
|
*
|
||||||
|
* $Id: rft.c,v 1.1 2003-10-07 22:15:49 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 <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h> /* String function definitions */
|
||||||
|
#include <unistd.h> /* UNIX standard function definitions */
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "hamlib/rig.h"
|
||||||
|
#include "serial.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "register.h"
|
||||||
|
|
||||||
|
#include "rft.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define BUFSZ 64
|
||||||
|
|
||||||
|
#define CR "\x0d"
|
||||||
|
#define EOM CR
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rft_transaction
|
||||||
|
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
|
||||||
|
*/
|
||||||
|
int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
|
||||||
|
{
|
||||||
|
int retval;
|
||||||
|
struct rig_state *rs;
|
||||||
|
|
||||||
|
rs = &rig->state;
|
||||||
|
|
||||||
|
serial_flush(&rs->rigport);
|
||||||
|
|
||||||
|
retval = write_block(&rs->rigport, cmd, cmd_len);
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
|
||||||
|
/* no data expected, TODO: flush input? */
|
||||||
|
if (!data || !data_len)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
*data_len = read_string(&rs->rigport, data, BUFSZ, CR, 1);
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rft_set_freq
|
||||||
|
* Assumes rig!=NULL
|
||||||
|
*/
|
||||||
|
int rft_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
|
{
|
||||||
|
unsigned char freqbuf[16], ackbuf[16];
|
||||||
|
int freq_len, ack_len, retval;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
freq_len = sprintf(freqbuf,"FRQ%f" EOM, (float)freq/1000);
|
||||||
|
retval = rft_transaction(rig, freqbuf, freq_len, ackbuf, &ack_len);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* initrigs_rft is called by rig_backend_load
|
||||||
|
*/
|
||||||
|
DECLARE_INITRIG_BACKEND(rft)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "rft: _init called\n");
|
||||||
|
|
||||||
|
rig_register(&ekd500_caps);
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Hamlib RFT backend - main header
|
||||||
|
* Copyright (c) 2003 by Stephane Fillod
|
||||||
|
*
|
||||||
|
* $Id: rft.h,v 1.1 2003-10-07 22:15:49 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 _RFT_H
|
||||||
|
#define _RFT_H 1
|
||||||
|
|
||||||
|
#include <hamlib/rig.h>
|
||||||
|
|
||||||
|
|
||||||
|
int rft_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||||
|
|
||||||
|
extern const struct rig_caps ekd500_caps;
|
||||||
|
|
||||||
|
#endif /* _RFT_H */
|
|
@ -0,0 +1,8 @@
|
||||||
|
TAPRSRCLIST = dsp10.c
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = hamlib-tapr.la
|
||||||
|
hamlib_tapr_la_SOURCES = $(TAPRSRCLIST) tapr.c
|
||||||
|
hamlib_tapr_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||||
|
hamlib_tapr_la_LIBADD = $(top_builddir)/src/libhamlib.la
|
||||||
|
|
||||||
|
noinst_HEADERS = tapr.h
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
* Hamlib TAPR backend - DSP-10 description
|
||||||
|
* Copyright (c) 2003 by Stephane Fillod
|
||||||
|
*
|
||||||
|
* $Id: dsp10.c,v 1.1 2003-10-07 22:15:49 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 "tapr.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define DSP10_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM)
|
||||||
|
|
||||||
|
#define DSP10_FUNC (RIG_FUNC_NONE)
|
||||||
|
|
||||||
|
#define DSP10_LEVEL_ALL (RIG_LEVEL_NONE)
|
||||||
|
|
||||||
|
#define DSP10_PARM_ALL (RIG_PARM_NONE)
|
||||||
|
|
||||||
|
#define DSP10_VFO (RIG_VFO_A)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DSP-10 rig capabilities.
|
||||||
|
*
|
||||||
|
* This backend is not working, and is just a call for someone motivated.
|
||||||
|
* Note: The DSP has to be loaded beforehand!
|
||||||
|
*
|
||||||
|
* protocol is documented at (version 2)
|
||||||
|
* http://www.proaxis.com/~boblark/pc_dsp2.txt
|
||||||
|
*
|
||||||
|
* See also:
|
||||||
|
* http://home.teleport.com/~oldaker/dsp10_repository.htm
|
||||||
|
* http://www.proaxis.com/~boblark/dsp10.htm
|
||||||
|
* http://www.tapr.org/tapr/html/Fdsp10.html
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const struct rig_caps dsp10_caps = {
|
||||||
|
.rig_model = RIG_MODEL_DSP10,
|
||||||
|
.model_name = "DSP-10",
|
||||||
|
.mfg_name = "TAPR",
|
||||||
|
.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 = 9600,
|
||||||
|
.serial_rate_max = 9600,
|
||||||
|
.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 = DSP10_FUNC,
|
||||||
|
.has_set_func = DSP10_FUNC,
|
||||||
|
.has_get_level = DSP10_LEVEL_ALL,
|
||||||
|
.has_set_level = RIG_LEVEL_SET(DSP10_LEVEL_ALL),
|
||||||
|
.has_get_parm = DSP10_PARM_ALL,
|
||||||
|
.has_set_parm = RIG_PARM_SET(DSP10_PARM_ALL),
|
||||||
|
.level_gran = {}, /* FIXME: 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,
|
||||||
|
.transceive = RIG_TRN_OFF,
|
||||||
|
.bank_qty = 0,
|
||||||
|
.chan_desc_sz = 0,
|
||||||
|
|
||||||
|
.chan_list = {
|
||||||
|
RIG_CHAN_END,
|
||||||
|
},
|
||||||
|
|
||||||
|
.rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */
|
||||||
|
.tx_range_list1 = { RIG_FRNG_END, },
|
||||||
|
.rx_range_list2 = {
|
||||||
|
{MHz(144),kHz(148),DSP10_MODES,-1,-1,DSP10_VFO},
|
||||||
|
RIG_FRNG_END,
|
||||||
|
},
|
||||||
|
.tx_range_list2 = {
|
||||||
|
{MHz(144),kHz(148),DSP10_MODES,mW(20),mW(20),DSP10_VFO},
|
||||||
|
RIG_FRNG_END,
|
||||||
|
},
|
||||||
|
.tuning_steps = {
|
||||||
|
{DSP10_MODES,1},
|
||||||
|
RIG_TS_END,
|
||||||
|
},
|
||||||
|
/* mode/filter list, remember: order matters! */
|
||||||
|
.filters = {
|
||||||
|
{RIG_MODE_SSB|RIG_MODE_CW, kHz(2.7)},
|
||||||
|
{RIG_MODE_FM, kHz(8)},
|
||||||
|
RIG_FLT_END,
|
||||||
|
},
|
||||||
|
.priv = (void*)NULL,
|
||||||
|
|
||||||
|
.set_freq = tapr_set_freq,
|
||||||
|
.set_mode = tapr_set_mode,
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*
|
||||||
|
* Hamlib TAPR backend - main file
|
||||||
|
* Copyright (c) 2003 by Stephane Fillod
|
||||||
|
*
|
||||||
|
* $Id: tapr.c,v 1.1 2003-10-07 22:15:49 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> /* String function definitions */
|
||||||
|
#include <unistd.h> /* UNIX standard function definitions */
|
||||||
|
|
||||||
|
#include "hamlib/rig.h"
|
||||||
|
#include "register.h"
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
#include "tapr.h"
|
||||||
|
|
||||||
|
#define ESC '$'
|
||||||
|
#define CMD_LEN 6
|
||||||
|
|
||||||
|
#define CMD7 7
|
||||||
|
|
||||||
|
#define NU1 1
|
||||||
|
#define NU2 2
|
||||||
|
#define NU3 3
|
||||||
|
#define NU4 4
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tapr_cmd
|
||||||
|
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL
|
||||||
|
* Otherwise, you'll get a nice seg fault. You've been warned!
|
||||||
|
* TODO: error case handling
|
||||||
|
*/
|
||||||
|
static int tapr_cmd(RIG *rig, unsigned char cmd, unsigned char c1, unsigned char c2, unsigned char c3, unsigned char c4)
|
||||||
|
{
|
||||||
|
int retval;
|
||||||
|
struct rig_state *rs;
|
||||||
|
unsigned char cmdbuf[CMD_LEN];
|
||||||
|
|
||||||
|
rs = &rig->state;
|
||||||
|
|
||||||
|
serial_flush(&rs->rigport);
|
||||||
|
|
||||||
|
cmdbuf[0] = ESC;
|
||||||
|
cmdbuf[1] = cmd;
|
||||||
|
cmdbuf[2] = c1;
|
||||||
|
cmdbuf[3] = c2;
|
||||||
|
cmdbuf[4] = c3;
|
||||||
|
cmdbuf[5] = c4;
|
||||||
|
|
||||||
|
retval = write_block(&rs->rigport, cmdbuf, 6);
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tapr_set_freq
|
||||||
|
* Assumes rig!=NULL
|
||||||
|
*/
|
||||||
|
int tapr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
|
{
|
||||||
|
unsigned int dsp_dph, dsp_deltap_lo, dsp_deltap_hi;
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
return -RIG_ENIMPL; /* FIXME! */
|
||||||
|
|
||||||
|
dsp_dph=(unsigned int) (1.365333333*(double)(freq-MHz(144)+15000UL));
|
||||||
|
dsp_deltap_lo = 0xff & dsp_dph;
|
||||||
|
dsp_deltap_hi = 0xff & (dsp_dph >> 8);
|
||||||
|
retval = tapr_cmd (rig, CMD7, 0, NU1, dsp_deltap_lo, dsp_deltap_hi);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tapr_set_mode
|
||||||
|
* Assumes rig!=NULL
|
||||||
|
*/
|
||||||
|
int tapr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||||
|
{
|
||||||
|
return -RIG_ENIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* initrigs_tapr is called by rig_backend_load
|
||||||
|
*/
|
||||||
|
DECLARE_INITRIG_BACKEND(tapr)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "tapr: _init called\n");
|
||||||
|
|
||||||
|
rig_register(&dsp10_caps);
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Hamlib TAPR backend - main header
|
||||||
|
* Copyright (c) 2003 by Stephane Fillod
|
||||||
|
*
|
||||||
|
* $Id: tapr.h,v 1.1 2003-10-07 22:15:49 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 _TAPR_H
|
||||||
|
#define _TAPR_H 1
|
||||||
|
|
||||||
|
#include <hamlib/rig.h>
|
||||||
|
|
||||||
|
|
||||||
|
int tapr_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||||
|
int tapr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||||
|
|
||||||
|
extern const struct rig_caps dsp10_caps;
|
||||||
|
|
||||||
|
#endif /* _TAPR_H */
|
Ładowanie…
Reference in New Issue