Pointerize state references in Tentec rigs.

pull/1562/head
George Baltz N3GB 2024-06-03 16:11:36 -04:00
rodzic 9eda0628f6
commit 9e4bacbec9
9 zmienionych plików z 122 dodań i 122 usunięć

Wyświetl plik

@ -291,16 +291,16 @@ int tt538_init(RIG *rig)
{
struct tt538_priv_data *priv;
rig->state.priv = (struct tt538_priv_data *) calloc(1, sizeof(
STATE(rig)->priv = (struct tt538_priv_data *) calloc(1, sizeof(
struct tt538_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct tt538_priv_data));
@ -315,7 +315,7 @@ int tt538_init(RIG *rig)
static char which_vfo(const RIG *rig, vfo_t vfo)
{
const struct tt538_priv_data *priv = (struct tt538_priv_data *)rig->state.priv;
const struct tt538_priv_data *priv = (struct tt538_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -340,7 +340,7 @@ static char which_vfo(const RIG *rig, vfo_t vfo)
int tt538_get_vfo(RIG *rig, vfo_t *vfo)
{
const struct tt538_priv_data *priv = (struct tt538_priv_data *) rig->state.priv;
const struct tt538_priv_data *priv = (struct tt538_priv_data *) STATE(rig)->priv;
*vfo = priv->vfo_curr;
return RIG_OK;
}
@ -351,7 +351,7 @@ int tt538_get_vfo(RIG *rig, vfo_t *vfo)
*/
int tt538_set_vfo(RIG *rig, vfo_t vfo)
{
struct tt538_priv_data *priv = (struct tt538_priv_data *)rig->state.priv;
struct tt538_priv_data *priv = (struct tt538_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -436,7 +436,7 @@ int tt538_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/*
* tt538_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes rig!=NULL, STATE(rig)->priv!=NULL
* assumes priv->mode in AM,CW,LSB or USB.
*/
@ -634,7 +634,7 @@ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
unsigned char cmdbuf[32], respbuf[32], ttmode;
int resp_len, retval;
const struct tt538_priv_data *priv = (struct tt538_priv_data *) rig->state.priv;
const struct tt538_priv_data *priv = (struct tt538_priv_data *) STATE(rig)->priv;
/* Query mode for both VFOs. */
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?M" EOM);

Wyświetl plik

@ -330,16 +330,16 @@ int tt588_init(RIG *rig)
struct tt588_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s:\n", __func__);
rig->state.priv = (struct tt588_priv_data *) calloc(1, sizeof(
STATE(rig)->priv = (struct tt588_priv_data *) calloc(1, sizeof(
struct tt588_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct tt588_priv_data));
@ -380,7 +380,7 @@ static char which_vfo(const RIG *rig, vfo_t vfo)
int tt588_get_vfo(RIG *rig, vfo_t *vfo)
{
static int getinfo = TRUE;
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
if (getinfo) // this is the first call to this package so we do this here
{
@ -407,7 +407,7 @@ int tt588_get_vfo(RIG *rig, vfo_t *vfo)
*/
int tt588_set_vfo(RIG *rig, vfo_t vfo)
{
struct tt588_priv_data *priv = (struct tt588_priv_data *)rig->state.priv;
struct tt588_priv_data *priv = (struct tt588_priv_data *)STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
@ -461,7 +461,7 @@ int tt588_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int resp_len, retval;
unsigned char cmdbuf[16], respbuf[32];
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -504,7 +504,7 @@ int tt588_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/*
* tt588_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
int tt588_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
@ -597,7 +597,7 @@ int tt588_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int resp_len, retval;
unsigned char cmdbuf[16], respbuf[32];
char ttmode;
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
@ -798,7 +798,7 @@ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
unsigned char cmdbuf[32], respbuf[32], ttmode;
int resp_len, retval;
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s mode=%s width=%d\n", __func__,
rig_strvfo(vfo), rig_strrmode(mode), (int)width);

Wyświetl plik

@ -101,7 +101,7 @@ double tt565_timenow() /* returns current time in secs+microsecs */
*
* This is the basic I/O transaction to/from the Orion.
* \n Read variable number of bytes, up to buffer size, if data & data_len != NULL.
* \n We assume that rig!=NULL, rig->state!= NULL.
* \n We assume that rig!=NULL, STATE(rig)!= NULL.
* Otherwise, you'll get a nice seg fault. You've been warned!
*/
@ -221,12 +221,12 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int tt565_init(RIG *rig)
{
struct tt565_priv_data *priv;
rig->state.priv = (struct tt565_priv_data *)calloc(1, sizeof(
STATE(rig)->priv = (struct tt565_priv_data *)calloc(1, sizeof(
struct tt565_priv_data));
if (!rig->state.priv) { return -RIG_ENOMEM; } /* no memory available */
if (!STATE(rig)->priv) { return -RIG_ENOMEM; } /* no memory available */
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct tt565_priv_data));
priv->ch = 0; /* set arbitrary initial status */
@ -242,12 +242,12 @@ int tt565_init(RIG *rig)
*/
int tt565_cleanup(RIG *rig)
{
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;
}
@ -274,11 +274,11 @@ int tt565_open(RIG *rig)
if (!strstr(buf, "1."))
{
/* Not v1 means probably v2 */
memcpy(&rig->state.str_cal, &cal2, sizeof(cal_table_t));
memcpy(&STATE(rig)->str_cal, &cal2, sizeof(cal_table_t));
}
else
{
memcpy(&rig->state.str_cal, &cal1, sizeof(cal_table_t));
memcpy(&STATE(rig)->str_cal, &cal1, sizeof(cal_table_t));
}
return RIG_OK;
@ -296,7 +296,7 @@ int tt565_open(RIG *rig)
*/
static char which_receiver(const RIG *rig, vfo_t vfo)
{
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -325,7 +325,7 @@ static char which_receiver(const RIG *rig, vfo_t vfo)
*/
static char which_vfo(const RIG *rig, vfo_t vfo)
{
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -353,7 +353,7 @@ static char which_vfo(const RIG *rig, vfo_t vfo)
* \param freq
* \brief Set a frequence into the specified VFO
*
* assumes rig->state.priv!=NULL
* assumes STATE(rig)->priv!=NULL
* \n assumes priv->mode in AM,CW,LSB or USB.
*/
@ -373,7 +373,7 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
this_range = rig->state.rx_range_list[i];
this_range = STATE(rig)->rx_range_list[i];
if (this_range.startf == 0 && this_range.endf == 0)
{
@ -382,7 +382,7 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
/* We don't care about mode setting, but vfo must match. */
if (freq >= this_range.startf && freq <= this_range.endf &&
(this_range.vfo == rig->state.current_vfo))
(this_range.vfo == STATE(rig)->current_vfo))
{
in_range = TRUE;
break;
@ -481,7 +481,7 @@ int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int tt565_set_vfo(RIG *rig, vfo_t vfo)
{
struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR)
{
@ -510,7 +510,7 @@ int tt565_set_vfo(RIG *rig, vfo_t vfo)
*/
int tt565_get_vfo(RIG *rig, vfo_t *vfo)
{
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
*vfo = priv->vfo_curr;
@ -1783,7 +1783,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
*/
int tt565_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
priv->ch = ch; /* See RIG_OP_TO/FROM_VFO */
return RIG_OK;
@ -1798,7 +1798,7 @@ int tt565_set_mem(RIG *rig, vfo_t vfo, int ch)
*/
int tt565_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
*ch = priv->ch;
return RIG_OK;
@ -1820,7 +1820,7 @@ int tt565_get_mem(RIG *rig, vfo_t vfo, int *ch)
*/
int tt565_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
char cmdbuf[TT565_BUFSIZE];
int retval;

Wyświetl plik

@ -209,16 +209,16 @@ int tt585_init(RIG *rig)
{
struct tt585_priv_data *priv;
rig->state.priv = (struct tt585_priv_data *) calloc(1, sizeof(
STATE(rig)->priv = (struct tt585_priv_data *) calloc(1, sizeof(
struct tt585_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct tt585_priv_data));
@ -227,10 +227,10 @@ int tt585_init(RIG *rig)
int tt585_cleanup(RIG *rig)
{
if (rig->state.priv)
if (STATE(rig)->priv)
{
free(rig->state.priv);
rig->state.priv = NULL;
free(STATE(rig)->priv);
STATE(rig)->priv = NULL;
}
return RIG_OK;
@ -238,7 +238,7 @@ int tt585_cleanup(RIG *rig)
int tt585_get_vfo(RIG *rig, vfo_t *vfo)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *) rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *) STATE(rig)->priv;
int ret;
ret = tt585_get_status_data(rig);
@ -302,7 +302,7 @@ int tt585_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
int tt585_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
int ret;
ret = tt585_get_status_data(rig);
@ -325,7 +325,7 @@ int tt585_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
*/
int tt585_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
int ret;
unsigned char *p;
@ -351,13 +351,13 @@ int tt585_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/*
* tt585_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes rig!=NULL, STATE(rig)->priv!=NULL
* assumes priv->mode in AM,CW,LSB or USB.
*/
int tt585_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
#define FREQBUFSZ 16
char buf[FREQBUFSZ], *p;
@ -379,7 +379,7 @@ int tt585_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
*/
int tt585_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
const struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
const struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
int ret;
ret = tt585_get_status_data(rig);
@ -452,7 +452,7 @@ int tt585_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
const char *mcmd, *wcmd;
int ret;
hamlib_port_t *rp = RIGPORT(rig);
@ -517,7 +517,7 @@ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int tt585_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
char buf[16];
if (ch < 0 || ch > 61)
@ -535,7 +535,7 @@ int tt585_set_mem(RIG *rig, vfo_t vfo, int ch)
int tt585_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *) rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *) STATE(rig)->priv;
int ret;
ret = tt585_get_status_data(rig);
@ -565,7 +565,7 @@ int tt585_get_mem(RIG *rig, vfo_t vfo, int *ch)
*/
int tt585_get_status_data(RIG *rig)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
hamlib_port_t *rigport;
int ret;
@ -637,7 +637,7 @@ int tt585_set_parm(RIG *rig, setting_t parm, value_t val)
*/
int tt585_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv;
struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv;
const char *cmd;
char buf[16];

Wyświetl plik

@ -232,7 +232,7 @@ struct rig_caps rx331_caps =
/*
* rx331_transaction
* read exactly data_len bytes
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
* We assume that rig!=NULL, STATE(rig)!= NULL, data!=NULL, data_len!=NULL
* Otherwise, you'll get a nice seg fault. You've been warned!
*/
static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
@ -243,7 +243,7 @@ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
char str[BUFSZ];
char fmt[16];
hamlib_port_t *rp = RIGPORT(rig);
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
const struct rx331_priv_data *priv = (struct rx331_priv_data *)STATE(rig)->priv;
rig_flush(rp);
@ -289,16 +289,16 @@ int rx331_init(RIG *rig)
{
struct rx331_priv_data *priv;
rig->state.priv = (struct rx331_priv_data *)calloc(1, sizeof(
STATE(rig)->priv = (struct rx331_priv_data *)calloc(1, sizeof(
struct rx331_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct rx331_priv_data));
@ -311,19 +311,19 @@ int rx331_init(RIG *rig)
*/
int rx331_cleanup(RIG *rig)
{
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;
}
int rx331_set_conf(RIG *rig, hamlib_token_t token, const char *val)
{
struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
struct rx331_priv_data *priv = (struct rx331_priv_data *)STATE(rig)->priv;
switch (token)
{
@ -340,7 +340,7 @@ int rx331_set_conf(RIG *rig, hamlib_token_t token, const char *val)
int rx331_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
{
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
const struct rx331_priv_data *priv = (struct rx331_priv_data *)STATE(rig)->priv;
switch (token)
{
@ -391,7 +391,7 @@ int rx331_close(RIG *rig)
int rx331_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
const struct rx331_priv_data *priv = (struct rx331_priv_data *)STATE(rig)->priv;
int freq_len, retval;
char freqbuf[16];
@ -439,7 +439,7 @@ int rx331_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
const struct rx331_priv_data *priv = (struct rx331_priv_data *)STATE(rig)->priv;
char dmode;
int mdbuf_len, retval;
char mdbuf[32];
@ -560,7 +560,7 @@ int rx331_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
const struct rx331_priv_data *priv = (struct rx331_priv_data *)rig->state.priv;
const struct rx331_priv_data *priv = (struct rx331_priv_data *)STATE(rig)->priv;
int retval = RIG_OK;
char cmdbuf[32];

Wyświetl plik

@ -187,7 +187,7 @@ struct rig_caps rx340_caps =
/*
* rx340_transaction
* read exactly data_len bytes
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
* We assume that rig!=NULL, STATE(rig)!= NULL, data!=NULL, data_len!=NULL
* Otherwise, you'll get a nice seg fault. You've been warned!
*/
static int rx340_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
@ -247,7 +247,7 @@ int rx340_init(RIG *rig)
* set arbitrary initial status
*/
rig->state.priv = (rig_ptr_t)priv;
STATE(rig)->priv = (rig_ptr_t)priv;
return RIG_OK;
}
@ -258,12 +258,12 @@ int rx340_init(RIG *rig)
*/
int rx340_cleanup(RIG *rig)
{
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;
}

Wyświetl plik

@ -52,7 +52,7 @@ static int tentec_filters[] =
/*
* tentec_transaction
* read exactly data_len bytes
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
* We assume that rig!=NULL, STATE(rig)!= NULL, data!=NULL, data_len!=NULL
* Otherwise, you'll get a nice seg fault. You've been warned!
*/
int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
@ -103,16 +103,16 @@ int tentec_init(RIG *rig)
{
struct tentec_priv_data *priv;
rig->state.priv = (struct tentec_priv_data *)calloc(1, sizeof(
STATE(rig)->priv = (struct tentec_priv_data *)calloc(1, sizeof(
struct tentec_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct tentec_priv_data));
@ -127,7 +127,7 @@ int tentec_init(RIG *rig)
priv->agc = RIG_AGC_MEDIUM; /* medium */
priv->lnvol = priv->spkvol = 0.0; /* mute */
/* tentec_tuning_factor_calc needs rig->state.priv */
/* tentec_tuning_factor_calc needs STATE(rig)->priv */
tentec_tuning_factor_calc(rig);
return RIG_OK;
@ -139,12 +139,12 @@ int tentec_init(RIG *rig)
*/
int tentec_cleanup(RIG *rig)
{
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;
}
@ -174,7 +174,7 @@ int tentec_trx_open(RIG *rig)
/*
* Tuning Factor Calculations
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes rig!=NULL, STATE(rig)->priv!=NULL
* assumes priv->mode in supported modes.
*/
static void tentec_tuning_factor_calc(RIG *rig)
@ -183,7 +183,7 @@ static void tentec_tuning_factor_calc(RIG *rig)
freq_t tfreq;
int adjtfreq, mcor, fcor, cwbfo;
priv = (struct tentec_priv_data *)rig->state.priv;
priv = (struct tentec_priv_data *)STATE(rig)->priv;
cwbfo = 0;
/* computed fcor only used if mode is not CW */
@ -221,7 +221,7 @@ static void tentec_tuning_factor_calc(RIG *rig)
/*
* tentec_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes rig!=NULL, STATE(rig)->priv!=NULL
* assumes priv->mode in AM,CW,LSB or USB.
*/
int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
@ -231,7 +231,7 @@ int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char freqbuf[16];
freq_t old_freq;
priv = (struct tentec_priv_data *)rig->state.priv;
priv = (struct tentec_priv_data *)STATE(rig)->priv;
old_freq = priv->freq;
priv->freq = freq;
@ -260,7 +260,7 @@ int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int tentec_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
const struct tentec_priv_data *priv = (struct tentec_priv_data *)
rig->state.priv;
STATE(rig)->priv;
*freq = priv->freq;
@ -273,7 +273,7 @@ int tentec_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
struct tentec_priv_data *priv = (struct tentec_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
char ttmode;
rmode_t saved_mode;
@ -381,7 +381,7 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int tentec_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
const struct tentec_priv_data *priv = (struct tentec_priv_data *)
rig->state.priv;
STATE(rig)->priv;
*mode = priv->mode;
*width = priv->width;
@ -397,7 +397,7 @@ int tentec_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
struct tentec_priv_data *priv = (struct tentec_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
int retval = RIG_OK;
char cmdbuf[32];
@ -467,7 +467,7 @@ int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
int tentec_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
const struct tentec_priv_data *priv = (struct tentec_priv_data *)
rig->state.priv;
STATE(rig)->priv;
int retval, lvl_len;
unsigned char lvlbuf[32];

Wyświetl plik

@ -78,7 +78,7 @@
/*
* tentec_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes rig!=NULL, STATE(rig)->priv!=NULL
* assumes priv->mode in AM,CW,LSB or USB.
*/
int tentec2_set_freq(RIG *rig, vfo_t vfo, freq_t freq)

Wyświetl plik

@ -58,7 +58,7 @@ static int tt550_tx_filters[] =
/*
* tt550_transaction
* read exactly data_len bytes
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
* We assume that rig!=NULL, STATE(rig)!= NULL, data!=NULL, data_len!=NULL
* Otherwise, you'll get a nice seg fault. You've been warned!
*/
int
@ -201,7 +201,7 @@ tt550_tuning_factor_calc(RIG *rig, int tx)
int FilterBw; // Filter Bandwidth determined from table
int Mode, PbtAdj, RitAdj, XitAdj;
priv = (struct tt550_priv_data *) rig->state.priv;
priv = (struct tt550_priv_data *) STATE(rig)->priv;
Mode = (tx ? priv->tx_mode : priv->rx_mode);
radio_freq = ((tx ? priv->tx_freq : priv->rx_freq)) / (double) MHz(1);
@ -352,10 +352,10 @@ tt550_init(RIG *rig)
{
struct tt550_priv_data *priv;
rig->state.priv = (struct tt550_priv_data *) calloc(1, sizeof(
STATE(rig)->priv = (struct tt550_priv_data *) calloc(1, sizeof(
struct tt550_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/*
* whoops! memory shortage!
@ -363,7 +363,7 @@ tt550_init(RIG *rig)
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct tt550_priv_data));
@ -393,12 +393,12 @@ tt550_init(RIG *rig)
int
tt550_cleanup(RIG *rig)
{
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;
}
@ -454,7 +454,7 @@ tt550_trx_open(RIG *rig)
struct tt550_priv_data *priv;
priv = (struct tt550_priv_data *) rig->state.priv;
priv = (struct tt550_priv_data *) STATE(rig)->priv;
/*
* Reset the radio and start its program running
@ -510,7 +510,7 @@ int
tt550_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
int retval;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
retval = tt550_set_rx_freq(rig, vfo, freq);
@ -535,7 +535,7 @@ tt550_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int
tt550_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
*freq = priv->rx_freq;
@ -552,7 +552,7 @@ int
tt550_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
int retval;
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
retval = tt550_set_rx_mode(rig, vfo, mode, width);
@ -577,7 +577,7 @@ tt550_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int
tt550_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
*mode = priv->rx_mode;
*width = priv->width;
@ -598,7 +598,7 @@ tt550_set_rx_freq(RIG *rig, vfo_t vfo, freq_t freq)
int retval;
char freqbuf[16];
priv = (struct tt550_priv_data *) rig->state.priv;
priv = (struct tt550_priv_data *) STATE(rig)->priv;
priv->rx_freq = freq;
@ -631,7 +631,7 @@ tt550_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
int retval;
char freqbuf[16];
priv = (struct tt550_priv_data *) rig->state.priv;
priv = (struct tt550_priv_data *) STATE(rig)->priv;
priv->tx_freq = freq;
@ -660,7 +660,7 @@ tt550_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
int
tt550_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
*freq = priv->tx_freq;
@ -675,7 +675,7 @@ tt550_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int
tt550_set_rx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
char ttmode;
rmode_t saved_mode;
@ -790,7 +790,7 @@ tt550_set_rx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int
tt550_set_tx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
char ttmode;
rmode_t saved_mode;
@ -919,7 +919,7 @@ tt550_set_tx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int
tt550_get_tx_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
*mode = priv->tx_mode;
*width = priv->tx_width;
@ -933,7 +933,7 @@ tt550_get_tx_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int
tt550_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
priv->rit = rit;
tt550_set_rx_freq(rig, vfo, priv->rx_freq);
@ -947,7 +947,7 @@ tt550_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
int
tt550_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
{
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
*rit = priv->rit;
@ -960,7 +960,7 @@ tt550_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
int
tt550_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
priv->xit = xit;
tt550_set_tx_freq(rig, vfo, priv->tx_freq);
@ -974,7 +974,7 @@ tt550_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
int
tt550_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
{
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
*xit = priv->xit;
@ -988,7 +988,7 @@ tt550_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
int
tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
int retval, ditfactor, dahfactor, spcfactor;
char cmdbuf[32];
@ -1195,7 +1195,7 @@ tt550_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
int
tt550_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
int retval, lvl_len;
char lvlbuf[32];
@ -1409,7 +1409,7 @@ tt550_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
int
tt550_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
priv->split = split;
@ -1423,7 +1423,7 @@ tt550_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
int
tt550_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
*split = priv->split;
@ -1435,7 +1435,7 @@ int
tt550_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
unsigned char fctbuf[16];
struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
/* Optimize:
@ -1484,7 +1484,7 @@ tt550_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
int
tt550_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
/* Optimize:
* sort the switch cases with the most frequent first
@ -1526,7 +1526,7 @@ tt550_set_tuning_step(RIG *rig, vfo_t vfo, shortfreq_t stepsize)
struct tt550_priv_data *priv;
struct rig_state *rs;
rs = &rig->state;
rs = STATE(rig);
priv = (struct tt550_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: tt550_set_tuning_step - %d\n",
@ -1547,7 +1547,7 @@ tt550_get_tuning_step(RIG *rig, vfo_t vfo, shortfreq_t *stepsize)
struct tt550_priv_data *priv;
struct rig_state *rs;
rs = &rig->state;
rs = STATE(rig);
priv = (struct tt550_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: tt550_get_tuning_step - %d\n",
@ -1568,7 +1568,7 @@ tt550_tune(RIG *rig)
value_t current_power;
rmode_t current_mode;
value_t lowpower;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv;
const struct tt550_priv_data *priv = (struct tt550_priv_data *) STATE(rig)->priv;
/* Set our lowpower level to about 10 Watts */
lowpower.f = 0.12;
@ -1672,7 +1672,7 @@ tt550_decode_event(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s/tt: tt550_decode_event called\n", __func__);
rs = &rig->state;
rs = STATE(rig);
priv = (struct tt550_priv_data *) rs->priv;
data_len = read_string(RIGPORT(rig), buf, MAXFRAMELEN, "\n\r", 2, 0,