Update:
		Miscellaneous formating cleanup.


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1235 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Nate Bargmann, N0NB 2002-11-04 05:16:19 +00:00
rodzic 1083331fce
commit e10a0458c9
2 zmienionych plików z 272 dodań i 309 usunięć

Wyświetl plik

@ -12,7 +12,7 @@
* pages 86 to 90 * pages 86 to 90
* *
* *
* $Id: ft920.c,v 1.4 2002-11-01 04:39:47 n0nb Exp $ * $Id: ft920.c,v 1.5 2002-11-04 05:16:19 n0nb Exp $
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -29,7 +29,6 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
*
*/ */
@ -55,38 +54,41 @@
static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl); static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl);
static int ft920_send_priv_cmd(RIG *rig, unsigned char ci); static int ft920_send_priv_cmd(RIG *rig, unsigned char ci);
/* Native ft920 cmd set prototypes. These are READ ONLY as each */ /*
/* rig instance will copy from these and modify if required . */ * Native ft920 cmd set prototypes. These are READ ONLY as each
/* Complete sequences (1) can be read and used directly as a cmd sequence . */ * rig instance will copy from these and modify if required.
/* Incomplete sequences (0) must be completed with extra parameters */ * Complete sequences (1) can be read and used directly as a cmd sequence.
/* eg: mem number, or freq etc.. */ * Incomplete sequences (0) must be completed with extra parameters
* eg: mem number, or freq etc..
*
*/
static const yaesu_cmd_set_t ncmd[] = { static const yaesu_cmd_set_t ncmd[] = {
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* memory operations */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* memory operations */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* copy memory data to vfo A */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* copy memory data to vfo A */
/* { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, */ /* clarifier operations */ /* { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, */ /* clarifier operations */
/* { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, */ /* RX clarifier on */ /* { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, */ /* RX clarifier on */
/* { 1, { 0x00, 0x00, 0x00, 0x80, 0x09 } }, */ /* TX clarifier on */ /* { 1, { 0x00, 0x00, 0x00, 0x80, 0x09 } }, */ /* TX clarifier on */
/* { 1, { 0x00, 0x00, 0x00, 0x81, 0x09 } }, */ /* TX clarifier on */ /* { 1, { 0x00, 0x00, 0x00, 0x81, 0x09 } }, */ /* TX clarifier on */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set freq */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set freq */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* vfo A mode set LSB */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* vfo A mode set LSB */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* vfo A mode set USB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* vfo A mode set USB */
{ 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* vfo A mode set CW-USB */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* vfo A mode set CW-USB */
{ 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* vfo A mode set CW-LSB */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* vfo A mode set CW-LSB */
{ 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* vfo A mode set AM */ { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* vfo A mode set AM */
{ 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* vfo A mode set AM */ { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* vfo A mode set AM */
{ 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* vfo A mode set FM */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* vfo A mode set FM */
{ 1, { 0x00, 0x00, 0x00, 0x07, 0x0c } }, /* vfo A mode set FMN */ { 1, { 0x00, 0x00, 0x00, 0x07, 0x0c } }, /* vfo A mode set FMN */
{ 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* vfo A mode set DATA-LSB */ { 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* vfo A mode set DATA-LSB */
{ 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* vfo A mode set DATA-LSB */ { 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* vfo A mode set DATA-LSB */
{ 1, { 0x00, 0x00, 0x00, 0x0a, 0x0c } }, /* vfo A mode set DATA-USB */ { 1, { 0x00, 0x00, 0x00, 0x0a, 0x0c } }, /* vfo A mode set DATA-USB */
{ 1, { 0x00, 0x00, 0x00, 0x0b, 0x0c } }, /* vfo A mode set DATA-FM */ { 1, { 0x00, 0x00, 0x00, 0x0b, 0x0c } }, /* vfo A mode set DATA-FM */
/* { 1, { 0x00, 0x00, 0x00, 0x80, 0x0c } }, */ /* vfo B mode set LSB */ /* { 1, { 0x00, 0x00, 0x00, 0x80, 0x0c } }, */ /* vfo B mode set LSB */
/* { 1, { 0x00, 0x00, 0x00, 0x81, 0x0c } }, */ /* vfo B mode set USB */ /* { 1, { 0x00, 0x00, 0x00, 0x81, 0x0c } }, */ /* vfo B mode set USB */
@ -101,9 +103,9 @@ static const yaesu_cmd_set_t ncmd[] = {
/* { 1, { 0x00, 0x00, 0x00, 0x8a, 0x0c } }, */ /* vfo B mode set DATA-USB */ /* { 1, { 0x00, 0x00, 0x00, 0x8a, 0x0c } }, */ /* vfo B mode set DATA-USB */
/* { 1, { 0x00, 0x00, 0x00, 0x8b, 0x0c } }, */ /* vfo B mode set DATA-FM */ /* { 1, { 0x00, 0x00, 0x00, 0x8b, 0x0c } }, */ /* vfo B mode set DATA-FM */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* update interval/pacing */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* update interval/pacing */
{ 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* status update VFO A & B update (28 bytes) hard coded for now */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* status update VFO A & B update (28 bytes) hard coded for now */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0xFA } }, /* Read status flags */ { 1, { 0x00, 0x00, 0x00, 0x01, 0xFA } }, /* Read status flags */
/* { 0, { 0x00, 0x00, 0x00, 0x00, 0x70 } }, */ /* keyer commands */ /* { 0, { 0x00, 0x00, 0x00, 0x00, 0x70 } }, */ /* keyer commands */
/* { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, */ /* tuner off */ /* { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, */ /* tuner off */
/* { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, */ /* tuner on */ /* { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, */ /* tuner on */
@ -112,12 +114,10 @@ static const yaesu_cmd_set_t ncmd[] = {
}; };
/*
/*
* Receiver caps * Receiver caps
*/ */
#define FT920_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT920_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB)
#define FT920_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT920_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB)
#define FT920_AM_RX_MODES (RIG_MODE_AM) #define FT920_AM_RX_MODES (RIG_MODE_AM)
@ -128,12 +128,9 @@ static const yaesu_cmd_set_t ncmd[] = {
* TX caps * TX caps
*/ */
#define FT920_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */ #define FT920_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */
#define FT920_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT920_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */
#define FT920_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) /* fix */
#define FT920_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) /* fix */
/* /*
@ -142,150 +139,153 @@ static const yaesu_cmd_set_t ncmd[] = {
*/ */
struct ft920_priv_data { struct ft920_priv_data {
unsigned char pacing; /* pacing value */ unsigned char pacing; /* pacing value */
unsigned int read_update_delay; /* depends on pacing value */ unsigned int read_update_delay; /* depends on pacing value */
unsigned char current_vfo; /* active VFO from last cmd */ unsigned char current_vfo; /* active VFO from last cmd */
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT_920_NATIVE_SIZE]; /* private cmd set */ yaesu_cmd_set_t pcs[FT_920_NATIVE_SIZE]; /* private cmd set */
unsigned char update_data[FT920_VFO_UPDATE_DATA_LENGTH]; /* returned data--max value, some are less */ unsigned char update_data[FT920_VFO_UPDATE_DATA_LENGTH];/* returned data--max value, some are less */
}; };
/* /*
* ft920 rigs capabilities. * ft920 rigs capabilities.
* Also this struct is READONLY! * Also this struct is READONLY!
*
*/ */
const struct rig_caps ft920_caps = { const struct rig_caps ft920_caps = {
.rig_model = RIG_MODEL_FT920, .rig_model = RIG_MODEL_FT920,
.model_name = "FT-920", .model_name = "FT-920",
.mfg_name = "Yaesu", .mfg_name = "Yaesu",
.version = "0.0.2", .version = "0.0.2",
.copyright = "GPL", .copyright = "GPL",
.status = RIG_STATUS_ALPHA, .status = RIG_STATUS_ALPHA,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_NONE, .ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE, .dcd_type = RIG_DCD_NONE,
.port_type = RIG_PORT_SERIAL, .port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800, .serial_rate_min = 4800,
.serial_rate_max = 4800, .serial_rate_max = 4800,
.serial_data_bits = 8, .serial_data_bits = 8,
.serial_stop_bits = 2, .serial_stop_bits = 2,
.serial_parity = RIG_PARITY_NONE, .serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE, .serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = FT920_WRITE_DELAY, .write_delay = FT920_WRITE_DELAY,
.post_write_delay = FT920_POST_WRITE_DELAY, .post_write_delay = FT920_POST_WRITE_DELAY,
.timeout = 2000, .timeout = 2000,
.retry = 0, .retry = 0,
.has_get_func = FT920_FUNC_ALL, .has_get_func = FT920_FUNC_ALL,
.has_set_func = FT920_FUNC_ALL, .has_set_func = FT920_FUNC_ALL,
.has_get_level = RIG_LEVEL_NONE, .has_get_level = RIG_LEVEL_NONE,
.has_set_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE,
.has_get_parm = RIG_PARM_NONE, .has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE,
.ctcss_list = NULL, .ctcss_list = NULL,
.dcs_list = NULL, .dcs_list = NULL,
.preamp = { RIG_DBLST_END, }, .preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, },
.max_rit = Hz(9999), .max_rit = Hz(9999),
.max_xit = Hz(9999), .max_xit = Hz(9999),
.max_ifshift = Hz(0), .max_ifshift = Hz(0),
.targetable_vfo = 0, .targetable_vfo = 0,
.transceive = RIG_TRN_OFF, .transceive = RIG_TRN_OFF,
.bank_qty = 0, .bank_qty = 0,
.chan_desc_sz = 0, .chan_desc_sz = 0,
.chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 122 (!) */ .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 122 (!) */
.rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */
.tx_range_list1 = { RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, },
.rx_range_list2 = { .rx_range_list2 = {
{kHz(100), MHz(30), FT920_ALL_RX_MODES, -1, -1 }, /* General coverage + ham */ {kHz(100), MHz(30), FT920_ALL_RX_MODES, -1, -1 }, /* General coverage + ham */
{MHz(48), MHz(56), FT920_ALL_RX_MODES, -1, -1 }, /* 6m! */ {MHz(48), MHz(56), FT920_ALL_RX_MODES, -1, -1 }, /* 6m! */
RIG_FRNG_END,
}, /* Region 2 rx ranges */
.tx_range_list2 = { RIG_FRNG_END,
{MHz(1.8), MHz(1.99999), FT920_OTHER_TX_MODES, W(5), W(100)}, /* 100W class */ }, /* Region 2 rx ranges */
{MHz(1.8), MHz(1.99999), FT920_AM_TX_MODES, W(2), W(25)}, /* 25W class */
.tx_range_list2 = {
{MHz(1.8), MHz(1.99999), FT920_OTHER_TX_MODES, W(5), W(100)}, /* 100W class */
{MHz(1.8), MHz(1.99999), FT920_AM_TX_MODES, W(2), W(25)}, /* 25W class */
{MHz(3.5), MHz(3.99999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(3.5), MHz(3.99999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(3.5), MHz(3.99999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(3.5), MHz(3.99999), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(7), MHz(7.29999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(7), MHz(7.29999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(7), MHz(7.29999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(7), MHz(7.29999), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(10.1), MHz(10.14999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(10.1), MHz(10.14999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(10.1), MHz(10.14999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(10.1), MHz(10.14999), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(14), MHz(14.34999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(14), MHz(14.34999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(14), MHz(14.34999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(14), MHz(14.34999), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(18.068), MHz(18.16799), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(18.068), MHz(18.16799), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(18.068), MHz(18.16799), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(18.068), MHz(18.16799), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(21), MHz(21.44999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(21), MHz(21.44999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(21), MHz(21.44999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(21), MHz(21.44999), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(24.89), MHz(24.98999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(24.89), MHz(24.98999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(24.89), MHz(24.98999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(24.89), MHz(24.98999), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(28), MHz(29.69999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(28), MHz(29.69999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(28), MHz(29.69999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(28), MHz(29.69999), FT920_AM_TX_MODES, W(2), W(25)},
{MHz(50), MHz(53.99999), FT920_OTHER_TX_MODES, W(5), W(100)}, {MHz(50), MHz(53.99999), FT920_OTHER_TX_MODES, W(5), W(100)},
{MHz(50), MHz(53.99999), FT920_AM_TX_MODES, W(2), W(25)}, {MHz(50), MHz(53.99999), FT920_AM_TX_MODES, W(2), W(25)},
RIG_FRNG_END, RIG_FRNG_END,
}, /* region 2 TX ranges */ }, /* region 2 TX ranges */
.tuning_steps = { .tuning_steps = {
{FT920_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT920_SSB_CW_RX_MODES, Hz(10)}, /* Normal */
{FT920_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT920_SSB_CW_RX_MODES, Hz(100)}, /* Fast */
{FT920_AM_RX_MODES, Hz(100)}, /* Normal */ {FT920_AM_RX_MODES, Hz(100)}, /* Normal */
{FT920_AM_RX_MODES, kHz(1)}, /* Fast */ {FT920_AM_RX_MODES, kHz(1)}, /* Fast */
{FT920_FM_RX_MODES, Hz(100)}, /* Normal */ {FT920_FM_RX_MODES, Hz(100)}, /* Normal */
{FT920_FM_RX_MODES, kHz(1)}, /* Fast */ {FT920_FM_RX_MODES, kHz(1)}, /* Fast */
RIG_TS_END, RIG_TS_END,
/* The FT-920 has a Fine tuning step which increments in 1 Hz steps /*
* for SSB_CW_RX_MODES, and 10 Hz steps for AM_RX_MODES and * The FT-920 has a Fine tuning step which increments in 1 Hz steps
* FM_RX_MODES. It doesn't appear that anything finer than 10 Hz * for SSB_CW_RX_MODES, and 10 Hz steps for AM_RX_MODES and
* is available through the CAT interface, however. -N0NB * FM_RX_MODES. It doesn't appear that anything finer than 10 Hz
*/ * is available through the CAT interface, however. -N0NB
}, *
*/
},
/* mode/filter list, .remember = order matters! */ /* mode/filter list, .remember = order matters! */
.filters = {
{RIG_MODE_SSB, kHz(2.4)}, /* standard SSB filter bandwidth */
{RIG_MODE_CW, kHz(2.4)}, /* normal CW filter */
{RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection (must be installed!) */
{RIG_MODE_AM, kHz(15)}, /* normal AM filter (stock radio has no AM filter!) */
{RIG_MODE_AM, kHz(2.4)}, /* AM filter with narrow selection (SSB filter switched in) */
{RIG_MODE_FM, kHz(12)}, /* FM with optional FM unit */
{RIG_MODE_WFM, kHz(12)}, /* WideFM, with optional FM unit. */
.filters = { RIG_FLT_END,
{RIG_MODE_SSB, kHz(2.4)}, /* standard SSB filter bandwidth */ },
{RIG_MODE_CW, kHz(2.4)}, /* normal CW filter */
{RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection (must be installed!) */
{RIG_MODE_AM, kHz(15)}, /* normal AM filter (stock radio has no AM filter!) */
{RIG_MODE_AM, kHz(2.4)}, /* AM filter with narrow selection (SSB filter switched in) */
{RIG_MODE_FM, kHz(12)}, /* FM with optional FM unit */
{RIG_MODE_WFM, kHz(12)}, /* WideFM, with optional FM unit. */
RIG_FLT_END, .priv = NULL, /* private data */
},
.priv = NULL, /* private data */ .rig_init = ft920_init,
.rig_cleanup = ft920_cleanup,
.rig_open = ft920_open, /* port opened */
.rig_close = ft920_close, /* port closed */
.rig_init = ft920_init, .set_freq = ft920_set_freq, /* set freq */
.rig_cleanup = ft920_cleanup, .get_freq = ft920_get_freq, /* get freq */
.rig_open = ft920_open, /* port opened */ .set_mode = ft920_set_mode, /* set mode */
.rig_close = ft920_close, /* port closed */ .get_mode = ft920_get_mode, /* get mode */
.set_vfo = ft920_set_vfo, /* set vfo */
.set_freq = ft920_set_freq, /* set freq */ .get_vfo = ft920_get_vfo, /* get vfo */
.get_freq = ft920_get_freq, /* get freq */
.set_mode = ft920_set_mode, /* set mode */
.get_mode = ft920_get_mode, /* get mode */
.set_vfo = ft920_set_vfo, /* set vfo */
.get_vfo = ft920_get_vfo, /* get vfo */
}; };
@ -295,30 +295,27 @@ const struct rig_caps ft920_caps = {
* *
*/ */
int ft920_init(RIG *rig) { int ft920_init(RIG *rig) {
struct ft920_priv_data *p; struct ft920_priv_data *p;
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_init called \n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_init called \n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
p = (struct ft920_priv_data*)malloc(sizeof(struct ft920_priv_data)); p = (struct ft920_priv_data*)malloc(sizeof(struct ft920_priv_data));
if (!p) /* whoops! memory shortage! */ if (!p) /* whoops! memory shortage! */
return -RIG_ENOMEM; return -RIG_ENOMEM;
/* /*
* Copy native cmd set to private cmd storage area * Copy native cmd set to private cmd storage area
*/ */
memcpy(p->pcs,ncmd,sizeof(ncmd)); memcpy(p->pcs,ncmd,sizeof(ncmd));
/* TODO: read pacing from preferences */ /* TODO: read pacing from preferences */
p->pacing = FT920_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ p->pacing = FT920_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
p->read_update_delay = FT920_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ p->read_update_delay = FT920_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */ p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
rig->state.priv = (void*)p; rig->state.priv = (void*)p;
return RIG_OK; return RIG_OK;
@ -328,14 +325,15 @@ int ft920_init(RIG *rig) {
/* /*
* ft920_cleanup routine * ft920_cleanup routine
* the serial port is closed by the frontend * the serial port is closed by the frontend
*
*/ */
int ft920_cleanup(RIG *rig) { int ft920_cleanup(RIG *rig) {
rig_debug(RIG_DEBUG_VERBOSE, "ft920: ft920_cleanup called\n"); rig_debug(RIG_DEBUG_VERBOSE, "ft920: ft920_cleanup called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
if (rig->state.priv) if (rig->state.priv)
free(rig->state.priv); free(rig->state.priv);
@ -344,6 +342,7 @@ int ft920_cleanup(RIG *rig) {
return RIG_OK; return RIG_OK;
} }
/* /*
* ft920_open routine * ft920_open routine
* *
@ -354,15 +353,15 @@ int ft920_open(RIG *rig) {
rig_debug(RIG_DEBUG_VERBOSE, "ft920: ft920_open called\n"); rig_debug(RIG_DEBUG_VERBOSE, "ft920: ft920_open called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
rig_s = &rig->state; rig_s = &rig->state;
rig_debug(RIG_DEBUG_TRACE,"ft920: rig_open: write_delay = %i msec \n", rig_debug(RIG_DEBUG_TRACE,"ft920: rig_open: write_delay = %i msec \n",
rig_s->rigport.write_delay); rig_s->rigport.write_delay);
rig_debug(RIG_DEBUG_TRACE,"ft920: rig_open: post_write_delay = %i msec \n", rig_debug(RIG_DEBUG_TRACE,"ft920: rig_open: post_write_delay = %i msec \n",
rig_s->rigport.post_write_delay); rig_s->rigport.post_write_delay);
/* TODO */ /* TODO */
@ -375,36 +374,32 @@ int ft920_open(RIG *rig) {
* ft920_close routine * ft920_close routine
* *
*/ */
int ft920_close(RIG *rig) { int ft920_close(RIG *rig) {
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_close called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_close called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
return RIG_OK; return RIG_OK;
} }
/* /*
* Example of wrapping backend function inside frontend API * Example of wrapping backend function inside frontend API
* *
*/ */
int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
struct rig_state *rig_s; struct rig_state *rig_s;
struct ft920_priv_data *p; struct ft920_priv_data *p;
unsigned char *cmd; /* points to sequence to send */ unsigned char *cmd; /* points to sequence to send */
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_set_freq called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_set_freq called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
p = (struct ft920_priv_data*)rig->state.priv; p = (struct ft920_priv_data*)rig->state.priv;
rig_s = &rig->state; rig_s = &rig->state;
@ -414,21 +409,21 @@ int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
/* frontend sets VFO now , if targetable_vfo = 0 */ /* frontend sets VFO now , if targetable_vfo = 0 */
#if 0 #if 0
ft920_set_vfo(rig, vfo); /* select VFO first , new API */ ft920_set_vfo(rig, vfo); /* select VFO first , new API */
#endif #endif
/* /*
* Copy native cmd freq_set to private cmd storage area * Copy native cmd freq_set to private cmd storage area
*/ */
memcpy(&p->p_cmd,&ncmd[FT_920_NATIVE_FREQ_SET].nseq,YAESU_CMD_LENGTH);
memcpy(&p->p_cmd,&ncmd[FT_920_NATIVE_FREQ_SET].nseq,YAESU_CMD_LENGTH); to_bcd(p->p_cmd,freq/10,8); /* store bcd format in in p_cmd */
/* TODO -- fix 10Hz resolution -- FS */
to_bcd(p->p_cmd,freq/10,8); /* store bcd format in in p_cmd */ rig_debug(RIG_DEBUG_TRACE,"ft920: requested freq after conversion = %lli Hz\n",
/* TODO -- fix 10Hz resolution -- FS */ from_bcd(p->p_cmd,8)* 10 );
rig_debug(RIG_DEBUG_TRACE,"ft920: requested freq after conversion = %lli Hz\n", from_bcd(p->p_cmd,8)* 10 ); cmd = p->p_cmd; /* get native sequence */
cmd = p->p_cmd; /* get native sequence */
write_block(&rig_s->rigport, cmd, YAESU_CMD_LENGTH); write_block(&rig_s->rigport, cmd, YAESU_CMD_LENGTH);
return RIG_OK; return RIG_OK;
@ -437,6 +432,7 @@ int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
/* /*
* Return Freq for a given VFO * Return Freq for a given VFO
*
*/ */
int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
@ -451,10 +447,12 @@ int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
priv = (struct ft920_priv_data*)rig->state.priv; priv = (struct ft920_priv_data*)rig->state.priv;
ft920_get_update_data(rig, FT_920_NATIVE_VFO_UPDATE, FT920_VFO_UPDATE_DATA_LENGTH); /* get VFO record from rig*/ /* get VFO record from rig*/
ft920_get_update_data(rig, FT_920_NATIVE_VFO_UPDATE,
FT920_VFO_UPDATE_DATA_LENGTH);
if (vfo == RIG_VFO_CURR ) if (vfo == RIG_VFO_CURR )
vfo = priv->current_vfo; /* from previous vfo cmd */ vfo = priv->current_vfo; /* from previous vfo cmd */
switch(vfo) { switch(vfo) {
case RIG_VFO_A: case RIG_VFO_A:
@ -466,7 +464,7 @@ int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
rig_debug(RIG_DEBUG_TRACE,"ft920: VFO B [%x]\n", vfo); rig_debug(RIG_DEBUG_TRACE,"ft920: VFO B [%x]\n", vfo);
break; break;
default: default:
return -RIG_EINVAL; /* sorry, wrong VFO */ return -RIG_EINVAL; /* sorry, wrong VFO */
} }
/* big endian integer */ /* big endian integer */
@ -474,7 +472,7 @@ int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
rig_debug(RIG_DEBUG_TRACE,"ft920: freq = %lli Hz for VFO [%x]\n", f, vfo); rig_debug(RIG_DEBUG_TRACE,"ft920: freq = %lli Hz for VFO [%x]\n", f, vfo);
*freq = f; /* return diplayed frequency */ *freq = f; /* return diplayed frequency */
return RIG_OK; return RIG_OK;
} }
@ -486,9 +484,9 @@ int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
*/ */
int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
unsigned char cmd_index; /* index of sequence to send */ unsigned char cmd_index; /* index of sequence to send */
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_set_mode called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_set_mode called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
@ -496,15 +494,14 @@ int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
/* frontend sets VFO now , if targetable_vfo = 0 */ /* frontend sets VFO now , if targetable_vfo = 0 */
#if 0 #if 0
ft920_set_vfo(rig, vfo); /* select VFO first , new API */ ft920_set_vfo(rig, vfo); /* select VFO first , new API */
#endif #endif
rig_debug(RIG_DEBUG_TRACE,"ft920: generic mode = %x\n", mode);
/* /*
* translate mode from generic to ft920 specific * translate mode from generic to ft920 specific
*/ */
rig_debug(RIG_DEBUG_TRACE,"ft920: generic mode = %x\n", mode);
switch(mode) { switch(mode) {
case RIG_MODE_AM: case RIG_MODE_AM:
cmd_index = FT_920_NATIVE_MODE_SET_AMW; cmd_index = FT_920_NATIVE_MODE_SET_AMW;
@ -522,24 +519,23 @@ int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
cmd_index = FT_920_NATIVE_MODE_SET_FMW; cmd_index = FT_920_NATIVE_MODE_SET_FMW;
break; break;
default: default:
return -RIG_EINVAL; /* sorry, wrong MODE */ return -RIG_EINVAL; /* sorry, wrong MODE */
} }
/* /*
* Now set width * Now set width
*/ */
/* FIXME: so far setting passband is buggy, only 0 is accepted -N0NB */
/* FIXME: so far setting passband is buggy, only 0 is accepted -N0NB */
switch(width) { switch(width) {
case RIG_PASSBAND_NORMAL: /* easy case , no change to native sequence */ case RIG_PASSBAND_NORMAL: /* easy case , no change to native sequence */
break; break;
#ifdef RIG_PASSBAND_OLDTIME #ifdef RIG_PASSBAND_OLDTIME
case RIG_PASSBAND_WIDE: case RIG_PASSBAND_WIDE:
return -RIG_EINVAL; /* sorry, WIDE WIDTH is not supported */ return -RIG_EINVAL; /* sorry, WIDE WIDTH is not supported */
case RIG_PASSBAND_NARROW: /* must set narrow */ case RIG_PASSBAND_NARROW: /* must set narrow */
switch(mode) { switch(mode) {
case RIG_MODE_AM: case RIG_MODE_AM:
cmd_index = FT_920_NATIVE_MODE_SET_AMN; cmd_index = FT_920_NATIVE_MODE_SET_AMN;
@ -551,7 +547,7 @@ int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
cmd_index = FT_920_NATIVE_MODE_SET_CWN; cmd_index = FT_920_NATIVE_MODE_SET_CWN;
break; break;
default: default:
return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */ return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */
} }
break; break;
#else #else
@ -559,48 +555,53 @@ int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
#endif #endif
default: default:
return -RIG_EINVAL; /* sorry, wrong WIDTH requested */ return -RIG_EINVAL; /* sorry, wrong WIDTH requested */
} }
/* /*
* phew! now send cmd to rig * phew! now send cmd to rig
*/ */
ft920_send_priv_cmd(rig,cmd_index); ft920_send_priv_cmd(rig,cmd_index);
rig_debug(RIG_DEBUG_TRACE,"ft920: cmd_index = %i\n", cmd_index); rig_debug(RIG_DEBUG_TRACE,"ft920: cmd_index = %i\n", cmd_index);
return RIG_OK; /* good */ return RIG_OK; /* good */
} }
/*
* get mode : eg AM, CW etc for a given VFO
*
*/
int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) {
struct ft920_priv_data *p; struct ft920_priv_data *p;
unsigned char mymode; /* ft920 mode */ unsigned char mymode; /* ft920 mode */
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_get_mode called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_get_mode called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
p = (struct ft920_priv_data*)rig->state.priv; p = (struct ft920_priv_data*)rig->state.priv;
/* FIXME: Command passed is for VFO A & B, there should /*
* be a complement for current display. e.g. mem tune -N0NB * FIXME: Command passed is for VFO A & B, there should
*/ * be a complement for current display. e.g. mem tune -N0NB
ft920_get_update_data(rig, FT_920_NATIVE_VFO_UPDATE, FT920_VFO_UPDATE_DATA_LENGTH); */
ft920_get_update_data(rig, FT_920_NATIVE_VFO_UPDATE,
FT920_VFO_UPDATE_DATA_LENGTH);
mymode = p->update_data[FT920_SUMO_DISPLAYED_MODE]; mymode = p->update_data[FT920_SUMO_DISPLAYED_MODE];
mymode &= MODE_MASK; /* mask out bits 4, 5 and 6 */ mymode &= MODE_MASK; /* mask out bits 4, 5 and 6 */
rig_debug(RIG_DEBUG_TRACE,"ft920: mymode = %x\n", mymode); rig_debug(RIG_DEBUG_TRACE,"ft920: mymode = %x\n", mymode);
/* /*
* translate mode from ft920 to generic. * translate mode from ft920 to generic.
* TODO: Add DATA, and Narrow modes. CW on LSB? -N0NB * TODO: Add DATA, and Narrow modes. CW on LSB? -N0NB
*/ */
switch(mymode) { switch(mymode) {
case MODE_FM: case MODE_FM:
(*mode) = RIG_MODE_FM; (*mode) = RIG_MODE_FM;
@ -624,7 +625,7 @@ int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) {
break; break;
default: default:
return -RIG_EINVAL; /* sorry, wrong mode */ return -RIG_EINVAL; /* sorry, wrong mode */
break; break;
} }
@ -632,19 +633,18 @@ int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) {
} }
/* /*
* set vfo and store requested vfo for later RIG_VFO_CURR * set vfo and store requested vfo for later RIG_VFO_CURR
* requests. * requests.
* *
*/ */
int ft920_set_vfo(RIG *rig, vfo_t vfo) { int ft920_set_vfo(RIG *rig, vfo_t vfo) {
struct rig_state *rig_s; struct rig_state *rig_s;
struct ft920_priv_data *p; struct ft920_priv_data *p;
unsigned char cmd_index; /* index of sequence to send */ unsigned char cmd_index; /* index of sequence to send */
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_set_vfo called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_set_vfo called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
@ -656,44 +656,41 @@ int ft920_set_vfo(RIG *rig, vfo_t vfo) {
/* /*
* TODO : check for errors -- FS * TODO : check for errors -- FS
*/ */
switch(vfo) { switch(vfo) {
case RIG_VFO_A: case RIG_VFO_A:
cmd_index = FT_920_NATIVE_VFO_A; cmd_index = FT_920_NATIVE_VFO_A;
p->current_vfo = vfo; /* update active VFO */ p->current_vfo = vfo; /* update active VFO */
rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_A\n"); rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_A\n");
break; break;
case RIG_VFO_B: case RIG_VFO_B:
cmd_index = FT_920_NATIVE_VFO_B; cmd_index = FT_920_NATIVE_VFO_B;
p->current_vfo = vfo; /* update active VFO */ p->current_vfo = vfo; /* update active VFO */
rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_B\n"); rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_B\n");
break; break;
case RIG_VFO_CURR: case RIG_VFO_CURR:
switch(p->current_vfo) { /* what is my active VFO ? */ switch(p->current_vfo) { /* what is my active VFO ? */
case RIG_VFO_A: case RIG_VFO_A:
cmd_index = FT_920_NATIVE_VFO_A; cmd_index = FT_920_NATIVE_VFO_A;
rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_CURR:RIG_VFO_A\n"); rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_CURR:RIG_VFO_A\n");
break; break;
case RIG_VFO_B: case RIG_VFO_B:
cmd_index = FT_920_NATIVE_VFO_B; cmd_index = FT_920_NATIVE_VFO_B;
rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_CURR:RIG_VFO_B\n"); rig_debug(RIG_DEBUG_TRACE,"ft920: vfo == RIG_VFO_CURR:RIG_VFO_B\n");
break; break;
default: default:
rig_debug(RIG_DEBUG_TRACE,"ft920: Unknown default VFO \n"); rig_debug(RIG_DEBUG_TRACE,"ft920: Unknown default VFO \n");
return -RIG_EINVAL; /* sorry, wrong current VFO */ return -RIG_EINVAL; /* sorry, wrong current VFO */
} }
break; break;
default: default:
return -RIG_EINVAL; /* sorry, wrong VFO */ return -RIG_EINVAL; /* sorry, wrong VFO */
} }
/* /*
* phew! now send cmd to rig * phew! now send cmd to rig
*/ */
ft920_send_priv_cmd(rig,cmd_index); ft920_send_priv_cmd(rig,cmd_index);
return RIG_OK; return RIG_OK;
@ -701,49 +698,55 @@ int ft920_set_vfo(RIG *rig, vfo_t vfo) {
} }
/*
* get vfo and store requested vfo for later RIG_VFO_CURR
* requests.
*
*/
int ft920_get_vfo(RIG *rig, vfo_t *vfo) { int ft920_get_vfo(RIG *rig, vfo_t *vfo) {
struct ft920_priv_data *p; struct ft920_priv_data *p;
unsigned char status; /* ft920 status flag */ unsigned char status; /* ft920 status flag */
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_get_vfo called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_get_vfo called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
p = (struct ft920_priv_data*)rig->state.priv; p = (struct ft920_priv_data*)rig->state.priv;
/* Get flags for VFO status */ /* Get flags for VFO status */
ft920_get_update_data(rig, FT_920_NATIVE_UPDATE, FT920_STATUS_UPDATE_DATA_LENGTH); ft920_get_update_data(rig, FT_920_NATIVE_UPDATE,
FT920_STATUS_UPDATE_DATA_LENGTH);
status = p->update_data[FT920_SUMO_DISPLAYED_STATUS]; status = p->update_data[FT920_SUMO_DISPLAYED_STATUS];
status &= SF_VFOAB; /* check VFO bit*/ status &= SF_VFOAB; /* check VFO bit*/
rig_debug(RIG_DEBUG_TRACE,"ft920: vfo status = %x\n", status); rig_debug(RIG_DEBUG_TRACE,"ft920: vfo status = %x\n", status);
/* /*
* translate vfo status from ft920 to generic. * translate vfo status from ft920 to generic.
*/ */
switch (status) {
switch (status) { case SF_VFOAB:
case SF_VFOAB:
(*vfo) = RIG_VFO_B; (*vfo) = RIG_VFO_B;
rig_debug(RIG_DEBUG_TRACE,"ft920: TX/RX VFO B = %x\n", status); rig_debug(RIG_DEBUG_TRACE,"ft920: TX/RX VFO B = %x\n", status);
return RIG_OK; return RIG_OK;
case SF_SPLITB: /* FIXME: Split operation, RX on VFO B */ case SF_SPLITB: /* FIXME: Split operation, RX on VFO B */
(*vfo) = RIG_VFO_B; (*vfo) = RIG_VFO_B;
rig_debug(RIG_DEBUG_TRACE,"ft920: Split: RX VFO B = %x\n", status); rig_debug(RIG_DEBUG_TRACE,"ft920: Split: RX VFO B = %x\n", status);
return RIG_OK; return RIG_OK;
case SF_SPLITA: /* FIXME: Split operation, RX on VFO A */ case SF_SPLITA: /* FIXME: Split operation, RX on VFO A */
(*vfo) = RIG_VFO_A; (*vfo) = RIG_VFO_A;
rig_debug(RIG_DEBUG_TRACE,"ft920: Split: RX VFO A= %x\n", status); rig_debug(RIG_DEBUG_TRACE,"ft920: Split: RX VFO A= %x\n", status);
return RIG_OK; return RIG_OK;
case NULL: /* FIXME: Split operation, RX on VFO B */ case NULL: /* FIXME: Split operation, RX on VFO B */
(*vfo) = RIG_VFO_A; (*vfo) = RIG_VFO_A;
rig_debug(RIG_DEBUG_TRACE,"ft920: TX/RX VFO A = %x\n", status); rig_debug(RIG_DEBUG_TRACE,"ft920: TX/RX VFO A = %x\n", status);
return RIG_OK; return RIG_OK;
default: /* Oops! */ default: /* Oops! */
rig_debug(RIG_DEBUG_TRACE,"ft920: Unknown default VFO %x\n", status); rig_debug(RIG_DEBUG_TRACE,"ft920: Unknown default VFO %x\n", status);
return -RIG_EINVAL; /* sorry, wrong current VFO */ return -RIG_EINVAL; /* sorry, wrong current VFO */
} }
} }
@ -758,17 +761,18 @@ int ft920_get_vfo(RIG *rig, vfo_t *vfo) {
* need to use this when doing ft920_get_* stuff * need to use this when doing ft920_get_* stuff
* *
* Variables: ci = command index, rl = read length of returned data * Variables: ci = command index, rl = read length of returned data
*
*/ */
static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) { static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) {
struct rig_state *rig_s; struct rig_state *rig_s;
struct ft920_priv_data *p; struct ft920_priv_data *p;
unsigned char *cmd; /* points to sequence to send */ unsigned char *cmd; /* points to sequence to send */
int n; /* for read_ */ int n; /* for read_ */
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_get_update_data called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_get_update_data called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
p = (struct ft920_priv_data*)rig->state.priv; p = (struct ft920_priv_data*)rig->state.priv;
@ -779,16 +783,14 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) {
*/ */
memcpy(&p->p_cmd, &ncmd[FT_920_NATIVE_PACING].nseq, YAESU_CMD_LENGTH); memcpy(&p->p_cmd, &ncmd[FT_920_NATIVE_PACING].nseq, YAESU_CMD_LENGTH);
p->p_cmd[3] = p->pacing; /* get pacing value, and store in private cmd */ p->p_cmd[3] = p->pacing; /* get pacing value, and store in private cmd */
rig_debug(RIG_DEBUG_TRACE,"ft920: read pacing = %i\n",p->pacing); rig_debug(RIG_DEBUG_TRACE,"ft920: read pacing = %i\n",p->pacing);
/* send PACING cmd to rig */ /* send PACING cmd to rig */
cmd = p->p_cmd; cmd = p->p_cmd;
write_block(&rig_s->rigport, cmd, YAESU_CMD_LENGTH); write_block(&rig_s->rigport, cmd, YAESU_CMD_LENGTH);
/* send UPDATE comand to fetch data*/ /* send UPDATE comand to fetch data*/
ft920_send_priv_cmd(rig, ci); ft920_send_priv_cmd(rig, ci);
n = read_block(&rig_s->rigport, p->update_data, rl); n = read_block(&rig_s->rigport, p->update_data, rl);
@ -798,9 +800,9 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) {
} }
/* /*
* init_ft920 is called by rig_backend_load * init_ft920 is called by rig_backend_load
*
*/ */
int init_ft920(void *be_handle) { int init_ft920(void *be_handle) {
@ -810,20 +812,20 @@ int init_ft920(void *be_handle) {
} }
/* /*
* private helper function to send a private command * private helper function to send a private command
* sequence . Must only be complete sequences. * sequence . Must only be complete sequences.
* TODO: place variant of this in yaesu.c * TODO: place variant of this in yaesu.c
*
*/ */
static int ft920_send_priv_cmd(RIG *rig, unsigned char ci) { static int ft920_send_priv_cmd(RIG *rig, unsigned char ci) {
struct rig_state *rig_s; struct rig_state *rig_s;
struct ft920_priv_data *p; struct ft920_priv_data *p;
unsigned char *cmd; /* points to sequence to send */ unsigned char *cmd; /* points to sequence to send */
unsigned char cmd_index; /* index of sequence to send */ unsigned char cmd_index; /* index of sequence to send */
rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_send_priv_cmd called\n"); rig_debug(RIG_DEBUG_VERBOSE,"ft920: ft920_send_priv_cmd called\n");
if (!rig) if (!rig)
return -RIG_EINVAL; return -RIG_EINVAL;
@ -832,7 +834,7 @@ static int ft920_send_priv_cmd(RIG *rig, unsigned char ci) {
p = (struct ft920_priv_data*)rig->state.priv; p = (struct ft920_priv_data*)rig->state.priv;
rig_s = &rig->state; rig_s = &rig->state;
cmd_index = ci; /* get command */ cmd_index = ci; /* get command */
if (! p->pcs[cmd_index].ncomp) { if (! p->pcs[cmd_index].ncomp) {
rig_debug(RIG_DEBUG_TRACE,"ft920: Attempt to send incomplete sequence\n"); rig_debug(RIG_DEBUG_TRACE,"ft920: Attempt to send incomplete sequence\n");
@ -845,4 +847,3 @@ static int ft920_send_priv_cmd(RIG *rig, unsigned char ci) {
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -9,7 +9,7 @@
* via serial interface to an FT-920 using the "CAT" interface * via serial interface to an FT-920 using the "CAT" interface
* *
* *
* $Id: ft920.h,v 1.4 2002-11-01 04:39:47 n0nb Exp $ * $Id: ft920.h,v 1.5 2002-11-04 05:16:19 n0nb Exp $
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -52,24 +52,24 @@
/* /*
* 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte rate = 1 byte in 2.2917 msec * 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte rate = 1 byte in 2.2917 msec
* => 345 bytes in 790 msec * => 28 bytes in 64 msec
* *
* delay for 1 byte = 2.2917 + (pace_interval * 5) * delay for 1 byte = 2.2917 + (pace_interval * 5)
* *
* pace_interval time to read 345 bytes * pace_interval time to read 345 bytes
* ------------ ---------------------- * ------------ ----------------------
* *
* 0 790 msec * 0 64 msec
* 1 2515 msec * 1 321 msec
* 2 4240 msec * 2 642 msec
* 255 441 sec => 7 min 21 seconds * 255 16.4 sec
* *
*/ */
/* /*
* Native FT920 functions. This is what I have to work with :-) * Native FT920 functions. More to come :-)
* *
*/ */
@ -97,16 +97,18 @@ enum ft920_native_cmd_e {
FT_920_NATIVE_PACING, FT_920_NATIVE_PACING,
FT_920_NATIVE_VFO_UPDATE, FT_920_NATIVE_VFO_UPDATE,
FT_920_NATIVE_UPDATE, FT_920_NATIVE_UPDATE,
FT_920_NATIVE_SIZE /* end marker, value indicates number of */ FT_920_NATIVE_SIZE /* end marker, value indicates number of */
/* native cmd entries */ /* native cmd entries */
}; };
typedef enum ft920_native_cmd_e ft920_native_cmd_t; typedef enum ft920_native_cmd_e ft920_native_cmd_t;
/*
/* Internal MODES - when setting modes via cmd_mode_set() */ * Internal MODES - when setting modes via cmd_mode_set()
*
*/
#define MODE_SET_LSB 0x00 #define MODE_SET_LSB 0x00
#define MODE_SET_USB 0x01 #define MODE_SET_USB 0x01
@ -121,6 +123,7 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
/* /*
* Mode Bitmap. Bits 5 and 6 unused * Mode Bitmap. Bits 5 and 6 unused
* When READING modes * When READING modes
*
*/ */
#define MODE_LSB 0x00 #define MODE_LSB 0x00
@ -149,6 +152,7 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
/* /*
* Status Flag Masks when reading * Status Flag Masks when reading
*
*/ */
#define SF_DLOCK 0x01 #define SF_DLOCK 0x01
@ -164,6 +168,7 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
/* /*
* Local VFO CMD's, according to spec * Local VFO CMD's, according to spec
*
*/ */
#define FT920_VFO_A 0x00 #define FT920_VFO_A 0x00
@ -173,8 +178,6 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
/* /*
* Some useful offsets in the status update map (offset) * Some useful offsets in the status update map (offset)
* *
* Manual appears to be full of mistakes regarding offsets etc.. -- FS
*
*/ */
#define FT920_SUMO_DISPLAYED_MODE 0x07 #define FT920_SUMO_DISPLAYED_MODE 0x07
@ -186,7 +189,8 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
/* /*
* API local implementation * API local implementation
*
*/ */
int ft920_init(RIG *rig); int ft920_init(RIG *rig);
@ -204,46 +208,4 @@ int ft920_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */
int ft920_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */ int ft920_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */
/*
* Below is leftovers of old interface. TODO
*
*/
#if 0
/*
* Allow TX commands to be disabled
*
*/
#undef TX_ENABLED
/*
* Mode Bitmap. Bits 5 and 6 unused
* When reading modes
*/
#define MODE_FM 0x01
#define MODE_AM 0x02
#define MODE_CW 0x04
#define MODE_FMN 0x81
#define MODE_AMN 0x82
#define MODE_CWN 0x84
#define MODE_USB 0x08
#define MODE_LSB 0x10
#define MODE_NAR 0x80 /* narrow bit set only */
/*
* Map band data value to band.
*
* Band "n" is from band_data[n] to band_data[n+1]
*/
const float band_data[11] = { 0.0, 0.1, 2.5, 4.0, 7.5, 10.5, 14.5, 18.5, 21.5, 25.0, 30.0 };
#endif
#endif /* _FT920_H */ #endif /* _FT920_H */