Add ecpp(7D) (parallel port) for Solaris.
* configure.ac: add Solaris' default parallel port. * linux_ppdev.h: change parallel port access to the new style. * freebsd_ppi.h: New file, abstract FreeBSD's ppi(4). * solaris_ecpp.h: New file, abstract Solaris' ecpp(7D). * par.c: change header inclusion sequence. * pgm.h: remove obsolete ppi_claim() and ppi_release() dummies. * ppi.c: change header inclusion sequence, use new parport abstraction, drop obsolete dummy implementation. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@542 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
5ce121ab1c
commit
ad9238b29e
|
@ -140,7 +140,7 @@ case $target in
|
|||
DEFAULT_SER_PORT="/dev/cuaa0"
|
||||
;;
|
||||
*-*-solaris*)
|
||||
DEFAULT_PAR_PORT="unknown"
|
||||
DEFAULT_PAR_PORT="/dev/printers/0"
|
||||
DEFAULT_SER_PORT="/dev/term/a"
|
||||
;;
|
||||
*-*-msdos* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2005 Joerg Wunsch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef freebsd_ppi_h
|
||||
#define freebsd_ppi_h
|
||||
|
||||
#include <dev/ppbus/ppi.h>
|
||||
|
||||
#define ppi_claim(pgm) {}
|
||||
|
||||
#define ppi_release(pgm) {}
|
||||
|
||||
#define DO_PPI_READ(fd, reg, valp) \
|
||||
(void)ioctl(fd, \
|
||||
(reg) == PPIDATA? PPIGDATA: ((reg) == PPICTRL? PPIGCTRL: PPIGSTATUS), \
|
||||
valp)
|
||||
#define DO_PPI_WRITE(fd, reg, valp) \
|
||||
(void)ioctl(fd, \
|
||||
(reg) == PPIDATA? PPISDATA: ((reg) == PPICTRL? PPISCTRL: PPISSTATUS), \
|
||||
valp)
|
||||
|
||||
#endif /* freebsd_ppi_h */
|
|
@ -9,15 +9,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define PPISDATA PPWDATA
|
||||
#define PPIGDATA PPRDATA
|
||||
|
||||
#define PPISCTRL PPWCONTROL
|
||||
#define PPIGCTRL PPRCONTROL
|
||||
|
||||
#define PPISSTATUS PPWSTATUS
|
||||
#define PPIGSTATUS PPRSTATUS
|
||||
|
||||
#define ppi_claim(pgm) \
|
||||
if (ioctl(pgm->fd, PPCLAIM)) { \
|
||||
fprintf(stderr, "%s: can't claim device \"%s\": %s\n\n", \
|
||||
|
@ -33,5 +24,13 @@
|
|||
exit(1); \
|
||||
}
|
||||
|
||||
#define DO_PPI_READ(fd, reg, valp) \
|
||||
(void)ioctl(fd, \
|
||||
(reg) == PPIDATA? PPRDATA: ((reg) == PPICTRL? PPRCONTROL: PPRSTATUS), \
|
||||
valp)
|
||||
#define DO_PPI_WRITE(fd, reg, valp) \
|
||||
(void)ioctl(fd, \
|
||||
(reg) == PPIDATA? PPWDATA: ((reg) == PPICTRL? PPWCONTROL: PPWSTATUS), \
|
||||
valp)
|
||||
|
||||
#endif /* __linux_ppdev_h__ */
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
#include <errno.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <dev/ppbus/ppi.h>
|
||||
# include "freebsd_ppi.h"
|
||||
#elif defined(__linux__)
|
||||
#include "linux_ppdev.h"
|
||||
# include "linux_ppdev.h"
|
||||
#elif defined(__sun__) && defined(__svr4__) /* Solaris */
|
||||
# include "solaris_ecpp.h"
|
||||
#endif
|
||||
|
||||
#include "avr.h"
|
||||
|
|
|
@ -111,12 +111,4 @@ void gettimeofday(struct timeval*, void*z);
|
|||
#endif /* __win32native_h */
|
||||
|
||||
|
||||
#if !defined(ppi_claim)
|
||||
# define ppi_claim(pgm)
|
||||
#endif
|
||||
|
||||
#if !defined(ppi_release)
|
||||
# define ppi_release(pgm)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
/* $Id$ */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__linux__)
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#if HAVE_PARPORT
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -31,9 +31,11 @@
|
|||
#include <errno.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <dev/ppbus/ppi.h>
|
||||
# include "freebsd_ppi.h"
|
||||
#elif defined(__linux__)
|
||||
#include "linux_ppdev.h"
|
||||
# include "linux_ppdev.h"
|
||||
#elif defined(__sun__) && defined(__svr4__) /* Solaris */
|
||||
# include "solaris_ecpp.h"
|
||||
#endif
|
||||
|
||||
#include "avr.h"
|
||||
|
@ -53,22 +55,15 @@ int ppi_shadow_access(int fd, int reg, unsigned char *v, unsigned char action)
|
|||
{
|
||||
static unsigned char shadow[3];
|
||||
int shadow_num;
|
||||
unsigned long set, get;
|
||||
|
||||
switch (reg) {
|
||||
case PPIDATA:
|
||||
set = PPISDATA;
|
||||
get = PPIGDATA;
|
||||
shadow_num = 0;
|
||||
break;
|
||||
case PPICTRL:
|
||||
set = PPISCTRL;
|
||||
get = PPIGCTRL;
|
||||
shadow_num = 1;
|
||||
break;
|
||||
case PPISTATUS:
|
||||
set = PPISSTATUS;
|
||||
get = PPIGSTATUS;
|
||||
shadow_num = 2;
|
||||
break;
|
||||
default:
|
||||
|
@ -83,12 +78,12 @@ int ppi_shadow_access(int fd, int reg, unsigned char *v, unsigned char action)
|
|||
*v = shadow[shadow_num];
|
||||
break;
|
||||
case PPI_READ:
|
||||
ioctl(fd, get, v);
|
||||
DO_PPI_READ(fd, reg, v);
|
||||
shadow[shadow_num]=*v;
|
||||
break;
|
||||
case PPI_WRITE:
|
||||
shadow[shadow_num]=*v;
|
||||
ioctl(fd, set, v);
|
||||
DO_PPI_WRITE(fd, reg, v);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -231,76 +226,5 @@ void ppi_close(int fd)
|
|||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
#elif defined(__POWERPC__) && defined(__APPLE__)
|
||||
|
||||
int ppi_shadow_access(int fd, int reg, unsigned char *v, unsigned char action)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* set the indicated bit of the specified register.
|
||||
*/
|
||||
int ppi_set(int fd, int reg, int bit)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* clear the indicated bit of the specified register.
|
||||
*/
|
||||
int ppi_clr(int fd, int reg, int bit)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get the indicated bit of the specified register.
|
||||
*/
|
||||
int ppi_get(int fd, int reg, int bit)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* toggle the indicated bit of the specified register.
|
||||
*/
|
||||
int ppi_toggle(int fd, int reg, int bit)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get all bits of the specified register.
|
||||
*/
|
||||
int ppi_getall(int fd, int reg)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* set all bits of the specified register to val.
|
||||
*/
|
||||
int ppi_setall(int fd, int reg, int val)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int ppi_open(char * port)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void ppi_close(int fd)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_PARPORT */
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2005 Joerg Wunsch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef solaris_ecpp_h
|
||||
#define solaris_ecpp_h
|
||||
|
||||
#include <sys/ecppio.h>
|
||||
|
||||
#define ppi_claim(pgm) \
|
||||
do { \
|
||||
struct ecpp_transfer_parms p; \
|
||||
(void)ioctl(pgm->fd, ECPPIOC_GETPARMS, &p); \
|
||||
p.mode = ECPP_DIAG_MODE; \
|
||||
(void)ioctl(pgm->fd, ECPPIOC_SETPARMS, &p); \
|
||||
} while(0);
|
||||
|
||||
#define ppi_release(pgm)
|
||||
|
||||
#define DO_PPI_READ(fd, reg, valp) \
|
||||
do { struct ecpp_regs r; \
|
||||
if ((reg) == PPIDATA) { (void)ioctl(fd, ECPPIOC_GETDATA, valp); } \
|
||||
else { (void)ioctl(fd, ECPPIOC_GETREGS, &r); \
|
||||
*(valp) = ((reg) == PPICTRL)? r.dcr: r.dsr; } \
|
||||
} while(0)
|
||||
#define DO_PPI_WRITE(fd, reg, valp) \
|
||||
do { struct ecpp_regs r; \
|
||||
if ((reg) == PPIDATA) { (void)ioctl(fd, ECPPIOC_SETDATA, valp); } \
|
||||
else { if ((reg) == PPICTRL) r.dcr = *(valp); else r.dsr = *(valp); \
|
||||
(void)ioctl(fd, ECPPIOC_SETREGS, &r); } \
|
||||
} while(0)
|
||||
|
||||
|
||||
#endif /* solaris_ecpp_h */
|
Loading…
Reference in New Issue