mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-22 02:47:21 +00:00
* added model specific caps->priv support
* ss calibration now make use of src/cal.c git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@439 7ae35d74-ebe9-4afe-98af-79ac388436b8
This commit is contained in:
parent
e72ff1c582
commit
5e69731906
61
icom/ic706.c
61
icom/ic706.c
@ -7,7 +7,7 @@
|
||||
* using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: ic706.c,v 1.17 2001-03-02 18:35:18 f4cfe Exp $
|
||||
* $Id: ic706.c,v 1.18 2001-03-04 13:03:41 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
@ -55,11 +55,40 @@
|
||||
|
||||
#define IC706_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
|
||||
|
||||
|
||||
#define IC706IIG_STR_CAL { 16, \
|
||||
{ \
|
||||
{ 100, -18 }, \
|
||||
{ 104, -16 }, \
|
||||
{ 108, -14 }, \
|
||||
{ 111, -12 }, \
|
||||
{ 114, -10 }, \
|
||||
{ 118, -8 }, \
|
||||
{ 121, -6 }, \
|
||||
{ 125, -4 }, \
|
||||
{ 129, -2 }, \
|
||||
{ 133, 0 }, \
|
||||
{ 137, 2 }, \
|
||||
{ 142, 4 }, \
|
||||
{ 146, 6 }, \
|
||||
{ 151, 8 }, \
|
||||
{ 156, 10 }, \
|
||||
{ 161, 12 } \
|
||||
} }
|
||||
|
||||
|
||||
/*
|
||||
* ic706 rigs capabilities.
|
||||
* Notice that some rigs share the same functions.
|
||||
* Also this struct is READONLY!
|
||||
*/
|
||||
static const struct icom_priv_caps ic706_priv_caps = {
|
||||
0x48, /* default address */
|
||||
0, /* 731 mode */
|
||||
ic706_ts_sc_list,
|
||||
IC706IIG_STR_CAL
|
||||
};
|
||||
|
||||
const struct rig_caps ic706_caps = {
|
||||
RIG_MODEL_IC706, "IC-706", "Icom", "0.2", "GPL",
|
||||
RIG_STATUS_UNTESTED, RIG_TYPE_MOBILE,
|
||||
@ -75,7 +104,7 @@ const struct rig_caps ic706_caps = {
|
||||
NULL,
|
||||
Hz(0), Hz(0), /* RIT, IF-SHIFT */
|
||||
0, /* FIXME: VFO list */
|
||||
0, RIG_TRN_ON,
|
||||
0, RIG_TRN_RIG,
|
||||
101, 0, 0,
|
||||
|
||||
{ RIG_CHAN_END, }, /* FIXME: memory channel list */
|
||||
@ -132,12 +161,20 @@ const struct rig_caps ic706_caps = {
|
||||
{RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */
|
||||
RIG_FLT_END,
|
||||
},
|
||||
NULL, /* priv */
|
||||
(void*)&ic706_priv_caps,
|
||||
icom_init, icom_cleanup, NULL, NULL, NULL /* probe not supported yet */,
|
||||
icom_set_freq, icom_get_freq, icom_set_mode, icom_get_mode, icom_set_vfo,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
static const struct icom_priv_caps ic706mkii_priv_caps = {
|
||||
0x4e, /* default address */
|
||||
0, /* 731 mode */
|
||||
ic706_ts_sc_list,
|
||||
IC706IIG_STR_CAL
|
||||
};
|
||||
|
||||
const struct rig_caps ic706mkii_caps = {
|
||||
RIG_MODEL_IC706MKII, "IC-706MKII", "Icom", "0.2", "GPL",
|
||||
RIG_STATUS_UNTESTED, RIG_TYPE_MOBILE,
|
||||
@ -153,7 +190,7 @@ const struct rig_caps ic706mkii_caps = {
|
||||
NULL,
|
||||
Hz(0), Hz(0), /* RIT, IF-SHIFT */
|
||||
0, /* FIXME: VFO list */
|
||||
0, RIG_TRN_ON,
|
||||
0, RIG_TRN_RIG,
|
||||
101, 0, 0,
|
||||
|
||||
{ RIG_CHAN_END, }, /* FIXME: memory channel list */
|
||||
@ -210,7 +247,7 @@ const struct rig_caps ic706mkii_caps = {
|
||||
{RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */
|
||||
RIG_FLT_END,
|
||||
},
|
||||
NULL, /* priv */
|
||||
(void*)&ic706mkii_priv_caps,
|
||||
icom_init, icom_cleanup, NULL, NULL, NULL /* probe not supported yet */,
|
||||
icom_set_freq, icom_get_freq, icom_set_mode, icom_get_mode, icom_set_vfo,
|
||||
NULL,
|
||||
@ -220,6 +257,13 @@ const struct rig_caps ic706mkii_caps = {
|
||||
* Basically, the IC706MKIIG is an IC706MKII plus UHF, a DSP
|
||||
* and 50W VHF
|
||||
*/
|
||||
static const struct icom_priv_caps ic706mkiig_priv_caps = {
|
||||
0x58, /* default address */
|
||||
0, /* 731 mode */
|
||||
ic706_ts_sc_list,
|
||||
IC706IIG_STR_CAL
|
||||
};
|
||||
|
||||
const struct rig_caps ic706mkiig_caps = {
|
||||
RIG_MODEL_IC706MKIIG, "IC-706MKIIG", "Icom", "0.2", "GPL",
|
||||
RIG_STATUS_ALPHA, RIG_TYPE_MOBILE,
|
||||
@ -235,7 +279,7 @@ const struct rig_caps ic706mkiig_caps = {
|
||||
NULL,
|
||||
Hz(0), Hz(0), /* RIT, IF-SHIFT */
|
||||
0, /* FIXME: VFO list */
|
||||
0, RIG_TRN_ON,
|
||||
0, RIG_TRN_RIG,
|
||||
105, 0, 0,
|
||||
|
||||
/* memory channel list */
|
||||
@ -299,7 +343,7 @@ const struct rig_caps ic706mkiig_caps = {
|
||||
{RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */
|
||||
RIG_FLT_END,
|
||||
},
|
||||
NULL, /* priv */
|
||||
(void*)&ic706mkiig_priv_caps,
|
||||
icom_init, icom_cleanup, NULL, NULL, NULL /* probe not supported yet */,
|
||||
icom_set_freq, icom_get_freq, icom_set_mode, icom_get_mode, icom_set_vfo,
|
||||
NULL,
|
||||
@ -338,6 +382,7 @@ get_split: icom_get_split,
|
||||
* Function definitions below
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static const int mkiig_raw[STR_CAL_LENGTH] = {
|
||||
100, 104, 108, 111, 114, 118, 121, 125, 129, 133, 137, 142, 146, 151, 156, 161
|
||||
};
|
||||
@ -364,3 +409,5 @@ int ic706mkiig_str_cal_init(RIG *rig)
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
13
icom/icall.c
13
icom/icall.c
@ -7,7 +7,7 @@
|
||||
* using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icall.c,v 1.1 2001-03-02 18:30:45 f4cfe Exp $
|
||||
* $Id: icall.c,v 1.2 2001-03-04 13:03:41 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -54,6 +54,13 @@
|
||||
|
||||
#define ICALL_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
|
||||
|
||||
static const struct icom_priv_caps icall_priv_caps = {
|
||||
0x58, /* whatever! */
|
||||
0, /* 731 mode */
|
||||
ic706_ts_sc_list,
|
||||
EMPTY_STR_CAL
|
||||
};
|
||||
|
||||
/*
|
||||
*/
|
||||
const struct rig_caps icall_caps = {
|
||||
@ -71,7 +78,7 @@ const struct rig_caps icall_caps = {
|
||||
NULL,
|
||||
Hz(9999), kHz(2.1), /* RIT, IF-SHIFT */
|
||||
0, /* FIXME: VFO list */
|
||||
0, RIG_TRN_ON,
|
||||
0, RIG_TRN_RIG,
|
||||
105, 0, 0,
|
||||
|
||||
/* memory channel list */
|
||||
@ -135,7 +142,7 @@ const struct rig_caps icall_caps = {
|
||||
{RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */
|
||||
RIG_FLT_END,
|
||||
},
|
||||
NULL, /* priv */
|
||||
(void*)&icall_priv_caps, /* priv */
|
||||
icom_init, icom_cleanup, NULL, NULL, NULL /* probe not supported yet */,
|
||||
icom_set_freq, icom_get_freq, icom_set_mode, icom_get_mode, icom_set_vfo,
|
||||
NULL,
|
||||
|
52
icom/icom.c
52
icom/icom.c
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
|
||||
*
|
||||
* icom.c - Copyright (C) 2000 Stephane Fillod
|
||||
* icom.c - Copyright (C) 2000,2001 Stephane Fillod
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to an ICOM using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icom.c,v 1.20 2001-03-02 18:33:27 f4cfe Exp $
|
||||
* $Id: icom.c,v 1.21 2001-03-04 13:03:41 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
@ -40,6 +40,7 @@
|
||||
#include <hamlib/riglist.h>
|
||||
#include <serial.h>
|
||||
#include <misc.h>
|
||||
#include <cal.h>
|
||||
#include "icom.h"
|
||||
#include "icom_defs.h"
|
||||
#include "frame.h"
|
||||
@ -211,14 +212,20 @@ const int icom_ctcss_list[] = {
|
||||
int icom_init(RIG *rig)
|
||||
{
|
||||
struct icom_priv_data *priv;
|
||||
const struct icom_priv_caps *priv_caps;
|
||||
const struct rig_caps *caps;
|
||||
int i;
|
||||
|
||||
if (!rig)
|
||||
if (!rig || !rig->caps)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
caps = rig->caps;
|
||||
|
||||
if (!caps->priv)
|
||||
return -RIG_ECONF;
|
||||
|
||||
priv_caps = (const struct icom_priv_caps *) caps->priv;
|
||||
|
||||
priv = (struct icom_priv_data*)malloc(sizeof(struct icom_priv_data));
|
||||
if (!priv) {
|
||||
/* whoops! memory shortage! */
|
||||
@ -235,6 +242,9 @@ int icom_init(RIG *rig)
|
||||
*/
|
||||
|
||||
priv->re_civ_addr = 0x00;
|
||||
|
||||
/* to be removed soon */
|
||||
#if 0
|
||||
for (i=0; icom_addr_list[i].model >= 0; i++) {
|
||||
if (icom_addr_list[i].model == caps->rig_model) {
|
||||
priv->re_civ_addr = icom_addr_list[i].re_civ_addr;
|
||||
@ -273,6 +283,11 @@ int icom_init(RIG *rig)
|
||||
default:
|
||||
priv->ts_sc_list = ic706_ts_sc_list;
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->re_civ_addr = priv_caps->re_civ_addr;
|
||||
priv->civ_731_mode = priv_caps->civ_731_mode;
|
||||
memcpy(&priv->str_cal, &priv_caps->str_cal, sizeof(cal_table_t));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -619,6 +634,8 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* will be removed soon */
|
||||
#if 0
|
||||
/*
|
||||
* compensate strength using calibration
|
||||
* assume STR_CAL_LENGTH!=0
|
||||
@ -645,7 +662,7 @@ static int comp_cal_str(int str_cal_raw[], int str_cal_db[], int icom_val)
|
||||
|
||||
return str_cal_db[i] - interpolation;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@ -784,7 +801,10 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
|
||||
switch (level) {
|
||||
case RIG_LEVEL_STRENGTH:
|
||||
#if 0
|
||||
val->i = comp_cal_str(priv->str_cal_raw,priv->str_cal_db,icom_val);
|
||||
#endif
|
||||
val->i = rig_raw2val(icom_val, &priv->str_cal);
|
||||
break;
|
||||
case RIG_LEVEL_SQLSTAT:
|
||||
/*
|
||||
@ -1188,22 +1208,20 @@ int icom_get_split(RIG *rig, vfo_t vfo, split_t *split)
|
||||
|
||||
/*
|
||||
* icom_set_ts
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, rig->caps->priv!=NULL
|
||||
*/
|
||||
int icom_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
|
||||
{
|
||||
struct icom_priv_data *priv;
|
||||
struct rig_state *rs;
|
||||
const struct icom_priv_caps *priv_caps;
|
||||
unsigned char ackbuf[16];
|
||||
int i, ack_len;
|
||||
int ts_sc = 0;
|
||||
|
||||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data*)rs->priv;
|
||||
priv_caps = (const struct icom_priv_caps*)rig->caps->priv;
|
||||
|
||||
for (i=0; i<TSLSTSIZ; i++) {
|
||||
if (priv->ts_sc_list[i].ts == ts) {
|
||||
ts_sc = priv->ts_sc_list[i].sc;
|
||||
if (priv_caps->ts_sc_list[i].ts == ts) {
|
||||
ts_sc = priv_caps->ts_sc_list[i].sc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1224,17 +1242,15 @@ int icom_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
|
||||
|
||||
/*
|
||||
* icom_get_ts
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL, ts!=NULL
|
||||
* Assumes rig!=NULL, rig->caps->priv!=NULL, ts!=NULL
|
||||
*/
|
||||
int icom_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
|
||||
{
|
||||
struct icom_priv_data *priv;
|
||||
struct rig_state *rs;
|
||||
const struct icom_priv_caps *priv_caps;
|
||||
unsigned char tsbuf[16];
|
||||
int ts_len,i;
|
||||
|
||||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data*)rs->priv;
|
||||
priv_caps = (const struct icom_priv_caps*)rig->caps->priv;
|
||||
|
||||
icom_transaction (rig, C_SET_TS, -1, NULL, 0, tsbuf, &ts_len);
|
||||
|
||||
@ -1249,8 +1265,8 @@ int icom_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
|
||||
}
|
||||
|
||||
for (i=0; i<TSLSTSIZ; i++) {
|
||||
if (priv->ts_sc_list[i].sc == tsbuf[1]) {
|
||||
*ts = priv->ts_sc_list[i].ts;
|
||||
if (priv_caps->ts_sc_list[i].sc == tsbuf[1]) {
|
||||
*ts = priv_caps->ts_sc_list[i].ts;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
23
icom/icom.h
23
icom/icom.h
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
|
||||
*
|
||||
* icom.h - Copyright (C) 2000 Stephane Fillod
|
||||
* icom.h - Copyright (C) 2000,2001 Stephane Fillod
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to an ICOM using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icom.h,v 1.15 2001-03-02 18:39:42 f4cfe Exp $
|
||||
* $Id: icom.h,v 1.16 2001-03-04 13:03:41 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -29,6 +29,7 @@
|
||||
#define _ICOM_H 1
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
#include <cal.h>
|
||||
|
||||
/*
|
||||
* defines used by comp_cal_str in rig.c
|
||||
@ -44,16 +45,28 @@ struct ts_sc_list {
|
||||
unsigned char sc; /* sub command */
|
||||
};
|
||||
|
||||
struct icom_priv_caps {
|
||||
unsigned char re_civ_addr; /* the remote dlft equipment's CI-V address*/
|
||||
int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */
|
||||
const struct ts_sc_list *ts_sc_list;
|
||||
cal_table_t str_cal;
|
||||
};
|
||||
|
||||
|
||||
struct icom_priv_data {
|
||||
unsigned char re_civ_addr; /* the remote equipment's CI-V address*/
|
||||
int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */
|
||||
const struct ts_sc_list *ts_sc_list;
|
||||
int str_cal_raw[STR_CAL_LENGTH];
|
||||
int str_cal_db[STR_CAL_LENGTH];
|
||||
cal_table_t str_cal;
|
||||
};
|
||||
|
||||
extern const int icom_ctcss_list[];
|
||||
|
||||
extern const struct ts_sc_list r8500_ts_sc_list[];
|
||||
extern const struct ts_sc_list ic737_ts_sc_list[];
|
||||
extern const struct ts_sc_list r75_ts_sc_list[];
|
||||
extern const struct ts_sc_list r7100_ts_sc_list[];
|
||||
extern const struct ts_sc_list ic756_ts_sc_list[];
|
||||
extern const struct ts_sc_list ic706_ts_sc_list[];
|
||||
|
||||
int icom_init(RIG *rig);
|
||||
int icom_cleanup(RIG *rig);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* using the "CI-V" interface.
|
||||
*
|
||||
*
|
||||
* $Id: icr8500.c,v 1.7 2001-03-02 18:35:18 f4cfe Exp $
|
||||
* $Id: icr8500.c,v 1.8 2001-03-04 13:03:41 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
@ -48,6 +48,12 @@
|
||||
|
||||
#define ICR8500_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_APF|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
|
||||
|
||||
static const struct icom_priv_caps icr8500_priv_caps = {
|
||||
0x4a, /* default address */
|
||||
0, /* 731 mode */
|
||||
r8500_ts_sc_list,
|
||||
EMPTY_STR_CAL
|
||||
};
|
||||
/*
|
||||
* ICR8500 rigs capabilities.
|
||||
*/
|
||||
@ -61,12 +67,12 @@ const struct rig_caps icr8500_caps = {
|
||||
RIG_FUNC_NONE, ICR8500_FUNC_ALL, ICR8500_LEVEL_ALL, ICR8500_LEVEL_ALL,
|
||||
RIG_PARM_NONE, RIG_PARM_NONE, /* FIXME: parms */
|
||||
NULL, NULL, /* FIXME: CTCSS/DCS list */
|
||||
{ 20, RIG_DBLST_END, },
|
||||
{ 10, RIG_DBLST_END, },
|
||||
{ 20, RIG_DBLST_END, },
|
||||
NULL,
|
||||
Hz(9999), Hz(0), /* RIT, IF-SHIFT */
|
||||
0, /* FIXME: VFO list */
|
||||
0, RIG_TRN_ON,
|
||||
0, RIG_TRN_RIG,
|
||||
999, 12, 0,
|
||||
|
||||
{ RIG_CHAN_END, }, /* FIXME: memory channel list */
|
||||
@ -107,7 +113,7 @@ const struct rig_caps icr8500_caps = {
|
||||
{RIG_MODE_WFM, kHz(230)},
|
||||
RIG_FLT_END,
|
||||
},
|
||||
NULL, /* priv */
|
||||
(void*)&icr8500_priv_caps,
|
||||
icom_init, icom_cleanup, NULL, NULL, NULL /* probe not supported yet */,
|
||||
icom_set_freq, icom_get_freq, icom_set_mode, icom_get_mode, icom_set_vfo,
|
||||
NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user