git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@16 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.0.0
Frank Singleton, VK3FCS 2000-07-25 01:17:00 +00:00
rodzic d5a340429d
commit a2198dae87
5 zmienionych plików z 687 dodań i 0 usunięć

120
ft847/Makefile 100644
Wyświetl plik

@ -0,0 +1,120 @@
#
#
# Make file for FT-847 CAT program shared lib
#
# creates: libft847.so
#
# $Id: Makefile,v 1.1 2000-07-25 01:17:00 javabear Exp $
#
#
# .h files go in INSTALL_INCLUDEDIR
# .so files go in INSTALL_LIBDIR
#
#
INSTALL_LIBDIR = ./lib/
INSTALL_INCLUDEDIR = ./include/
INCLUDE = -I/usr/include -I/usr/local/include -I. -I../common
LIB_NAME = libft847.so
LIB_SONAME = libft847.so.1
LIB_RELEASE = libft847.so.1.0.1
LIB_HEADER = ft847.h
LIB_SRC = ft847.c
LIB_OBJECTS = ft847.o
CC = gcc
CFLAGS = -fPIC -g -Wall
all: lib
.PHONY: lib
lib:
$(CC) $(CFLAGS) $(INCLUDE) -c $(LIB_SRC)
$(CC) -shared -Wl,-soname,$(LIB_SONAME) -o $(LIB_RELEASE) $(LIB_OBJECTS) -lc
# install header and lib
install:
make install_lib
make install_header
# install lib in MYLIBDIR
.PHONY: install_lib
install_lib:
mv $(LIB_RELEASE) $(INSTALL_LIBDIR)
cd $(INSTALL_LIBDIR); /sbin/ldconfig -n .
cd $(INSTALL_LIBDIR); ln -s $(LIB_SONAME) $(LIB_NAME)
# install libft847.h in INSTALL_INCLUDEDIR
.PHONY: install_header
install_header:
cp -f $(LIB_HEADER) $(INSTALL_INCLUDEDIR)
# build lib and install and build test suite, but DONT run it
.PHONY: build_all
build_all:
make all
make install
(cd test && $(MAKE) all)
# build everything and run test suite ( stand back ..)
.PHONY: verify
verify:
make build_all
(cd test && $(MAKE) runtest)
# clean up local directory, my include and lib
# directories also.
clean:
make cleanlocal
make cleanlib
make cleaninclude
# clean up local directory, my include and lib and test
# directories also.
.PHONY: cleanall
cleanall:
make cleanlocal
make cleanlib
make cleaninclude
make cleantest
# clean up local directory
.PHONY: cleanlocal
cleanlocal:
rm -f *.o *.so*
# clean up local lib directory
.PHONY: cleanlib
cleanlib:
cd $(INSTALL_LIBDIR); rm -f $(LIB_NAME)*
# clean up local include directory
.PHONY: cleaninclude
cleaninclude:
cd $(INSTALL_INCLUDEDIR); rm -f $(LIB_HEADER)
# clean up test directory
.PHONY: cleantest
cleantest:
(cd test && $(MAKE) clean)

34
ft847/README.ft847 100644
Wyświetl plik

@ -0,0 +1,34 @@
hamlib - (C) Frank Singleton 2000
libft747.so - (C) Frank Singleton 2000
This shared library provides an API for communicating
via serial interface to an FT-747GX using the "CAT" interface
box (FIF-232C) or similar.
Reference Documentation
-----------------------
Operating Manual
FT-747GX
Yaesu Musen Co, LTD.
Status
------
Handles >90% of all opcodes
Warnings
--------
NA
Contributors
------------

15
ft847/TODO.ft847 100644
Wyświetl plik

@ -0,0 +1,15 @@
hamlib - (C) Frank Singleton 2000
TODO.ft847 - (C) Frank Singleton 2000
This shared library provides an API for communicating
via serial interface to an FT-847 using the "CAT" interface.
TODO
----
1. Complete pcodes
2. Write More extensive Test Suite
3.
4.
5.

410
ft847/ft847.c 100644
Wyświetl plik

@ -0,0 +1,410 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* ft847.c - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
* This shared library provides an API for communicating
* via serial interface to an FT-847 using the "CAT" interface.
*
*
* $Id: ft847.c,v 1.1 2000-07-25 01:17:00 javabear Exp $
*
*/
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include "serial.h"
#include "ft847.h"
static unsigned char datain[5]; /* data read from rig */
/*
* Function definitions below
*/
/*
* Open serial connection to rig.
* returns fd.
*/
int rig_open(char *serial_port) {
return open_port(serial_port);
}
/*
* Closes serial connection to rig.
*
*/
int rig_close(int fd) {
return close_port(fd);
}
/*
* Implement OPCODES
*/
void cmd_cat_on(int fd) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x00 }; /* cat = on */
write_block(fd,data);
}
void cmd_cat_off(int fd) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x80 }; /* cat = off */
write_block(fd,data);
}
void cmd_ptt_on(int fd) {
#ifdef TX_ENABLED
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x0f }; /* ptt = on */
write_block(fd,data);
printf("cmd_ptt_on complete \n");
#elsif
printf("cmd_ptt_on disabled \n");
#endif
}
void cmd_ptt_off(int fd) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x88 }; /* ptt = off */
write_block(fd,data);
}
void cmd_sat_on(int fd) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x08 }; /* sat = on */
write_block(fd,data);
}
void cmd_sat_off(int fd) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x88 }; /* sat = off */
write_block(fd,data);
}
void cmd_set_freq_main_vfo(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x01 }; /* set freq, main vfo*/
data[0] = d1;
data[1] = d2;
data[2] = d3;
data[3] = d4;
write_block(fd,data);
}
void cmd_set_freq_sat_rx_vfo(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x11 }; /* set freq, sat rx vfo*/
data[0] = d1;
data[1] = d2;
data[2] = d3;
data[3] = d4;
write_block(fd,data);
}
void cmd_set_freq_sat_tx_vfo(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x21 }; /* set freq, sat tx vfo*/
data[0] = d1;
data[1] = d2;
data[2] = d3;
data[3] = d4;
write_block(fd,data);
}
void cmd_set_opmode_main_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x07 }; /* set opmode, main vfo*/
data[0] = d1;
write_block(fd,data);
}
void cmd_set_opmode_sat_rx_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x17 }; /* set opmode, sat rx vfo */
data[0] = d1;
write_block(fd,data);
}
void cmd_set_opmode_sat_tx_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x27 }; /* set opmode, sat tx vfo */
data[0] = d1;
write_block(fd,data);
}
void cmd_set_ctcss_dcs_main_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x0a }; /* set ctcss/dcs, main vfo*/
data[0] = d1;
write_block(fd,data);
}
void cmd_set_ctcss_dcs_sat_rx_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x1a }; /* set ctcss/dcs, sat rx vfo*/
data[0] = d1;
write_block(fd,data);
}
void cmd_set_ctcss_dcs_sat_tx_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x2a }; /* set ctcss/dcs, sat tx vfo*/
data[0] = d1;
write_block(fd,data);
}
void cmd_set_ctcss_freq_main_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x0b }; /* set ctcss freq, main vfo*/
data[0] = d1;
write_block(fd,data);
}
void cmd_set_ctcss_freq_sat_rx_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x1b }; /* set ctcss freq, sat rx vfo*/
data[0] = d1;
write_block(fd,data);
}
void cmd_set_ctcss_freq_sat_tx_vfo(int fd, unsigned char d1) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x2b }; /* set ctcss freq, sat rx vfo*/
data[0] = d1;
write_block(fd,data);
}
void cmd_set_dcs_code_main_vfo(int fd, unsigned char d1, unsigned char d2) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x0c }; /* set dcs code, main vfo*/
data[0] = d1;
data[1] = d2;
write_block(fd,data);
}
void cmd_set_dcs_code_sat_rx_vfo(int fd, unsigned char d1, unsigned char d2) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x1c }; /* set dcs code, sat rx vfo*/
data[0] = d1;
data[1] = d2;
write_block(fd,data);
}
void cmd_set_dcs_code_sat_tx_vfo(int fd, unsigned char d1, unsigned char d2) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x2c }; /* set dcs code, sat tx vfo*/
data[0] = d1;
data[1] = d2;
write_block(fd,data);
}
void cmd_set_repeater_shift_minus(int fd) {
static unsigned char data[] = { 0x09, 0x00, 0x00, 0x00, 0x09 }; /* set repeater shift minus */
write_block(fd,data);
}
void cmd_set_repeater_shift_plus(int fd) {
static unsigned char data[] = { 0x49, 0x00, 0x00, 0x00, 0x09 }; /* set repeater shift */
write_block(fd,data);
}
void cmd_set_repeater_shift_simplex(int fd) {
static unsigned char data[] = { 0x89, 0x00, 0x00, 0x00, 0x09 }; /* set repeater simplex */
write_block(fd,data);
}
void cmd_set_repeater_offset(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4) {
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0xf9 }; /* set repeater offset */
data[0] = d1;
data[1] = d2;
data[2] = d3;
data[3] = d4;
write_block(fd,data);
}
unsigned char cmd_get_rx_status(int fd) {
int bytes; /* read from rig */
int i,n; /* counters */
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0xe7 }; /* get receiver status */
write_block(fd,data);
/*
* Sleep regularly until the buffer contains all 1 bytes
* This should handle most cases.
*/
bytes = 0;
while(bytes < 1) {
ioctl(fd, FIONREAD, &bytes); /* get bytes in buffer */
printf("bytes = %i\n", bytes);
sleep(1);
}
/* this should not block now */
n = read(fd,datain,1); /* grab 1 byte from rig */
printf("i = %i ,datain[i] = %x \n", i, datain[i]);
return datain[0];
}
unsigned char cmd_get_tx_status(int fd) {
int bytes; /* read from rig */
int i,n; /* counters */
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0xf7 }; /* get tx status */
write_block(fd,data);
/*
* Sleep regularly until the buffer contains all 1 bytes
* This should handle most cases.
*/
bytes = 0;
while(bytes < 1) {
ioctl(fd, FIONREAD, &bytes); /* get bytes in buffer */
printf("bytes = %i\n", bytes);
sleep(1);
}
/* this should not block now */
n = read(fd,datain,1); /* grab 1 byte from rig */
printf("i = %i ,datain[i] = %x \n", i, datain[i]);
return datain[0];
}
unsigned char cmd_get_freq_mode_status_main_vfo(int fd) {
int bytes; /* read from rig */
int i,n; /* counters */
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x03 }; /* get freq and mode status */
/* main vfo*/
write_block(fd,data);
/*
* Sleep regularly until the buffer contains all 1 bytes
* This should handle most cases.
*/
bytes = 0;
while(bytes < 1) {
ioctl(fd, FIONREAD, &bytes); /* get bytes in buffer */
printf("bytes = %i\n", bytes);
sleep(1);
}
/* this should not block now */
n = read(fd,datain,1); /* grab 1 byte from rig */
printf("i = %i ,datain[i] = %x \n", i, datain[i]);
return datain[0];
}
unsigned char cmd_get_freq_mode_status_sat_rx_vfo(int fd) {
int bytes; /* read from rig */
int i,n; /* counters */
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x13 }; /* get freq and mode status */
/* sat rx vfo*/
write_block(fd,data);
/*
* Sleep regularly until the buffer contains all 1 bytes
* This should handle most cases.
*/
bytes = 0;
while(bytes < 1) {
ioctl(fd, FIONREAD, &bytes); /* get bytes in buffer */
printf("bytes = %i\n", bytes);
sleep(1);
}
/* this should not block now */
n = read(fd,datain,1); /* grab 1 byte from rig */
printf("i = %i ,datain[i] = %x \n", i, datain[i]);
return datain[0];
}
unsigned char cmd_get_freq_mode_status_sat_tx_vfo(int fd) {
int bytes; /* read from rig */
int i,n; /* counters */
static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x13 }; /* get freq and mode status */
/* sat tx vfo*/
write_block(fd,data);
/*
* Sleep regularly until the buffer contains all 1 bytes
* This should handle most cases.
*/
bytes = 0;
while(bytes < 1) {
ioctl(fd, FIONREAD, &bytes); /* get bytes in buffer */
printf("bytes = %i\n", bytes);
sleep(1);
}
/* this should not block now */
n = read(fd,datain,1); /* grab 1 byte from rig */
printf("i = %i ,datain[i] = %x \n", i, datain[i]);
return datain[0];
}

108
ft847/ft847.h 100644
Wyświetl plik

@ -0,0 +1,108 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* ft847.h - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
* This shared library provides an API for communicating
* via serial interface to an FT-847 using the "CAT" interface.
*
*
* $Id: ft847.h,v 1.1 2000-07-25 01:17:00 javabear Exp $
*/
/*
* Allow TX commands to be disabled
*
*/
#undef TX_ENABLED
/*
* TX Status Flags
*/
const unsigned char TXSF_DISC_CENTER = (1<<5);
const unsigned char TXSF_CTCSS_DCS_CODE = (1<<6);
const unsigned char TXSF_SQUELCH_STATUS = (1<<7);
const unsigned char TXSF_SMETER_MASK = 0x1f; /* bottom 5 bits */
/*
* RX Status Flags
*/
const unsigned char RXSF_PTT_STATUS = (1<<7);
const unsigned char RXSF_POALC_METER_MASK = 0x1f; /* bottom 5 bits */
/*
* MODES for READING and SETTING
*/
const unsigned char MODE_LSB = 0;
const int MODE_USB = 1;
const int MODE_CW = 2;
const int MODE_CWR = 3;
const int MODE_AM = 4;
const int MODE_FM = 8;
const int MODE_CWN = 82;
const int MODE_CWNR = 83;
const int MODE_AMN = 84;
const int MODE_FMN = 88;
/*
* Visible functions in shared lib.
*
*/
int open_port(char *serial_port); /* return fd or -1 on error */
int close_port(int fd); /* close port using fd */
/*
* CAT command set
*
*/
void cmd_cat_on(int fd);
void cmd_cat_off(int fd);
void cmd_ptt_on(int fd);
void cmd_ptt_off(int fd);
void cmd_sat_on(int fd);
void cmd_sat_off(int fd);
void cmd_set_freq_main_vfo(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
void cmd_set_freq_sat_rx_vfo(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
void cmd_set_freq_sat_tx_vfo(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
void cmd_set_opmode_main_vfo(int fd, unsigned char d1);
void cmd_set_opmode_sat_rx_vfo(int fd, unsigned char d1);
void cmd_set_opmode_sat_tx_vfo(int fd, unsigned char d1);
void cmd_set_ctcss_dcs_main_vfo(int fd, unsigned char d1);
void cmd_set_ctcss_dcs_sat_rx_vfo(int fd, unsigned char d1);
void cmd_set_ctcss_dcs_sat_tx_vfo(int fd, unsigned char d1);
void cmd_set_ctcss_freq_main_vfo(int fd, unsigned char d1);
void cmd_set_ctcss_freq_sat_rx_vfo(int fd, unsigned char d1);
void cmd_set_ctcss_freq_sat_tx_vfo(int fd, unsigned char d1);
void cmd_set_dcs_code_main_vfo(int fd, unsigned char d1, unsigned char d2);
void cmd_set_dcs_code_sat_rx_vfo(int fd, unsigned char d1, unsigned char d2);
void cmd_set_dcs_code_sat_tx_vfo(int fd, unsigned char d1, unsigned char d2);
void cmd_set_repeater_shift_minus(int fd);
void cmd_set_repeater_shift_plus(int fd);
void cmd_set_repeater_shift_simplex(int fd);
void cmd_set_repeater_offset(int fd, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
unsigned char cmd_get_rx_status(int fd);
unsigned char cmd_get_tx_status(int fd);
unsigned char cmd_get_freq_mode_status_main_vfo(int fd);
unsigned char cmd_get_freq_mode_status_sat_rx_vfo(int fd);
unsigned char cmd_get_freq_mode_status_sat_tx_vfo(int fd);