kopia lustrzana https://github.com/Hamlib/Hamlib
initial parallel port support for *BSD
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1924 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.4
rodzic
475e88be72
commit
af21fced51
|
@ -61,6 +61,7 @@ AC_CHECK_HEADERS([stdlib.h values.h rpc/rpc.h rpc/rpcent.h net/errno.h])
|
|||
AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h sys/param.h unistd.h getopt.h errno.h])
|
||||
AC_CHECK_HEADERS([sys/ioccom.h sgtty.h term.h termio.h termios.h])
|
||||
AC_CHECK_HEADERS([linux/ppdev.h linux/parport.h linux/ioctl.h])
|
||||
AC_CHECK_HEADERS([dev/ppbus/ppi.h dev/ppbus/ppbconf.h])
|
||||
gt_HEADER_INTTYPES_H
|
||||
|
||||
dnl Check for Mingw support
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Interface - parallel communication low-level support
|
||||
* Copyright (c) 2000-2004 by Stephane Fillod
|
||||
* Copyright (c) 2000-2005 by Stephane Fillod
|
||||
*
|
||||
* $Id: parallel.c,v 1.1 2004-10-02 20:37:24 fillods Exp $
|
||||
* $Id: parallel.c,v 1.2 2005-02-20 02:38:27 fillods 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
|
||||
|
@ -78,6 +78,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_DEV_PPBUS_PPI_H
|
||||
#include <dev/ppbus/ppi.h>
|
||||
#include <dev/ppbus/ppbconf.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* TODO: to be called before exiting: atexit(parport_cleanup)
|
||||
|
@ -105,6 +110,14 @@ int par_open(port_t *port)
|
|||
return -RIG_EIO;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
|
||||
fd = open(port->pathname, O_RDWR);
|
||||
if (fd < 0) {
|
||||
rig_debug(RIG_DEBUG_ERR, "Opening device \"%s\": %s\n", port->pathname, strerror(errno));
|
||||
return -RIG_EIO;
|
||||
}
|
||||
|
||||
#elif defined(WIN32)
|
||||
fd = (int)CreateFile(port->pathname, GENERIC_READ | GENERIC_WRITE,
|
||||
0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
@ -123,6 +136,7 @@ int par_open(port_t *port)
|
|||
int par_close(port_t *port)
|
||||
{
|
||||
#ifdef HAVE_LINUX_PPDEV_H
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
#elif defined(WIN32)
|
||||
CloseHandle((HANDLE)(port->fd));
|
||||
return RIG_OK;
|
||||
|
@ -136,6 +150,10 @@ int HAMLIB_API par_write_data(port_t *port, unsigned char data)
|
|||
int status;
|
||||
status = ioctl(port->fd, PPWDATA, &data);
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
int status;
|
||||
status = ioctl(port->fd, PPISDATA, &data);
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(WIN32)
|
||||
unsigned int dummy;
|
||||
|
||||
|
@ -153,6 +171,10 @@ int HAMLIB_API par_read_data(port_t *port, unsigned char *data)
|
|||
int status;
|
||||
status = ioctl(port->fd, PPRDATA, data);
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
int status;
|
||||
status = ioctl(port->fd, PPIGDATA, &data);
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(WIN32)
|
||||
char ret;
|
||||
unsigned int dummy;
|
||||
|
@ -175,6 +197,11 @@ int HAMLIB_API par_write_control(port_t *port, unsigned char control)
|
|||
unsigned char ctrl = control ^ CP_ACTIVE_LOW_BITS;
|
||||
status = ioctl(port->fd, PPWCONTROL, &ctrl);
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
int status;
|
||||
unsigned char ctrl = control ^ CP_ACTIVE_LOW_BITS;
|
||||
status = ioctl(port->fd, PPISCTRL, &ctrl);
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(WIN32)
|
||||
unsigned char ctr = control;
|
||||
unsigned char dummyc;
|
||||
|
@ -209,6 +236,12 @@ int HAMLIB_API par_read_control(port_t *port, unsigned char *control)
|
|||
status = ioctl(port->fd, PPRCONTROL, &ctrl);
|
||||
*control = ctrl ^ CP_ACTIVE_LOW_BITS;
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
int status;
|
||||
unsigned char ctrl;
|
||||
status = ioctl(port->fd, PPIGCTRL, &ctrl);
|
||||
*control = ctrl ^ CP_ACTIVE_LOW_BITS;
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(WIN32)
|
||||
char ret;
|
||||
unsigned int dummy;
|
||||
|
@ -232,6 +265,12 @@ int HAMLIB_API par_read_status(port_t *port, unsigned char *status)
|
|||
ret = ioctl(port->fd, PPRSTATUS, &sta);
|
||||
*status = sta ^ SP_ACTIVE_LOW_BITS;
|
||||
return ret == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
int status;
|
||||
unsigned char sta;
|
||||
status = ioctl(port->fd, PPIGSTATUS, &sta);
|
||||
*control = sta ^ SP_ACTIVE_LOW_BITS;
|
||||
return status == 0 ? RIG_OK : -RIG_EIO;
|
||||
#elif defined(WIN32)
|
||||
unsigned char ret;
|
||||
unsigned int dummy;
|
||||
|
@ -255,6 +294,7 @@ int HAMLIB_API par_lock(port_t *port)
|
|||
return -RIG_EIO;
|
||||
}
|
||||
return RIG_OK;
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
#elif defined(WIN32)
|
||||
return RIG_OK;
|
||||
#endif
|
||||
|
@ -269,6 +309,7 @@ int HAMLIB_API par_unlock(port_t *port)
|
|||
return -RIG_EIO;
|
||||
}
|
||||
return RIG_OK;
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
#elif defined(WIN32)
|
||||
return RIG_OK;
|
||||
#endif
|
||||
|
|
10
src/rig.c
10
src/rig.c
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Interface - main file
|
||||
* Copyright (c) 2000-2004 by Stephane Fillod and Frank Singleton
|
||||
* Copyright (c) 2000-2005 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: rig.c,v 1.84 2005-01-12 01:55:38 n2por Exp $
|
||||
* $Id: rig.c,v 1.85 2005-02-20 02:38:27 fillods 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
|
||||
|
@ -26,7 +26,7 @@
|
|||
* \brief Ham Radio Control Libraries interface
|
||||
* \author Stephane Fillod
|
||||
* \author Frank Singleton
|
||||
* \date 2000-2004
|
||||
* \date 2000-2005
|
||||
*
|
||||
* Hamlib interface is a frontend implementing wrapper functions.
|
||||
*/
|
||||
|
@ -70,7 +70,7 @@ const char hamlib_version[] = "Hamlib version " PACKAGE_VERSION;
|
|||
* \brief Hamlib copyright notice
|
||||
*/
|
||||
const char hamlib_copyright[] =
|
||||
"Copyright (C) 2000-2004 Stephane Fillod and Frank Singleton\n"
|
||||
"Copyright (C) 2000-2005 Stephane Fillod and Frank Singleton\n"
|
||||
"This is free software; see the source for copying conditions. There is NO\n"
|
||||
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.";
|
||||
|
||||
|
@ -85,6 +85,8 @@ const char hamlib_copyright[] =
|
|||
|
||||
#if defined(WIN32)
|
||||
#define DEFAULT_PARALLEL_PORT "\\\\.\\$VDMLPT1"
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
#define DEFAULT_PARALLEL_PORT "/dev/ppi0"
|
||||
#else
|
||||
#define DEFAULT_PARALLEL_PORT "/dev/parport0"
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Hamlib Interface - main file
|
||||
* Copyright (c) 2000-2004 by Stephane Fillod and Frank Singleton
|
||||
* Copyright (c) 2000-2005 by Stephane Fillod and Frank Singleton
|
||||
*
|
||||
* $Id: rotator.c,v 1.16 2004-10-02 20:37:24 fillods Exp $
|
||||
* $Id: rotator.c,v 1.17 2005-02-20 02:38:29 fillods 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
|
||||
|
@ -25,7 +25,7 @@
|
|||
* \ingroup rot
|
||||
* \brief Rotator interface
|
||||
* \author Stephane Fillod
|
||||
* \date 2000-2004
|
||||
* \date 2000-2005
|
||||
*
|
||||
* Hamlib interface is a frontend implementing rotator wrapper functions.
|
||||
*/
|
||||
|
@ -66,6 +66,8 @@
|
|||
#endif
|
||||
#if defined(WIN32)
|
||||
#define DEFAULT_PARALLEL_PORT "\\\\.\\$VDMLPT1"
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H)
|
||||
#define DEFAULT_PARALLEL_PORT "/dev/ppi0"
|
||||
#else
|
||||
#define DEFAULT_PARALLEL_PORT "/dev/parport0"
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue