- Fixed type mismatches and unhandled switch cases.

- Incremented backend version numbers.


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2135 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.6rc1
Alexandru Csete OZ9AEC 2006-10-07 21:10:11 +00:00
rodzic 4f086db73f
commit 842a06fe98
4 zmienionych plików z 88 dodań i 65 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - main file
* Copyright (c) 2000-2005 by Stephane Fillod
*
* $Id: aor.c,v 1.39 2005-04-21 20:19:41 fillods Exp $
* $Id: aor.c,v 1.40 2006-10-07 21:10:11 csete Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -75,7 +75,7 @@ static int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, i
{
int retval;
struct rig_state *rs;
unsigned char ackbuf[BUFSZ];
char ackbuf[BUFSZ];
int ack_len;
rs = &rig->state;
@ -158,7 +158,7 @@ static int format_freq(char *buf, freq_t freq)
*/
int aor_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
int freq_len;
freq_len = format_freq(freqbuf, freq);
@ -176,7 +176,7 @@ int aor_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
char *rfp;
int freq_len, retval;
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
retval = aor_transaction (rig, "RX" EOM, 3, freqbuf, &freq_len);
if (retval != RIG_OK)
@ -227,7 +227,7 @@ int aor_set_vfo(RIG *rig, vfo_t vfo)
int aor_get_vfo(RIG *rig, vfo_t *vfo)
{
int vfo_len, retval;
unsigned char vfobuf[BUFSZ];
char vfobuf[BUFSZ];
retval = aor_transaction (rig, "RX" EOM, 3, vfobuf, &vfo_len);
if (retval != RIG_OK)
@ -306,7 +306,7 @@ int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
int aor_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv;
unsigned char mdbuf[BUFSZ];
char mdbuf[BUFSZ];
int mdbuf_len, retval;
mdbuf_len = priv->format_mode(rig, mdbuf, mode, width);
@ -364,8 +364,8 @@ int parse8k_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwid
int aor_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv;
unsigned char ackbuf[BUFSZ], *mdp;
unsigned char ackbuf2[BUFSZ], *mdp2;
char ackbuf[BUFSZ], *mdp;
char ackbuf2[BUFSZ], *mdp2;
int ack_len, ack2_len, retval;
@ -404,7 +404,7 @@ int aor_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
int aor_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
{
unsigned char tsbuf[BUFSZ];
char tsbuf[BUFSZ];
int ts_len;
/*
@ -424,7 +424,7 @@ int aor_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct rig_state *rs;
unsigned char lvlbuf[BUFSZ];
char lvlbuf[BUFSZ];
int lvl_len;
unsigned i;
int agc;
@ -475,7 +475,7 @@ int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct rig_state *rs;
unsigned char lvlbuf[BUFSZ],ackbuf[BUFSZ];
char lvlbuf[BUFSZ],ackbuf[BUFSZ];
int lvl_len, ack_len, retval;
rs = &rig->state;
@ -551,7 +551,7 @@ int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
*/
int aor_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
unsigned char ackbuf[BUFSZ];
char ackbuf[BUFSZ];
int ack_len, retval;
retval = aor_transaction (rig, "LM" EOM, 3, ackbuf, &ack_len);
@ -610,7 +610,7 @@ int aor_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
int aor_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv;
unsigned char membuf[BUFSZ];
char membuf[BUFSZ];
int mem_len;
int mem_num;
char bank_base;
@ -642,7 +642,7 @@ int aor_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv;
int mem_len, retval;
unsigned char membuf[BUFSZ];
char membuf[BUFSZ];
retval = aor_transaction (rig, "MR" EOM, 3, membuf, &mem_len);
if (retval != RIG_OK)
@ -673,7 +673,7 @@ int aor_get_mem(RIG *rig, vfo_t vfo, int *ch)
int aor_set_bank(RIG *rig, vfo_t vfo, int bank)
{
struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv;
unsigned char membuf[BUFSZ];
char membuf[BUFSZ];
int mem_len;
mem_len = sprintf(membuf,"MR%c" EOM, (bank%10) + (bank<10 ?
@ -713,6 +713,7 @@ static int parse_chan_line(RIG *rig, channel_t *chan, char *basep, const channel
struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv;
int retval;
char *tagp;
int ts;
/*
* search for attribute tags in the line.
@ -780,7 +781,8 @@ static int parse_chan_line(RIG *rig, channel_t *chan, char *basep, const channel
__FUNCTION__, basep);
return -RIG_EPROTO;
}
sscanf(tagp+2,"%d", (int*)&chan->tuning_step);
ts = chan->tuning_step;
sscanf(tagp+2,"%d", &ts);
}

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - AR3000 description
* Copyright (c) 2000-2005 by Stephane Fillod
*
* $Id: ar3000.c,v 1.9 2005-04-10 21:47:12 fillods Exp $
* $Id: ar3000.c,v 1.10 2006-10-07 21:10:11 csete Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -74,7 +74,7 @@ const struct rig_caps ar3000a_caps = {
.rig_model = RIG_MODEL_AR3000A,
.model_name = "AR3000A",
.mfg_name = "AOR",
.version = "0.4",
.version = "0.5",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_SCANNER,
@ -222,7 +222,7 @@ static int ar3k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
*/
int ar3k_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
int freq_len, retval;
unsigned lowhz;
@ -257,7 +257,7 @@ int ar3k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
char *rfp;
int freq_len, retval;
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
/*
* #--J0WZ-----Y---------Q
@ -282,7 +282,7 @@ int ar3k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int ar3k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
unsigned char mdbuf[BUFSZ];
char mdbuf[BUFSZ];
int mdbuf_len, aormode, retval;
switch (mode) {
@ -312,7 +312,7 @@ int ar3k_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
char *rfp;
int buf_len, retval;
unsigned char buf[BUFSZ];
char buf[BUFSZ];
/*
* #--J0WZ-----Y---------Q
@ -350,7 +350,7 @@ int ar3k_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
int ar3k_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts)
{
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
int freq_len, retval;
int lowhz;
@ -385,7 +385,7 @@ int ar3k_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
{
char *rfp;
int freq_len, retval;
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
/*
* #--J0WZ-----Y---------Q
@ -407,7 +407,7 @@ int ar3k_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts)
int ar3k_set_mem(RIG *rig, vfo_t vfo, int ch)
{
unsigned char cmdbuf[BUFSZ];
char cmdbuf[BUFSZ];
int cmd_len, retval;
cmd_len = sprintf(cmdbuf, "%02dM" EOM, ch);
@ -418,7 +418,7 @@ int ar3k_set_mem(RIG *rig, vfo_t vfo, int ch)
int ar3k_set_bank(RIG *rig, vfo_t vfo, int bank)
{
unsigned char cmdbuf[BUFSZ];
char cmdbuf[BUFSZ];
int cmd_len, retval;
cmd_len = sprintf(cmdbuf, "%dX" EOM, bank);
@ -430,7 +430,7 @@ int ar3k_set_bank(RIG *rig, vfo_t vfo, int bank)
int ar3k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
unsigned char *cmd;
char *cmd;
int retval;
switch(level) {
@ -451,7 +451,7 @@ int ar3k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
int ar3k_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
int info_len, retval;
unsigned char infobuf[BUFSZ];
char infobuf[BUFSZ];
switch(level) {
case RIG_LEVEL_ATT:

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - AR3030 description
* Copyright (c) 2000-2005 by Stephane Fillod
*
* $Id: ar3030.c,v 1.9 2005-04-10 21:47:12 fillods Exp $
* $Id: ar3030.c,v 1.10 2006-10-07 21:10:11 csete Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -100,7 +100,7 @@ const struct rig_caps ar3030_caps = {
.rig_model = RIG_MODEL_AR3030,
.model_name = "AR3030",
.mfg_name = "AOR",
.version = "0.3",
.version = "0.4",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rig_type = RIG_TYPE_RECEIVER,
@ -279,7 +279,7 @@ int ar3030_close(RIG *rig)
int ar3030_set_vfo(RIG *rig, vfo_t vfo)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
unsigned char *cmd = "";
char *cmd = "";
int retval;
switch(vfo) {
@ -315,7 +315,7 @@ int ar3030_get_vfo(RIG *rig, vfo_t *vfo)
int ar3030_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
int freq_len, retval;
freq_len = sprintf(freqbuf,"%03.4f" EOM, ((double)freq)/MHz(1));
@ -338,7 +338,7 @@ int ar3030_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
char *rfp;
int freq_len, retval;
unsigned char freqbuf[BUFSZ];
char freqbuf[BUFSZ];
/*
* D Rn Gn Bn Tn Fnnnnnnnn C
@ -363,7 +363,7 @@ int ar3030_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int ar3030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
unsigned char mdbuf[BUFSZ];
char mdbuf[BUFSZ];
int mdbuf_len, aormode, retval;
switch (mode) {
@ -396,7 +396,7 @@ int ar3030_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
int buf_len, retval;
unsigned char buf[BUFSZ];
char buf[BUFSZ];
/*
* D Rn Gn Bn Tn Fnnnnnnnn C
@ -432,7 +432,7 @@ int ar3030_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int ar3030_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
unsigned char cmdbuf[BUFSZ];
char cmdbuf[BUFSZ];
int cmd_len, retval=RIG_OK;
if (priv->curr_vfo == RIG_VFO_MEM) {
@ -450,7 +450,7 @@ int ar3030_set_mem(RIG *rig, vfo_t vfo, int ch)
int ar3030_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
unsigned char infobuf[BUFSZ];
char infobuf[BUFSZ];
int info_len, retval;
if (priv->curr_vfo != RIG_VFO_MEM) {
@ -484,7 +484,7 @@ int ar3030_get_mem(RIG *rig, vfo_t vfo, int *ch)
int ar3030_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
unsigned char *cmd;
char *cmd;
int retval;
switch(level) {
@ -512,7 +512,7 @@ int ar3030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
int info_len, retval;
unsigned char infobuf[BUFSZ], *p;
char infobuf[BUFSZ], *p;
switch(level) {
case RIG_LEVEL_ATT:
@ -564,7 +564,7 @@ int ar3030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int ar3030_get_channel(RIG *rig, channel_t *chan)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
unsigned char cmdbuf[BUFSZ], infobuf[BUFSZ];
char cmdbuf[BUFSZ], infobuf[BUFSZ];
int info_len, cmd_len, retval;
@ -623,7 +623,7 @@ int ar3030_get_channel(RIG *rig, channel_t *chan)
int ar3030_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv;
unsigned char buf[16];
char buf[16];
int len, retval;
switch(op) {

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - AR7030 description
* Copyright (c) 2000-2006 by Stephane Fillod & Fritz Melchert
*
* $Id: ar7030.c,v 1.6 2006-02-26 19:21:53 fillods Exp $
* $Id: ar7030.c,v 1.7 2006-10-07 21:10:11 csete Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -74,7 +74,7 @@
static int rxr_writeByte(RIG *rig, unsigned char c)
{
return write_block(&rig->state.rigport, &c, 1);
return write_block(&rig->state.rigport, (char *) &c, 1);
}
@ -83,8 +83,8 @@ static int rxr_readByte(RIG *rig)
unsigned char response[1];
unsigned char buf[] = {0x71}; // Read command
int retval;
retval = write_block(&rig->state.rigport, buf, 1);
retval = read_block(&rig->state.rigport, response, 1);
retval = write_block(&rig->state.rigport, (char *) buf, 1);
retval = read_block(&rig->state.rigport, (char *) response, 1);
return response[0];
}
@ -164,6 +164,8 @@ static void Execute_Routine_0(RIG *rig)
// RF filters and oscillator range.
// Routine 2 Set mode Setup from mode byte in memory and display mode,
// select preferred filter and PBS, BFO values etc.
// currently not used
#if 0
static void Execute_Routine_2_1(RIG *rig, char mp , char ad , int numSteps)
{
setLock(rig, 1); //Set Lock Level
@ -173,6 +175,7 @@ static void Execute_Routine_2_1(RIG *rig, char mp , char ad , int numSteps)
rxr_writeByte(rig, 0x22);
unlock(rig); //Set UnLock Level
}
#endif
// Routine 3 Set passband Setup all IF parameters from filter, pbsval and bfoval bytes.
static void Execute_Routine_3_1(RIG *rig, char mp , char ad , int numSteps)
{
@ -223,6 +226,8 @@ static void Execute_Routine_4_3(RIG *rig, char mp , char ad , int numSteps)
}
// Routine 5 Set audio Setup audio controller from memory register values.
// currently not used
#if 0
static void Execute_Routine_5_1(RIG *rig, char mp , char ad , int numSteps)
{
setLock(rig, 1); //Set Lock Level
@ -232,6 +237,8 @@ static void Execute_Routine_5_1(RIG *rig, char mp , char ad , int numSteps)
rxr_writeByte(rig, 0x25);
unlock(rig); //Set UnLock Level
}
#endif
// Routine 6 Set RF-IF Setup RF Gain, IF Gain and AGC speed. Also sets Notch Filter and
// Noise Blanker if these options are fitted.
static void Execute_Routine_6_1(RIG *rig, char mp , char ad , int numSteps)
@ -251,8 +258,8 @@ static int Execute_Routine_14(RIG *rig)
unsigned char response[1];
unsigned char buf[] = {0x2e}; // Read command
int retval;
retval = write_block(&rig->state.rigport, buf, 1);
retval = read_block(&rig->state.rigport, response, 1);
retval = write_block(&rig->state.rigport, (char *) buf, 1);
retval = read_block(&rig->state.rigport, (char *) response, 1);
return response[0];
}
@ -617,11 +624,15 @@ static int ar7030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
else if (smval1 < 11)
{
val->i = round((smval1 * 6 + smval2) * 10 / 12) - 118;
/* int ops => int result => round has no effect (besides compiler warning */
//val->i = round((smval1 * 6 + smval2) * 10 / 12) - 118;
val->i = ((smval1 * 6 + smval2) * 10 / 12) - 118;
}
else if (smval1 >= 11)
{
val->i = round((smval1 * 6 + smval2) * 10 / 6) - 173;
/* int ops => int result => round has no effect (besides compiler warning */
//val->i = round((smval1 * 6 + smval2) * 10 / 6) - 173;
val->i = ((smval1 * 6 + smval2) * 10 / 6) - 173;
}
return RIG_OK;
default :
@ -636,16 +647,22 @@ static int ar7030_set_powerstat(RIG *rig, powerstat_t status)
// 1 > RIG_POWER_ON Power on
// 2 > RIG_POWER_STANDBY Standby
switch (status) {
case RIG_POWER_OFF:
// Operate button 9 = Power button
Execute_Operate_button(rig, 9);
return RIG_OK;
case RIG_POWER_ON:
// Operate button 0 = None pressed
Execute_Operate_button(rig, 0);
return RIG_OK;
}
return -RIG_EINVAL;
case RIG_POWER_OFF:
// Operate button 9 = Power button
Execute_Operate_button(rig, 9);
return RIG_OK;
case RIG_POWER_ON:
// Operate button 0 = None pressed
Execute_Operate_button(rig, 0);
return RIG_OK;
default:
break;
}
return -RIG_EINVAL;
}
static int ar7030_get_powerstat(RIG *rig, powerstat_t *status)
@ -665,13 +682,17 @@ static int ar7030_reset(RIG *rig, reset_t reset)
// 2 > RIG_RESET_VFO VFO reset
// 3 > RIG_RESET_MCALL Memory clear
// 4 > RIG_RESET_MASTER Master reset
switch(reset)
{
switch(reset) {
// Routine 0 Reset Setup receiver as at switch-on.
case RIG_RESET_SOFT :
Execute_Routine_0(rig) ;
return RIG_OK;
case RIG_RESET_SOFT :
Execute_Routine_0(rig) ;
return RIG_OK;
default:
break;
}
return -RIG_EINVAL;
}
@ -690,7 +711,7 @@ const struct rig_caps ar7030_caps = {
.rig_model = RIG_MODEL_AR7030,
.model_name = "AR7030",
.mfg_name = "AOR",
.version = "0.3.1",
.version = "0.4",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_RECEIVER,