kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
d6dcd4aad4
commit
d17290b835
|
@ -168,16 +168,16 @@ int dds60_init(RIG *rig)
|
|||
{
|
||||
struct dds60_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct dds60_priv_data *)calloc(1, sizeof(
|
||||
STATE(rig)->priv = (struct dds60_priv_data *)calloc(1, sizeof(
|
||||
struct dds60_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->osc_freq = OSCFREQ;
|
||||
priv->if_mix_freq = IFMIXFREQ;
|
||||
|
@ -194,26 +194,26 @@ int dds60_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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
int dds60_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
||||
{
|
||||
struct dds60_priv_data *priv;
|
||||
float phase;
|
||||
|
||||
priv = (struct dds60_priv_data *)rig->state.priv;
|
||||
priv = (struct dds60_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -243,14 +243,14 @@ int dds60_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
|
||||
/*
|
||||
* assumes rig!=NULL,
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
* and val points to a buffer big enough to hold the conf value.
|
||||
*/
|
||||
int dds60_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
||||
{
|
||||
struct dds60_priv_data *priv;
|
||||
|
||||
priv = (struct dds60_priv_data *)rig->state.priv;
|
||||
priv = (struct dds60_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -351,7 +351,7 @@ int dds60_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
hamlib_port_t *port = RIGPORT(rig);
|
||||
freq_t osc_ref;
|
||||
|
||||
priv = (struct dds60_priv_data *)rig->state.priv;
|
||||
priv = (struct dds60_priv_data *)STATE(rig)->priv;
|
||||
|
||||
if (priv->multiplier)
|
||||
{
|
||||
|
|
|
@ -168,16 +168,16 @@ int drt1_init(RIG *rig)
|
|||
{
|
||||
struct drt1_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct drt1_priv_data *)calloc(1, sizeof(
|
||||
STATE(rig)->priv = (struct drt1_priv_data *)calloc(1, sizeof(
|
||||
struct drt1_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->osc_freq = OSCFREQ;
|
||||
priv->ref_mult = REFMULT;
|
||||
|
@ -194,25 +194,25 @@ int drt1_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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
int drt1_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
||||
{
|
||||
struct drt1_priv_data *priv;
|
||||
|
||||
priv = (struct drt1_priv_data *)rig->state.priv;
|
||||
priv = (struct drt1_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -241,14 +241,14 @@ int drt1_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
|
||||
/*
|
||||
* assumes rig!=NULL,
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
* and val points to a buffer big enough to hold the conf value.
|
||||
*/
|
||||
int drt1_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
||||
{
|
||||
struct drt1_priv_data *priv;
|
||||
|
||||
priv = (struct drt1_priv_data *)rig->state.priv;
|
||||
priv = (struct drt1_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -414,7 +414,7 @@ int drt1_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
struct drt1_priv_data *priv;
|
||||
hamlib_port_t *port = RIGPORT(rig);
|
||||
|
||||
priv = (struct drt1_priv_data *)rig->state.priv;
|
||||
priv = (struct drt1_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_flush(port);
|
||||
|
||||
|
|
|
@ -226,16 +226,16 @@ int dwtdll_init(RIG *rig)
|
|||
{
|
||||
struct dwtdll_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct dwtdll_priv_data *)calloc(1, sizeof(
|
||||
STATE(rig)->priv = (struct dwtdll_priv_data *)calloc(1, sizeof(
|
||||
struct dwtdll_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
/* Try to load required dll */
|
||||
priv->dll = LoadLibrary(DWTDLL);
|
||||
|
@ -244,7 +244,7 @@ int dwtdll_init(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n",
|
||||
__func__, DWTDLL);
|
||||
free(rig->state.priv);
|
||||
free(STATE(rig)->priv);
|
||||
return -RIG_EIO; /* huh! */
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ int dwtdll_init(RIG *rig)
|
|||
|
||||
int dwtdll_open(RIG *rig)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
short ret;
|
||||
|
||||
/* Open DWT receiver */
|
||||
|
@ -319,7 +319,7 @@ int dwtdll_open(RIG *rig)
|
|||
|
||||
int dwtdll_close(RIG *rig)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
short ret;
|
||||
|
||||
/* Open DWT receiver */
|
||||
|
@ -335,24 +335,24 @@ int dwtdll_close(RIG *rig)
|
|||
|
||||
int dwtdll_cleanup(RIG *rig)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
|
||||
/* Clean up the dll access */
|
||||
if (priv) { FreeLibrary(priv->dll); }
|
||||
|
||||
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 dwtdll_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
short ret;
|
||||
|
||||
ret = priv->FrontendSetFrequency((double) freq);
|
||||
|
@ -362,7 +362,7 @@ int dwtdll_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
int dwtdll_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
|
||||
*freq = (freq_t) priv->FrontendGetFrequency();
|
||||
|
||||
|
@ -371,7 +371,7 @@ int dwtdll_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
int dwtdll_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
tFrontendMode dwtmode;
|
||||
short ret;
|
||||
|
||||
|
@ -394,7 +394,7 @@ int dwtdll_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
int dwtdll_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
tFrontendMode dwtmode;
|
||||
|
||||
dwtmode = priv->FrontendGetMode();
|
||||
|
@ -419,7 +419,7 @@ int dwtdll_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
int dwtdll_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
short ret = 0;
|
||||
|
||||
switch (level)
|
||||
|
@ -437,7 +437,7 @@ int dwtdll_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
int dwtdll_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
signed short ret = 0;
|
||||
|
||||
switch (level)
|
||||
|
@ -489,7 +489,7 @@ int dwtdll_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
static const char *dwtdll_get_info(RIG *rig)
|
||||
{
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)STATE(rig)->priv;
|
||||
static char info[22];
|
||||
|
||||
if (priv->FrontendGetId(info) < 0)
|
||||
|
|
|
@ -160,16 +160,16 @@ int elektor304_init(RIG *rig)
|
|||
{
|
||||
struct elektor304_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct elektor304_priv_data *)calloc(1, sizeof(struct
|
||||
STATE(rig)->priv = (struct elektor304_priv_data *)calloc(1, sizeof(struct
|
||||
elektor304_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->osc_freq = OSCFREQ;
|
||||
priv->if_mix_freq = IFMIXFREQ;
|
||||
|
@ -184,25 +184,25 @@ int elektor304_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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
int elektor304_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
||||
{
|
||||
struct elektor304_priv_data *priv;
|
||||
|
||||
priv = (struct elektor304_priv_data *)rig->state.priv;
|
||||
priv = (struct elektor304_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -223,14 +223,14 @@ int elektor304_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
|
||||
/*
|
||||
* assumes rig!=NULL,
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
* and val points to a buffer big enough to hold the conf value.
|
||||
*/
|
||||
int elektor304_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
||||
{
|
||||
struct elektor304_priv_data *priv;
|
||||
|
||||
priv = (struct elektor304_priv_data *)rig->state.priv;
|
||||
priv = (struct elektor304_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -344,7 +344,7 @@ int elektor304_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
struct elektor304_priv_data *priv;
|
||||
hamlib_port_t *port = RIGPORT(rig);
|
||||
|
||||
priv = (struct elektor304_priv_data *)rig->state.priv;
|
||||
priv = (struct elektor304_priv_data *)STATE(rig)->priv;
|
||||
|
||||
rig_flush(port);
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ int elektor507_init(RIG *rig)
|
|||
extra_priv->FT_Write =
|
||||
(FNCFT_Write) GetProcAddress(extra_priv->dll, "FT_Write");
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
STATE(rig)->priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ int elektor507_ftdi_write_data(RIG *rig, void *FTOutBuf,
|
|||
unsigned long BufferSize)
|
||||
{
|
||||
struct elektor507_extra_priv_data *extra_priv =
|
||||
&((struct elektor507_priv_data *)rig->state.priv)->extra_priv;
|
||||
&((struct elektor507_priv_data *)STATE(rig)->priv)->extra_priv;
|
||||
FT_Result ret;
|
||||
int Result;
|
||||
|
||||
|
@ -338,17 +338,17 @@ int elektor507_ftdi_write_data(RIG *rig, void *FTOutBuf,
|
|||
int elektor507_cleanup(RIG *rig)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
|
||||
/* Clean up the dll access */
|
||||
if (priv) { FreeLibrary(priv->extra_priv.dll); }
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -376,16 +376,16 @@ int elektor507_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct elektor507_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct elektor507_priv_data *)calloc(sizeof(struct
|
||||
STATE(rig)->priv = (struct elektor507_priv_data *)calloc(sizeof(struct
|
||||
elektor507_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->xtal_cal = XTAL_CAL;
|
||||
priv->osc_freq = OSCFREQ;
|
||||
|
@ -412,12 +412,12 @@ int elektor507_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;
|
||||
}
|
||||
|
@ -646,7 +646,7 @@ int elektor507_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
struct elektor507_priv_data *priv;
|
||||
freq_t freq;
|
||||
|
||||
priv = (struct elektor507_priv_data *)rig->state.priv;
|
||||
priv = (struct elektor507_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -670,7 +670,7 @@ int elektor507_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
|||
{
|
||||
struct elektor507_priv_data *priv;
|
||||
|
||||
priv = (struct elektor507_priv_data *)rig->state.priv;
|
||||
priv = (struct elektor507_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -699,7 +699,7 @@ int elektor507_get_conf(RIG *rig, hamlib_token_t token, char *val)
|
|||
int elektor507_open(RIG *rig)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
@ -1022,7 +1022,7 @@ static void find_P_Q_DIV1N(
|
|||
int elektor507_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
freq_t final_freq;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ int elektor507_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
int elektor507_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
double VCO;
|
||||
|
||||
VCO = ((double)priv->osc_freq * kHz(1)) / priv->Q * priv->P;
|
||||
|
@ -1081,7 +1081,7 @@ int elektor507_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
int elektor507_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret = 0;
|
||||
int att = 0;
|
||||
|
||||
|
@ -1120,7 +1120,7 @@ int elektor507_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
int elektor507_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
const struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret = 0;
|
||||
|
||||
switch (level)
|
||||
|
@ -1152,7 +1152,7 @@ int elektor507_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
int elektor507_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret, Mux;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
@ -1197,7 +1197,7 @@ int elektor507_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
|
|||
ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx)
|
||||
{
|
||||
const struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
|
||||
*ant_curr = priv->ant;
|
||||
|
||||
|
@ -1211,7 +1211,7 @@ int elektor507_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
|
|||
static int cy_update_pll(RIG *rig, unsigned char IICadr)
|
||||
{
|
||||
const struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int P0, R40, R41, R42;
|
||||
unsigned char Div1N;
|
||||
unsigned char Clk3_src;
|
||||
|
@ -1297,7 +1297,7 @@ static int cy_update_pll(RIG *rig, unsigned char IICadr)
|
|||
static void ftdi_SCL(RIG *rig, int d)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
|
||||
if (priv->Buf_adr >= FT_OUT_BUFFER_MAX)
|
||||
{
|
||||
|
@ -1323,7 +1323,7 @@ static void ftdi_SCL(RIG *rig, int d)
|
|||
static void ftdi_SDA(RIG *rig, int d)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
|
||||
if (priv->Buf_adr >= FT_OUT_BUFFER_MAX)
|
||||
{
|
||||
|
@ -1399,7 +1399,7 @@ int i2c_write_regs(RIG *rig, unsigned char IICadr, int reg_count,
|
|||
unsigned char reg_val1, unsigned char reg_val2, unsigned char reg_val3)
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret;
|
||||
|
||||
/* Start with a new buffer */
|
||||
|
@ -1461,7 +1461,7 @@ static const unsigned char ftdi_code[256] =
|
|||
int load_ftdi_code(RIG *rig, unsigned char IICadr, const unsigned char code[])
|
||||
{
|
||||
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret;
|
||||
int i, j;
|
||||
|
||||
|
|
|
@ -329,16 +329,16 @@ int fifisdr_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct fifisdr_priv_instance_data *priv;
|
||||
|
||||
rig->state.priv = (struct fifisdr_priv_instance_data *)calloc(sizeof(
|
||||
STATE(rig)->priv = (struct fifisdr_priv_instance_data *)calloc(sizeof(
|
||||
struct fifisdr_priv_instance_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->multiplier = 4;
|
||||
|
||||
|
@ -365,12 +365,12 @@ int fifisdr_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;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ int fifisdr_open(RIG *rig)
|
|||
struct fifisdr_priv_instance_data *priv;
|
||||
|
||||
|
||||
priv = (struct fifisdr_priv_instance_data *)rig->state.priv;
|
||||
priv = (struct fifisdr_priv_instance_data *)STATE(rig)->priv;
|
||||
|
||||
/* The VCO is a multiple of the RX frequency. Typically 4 */
|
||||
ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0,
|
||||
|
@ -426,7 +426,7 @@ int fifisdr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
{
|
||||
const struct fifisdr_priv_instance_data *priv = (struct
|
||||
fifisdr_priv_instance_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret;
|
||||
double mhz;
|
||||
uint32_t freq1121;
|
||||
|
@ -453,7 +453,7 @@ int fifisdr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
{
|
||||
const struct fifisdr_priv_instance_data *priv = (struct
|
||||
fifisdr_priv_instance_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret;
|
||||
uint32_t freq1121;
|
||||
|
||||
|
|
|
@ -228,16 +228,16 @@ int funcube_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct funcube_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct funcube_priv_data *)calloc(sizeof(
|
||||
STATE(rig)->priv = (struct funcube_priv_data *)calloc(sizeof(
|
||||
struct funcube_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->freq = 0;
|
||||
|
||||
|
@ -258,16 +258,16 @@ int funcubeplus_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct funcube_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct funcube_priv_data *)calloc(sizeof(
|
||||
STATE(rig)->priv = (struct funcube_priv_data *)calloc(sizeof(
|
||||
struct funcube_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->freq = 0;
|
||||
|
||||
|
@ -290,12 +290,12 @@ int funcube_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;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ int set_freq_v1(libusb_device_handle *udh, unsigned int f, int timeout)
|
|||
|
||||
int funcube_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
struct funcube_priv_data *priv = (struct funcube_priv_data *)rig->state.priv;
|
||||
struct funcube_priv_data *priv = (struct funcube_priv_data *)STATE(rig)->priv;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
libusb_device_handle *udh = rp->handle;
|
||||
|
||||
|
@ -450,7 +450,7 @@ int funcube_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
int get_freq_v0(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
const struct funcube_priv_data *priv = (struct funcube_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: frequency is not read from the device, the value shown is the last successfully set.\n",
|
||||
|
|
|
@ -189,7 +189,7 @@ struct rig_caps hiqsdr_caps =
|
|||
static int send_command(RIG *rig)
|
||||
{
|
||||
const struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
int ret;
|
||||
|
||||
ret = write_block(RIGPORT(rig), (unsigned char *) priv->control_frame,
|
||||
|
@ -223,14 +223,14 @@ static unsigned compute_sample_rate(const struct hiqsdr_priv_data *priv)
|
|||
}
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
int hiqsdr_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv;
|
||||
struct rig_state *rs;
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
priv = (struct hiqsdr_priv_data *)rs->priv;
|
||||
|
||||
switch (token)
|
||||
|
@ -254,7 +254,7 @@ int hiqsdr_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
|
||||
/*
|
||||
* assumes rig!=NULL,
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
* and val points to a buffer big enough to hold the conf value.
|
||||
*/
|
||||
int hiqsdr_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
||||
|
@ -262,7 +262,7 @@ int hiqsdr_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
|||
struct hiqsdr_priv_data *priv;
|
||||
struct rig_state *rs;
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
priv = (struct hiqsdr_priv_data *)rs->priv;
|
||||
|
||||
switch (token)
|
||||
|
@ -293,15 +293,15 @@ int hiqsdr_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rig->state.priv = (struct hiqsdr_priv_data *)calloc(1, sizeof(
|
||||
STATE(rig)->priv = (struct hiqsdr_priv_data *)calloc(1, sizeof(
|
||||
struct hiqsdr_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;
|
||||
priv->ref_clock = REFCLOCK;
|
||||
|
@ -314,7 +314,7 @@ int hiqsdr_init(RIG *rig)
|
|||
|
||||
int hiqsdr_open(RIG *rig)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
#if 0
|
||||
const char buf_send_to_me[] = { 0x72, 0x72 };
|
||||
int ret;
|
||||
|
@ -371,12 +371,12 @@ int hiqsdr_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;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ int hiqsdr_cleanup(RIG *rig)
|
|||
*/
|
||||
int hiqsdr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
int ret;
|
||||
double rxphase;
|
||||
uint32_t rxphase32;
|
||||
|
@ -417,7 +417,7 @@ int hiqsdr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
static int hiqsdr_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
|
||||
vfo_t tx_vfo)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
|
||||
priv->split = split;
|
||||
|
||||
|
@ -426,7 +426,7 @@ static int hiqsdr_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
|
|||
|
||||
int hiqsdr_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
int ret;
|
||||
double rxphase;
|
||||
uint32_t rxphase32;
|
||||
|
@ -454,7 +454,7 @@ int hiqsdr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
int hiqsdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
int ret = RIG_OK;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n",
|
||||
|
@ -477,7 +477,7 @@ int hiqsdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
int hiqsdr_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
int ret = RIG_OK;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %d\n",
|
||||
|
@ -505,7 +505,7 @@ int hiqsdr_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
int hiqsdr_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
int ret = RIG_OK;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %u\n",
|
||||
|
@ -528,7 +528,7 @@ int hiqsdr_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
|||
|
||||
int hiqsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||
{
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv;
|
||||
struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)STATE(rig)->priv;
|
||||
int ret = RIG_OK;
|
||||
|
||||
switch (level)
|
||||
|
|
|
@ -569,16 +569,16 @@ int si570avrusb_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct si570xxxusb_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
STATE(rig)->priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
si570xxxusb_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
|
||||
/* QSD/QSE */
|
||||
|
@ -610,16 +610,16 @@ int si570peaberry1_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct si570xxxusb_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
STATE(rig)->priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
si570xxxusb_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
|
||||
/* QSD/QSE */
|
||||
|
@ -651,16 +651,16 @@ int si570peaberry2_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct si570xxxusb_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
STATE(rig)->priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
si570xxxusb_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
|
||||
/* QSD/QSE */
|
||||
|
@ -692,16 +692,16 @@ int si570picusb_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct si570xxxusb_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
STATE(rig)->priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
si570xxxusb_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
|
||||
/* QSD/QSE */
|
||||
|
@ -733,16 +733,16 @@ int fasdr_init(RIG *rig)
|
|||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct si570xxxusb_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
STATE(rig)->priv = (struct si570xxxusb_priv_data *)calloc(sizeof(struct
|
||||
si570xxxusb_priv_data), 1);
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
priv = STATE(rig)->priv;
|
||||
|
||||
priv->osc_freq = SI570_NOMINAL_XTALL_FREQ;
|
||||
/* QSD/QSE */
|
||||
|
@ -770,7 +770,7 @@ int fasdr_init(RIG *rig)
|
|||
int fasdr_open(RIG *rig)
|
||||
{
|
||||
struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
libusb_device_handle *udh = RIGPORT(rig)->handle;
|
||||
int ret, i;
|
||||
double f;
|
||||
|
@ -852,12 +852,12 @@ int si570xxxusb_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;
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ int si570xxxusb_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
double multiplier;
|
||||
unsigned int i2c_addr;
|
||||
|
||||
priv = (struct si570xxxusb_priv_data *)rig->state.priv;
|
||||
priv = (struct si570xxxusb_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -928,7 +928,7 @@ int si570xxxusb_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
int si570xxxusb_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
|
||||
{
|
||||
struct si570xxxusb_priv_data *priv;
|
||||
priv = (struct si570xxxusb_priv_data *)rig->state.priv;
|
||||
priv = (struct si570xxxusb_priv_data *)STATE(rig)->priv;
|
||||
|
||||
switch (token)
|
||||
{
|
||||
|
@ -1014,7 +1014,7 @@ static int setBPF(RIG *rig, int enable)
|
|||
int si570xxxusb_open(RIG *rig)
|
||||
{
|
||||
struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
libusb_device_handle *udh = RIGPORT(rig)->handle;
|
||||
int ret;
|
||||
unsigned char buffer[4];
|
||||
|
@ -1112,7 +1112,7 @@ static const int HS_DIV_MAP[] = {4, 5, 6, 7, -1, 9, -1, 11};
|
|||
static int calcDividers(RIG *rig, double f, struct solution *solution)
|
||||
{
|
||||
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
struct solution sols[8];
|
||||
int i;
|
||||
int imin;
|
||||
|
@ -1194,7 +1194,7 @@ static int calcDividers(RIG *rig, double f, struct solution *solution)
|
|||
int si570xxxusb_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
libusb_device_handle *udh = RIGPORT(rig)->handle;
|
||||
int ret;
|
||||
unsigned char buffer[6];
|
||||
|
@ -1260,7 +1260,7 @@ int si570xxxusb_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
int si570xxxusb_set_freq_by_value(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
libusb_device_handle *udh = RIGPORT(rig)->handle;
|
||||
int ret;
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ int si570xxxusb_set_freq_by_value(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
static double calculateFrequency(RIG *rig, const unsigned char *buffer)
|
||||
{
|
||||
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
|
||||
int RFREQ_int = ((buffer[2] & 0xf0) >> 4) + ((buffer[1] & 0x3f) * 16);
|
||||
int RFREQ_frac = (256 * 256 * 256 * (buffer[2] & 0xf)) +
|
||||
|
@ -1330,7 +1330,7 @@ static double calculateFrequency(RIG *rig, const unsigned char *buffer)
|
|||
int si570xxxusb_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
libusb_device_handle *udh = RIGPORT(rig)->handle;
|
||||
unsigned char buffer[6];
|
||||
int ret;
|
||||
|
@ -1362,7 +1362,7 @@ int si570xxxusb_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
int si570xxxusb_get_freq_by_value(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
const struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)
|
||||
rig->state.priv;
|
||||
STATE(rig)->priv;
|
||||
libusb_device_handle *udh = RIGPORT(rig)->handle;
|
||||
int ret;
|
||||
unsigned char buffer[4];
|
||||
|
|
|
@ -46,8 +46,8 @@ struct usrp_priv_data {
|
|||
int usrp_init(RIG *rig)
|
||||
{
|
||||
// cppcheck-suppress leakReturnValNotUsed
|
||||
rig->state.priv = static_cast<struct usrp_priv_data*>malloc(sizeof(struct usrp_priv_data));
|
||||
if (!rig->state.priv) {
|
||||
STATE(rig)->priv = static_cast<struct usrp_priv_data*>malloc(sizeof(struct usrp_priv_data));
|
||||
if (!STATE(rig)->priv) {
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
@ -60,16 +60,16 @@ int usrp_cleanup(RIG *rig)
|
|||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
if (rig->state.priv)
|
||||
free(rig->state.priv);
|
||||
rig->state.priv = NULL;
|
||||
if (STATE(rig)->priv)
|
||||
free(STATE(rig)->priv);
|
||||
STATE(rig)->priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
int usrp_open(RIG *rig)
|
||||
{
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>STATE(rig)->priv;
|
||||
|
||||
int which_board = 0;
|
||||
int decim = 125;
|
||||
|
@ -83,7 +83,7 @@ int usrp_open(RIG *rig)
|
|||
|
||||
int usrp_close(RIG *rig)
|
||||
{
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>STATE(rig)->priv;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
@ -97,11 +97,11 @@ int usrp_close(RIG *rig)
|
|||
}
|
||||
|
||||
/*
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
int usrp_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
||||
{
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>STATE(rig)->priv;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
@ -121,12 +121,12 @@ int usrp_set_conf(RIG *rig, hamlib_token_t token, const char *val)
|
|||
|
||||
/*
|
||||
* assumes rig!=NULL,
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
* and val points to a buffer big enough to hold the conf value.
|
||||
*/
|
||||
int usrp_get_conf(RIG *rig, hamlib_token_t token, char *val)
|
||||
{
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>STATE(rig)->priv;
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ int usrp_get_conf(RIG *rig, hamlib_token_t token, char *val)
|
|||
|
||||
int usrp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>STATE(rig)->priv;
|
||||
int chan = 0;
|
||||
|
||||
if (!priv)
|
||||
|
@ -166,7 +166,7 @@ int usrp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
int usrp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>rig->state.priv;
|
||||
const struct usrp_priv_data *priv = static_cast<struct usrp_priv_data*>STATE(rig)->priv;
|
||||
int chan = 0;
|
||||
|
||||
if (!priv)
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
/*
|
||||
* lowe_transaction
|
||||
* 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
|
||||
*/
|
||||
int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
||||
int *data_len)
|
||||
|
|
|
@ -51,7 +51,7 @@ int mds_transaction(RIG *rig, char *cmd, int expected, char **result)
|
|||
char cmd_buf[MAXCMDLEN];
|
||||
int retval;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
struct mds_priv_data *priv = rig->state.priv;
|
||||
struct mds_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd=%s\n", __func__, cmd);
|
||||
|
||||
|
@ -101,10 +101,10 @@ int mds_init(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s version %s\n", __func__, rig->caps->version);
|
||||
// cppcheck claims leak here but it's freed in cleanup
|
||||
rig->state.priv = (struct mds_priv_data *)calloc(1,
|
||||
STATE(rig)->priv = (struct mds_priv_data *)calloc(1,
|
||||
sizeof(struct mds_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
if (!STATE(rig)->priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
@ -127,19 +127,19 @@ int mds_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;
|
||||
}
|
||||
|
||||
/*
|
||||
* mds_get_freq
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL, freq!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, freq!=NULL
|
||||
*/
|
||||
int mds_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ int mds_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
// TC command does not work on 4050 -- not implemented as of 2022-01-12
|
||||
/*
|
||||
* mds_set_freq
|
||||
* assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*/
|
||||
int mds_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ int mds_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
rmode_t tmode;
|
||||
pbwidth_t twidth;
|
||||
|
||||
//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 mode=%s width=%d\n", __func__,
|
||||
rig_strvfo(vfo), rig_strrmode(mode), (int)width);
|
||||
|
|
Ładowanie…
Reference in New Issue