Stop copying table to private data, use table direct.

The table is never written so there is no point makeing the copy;
it only adds confusion for a programmer.
pull/780/head
Wouter van Gulik 2021-08-30 21:48:59 +02:00
rodzic a0672e4f7e
commit 261825fa27
10 zmienionych plików z 69 dodań i 149 usunięć

Wyświetl plik

@ -135,7 +135,6 @@ struct ft1000d_priv_data
vfo_t split_vfo; /* TX VFO in split mode Added on 16 Dec 2016 to include FT1000D function */
split_t split; /* split active or not Added on 16 Dec 2016 to include FT1000D function */
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of CAT cmd */
yaesu_cmd_set_t pcs[FT1000D_NATIVE_SIZE]; /* private cmd set */
ft1000d_update_data_t update_data; /* returned data */
};
@ -325,9 +324,6 @@ int ft1000d_init(RIG *rig)
priv = rig->state.priv;
// Copy native cmd set to private cmd storage area
memcpy(priv->pcs, ncmd, sizeof(ncmd));
// Set default pacing value
priv->pacing = FT1000D_PACING_DEFAULT_VALUE;
@ -3297,7 +3293,7 @@ int ft1000d_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -3305,7 +3301,6 @@ int ft1000d_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft1000d_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3316,17 +3311,16 @@ int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig_s->rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3345,7 +3339,7 @@ int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -3374,7 +3368,7 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft1000d_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -3408,7 +3402,6 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3434,7 +3427,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft1000d_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -3469,7 +3462,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* change the rit frequency.
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3494,7 +3487,7 @@ int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft1000d_priv_data *) rig->state.priv;
rig_s = &rig->state;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);

Wyświetl plik

@ -206,7 +206,6 @@ struct ft1000mp_priv_data
unsigned int read_update_delay; /* depends on pacing value */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT1000MP_NATIVE_SIZE]; /* private cmd set */
unsigned char update_data[2 *
FT1000MP_STATUS_UPDATE_LENGTH]; /* returned data--max value, some are less */
};
@ -642,11 +641,6 @@ int ft1000mp_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing =
FT1000MP_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
@ -1601,25 +1595,23 @@ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci,
static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft1000mp_priv_data *p;
unsigned char *cmd; /* points to sequence to send */
unsigned char cmd_index; /* index of sequence to send */
ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv;
rig_s = &rig->state;
cmd_index = ci; /* get command */
if (! p->pcs[cmd_index].ncomp)
if (! ncmd[cmd_index].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: attempt to send incomplete sequence\n",
__func__);
RETURNFUNC(-RIG_EINVAL);
}
cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */
cmd = (unsigned char *) ncmd[cmd_index].nseq; /* get native sequence */
rig_flush(&rig_s->rigport);
write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);

Wyświetl plik

@ -201,7 +201,6 @@ struct ft840_priv_data
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT840_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT840_ALL_DATA_LENGTH]; /* returned data--max value, some are less */
unsigned char current_mem; /* private memory channel number */
@ -366,11 +365,6 @@ static int ft840_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing = FT840_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
priv->read_update_delay =
@ -1743,7 +1737,7 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -1752,7 +1746,6 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft840_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft840_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1762,17 +1755,16 @@ static int ft840_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig_s->rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1791,7 +1783,7 @@ static int ft840_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -1820,7 +1812,7 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft840_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -1854,7 +1846,7 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -1881,7 +1873,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft840_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -1918,7 +1910,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -1950,7 +1942,7 @@ static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft840_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);

Wyświetl plik

@ -76,8 +76,6 @@
struct ft857_priv_data
{
yaesu_cmd_set_t pcs[FT857_NATIVE_SIZE]; /* TODO: why? */
/* rx status */
struct timeval rx_status_tv;
unsigned char rx_status;
@ -316,8 +314,6 @@ const struct rig_caps ft857_caps =
int ft857_init(RIG *rig)
{
struct ft857_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if ((rig->state.priv = calloc(1, sizeof(struct ft857_priv_data))) == NULL)
@ -325,11 +321,6 @@ int ft857_init(RIG *rig)
return -RIG_ENOMEM;
}
priv = rig->state.priv;
/* Copy complete native cmd set to private cmd storage area */
memcpy(priv->pcs, ncmd, sizeof(ncmd));
return RIG_OK;
}
@ -400,12 +391,11 @@ static int check_cache_timeout(struct timeval *tv)
static int ft857_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
unsigned char data[YAESU_CMD_LENGTH];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
memcpy(data, (char *)p->pcs[FT857_NATIVE_CAT_EEPROM_READ].nseq,
memcpy(data, (char *)ncmd[FT857_NATIVE_CAT_EEPROM_READ].nseq,
YAESU_CMD_LENGTH);
data[0] = addr >> 8;
@ -465,7 +455,7 @@ static int ft857_get_status(RIG *rig, int status)
rig_flush(&rig->state.rigport);
write_block(&rig->state.rigport, (char *) p->pcs[status].nseq,
write_block(&rig->state.rigport, (char *) ncmd[status].nseq,
YAESU_CMD_LENGTH);
if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0)
@ -499,17 +489,15 @@ static int ft857_get_status(RIG *rig, int status)
*/
static int ft857_send_cmd(RIG *rig, int index)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (p->pcs[index].ncomp == 0)
if (ncmd[index].ncomp == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: incomplete sequence\n", __func__);
return -RIG_EINTERNAL;
}
write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH);
write_block(&rig->state.rigport, (char *) ncmd[index].nseq, YAESU_CMD_LENGTH);
return ft817_read_ack(rig);
}
@ -518,18 +506,17 @@ static int ft857_send_cmd(RIG *rig, int index)
*/
static int ft857_send_icmd(RIG *rig, int index, unsigned char *data)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
unsigned char cmd[YAESU_CMD_LENGTH];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (p->pcs[index].ncomp == 1)
if (ncmd[index].ncomp == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: complete sequence\n", __func__);
return -RIG_EINTERNAL;
}
cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1];
cmd[YAESU_CMD_LENGTH - 1] = ncmd[index].nseq[YAESU_CMD_LENGTH - 1];
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);

Wyświetl plik

@ -139,7 +139,6 @@ struct ft890_priv_data
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT890_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT890_ALL_DATA_LENGTH]; /* returned data--max value, some are less */
unsigned char current_mem; /* private memory channel number */
@ -302,11 +301,6 @@ static int ft890_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing = FT890_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
priv->read_update_delay =
@ -1682,7 +1676,7 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -1691,7 +1685,6 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft890_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft890_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1701,17 +1694,16 @@ static int ft890_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig_s->rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1730,7 +1722,7 @@ static int ft890_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -1759,7 +1751,7 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft890_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -1793,7 +1785,7 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -1820,7 +1812,7 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft890_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -1857,7 +1849,7 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -1888,7 +1880,7 @@ static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft890_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);

Wyświetl plik

@ -81,8 +81,6 @@
struct ft897_priv_data
{
yaesu_cmd_set_t pcs[FT897_NATIVE_SIZE]; /* TODO: why? */
/* rx status */
struct timeval rx_status_tv;
unsigned char rx_status;
@ -492,8 +490,6 @@ const struct rig_caps ft897d_caps =
int ft897_init(RIG *rig)
{
struct ft897_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if ((rig->state.priv = calloc(1, sizeof(struct ft897_priv_data))) == NULL)
@ -501,11 +497,6 @@ int ft897_init(RIG *rig)
return -RIG_ENOMEM;
}
priv = rig->state.priv;
/* Copy complete native cmd set to private cmd storage area */
memcpy(priv->pcs, ncmd, sizeof(ncmd));
return RIG_OK;
}
@ -576,12 +567,11 @@ static int check_cache_timeout(struct timeval *tv)
static int ft897_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
unsigned char data[YAESU_CMD_LENGTH];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
memcpy(data, (char *)p->pcs[FT897_NATIVE_CAT_EEPROM_READ].nseq,
memcpy(data, (char *)ncmd[FT897_NATIVE_CAT_EEPROM_READ].nseq,
YAESU_CMD_LENGTH);
data[0] = addr >> 8;
@ -641,7 +631,7 @@ static int ft897_get_status(RIG *rig, int status)
rig_flush(&rig->state.rigport);
write_block(&rig->state.rigport, (char *) p->pcs[status].nseq,
write_block(&rig->state.rigport, (char *) ncmd[status].nseq,
YAESU_CMD_LENGTH);
if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0)
@ -956,17 +946,15 @@ int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
*/
static int ft897_send_cmd(RIG *rig, int index)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 0)
if (ncmd[index].ncomp == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: incomplete sequence\n", __func__);
return -RIG_EINTERNAL;
}
write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH);
write_block(&rig->state.rigport, (char *) ncmd[index].nseq, YAESU_CMD_LENGTH);
return ft817_read_ack(rig);
}
@ -975,18 +963,17 @@ static int ft897_send_cmd(RIG *rig, int index)
*/
static int ft897_send_icmd(RIG *rig, int index, unsigned char *data)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
unsigned char cmd[YAESU_CMD_LENGTH];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 1)
if (ncmd[index].ncomp == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: Complete sequence\n", __func__);
return -RIG_EINTERNAL;
}
cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1];
cmd[YAESU_CMD_LENGTH - 1] = ncmd[index].nseq[YAESU_CMD_LENGTH - 1];
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);

Wyświetl plik

@ -140,7 +140,6 @@ struct ft900_priv_data
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT900_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT900_ALL_DATA_LENGTH]; /* returned data--max value, some are less */
unsigned char current_mem; /* private memory channel number */
@ -304,11 +303,6 @@ static int ft900_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing = FT900_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
priv->read_update_delay =
@ -1684,7 +1678,7 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -1693,7 +1687,6 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft900_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft900_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1703,17 +1696,16 @@ static int ft900_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig_s->rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1732,7 +1724,7 @@ static int ft900_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -1761,7 +1753,7 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft900_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -1795,7 +1787,7 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -1822,7 +1814,7 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft900_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -1859,7 +1851,7 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -1890,7 +1882,7 @@ static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft900_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);

Wyświetl plik

@ -135,7 +135,6 @@ struct ft920_priv_data
split_t split; /* split active or not */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT920_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT920_VFO_DATA_LENGTH]; /* returned data--max value, some are less */
};
@ -382,11 +381,6 @@ static int ft920_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing =
FT920_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
@ -2397,7 +2391,7 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -2406,7 +2400,6 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft920_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft920_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -2416,21 +2409,19 @@ static int ft920_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
rig_s = &rig->state;
/*
* If we've been passed a command index (ci) that is marked
* as dynamic (0), then bail out.
*/
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n",
__func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig_s->rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -2449,7 +2440,7 @@ static int ft920_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -2482,7 +2473,7 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
* If we've been passed a command index (ci) that is marked
* as static (1), then bail out.
*/
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempted to modify a complete command sequence: %i\n",
@ -2516,7 +2507,7 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -2547,7 +2538,7 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* If we've been passed a command index (ci) that is marked
* as static (1), then bail out.
*/
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);
@ -2583,7 +2574,7 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -2618,7 +2609,7 @@ static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
* If we've been passed a command index (ci) that is marked
* as static (1), then bail out.
*/
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);

Wyświetl plik

@ -125,7 +125,6 @@ struct ft990_priv_data
unsigned int read_update_delay; /* depends on pacing value */
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of CAT cmd */
yaesu_cmd_set_t pcs[FT990_NATIVE_SIZE]; /* private cmd set */
ft990_update_data_t update_data; /* returned data */
};
@ -310,9 +309,6 @@ int ft990_init(RIG *rig)
priv = rig->state.priv;
// Copy native cmd set to private cmd storage area
memcpy(priv->pcs, ncmd, sizeof(ncmd));
// Set default pacing value
priv->pacing = FT990_PACING_DEFAULT_VALUE;
@ -3221,7 +3217,7 @@ int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -3229,7 +3225,6 @@ int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
int ft990_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft990_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3239,17 +3234,16 @@ int ft990_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig_s->rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3267,7 +3261,7 @@ int ft990_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -3295,7 +3289,7 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft990_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -3328,7 +3322,7 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3354,7 +3348,7 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft990_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
@ -3388,7 +3382,7 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* change the rit frequency.
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3413,7 +3407,7 @@ int ft990_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft990_priv_data *) rig->state.priv;
rig_s = &rig->state;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);

Wyświetl plik

@ -288,7 +288,7 @@ static int vx1700_do_transaction(RIG *rig,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the ncmd struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -314,7 +314,7 @@ static int vx1700_do_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the ncmd struct
* ci Command index of the cmd struct
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,