kopia lustrzana https://github.com/Hamlib/Hamlib
Next batch of state pointers
rodzic
494787cb3c
commit
eeba884c7e
|
@ -226,15 +226,15 @@ int ft736_open(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
rig->state.priv = (struct ft736_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft736_priv_data *) calloc(1,
|
||||
sizeof(struct ft736_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->split = RIG_SPLIT_OFF;
|
||||
|
||||
|
@ -256,7 +256,7 @@ int ft736_close(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
|
||||
/* send Ext Cntl OFF: Deactivate CAT */
|
||||
return write_block(RIGPORT(rig), cmd, YAESU_CMD_LENGTH);
|
||||
|
@ -267,7 +267,7 @@ int ft736_close(RIG *rig)
|
|||
int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01};
|
||||
const struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
|
||||
const struct ft736_priv_data *priv = (struct ft736_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
|
||||
// we will assume requesting to set VFOB is split mode
|
||||
|
@ -318,7 +318,7 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x07};
|
||||
unsigned char md;
|
||||
const struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
|
||||
const struct ft736_priv_data *priv = (struct ft736_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_B) { return ft736_set_split_mode(rig, vfo, mode, width); }
|
||||
|
||||
|
@ -366,7 +366,7 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
int ft736_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x8e};
|
||||
struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv;
|
||||
struct ft736_priv_data *priv = (struct ft736_priv_data *)STATE(rig)->priv;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
|
|
|
@ -441,10 +441,10 @@ struct rig_caps ft747_caps =
|
|||
|
||||
int ft747_init(RIG *rig)
|
||||
{
|
||||
rig->state.priv = (struct ft747_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft747_priv_data *) calloc(1,
|
||||
sizeof(struct ft747_priv_data));
|
||||
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
if (!STATE(rig)->priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
@ -465,12 +465,12 @@ int ft747_cleanup(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ int ft747_open(RIG *rig)
|
|||
struct ft747_priv_data *p;
|
||||
int ret;
|
||||
|
||||
rig_s = &rig->state;
|
||||
rig_s = STATE(rig);
|
||||
p = (struct ft747_priv_data *)rig_s->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "ft747:rig_open: write_delay = %i msec \n",
|
||||
|
@ -547,7 +547,7 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
// cppcheck-suppress *
|
||||
char *fmt = "%s: requested freq after conversion = %"PRIll" Hz \n";
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"ft747: requested freq = %"PRIfreq" Hz vfo = %s \n", freq, rig_strvfo(vfo));
|
||||
|
@ -595,7 +595,7 @@ int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
if (ret < 0)
|
||||
|
@ -712,7 +712,7 @@ int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "ft747: cmd_index = %i \n", cmd_index);
|
||||
|
||||
rig_force_cache_timeout(&((struct ft747_priv_data *)
|
||||
rig->state.priv)->status_tv);
|
||||
STATE(rig)->priv)->status_tv);
|
||||
|
||||
/*
|
||||
* phew! now send cmd to rig
|
||||
|
@ -728,7 +728,7 @@ int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
unsigned char mymode; /* ft747 mode */
|
||||
int ret;
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
|
||||
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
|
@ -798,7 +798,7 @@ int ft747_set_vfo(RIG *rig, vfo_t vfo)
|
|||
struct ft747_priv_data *p;
|
||||
unsigned char cmd_index; /* index of sequence to send */
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
|
@ -831,7 +831,7 @@ int ft747_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
unsigned char status; /* ft747 status flag */
|
||||
int ret;
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
|
||||
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
|
@ -872,7 +872,7 @@ int ft747_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
FT_747_NATIVE_SPLIT_OFF;
|
||||
|
||||
rig_force_cache_timeout(&((struct ft747_priv_data *)
|
||||
rig->state.priv)->status_tv);
|
||||
STATE(rig)->priv)->status_tv);
|
||||
|
||||
return ft747_send_priv_cmd(rig, cmd_index);
|
||||
|
||||
|
@ -884,7 +884,7 @@ int ft747_get_split(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
|
|||
unsigned char status; /* ft747 status flag */
|
||||
int ret;
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
|
||||
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
|
@ -930,7 +930,7 @@ int ft747_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
}
|
||||
|
||||
rig_force_cache_timeout(&((struct ft747_priv_data *)
|
||||
rig->state.priv)->status_tv);
|
||||
STATE(rig)->priv)->status_tv);
|
||||
|
||||
/*
|
||||
* phew! now send cmd to rig
|
||||
|
@ -943,7 +943,7 @@ int ft747_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|||
{
|
||||
struct ft747_priv_data *p;
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ch < 0 || ch > 0x13)
|
||||
{
|
||||
|
@ -968,7 +968,7 @@ int ft747_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|||
unsigned char mem_nb;
|
||||
int ret;
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
|
||||
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ static int ft747_get_update_data(RIG *rig)
|
|||
struct ft747_priv_data *p;
|
||||
//unsigned char last_byte;
|
||||
|
||||
p = (struct ft747_priv_data *)rig->state.priv;
|
||||
p = (struct ft747_priv_data *)STATE(rig)->priv;
|
||||
rigport = RIGPORT(rig);
|
||||
|
||||
if (CACHE(rig)->ptt == RIG_PTT_ON
|
||||
|
@ -1012,7 +1012,7 @@ static int ft747_get_update_data(RIG *rig)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (!rig->state.transmit) /* rig doesn't respond in Tx mode */
|
||||
if (!STATE(rig)->transmit) /* rig doesn't respond in Tx mode */
|
||||
{
|
||||
int ret;
|
||||
//int port_timeout;
|
||||
|
|
|
@ -365,15 +365,15 @@ static int ft757_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ft757_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft757_priv_data *) calloc(1,
|
||||
sizeof(struct ft757_priv_data));
|
||||
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
if (!STATE(rig)->priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->curfreq = 1e6;
|
||||
|
||||
|
@ -396,12 +396,12 @@ static int ft757_cleanup(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ static int ft757_cleanup(RIG *rig)
|
|||
|
||||
static int ft757_open(RIG *rig)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
|
@ -456,7 +456,7 @@ static int ft757_open(RIG *rig)
|
|||
|
||||
static int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0a};
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called. Freq=%"PRIfreq"\n", __func__, freq);
|
||||
|
@ -497,7 +497,7 @@ static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
static int ft757gx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called. fakefreq=%d\n", __func__,
|
||||
priv->fakefreq);
|
||||
|
@ -517,7 +517,7 @@ static int ft757gx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
@ -556,7 +556,7 @@ static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
const struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
const struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
@ -599,7 +599,7 @@ static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
static int ft757_set_vfo(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x05};
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
|
@ -627,7 +627,7 @@ static int ft757_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
static int ft757gx_get_vfo(RIG *rig, vfo_t *vfo)
|
||||
{
|
||||
const struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
const struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
// we'll just use the cached vfo for the 757GX since we can't read it
|
||||
*vfo = priv->current_vfo;
|
||||
return RIG_OK;
|
||||
|
@ -635,7 +635,7 @@ static int ft757gx_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
|
||||
static int ft757_get_vfo(RIG *rig, vfo_t *vfo)
|
||||
{
|
||||
const struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
const struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
@ -666,7 +666,7 @@ static int ft757_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
|
||||
static int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
@ -738,7 +738,7 @@ static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
static int ft757_get_update_data(RIG *rig)
|
||||
{
|
||||
const unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x10};
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)STATE(rig)->priv;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
int retval = 0;
|
||||
long nbtries;
|
||||
|
@ -897,7 +897,7 @@ static int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width)
|
|||
}
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
static int ft757gx_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
||||
{
|
||||
|
@ -907,7 +907,7 @@ static int ft757gx_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
priv = (struct ft757_priv_data *)rs->priv;
|
||||
|
||||
|
||||
|
@ -931,7 +931,7 @@ static int ft757gx_get_conf(RIG *rig, hamlib_token_t token, char *val)
|
|||
}
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
static int ft757gx_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
||||
{
|
||||
|
@ -941,7 +941,7 @@ static int ft757gx_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called. val=%s\n", __func__, val);
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
priv = (struct ft757_priv_data *)rs->priv;
|
||||
|
||||
switch (token)
|
||||
|
|
|
@ -753,7 +753,7 @@ static int ft817_init(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called, version %s\n", __func__,
|
||||
rig->caps->version);
|
||||
|
||||
if ((rig->state.priv = calloc(1, sizeof(struct ft817_priv_data))) == NULL)
|
||||
if ((STATE(rig)->priv = calloc(1, sizeof(struct ft817_priv_data))) == NULL)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
@ -765,9 +765,9 @@ static int ft817_cleanup(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
|
|||
|
||||
static int ft817_get_status(RIG *rig, int status)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct timeval *tv;
|
||||
unsigned char *data;
|
||||
|
@ -986,7 +986,7 @@ static int ft817_get_status(RIG *rig, int status)
|
|||
|
||||
static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
freq_t f1 = 0, f2 = 0;
|
||||
struct rig_cache *cachep = CACHE(rig);
|
||||
int retries = RIGPORT(rig)->retry +
|
||||
|
@ -1039,7 +1039,7 @@ static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
static int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1125,7 +1125,7 @@ static int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
||||
vfo_t *tx_vfo)
|
||||
{
|
||||
const struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
const struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
ptt_t ptt;
|
||||
int n;
|
||||
|
||||
|
@ -1164,7 +1164,7 @@ static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|||
|
||||
static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1186,7 +1186,7 @@ static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level,
|
||||
const cal_table_float_t *cal)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1233,7 +1233,7 @@ static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level,
|
|||
/* frontend will always use RAWSTR+cal_table */
|
||||
static int ft817_get_smeter_level(RIG *rig, value_t *val)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
int n;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
@ -1274,7 +1274,7 @@ static int ft817_get_smeter_level(RIG *rig, value_t *val)
|
|||
|
||||
static int ft817_get_raw_smeter_level(RIG *rig, value_t *val)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1296,7 +1296,7 @@ static int ft817_get_raw_smeter_level(RIG *rig, value_t *val)
|
|||
|
||||
static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
|
||||
switch (level)
|
||||
{
|
||||
|
@ -1327,7 +1327,7 @@ static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
static int ft817_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||
{
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||
struct ft817_priv_data *p = (struct ft817_priv_data *) STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1383,7 +1383,7 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
|
|||
/* if CURR then get real VFO before parsing EEPROM */
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = STATE(rig)->current_vfo;
|
||||
}
|
||||
|
||||
/* band info is 4 bit per VFO, for A lower nibble, B is upper nible */
|
||||
|
@ -1623,7 +1623,7 @@ static int ft817_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
to_bcd_be(data, (freq + 5) / 10, 8);
|
||||
|
||||
rig_force_cache_timeout(
|
||||
&((struct ft817_priv_data *)rig->state.priv)->fm_status_tv);
|
||||
&((struct ft817_priv_data *)STATE(rig)->priv)->fm_status_tv);
|
||||
|
||||
retval = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_FREQ, data);
|
||||
hl_usleep(50 * 1000); // FT817 needs a little time after setting freq
|
||||
|
@ -1743,7 +1743,7 @@ static int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
/* return -RIG_EINVAL; */
|
||||
|
||||
rig_force_cache_timeout(
|
||||
&((struct ft817_priv_data *)rig->state.priv)->fm_status_tv);
|
||||
&((struct ft817_priv_data *)STATE(rig)->priv)->fm_status_tv);
|
||||
|
||||
return ft817_send_cmd(rig, index);
|
||||
}
|
||||
|
@ -2088,7 +2088,7 @@ static int ft817_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
|||
|
||||
case RIG_OP_TOGGLE:
|
||||
rig_force_cache_timeout(&((struct ft817_priv_data *)
|
||||
rig->state.priv)->fm_status_tv);
|
||||
STATE(rig)->priv)->fm_status_tv);
|
||||
n = ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_VFOAB);
|
||||
hl_usleep(100 * 1000); // rig needs a little time to do this
|
||||
return n;
|
||||
|
|
|
@ -387,15 +387,15 @@ static int ft840_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ft840_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft840_priv_data *) calloc(1,
|
||||
sizeof(struct ft840_priv_data));
|
||||
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
if (!STATE(rig)->priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
priv->pacing = FT840_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
|
@ -422,12 +422,12 @@ static int ft840_cleanup(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ static int ft840_open(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
|
||||
__func__, RIGPORT(rig)->write_delay);
|
||||
|
@ -513,7 +513,7 @@ static int ft840_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
@ -569,7 +569,7 @@ static int ft840_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -660,7 +660,7 @@ static int ft840_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
rig_strrmode(mode));
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__, (int)width);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -797,7 +797,7 @@ static int ft840_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -941,7 +941,7 @@ static int ft840_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1021,7 +1021,7 @@ static int ft840_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS,
|
||||
|
@ -1127,7 +1127,7 @@ static int ft840_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
|
||||
|
@ -1190,7 +1190,7 @@ static int ft840_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS,
|
||||
|
@ -1303,7 +1303,7 @@ static int ft840_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO split status */
|
||||
err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS,
|
||||
|
@ -1370,7 +1370,7 @@ static int ft840_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/*
|
||||
* The assumption here is that the user hasn't changed
|
||||
|
@ -1450,7 +1450,7 @@ static int ft840_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1602,7 +1602,7 @@ static int ft840_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed level = %s\n", __func__,
|
||||
rig_strlevel(level));
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (level)
|
||||
{
|
||||
|
@ -1735,7 +1735,7 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft840_send_static_cmd(rig, ci);
|
||||
|
||||
|
@ -1832,7 +1832,7 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
|
|||
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
|
||||
__func__, p1, p2, p3, p4);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
@ -1891,7 +1891,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
@ -1957,7 +1957,7 @@ static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
|
||||
|
||||
priv = (struct ft840_priv_data *)rig->state.priv;
|
||||
priv = (struct ft840_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
|
|
@ -1019,16 +1019,16 @@ static int ft847_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ft847_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft847_priv_data *) calloc(1,
|
||||
sizeof(struct ft847_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
|
||||
priv->sat_mode = RIG_SPLIT_OFF;
|
||||
|
@ -1057,12 +1057,12 @@ static int ft847_cleanup(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ static int ft847_send_priv_cmd(RIG *rig, int cmd_index)
|
|||
*/
|
||||
static int opcode_vfo(RIG *rig, unsigned char *cmd, int cmd_index, vfo_t vfo)
|
||||
{
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
|
||||
memcpy(cmd, &ncmd[cmd_index].nseq, YAESU_CMD_LENGTH);
|
||||
|
||||
|
@ -1199,7 +1199,7 @@ static int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
if (UNIDIRECTIONAL)
|
||||
{
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
|
@ -1235,7 +1235,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode,
|
|||
unsigned char cmd_index; /* index of sequence to send */
|
||||
unsigned char data[8];
|
||||
int n;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo =%s \n",
|
||||
__func__, rig_strvfo(vfo));
|
||||
|
@ -1370,7 +1370,7 @@ static int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
if (UNIDIRECTIONAL)
|
||||
{
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
priv->mode = mode;
|
||||
priv->width = width;
|
||||
}
|
||||
|
@ -1482,7 +1482,7 @@ static int ft847_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
*/
|
||||
static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||
{
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
unsigned char cmd_index; /* index of sequence to send */
|
||||
int ret;
|
||||
|
||||
|
@ -1515,7 +1515,7 @@ static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
static int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
||||
vfo_t *tx_vfo)
|
||||
{
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -1565,7 +1565,7 @@ static int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
if (UNIDIRECTIONAL)
|
||||
{
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
priv->ptt = ptt;
|
||||
}
|
||||
|
||||
|
@ -1593,7 +1593,7 @@ static int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
static int ft847_get_status(RIG *rig, int status_ci)
|
||||
{
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
unsigned char *data;
|
||||
int len;
|
||||
|
@ -1648,12 +1648,12 @@ static int ft847_get_status(RIG *rig, int status_ci)
|
|||
static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||
{
|
||||
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
|
||||
int n;
|
||||
|
||||
if (UNIDIRECTIONAL)
|
||||
{
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)rig->state.priv;
|
||||
struct ft847_priv_data *priv = (struct ft847_priv_data *)STATE(rig)->priv;
|
||||
*ptt = priv->ptt;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -1673,7 +1673,7 @@ static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
socket DTR or RTS PTT on the rear PACKET PTT pin is likely. So we
|
||||
override if we know PTT was asserted via rig_set_ptt for any type
|
||||
of PTT */
|
||||
if (RIG_PTT_OFF == *ptt && rig->state.transmit) { *ptt = RIG_PTT_ON; }
|
||||
if (RIG_PTT_OFF == *ptt && STATE(rig)->transmit) { *ptt = RIG_PTT_ON; }
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -1682,7 +1682,7 @@ static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
static int ft847_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||
{
|
||||
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
|
||||
int n;
|
||||
|
||||
if (UNIDIRECTIONAL)
|
||||
|
@ -1711,7 +1711,7 @@ static int ft847_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
|||
*/
|
||||
static int ft847_get_rawstr_level(RIG *rig, value_t *val)
|
||||
{
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
|
||||
int n;
|
||||
|
||||
if (UNIDIRECTIONAL)
|
||||
|
@ -1783,7 +1783,7 @@ static int ft847_get_smeter_level(RIG *rig, value_t *val)
|
|||
*/
|
||||
static int ft847_get_alc_level(RIG *rig, value_t *val)
|
||||
{
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv;
|
||||
struct ft847_priv_data *p = (struct ft847_priv_data *) STATE(rig)->priv;
|
||||
int n;
|
||||
|
||||
if (UNIDIRECTIONAL)
|
||||
|
|
|
@ -537,15 +537,15 @@ static int ft890_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ft890_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft890_priv_data *) calloc(1,
|
||||
sizeof(struct ft890_priv_data));
|
||||
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
if (!STATE(rig)->priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
priv->pacing = FT890_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
|
@ -572,12 +572,12 @@ static int ft890_cleanup(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ static int ft890_open(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
|
||||
__func__, rp->write_delay);
|
||||
|
@ -664,7 +664,7 @@ static int ft890_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
@ -720,7 +720,7 @@ static int ft890_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -811,7 +811,7 @@ static int ft890_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
rig_strrmode(mode));
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, width);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -948,7 +948,7 @@ static int ft890_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1092,7 +1092,7 @@ static int ft890_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1172,7 +1172,7 @@ static int ft890_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS,
|
||||
|
@ -1278,7 +1278,7 @@ static int ft890_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
|
||||
|
@ -1340,7 +1340,7 @@ static int ft890_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS,
|
||||
|
@ -1452,7 +1452,7 @@ static int ft890_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO split status */
|
||||
err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS,
|
||||
|
@ -1518,7 +1518,7 @@ static int ft890_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/*
|
||||
* The assumption here is that the user hasn't changed
|
||||
|
@ -1604,7 +1604,7 @@ static int ft890_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1756,7 +1756,7 @@ static int ft890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed level = %s\n", __func__,
|
||||
rig_strlevel(level));
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (level)
|
||||
{
|
||||
|
@ -1889,7 +1889,7 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft890_send_static_cmd(rig, ci);
|
||||
|
||||
|
@ -1985,7 +1985,7 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
|
|||
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
|
||||
__func__, p1, p2, p3, p4);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
@ -2044,7 +2044,7 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
@ -2109,7 +2109,7 @@ static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
|
||||
|
||||
priv = (struct ft890_priv_data *)rig->state.priv;
|
||||
priv = (struct ft890_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
|
|
@ -371,7 +371,7 @@ static int ft891_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
priv = (struct newcat_priv_data *)STATE(rig)->priv;
|
||||
|
||||
// RX VFO and TX VFO cannot be the same, no support for MEM as TX VFO
|
||||
if (vfo == tx_vfo || tx_vfo == RIG_VFO_MEM)
|
||||
|
@ -436,7 +436,7 @@ static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
priv = (struct newcat_priv_data *)STATE(rig)->priv;
|
||||
|
||||
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "ST;");
|
||||
|
||||
|
@ -493,7 +493,7 @@ static int ft891_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
priv = (struct newcat_priv_data *)STATE(rig)->priv;
|
||||
|
||||
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "OI;");
|
||||
|
||||
|
@ -547,7 +547,7 @@ static int ft891_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__,
|
||||
(int)tx_width);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
priv = (struct newcat_priv_data *)STATE(rig)->priv;
|
||||
|
||||
// Remember VFOB frequency
|
||||
if (RIG_OK != (err = newcat_get_freq(rig, RIG_VFO_B, &b_freq)))
|
||||
|
@ -599,7 +599,7 @@ static int ft891_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
// We will always make VFOB match VFOA mode
|
||||
newcat_set_mode(rig, RIG_VFO_A, mode, width);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
priv = (struct newcat_priv_data *)STATE(rig)->priv;
|
||||
|
||||
// Copy A to B
|
||||
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "AB;");
|
||||
|
@ -621,6 +621,6 @@ static int ft891_init(RIG *rig)
|
|||
|
||||
if (ret != RIG_OK) { return ret; }
|
||||
|
||||
rig->state.current_vfo = RIG_VFO_A;
|
||||
STATE(rig)->current_vfo = RIG_VFO_A;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -559,15 +559,15 @@ static int ft900_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ft900_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft900_priv_data *) calloc(1,
|
||||
sizeof(struct ft900_priv_data));
|
||||
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
if (!STATE(rig)->priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
priv->pacing = FT900_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
|
@ -594,12 +594,12 @@ static int ft900_cleanup(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ static int ft900_open(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
|
||||
__func__, RIGPORT(rig)->write_delay);
|
||||
|
@ -685,7 +685,7 @@ static int ft900_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
@ -741,7 +741,7 @@ static int ft900_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -833,7 +833,7 @@ static int ft900_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n",
|
||||
__func__, width);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -970,7 +970,7 @@ static int ft900_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1114,7 +1114,7 @@ static int ft900_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1194,7 +1194,7 @@ static int ft900_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS,
|
||||
|
@ -1300,7 +1300,7 @@ static int ft900_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
|
||||
|
@ -1364,7 +1364,7 @@ static int ft900_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS,
|
||||
|
@ -1478,7 +1478,7 @@ static int ft900_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO split status */
|
||||
err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS,
|
||||
|
@ -1543,7 +1543,7 @@ static int ft900_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/*
|
||||
* The assumption here is that the user hasn't changed
|
||||
|
@ -1629,7 +1629,7 @@ static int ft900_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1782,7 +1782,7 @@ static int ft900_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed level = %s\n", __func__,
|
||||
rig_strlevel(level));
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (level)
|
||||
{
|
||||
|
@ -1910,7 +1910,7 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft900_send_static_cmd(rig, ci);
|
||||
|
||||
|
@ -2006,7 +2006,7 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
|
|||
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
|
||||
__func__, p1, p2, p3, p4);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
@ -2065,7 +2065,7 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
@ -2130,7 +2130,7 @@ static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
|
||||
|
||||
priv = (struct ft900_priv_data *)rig->state.priv;
|
||||
priv = (struct ft900_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (ncmd[ci].ncomp)
|
||||
{
|
||||
|
|
|
@ -633,15 +633,15 @@ static int ft920_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ft920_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft920_priv_data *) calloc(1,
|
||||
sizeof(struct ft920_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM; /* whoops! memory shortage! */
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
priv->pacing =
|
||||
|
@ -668,12 +668,12 @@ static int ft920_cleanup(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ static int ft920_open(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n",
|
||||
__func__, rp->write_delay);
|
||||
|
@ -773,7 +773,7 @@ static int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
@ -853,7 +853,7 @@ static int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -945,7 +945,7 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
rig_strrmode(mode));
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__, (int)width);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1183,7 +1183,7 @@ static int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1371,7 +1371,7 @@ static int ft920_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -1443,7 +1443,7 @@ static int ft920_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS,
|
||||
|
@ -1632,7 +1632,7 @@ static int ft920_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO split status */
|
||||
err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS,
|
||||
|
@ -1717,7 +1717,7 @@ static int ft920_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
|
||||
if (err != RIG_OK) { RETURNFUNC(err); }
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
|
||||
|
||||
|
@ -1778,7 +1778,7 @@ static int ft920_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
|
||||
|
||||
|
@ -1847,7 +1847,7 @@ static int ft920_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %d Hz\n", __func__,
|
||||
(int)tx_width);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
|
||||
|
||||
|
@ -1911,7 +1911,7 @@ static int ft920_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo);
|
||||
|
||||
|
@ -2056,7 +2056,7 @@ static int ft920_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
|
@ -2259,7 +2259,7 @@ static int ft920_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt);
|
||||
|
@ -2331,7 +2331,7 @@ static int ft920_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS,
|
||||
|
@ -2403,7 +2403,7 @@ static int ft920_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s, func = %s, status = %d\n",
|
||||
__func__, rig_strvfo(vfo), rig_strfunc(func), status);
|
||||
|
@ -2487,7 +2487,7 @@ static int ft920_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s, func = %s\n",
|
||||
__func__, rig_strvfo(vfo), rig_strfunc(func));
|
||||
|
@ -2622,7 +2622,7 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
err = ft920_send_static_cmd(rig, ci);
|
||||
|
||||
|
@ -2722,7 +2722,7 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
|
|||
"%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n",
|
||||
__func__, p1, p2, p3, p4);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/*
|
||||
* If we've been passed a command index (ci) that is marked
|
||||
|
@ -2786,7 +2786,7 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/*
|
||||
* If we've been passed a command index (ci) that is marked
|
||||
|
@ -2855,7 +2855,7 @@ static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
priv = (struct ft920_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/*
|
||||
* If we've been passed a command index (ci) that is marked
|
||||
|
|
|
@ -612,7 +612,7 @@ int ft980_transaction(RIG *rig, const unsigned char *cmd, unsigned char *data,
|
|||
int ft980_get_status_data(RIG *rig)
|
||||
{
|
||||
const unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01 };
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
@ -663,15 +663,15 @@ int ft980_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ft980_priv_data *) calloc(1,
|
||||
STATE(rig)->priv = (struct ft980_priv_data *) calloc(1,
|
||||
sizeof(struct ft980_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
|
||||
memset(priv, 0, sizeof(struct ft980_priv_data));
|
||||
|
||||
|
@ -705,12 +705,12 @@ int ft980_cleanup(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (rig->state.priv)
|
||||
if (STATE(rig)->priv)
|
||||
{
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
}
|
||||
|
||||
rig->state.priv = NULL;
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ int ft980_open(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* send Ext Cntl ON: Activate CAT */
|
||||
do
|
||||
|
@ -782,7 +782,7 @@ int ft980_open(RIG *rig)
|
|||
int ft980_close(RIG *rig)
|
||||
{
|
||||
unsigned char echo_back[YAESU_CMD_LENGTH];
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
int retry_count1 = 0;
|
||||
|
||||
|
@ -842,7 +842,7 @@ int ft980_close(RIG *rig)
|
|||
int ft980_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x08};
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
int err;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
@ -903,7 +903,7 @@ int ft980_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
*/
|
||||
int ft980_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
freq_t f;
|
||||
|
||||
|
@ -977,7 +977,7 @@ int ft980_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0A};
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
unsigned char md;
|
||||
int err;
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
int ft980_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
unsigned char my_mode; /* ft890 mode, mode offset */
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
int retval, norm;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
@ -1236,7 +1236,7 @@ int ft980_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
int ft980_set_mem(RIG *rig, vfo_t vfo, int ch)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0A };
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -1269,7 +1269,7 @@ int ft980_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|||
*/
|
||||
int ft980_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
||||
{
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
struct ft980_priv_data *priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
@ -1321,7 +1321,7 @@ int ft980_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s\n", __func__, rig_strvfo(vfo));
|
||||
|
||||
priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
|
@ -1407,7 +1407,7 @@ int ft980_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
return -RIG_EARG;
|
||||
}
|
||||
|
||||
priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
priv = (struct ft980_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Get flags for VFO status */
|
||||
err = ft980_get_status_data(rig);
|
||||
|
|
Ładowanie…
Reference in New Issue