summaryrefslogtreecommitdiff
path: root/sys/arch/pc532/dev
diff options
context:
space:
mode:
authorsimonb <simonb@NetBSD.org>2006-05-12 06:05:22 +0000
committersimonb <simonb@NetBSD.org>2006-05-12 06:05:22 +0000
commitc1924fc56dcccb7fd5481e73246263e0ceffe056 (patch)
tree2b375fd8674c783ffcbe68acfaea70194aa1765a /sys/arch/pc532/dev
parent4fb473c54c761f2cf032479259a4c2611b8d593a (diff)
KNF, ANSIfy, white space clean up.
Diffstat (limited to 'sys/arch/pc532/dev')
-rw-r--r--sys/arch/pc532/dev/aic.c26
-rw-r--r--sys/arch/pc532/dev/lpt.c136
-rw-r--r--sys/arch/pc532/dev/ncr.c50
-rw-r--r--sys/arch/pc532/dev/scn.c222
-rw-r--r--sys/arch/pc532/dev/scnvar.h12
5 files changed, 175 insertions, 271 deletions
diff --git a/sys/arch/pc532/dev/aic.c b/sys/arch/pc532/dev/aic.c
index 15001131ee1..faf6f406560 100644
--- a/sys/arch/pc532/dev/aic.c
+++ b/sys/arch/pc532/dev/aic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aic.c,v 1.11 2005/12/11 12:18:31 christos Exp $ */
+/* $NetBSD: aic.c,v 1.12 2006/05/12 06:05:22 simonb Exp $ */
/* Written by Phil Nelson for the pc532. Used source with the following
* copyrights as a model.
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic.c,v 1.11 2005/12/11 12:18:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic.c,v 1.12 2006/05/12 06:05:22 simonb Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -97,13 +97,17 @@ struct scsi_switch dp_switch = {
0, 0, 0
};
-int aicprobe(struct pc532_device *dvp)
+int
+aicprobe(struct pc532_device *dvp)
{
- return (0); /* All pc532s should have one, but it is not working now. */
+
+ /* All pc532s should have one, but it is not working now. */
+ return (0);
}
-int aicattach(struct pc532_device *dvp)
+int
+aicattach(struct pc532_device *dvp)
{
int r;
@@ -113,7 +117,8 @@ int aicattach(struct pc532_device *dvp)
return(r);
}
-void aicminphys(struct buf *bp)
+void
+aicminphys(struct buf *bp)
{
if(bp->b_bcount > ((AIC_NSEG - 1) * PAGE_SIZE))
@@ -121,8 +126,10 @@ void aicminphys(struct buf *bp)
minphys(bp);
}
-long int aic_adapter_info(int unit)
+long int
+aic_adapter_info(int unit)
{
+
return (1); /* only 1 outstanding request. */
}
@@ -131,8 +138,10 @@ long int aic_adapter_info(int unit)
struct scsipi_xfer *cur_xs;
-int aic_scsi_cmd(struct scsipi_xfer *xs)
+int
+aic_scsi_cmd(struct scsipi_xfer *xs)
{
+
printf ("aic_scsi_cmd: ... \n");
cur_xs = xs;
@@ -141,4 +150,5 @@ printf ("aic_scsi_cmd: ... \n");
void aic_intr (struct intrframe frame)
{
+
}
diff --git a/sys/arch/pc532/dev/lpt.c b/sys/arch/pc532/dev/lpt.c
index 257f88c5685..f8ce161501c 100644
--- a/sys/arch/pc532/dev/lpt.c
+++ b/sys/arch/pc532/dev/lpt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lpt.c,v 1.43 2006/03/28 17:38:26 thorpej Exp $ */
+/* $NetBSD: lpt.c,v 1.44 2006/05/12 06:05:22 simonb Exp $ */
/*
* Copyright (c) 1994 Matthias Pfaller.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.43 2006/03/28 17:38:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.44 2006/05/12 06:05:22 simonb Exp $");
#include "opt_inet.h"
@@ -183,30 +183,30 @@ struct lpt_softc {
#define LPTFLAGS(s) (minor(s) & 0xe0)
#define LPTSOFTC(n) ((struct lpt_softc *) lpt_cd.cd_devs[n])
-static int lptmatch __P((struct device *, struct cfdata *, void *aux));
-static void lptattach __P((struct device *, struct device *, void *));
-static void lptintr __P((void *));
-static int notready __P((u_char, struct lpt_softc *));
-static void lptout __P((void *));
-static int pushbytes __P((struct lpt_softc *));
+static int lptmatch(struct device *, struct cfdata *, void *aux);
+static void lptattach(struct device *, struct device *, void *);
+static void lptintr(void *);
+static int notready(u_char, struct lpt_softc *);
+static void lptout(void *);
+static int pushbytes(struct lpt_softc *);
#if defined(INET) && defined(PLIP)
/* Functions for the plip# interface */
-static void plipattach __P((struct lpt_softc *,int));
-static void plipinput __P((struct lpt_softc *));
-static int plipioctl __P((struct ifnet *, u_long, caddr_t));
-static void plipoutput __P((void *));
+static void plipattach(struct lpt_softc *,int);
+static void plipinput(struct lpt_softc *);
+static int plipioctl(struct ifnet *, u_long, caddr_t);
+static void plipoutput(void *);
#ifndef __OPTIMIZE__
static
#endif
- int plipreceive __P((volatile struct i8255 *, u_char *, int));
-static void pliprxenable __P((void *));
-static void plipsoftint __P((void *));
-static void plipstart __P((struct ifnet *));
+ int plipreceive(volatile struct i8255 *, u_char *, int);
+static void pliprxenable(void *);
+static void plipsoftint(void *);
+static void plipstart(struct ifnet *);
#ifndef __OPTIMIZE__
static
#endif
- int pliptransmit __P((volatile struct i8255 *, u_char *, int));
+ int pliptransmit(volatile struct i8255 *, u_char *, int);
#endif
CFATTACH_DECL(lpt, sizeof(struct lpt_softc),
@@ -225,10 +225,7 @@ const struct cdevsw lpt_cdevsw = {
};
static int
-lptmatch(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
+lptmatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct confargs *ca = aux;
volatile struct i8255 *i8255 =
@@ -262,9 +259,7 @@ lptmatch(parent, cf, aux)
}
static void
-lptattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
+lptattach(struct device *parent, struct device *self, void *aux)
{
struct confargs *ca = aux;
struct lpt_softc *sc = (struct lpt_softc *) self;
@@ -294,11 +289,7 @@ lptattach(parent, self, aux)
* Reset the printer, then wait until it's selected and not busy.
*/
int
-lptopen(dev, flag, mode, l)
- dev_t dev;
- int flag;
- int mode;
- struct lwp *l;
+lptopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct lpt_softc *sc;
volatile struct i8255 *i8255;
@@ -361,19 +352,19 @@ lptopen(dev, flag, mode, l)
}
static int
-notready(status, sc)
- u_char status;
- struct lpt_softc *sc;
+notready(u_char status, struct lpt_softc *sc)
{
status ^= LPT_INVERT;
if (status != sc->sc_status) {
if (status & LPC_NOPAPER)
- log(LOG_NOTICE, "%s: out of paper\n", sc->sc_dev.dv_xname);
+ log(LOG_NOTICE, "%s: out of paper\n",
+ sc->sc_dev.dv_xname);
if (status & LPC_ONLINE)
log(LOG_NOTICE, "%s: offline\n", sc->sc_dev.dv_xname);
if (status & LPC_NERROR)
- log(LOG_NOTICE, "%s: output error\n", sc->sc_dev.dv_xname);
+ log(LOG_NOTICE, "%s: output error\n",
+ sc->sc_dev.dv_xname);
if (status & LPC_NACK)
log(LOG_NOTICE, "%s: NACK low\n", sc->sc_dev.dv_xname);
if (status & LPC_NBUSY)
@@ -384,9 +375,9 @@ notready(status, sc)
}
static void
-lptout(arg)
- void *arg;
+lptout(void *arg)
{
+
struct lpt_softc *sc = arg;
if (sc->sc_count > 0)
sc->sc_i8255->port_control = LPT_IRQENABLE;
@@ -396,11 +387,7 @@ lptout(arg)
* Close the device, and free the local line buffer.
*/
int
-lptclose(dev, flag, mode, l)
- dev_t dev;
- int flag;
- int mode;
- struct lwp *l;
+lptclose(dev_t dev, int flag, int mode, struct lwp *l)
{
struct lpt_softc *sc = LPTSOFTC(LPTUNIT(dev));
@@ -415,8 +402,7 @@ lptclose(dev, flag, mode, l)
}
static int
-pushbytes(sc)
- struct lpt_softc *sc;
+pushbytes(struct lpt_softc *sc)
{
volatile struct i8255 *i8255 = sc->sc_i8255;
int error;
@@ -435,10 +421,7 @@ pushbytes(sc)
* get the chars moved to the output queue.
*/
int
-lptwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
+lptwrite(dev_t dev, struct uio *uio, int flags)
{
struct lpt_softc *sc = LPTSOFTC(LPTUNIT(dev));
size_t n;
@@ -467,8 +450,7 @@ lptwrite(dev, uio, flags)
* another char.
*/
static void
-lptintr(arg)
- void *arg;
+lptintr(void *arg)
{
struct lpt_softc *sc = arg;
volatile struct i8255 *i8255 = sc->sc_i8255;
@@ -509,12 +491,7 @@ lptintr(arg)
}
int
-lptioctl(dev, cmd, data, flag, l)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct lwp *l;
+lptioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
{
int error = 0;
@@ -529,12 +506,10 @@ lptioctl(dev, cmd, data, flag, l)
#if defined(INET) && defined(PLIP)
static void
-plipattach(sc, unit)
- struct lpt_softc *sc;
- int unit;
+plipattach(struct lpt_softc *sc, int unit)
{
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
- u_int8_t myaddr[ETHER_ADDR_LEN];
+ uint8_t myaddr[ETHER_ADDR_LEN];
callout_init(&sc->sc_plipout_ch);
callout_init(&sc->sc_pliprx_ch);
@@ -560,10 +535,7 @@ plipattach(sc, unit)
* Process an ioctl request.
*/
static int
-plipioctl(ifp, cmd, data)
- struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
+plipioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct proc *p = curproc; /* XXX ktrace-lwp */
struct lpt_softc *sc = (struct lpt_softc *)(ifp->if_softc);
@@ -639,8 +611,8 @@ plipioctl(ifp, cmd, data)
break;
case SIOCSIFMTU:
- if ((error = suser(p->p_ucred, &p->p_acflag)))
- return(error);
+ if ((error = suser(p->p_ucred, &p->p_acflag)))
+ return(error);
if (ifp->if_mtu != ifr->ifr_mtu) {
ifp->if_mtu = ifr->ifr_mtu;
if (sc->sc_ifbuf) {
@@ -659,8 +631,7 @@ plipioctl(ifp, cmd, data)
}
static void
-plipsoftint(arg)
- void *arg;
+plipsoftint(void *arg)
{
struct lpt_softc *sc = arg;
int pending = sc->sc_pending;
@@ -676,7 +647,8 @@ plipsoftint(arg)
}
#ifdef __OPTIMIZE__
-int plipreceive __P((volatile struct i8255 *, u_char *, int))
+int plipreceive(volatile struct i8255 *, u_char *, int)
+
__asm("plipreceive");
__asm(" \
plipreceive: \
@@ -732,10 +704,7 @@ plipreceive: \
");
#else
static int
-plipreceive(i8255, buf, len)
- volatile struct i8255 *i8255;
- u_char *buf;
- int len;
+plipreceive(volatile struct i8255 *i8255, u_char *buf, int len)
{
int i;
u_char cksum = 0, c;
@@ -757,17 +726,16 @@ plipreceive(i8255, buf, len)
#endif
static void
-pliprxenable(arg)
- void *arg;
+pliprxenable(void *arg)
{
+
struct lpt_softc *sc = arg;
volatile struct i8255 *i8255 = sc->sc_i8255;
i8255->port_a |= LPA_ACKENABLE | LPA_ACTIVE;
}
static void
-plipinput(sc)
- struct lpt_softc *sc;
+plipinput(struct lpt_softc *sc)
{
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
volatile struct i8255 *i8255 = sc->sc_i8255;
@@ -879,7 +847,8 @@ err:
}
#ifdef __OPTIMIZE__
-int pliptransmit __P((volatile struct i8255 *, u_char *, int))
+int pliptransmit(volatile struct i8255 *, u_char *, int)
+
__asm("pliptransmit");
__asm(" \
pliptransmit: \
@@ -939,10 +908,7 @@ pliptransmit: \
");
#else
static int
-pliptransmit(i8255, buf, len)
- volatile struct i8255 *i8255;
- u_char *buf;
- int len;
+pliptransmit(volatile struct i8255 *i8255, u_char *buf, int len)
{
int i;
u_char cksum = 0, c;
@@ -968,17 +934,16 @@ pliptransmit(i8255, buf, len)
* Setup output on interface.
*/
static void
-plipstart(ifp)
- struct ifnet *ifp;
+plipstart(struct ifnet *ifp)
{
+
struct lpt_softc *sc = (struct lpt_softc *)(ifp->if_softc);
sc->sc_pending |= PLIP_OPENDING;
softintr(sc->sc_ifsoftint);
}
static void
-plipoutput(arg)
- void *arg;
+plipoutput(void *arg)
{
struct lpt_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -1083,5 +1048,4 @@ retry:
i8255->port_a |= LPA_ACKENABLE | LPA_ACTIVE;
sc->sc_ifoerrs++;
}
-
#endif
diff --git a/sys/arch/pc532/dev/ncr.c b/sys/arch/pc532/dev/ncr.c
index e9ccf59f5c3..0e14536b293 100644
--- a/sys/arch/pc532/dev/ncr.c
+++ b/sys/arch/pc532/dev/ncr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr.c,v 1.54 2006/03/11 14:07:35 simonb Exp $ */
+/* $NetBSD: ncr.c,v 1.55 2006/05/12 06:05:22 simonb Exp $ */
/*
* Copyright (c) 1996, 1997 Matthias Pfaller.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.54 2006/03/11 14:07:35 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.55 2006/05/12 06:05:22 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,13 +52,13 @@ __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.54 2006/03/11 14:07:35 simonb Exp $");
/*
* Function declarations:
*/
-static int ncr_pdma_in __P((struct ncr5380_softc *, int, int, u_char *));
-static int ncr_pdma_out __P((struct ncr5380_softc *, int, int, u_char *));
-static void ncr_intr __P((void *));
-static void ncr_attach __P((struct device *, struct device *, void *));
-static int ncr_match __P((struct device *, struct cfdata *, void *));
-static int ncr_ready __P((struct ncr5380_softc *sc));
-static void ncr_wait_not_req __P((struct ncr5380_softc *sc));
+static int ncr_pdma_in(struct ncr5380_softc *, int, int, u_char *);
+static int ncr_pdma_out(struct ncr5380_softc *, int, int, u_char *);
+static void ncr_intr(void *);
+static void ncr_attach(struct device *, struct device *, void *);
+static int ncr_match(struct device *, struct cfdata *, void *);
+static int ncr_ready(struct ncr5380_softc *sc);
+static void ncr_wait_not_req(struct ncr5380_softc *sc);
/*
* Some constants.
@@ -90,10 +90,7 @@ CFATTACH_DECL(ncr, sizeof(struct ncr5380_softc),
static int ncr_attached;
static int
-ncr_match(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
+ncr_match(struct device *parent, struct cfdata *cf, void *aux)
{
struct confargs *ca = aux;
@@ -106,9 +103,7 @@ ncr_match(parent, cf, aux)
}
static void
-ncr_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
+ncr_attach(struct device *parent, struct device *self, void *aux)
{
struct confargs *ca = aux;
struct ncr5380_softc *sc = (struct ncr5380_softc *) self;
@@ -174,8 +169,7 @@ ncr_attach(parent, self, aux)
}
static void
-ncr_intr(arg)
- void *arg;
+ncr_intr(void *arg)
{
struct ncr5380_softc *sc = arg;
@@ -218,15 +212,14 @@ ncr_intr(arg)
#define TIMEOUT 1000000
static inline int
-ncr_ready(sc)
- struct ncr5380_softc *sc;
+ncr_ready(struct ncr5380_softc *sc)
{
int i;
for (i = TIMEOUT; i > 0; i--) {
if ((*sc->sci_csr & (SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH)) ==
(SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH))
- return(1);
+ return(1);
if ((*sc->sci_csr & SCI_CSR_PHASE_MATCH) == 0 ||
SCI_BUSY(sc) == 0)
@@ -237,10 +230,11 @@ ncr_ready(sc)
}
/* Return zero on success. */
-static inline void ncr_wait_not_req(sc)
- struct ncr5380_softc *sc;
+static inline void
+ncr_wait_not_req(struct ncr5380_softc *sc)
{
int timo;
+
for (timo = TIMEOUT; timo; timo--) {
if ((*sc->sci_bus_csr & SCI_BUS_REQ) == 0 ||
(*sc->sci_csr & SCI_CSR_PHASE_MATCH) == 0 ||
@@ -252,10 +246,7 @@ static inline void ncr_wait_not_req(sc)
}
static int
-ncr_pdma_in(sc, phase, datalen, data)
- struct ncr5380_softc *sc;
- int phase, datalen;
- u_char *data;
+ncr_pdma_in(struct ncr5380_softc *sc, int phase, int datalen, u_char *data)
{
volatile u_char *pdma = (void *)PDMA_ADDRESS;
int resid, s;
@@ -327,10 +318,7 @@ interrupt:
}
static int
-ncr_pdma_out(sc, phase, datalen, data)
- struct ncr5380_softc *sc;
- int phase, datalen;
- u_char *data;
+ncr_pdma_out(struct ncr5380_softc *sc, int phase, int datalen, u_char *data)
{
u_char *pdma = (void *)PDMA_ADDRESS;
int i, s, resid;
diff --git a/sys/arch/pc532/dev/scn.c b/sys/arch/pc532/dev/scn.c
index 50cec166584..1670ea7a8b7 100644
--- a/sys/arch/pc532/dev/scn.c
+++ b/sys/arch/pc532/dev/scn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scn.c,v 1.70 2006/03/29 03:58:48 thorpej Exp $ */
+/* $NetBSD: scn.c,v 1.71 2006/05/12 06:05:22 simonb Exp $ */
/*
* Copyright (c) 1991, 1992, 1993
@@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scn.c,v 1.70 2006/03/29 03:58:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scn.c,v 1.71 2006/05/12 06:05:22 simonb Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -121,18 +121,18 @@ __KERNEL_RCSID(0, "$NetBSD: scn.c,v 1.70 2006/03/29 03:58:48 thorpej Exp $");
static const char scnints[4] = {IR_TTY0, IR_TTY1, IR_TTY2, IR_TTY3};
static const char rxints[4] = {IR_TTY0RDY, IR_TTY1RDY, IR_TTY2RDY, IR_TTY3RDY};
-int scnprobe __P((struct device *, struct cfdata *, void *));
-void scnattach __P((struct device *, struct device *, void *));
-int scnparam __P((struct tty *, struct termios *));
-void scnstart __P((struct tty *));
-void scncnprobe __P((struct consdev *));
-void scncninit __P((struct consdev *));
-int scncngetc __P((void *));
-void scncnputc __P((void *, int));
-void scncnpollc __P((dev_t, int));
-int scninit __P((dev_t, int));
-void scncnreinit __P((void *));
-int scnhwiflow __P((struct tty *, int));
+int scnprobe(struct device *, struct cfdata *, void *);
+void scnattach(struct device *, struct device *, void *);
+int scnparam(struct tty *, struct termios *);
+void scnstart(struct tty *);
+void scncnprobe(struct consdev *);
+void scncninit(struct consdev *);
+int scncngetc(void *);
+void scncnputc(void *, int);
+void scncnpollc(dev_t, int);
+int scninit(dev_t, int);
+void scncnreinit(void *);
+int scnhwiflow(struct tty *, int);
CFATTACH_DECL(scn, sizeof(struct scn_softc),
scnprobe, scnattach, NULL, NULL);
@@ -176,18 +176,18 @@ int scnconsrate = CONSOLE_SPEED;
#define SCN_ISCONSOLE(addr) \
(SCN_ADDR2DUART(addr) == SCN_CONSDUART && (SCN_ADDR2CHAN(addr) == SCN_CONSCHAN))
-static void scnintr __P((void *));
-static void scnrxintr __P((void *));
-static int scn_rxintr __P((struct scn_softc *));
-static void scnsoft __P((void *));
-static void scn_setchip __P((struct scn_softc *sc));
-static int scniter __P((int *, int, int*, int*, struct chan *, int));
-static int scn_config __P((int, int, int, int, u_char, u_char));
-static void scn_rxenable __P((struct scn_softc *));
-static void scn_rxdisable __P((struct scn_softc *));
-static void dcd_int __P((struct scn_softc *, struct tty *, u_char));
-static void scnoverrun __P((int, long *, const char *));
-static unsigned char opbits __P((struct scn_softc *, int));
+static void scnintr(void *);
+static void scnrxintr(void *);
+static int scn_rxintr(struct scn_softc *);
+static void scnsoft(void *);
+static void scn_setchip(struct scn_softc *sc);
+static int scniter(int *, int, int*, int*, struct chan *, int);
+static int scn_config(int, int, int, int, u_char, u_char);
+static void scn_rxenable(struct scn_softc *);
+static void scn_rxdisable(struct scn_softc *);
+static void dcd_int(struct scn_softc *, struct tty *, u_char);
+static void scnoverrun(int, long *, const char *);
+static unsigned char opbits(struct scn_softc *, int);
static int scnsir = -1; /* s/w intr number */
#define setsoftscn() softintr(scnsir)
@@ -323,13 +323,13 @@ static u_char bothgroups[16] = {
* for minimum error (from some of Dave Rand's code)
*/
const struct {
- u_int16_t speed;
- u_int16_t div;
+ uint16_t speed;
+ uint16_t div;
} divs[] = {
{ 50, 2303 }, /* 2304 is exact?? */
{ 110, 1047 }, /* Should be 1047.27 */
- { 134, 857 }, /* Should be 856.505576 */
- { 1050, 110 }, /* Should be 109.7142857 */
+ { 134, 857 }, /* Should be 856.505576 */
+ { 1050, 110 }, /* Should be 109.7142857 */
{ 2000, 57 } /* Should be 57.6 */
};
#define DIVS (sizeof(divs)/sizeof(divs[0]))
@@ -376,8 +376,7 @@ extern int kgdb_debug_init;
*/
static void
-scn_setchip(sc)
- struct scn_softc *sc;
+scn_setchip(struct scn_softc *sc)
{
struct duart *dp;
u_char acr, csr, mr1, mr2;
@@ -461,7 +460,7 @@ scn_setchip(sc)
/* program counter/timer only if necessary */
if (dp->counter != dp->ocounter) {
- u_int16_t div;
+ uint16_t div;
#ifdef DIVS
int i;
@@ -518,14 +517,10 @@ scn_setchip(sc)
*/
static int
-scniter(index, wanted, counter, mode, other, c92)
- int *index; /* IN/OUT: index */
- int wanted; /* IN: speed wanted */
- int *counter; /* IN/OUT: counter/timer rate */
- int *mode; /* IN/OUT: mode */
- struct chan *other; /* IN: other channel, or NULL */
- int c92; /* IN: true for 26C92 */
+scniter(int *index, int wanted, int *counter, int *mode, struct chan *other,
+ int c92)
{
+
while (*index < TABENTRIES) {
struct tabent *tp;
@@ -579,13 +574,7 @@ scniter(index, wanted, counter, mode, other, c92)
* rewritten 2/97 -plb
*/
static int
-scn_config(unit, chan, ispeed, ospeed, mr1, mr2)
- int unit;
- int chan;
- int ispeed; /* input speed in bps */
- int ospeed; /* output speed in bps */
- u_char mr1; /* new bits for MR1 */
- u_char mr2; /* new bits for MR2 */
+scn_config(int unit, int chan, int ispeed, int ospeed, u_char mr1, u_char mr2)
{
struct scn_softc *sc;
struct duart *dp;
@@ -703,9 +692,9 @@ scn_config(unit, chan, ispeed, ospeed, mr1, mr2)
}
return EINVAL;
- gotit:
+ gotit:
s = spltty();
- gotit2:
+ gotit2:
dp->chan[chan].new_mr1 = mr1;
dp->chan[chan].new_mr2 = mr2;
dp->chan[chan].ispeed = ispeed;
@@ -723,10 +712,7 @@ scn_config(unit, chan, ispeed, ospeed, mr1, mr2)
}
int
-scnprobe(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
+scnprobe(struct device *parent, struct cfdata *cf, void *aux)
{
struct confargs *ca = aux;
volatile u_char *ch_base;
@@ -762,8 +748,7 @@ scnprobe(parent, cf, aux)
* they're only called on setup, open & close!
*/
static inline void
-scn_rxenable(sc)
- struct scn_softc *sc;
+scn_rxenable(struct scn_softc *sc)
{
struct duart *dp;
int channel;
@@ -780,8 +765,7 @@ scn_rxenable(sc)
}
static inline void
-scn_rxdisable(sc)
- struct scn_softc *sc;
+scn_rxdisable(struct scn_softc *sc)
{
struct duart *dp;
int channel;
@@ -798,10 +782,7 @@ scn_rxdisable(sc)
}
void
-scnattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
+scnattach(struct device *parent, struct device *self, void *aux)
{
struct confargs *ca = aux;
struct scn_softc *sc;
@@ -923,7 +904,7 @@ scnattach(parent, self, aux)
intr_establish(ca->ca_irq >> 4, scnrxintr, duart, intrname, IPL_ZERO,
IPL_RTTY, LOW_LEVEL);
- duart->base = duart_base;
+ duart->base = duart_base;
duart->type = scntype;
}
/* Record channel, uart */
@@ -958,11 +939,11 @@ scnattach(parent, self, aux)
}
/*
- * Set up the hardware to a base state, in particular:
- * o reset transmitter and receiver
- * o set speeds and configurations
- * o receiver interrupts only (RxRDY and BREAK)
- */
+ * Set up the hardware to a base state, in particular:
+ * o reset transmitter and receiver
+ * o set speeds and configurations
+ * o receiver interrupts only (RxRDY and BREAK)
+ */
s = spltty();
/* RTS off... */
@@ -1073,11 +1054,7 @@ scnattach(parent, self, aux)
/* ARGSUSED */
int
-scnopen(dev, flag, mode, l)
- dev_t dev;
- int flag;
- int mode;
- struct lwp *l;
+scnopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct tty *tp;
int unit = DEV_UNIT(dev);
@@ -1221,11 +1198,7 @@ scnopen(dev, flag, mode, l)
/*ARGSUSED*/
int
-scnclose(dev, flag, mode, l)
- dev_t dev;
- int flag;
- int mode;
- struct lwp *l;
+scnclose(dev_t dev, int flag, int mode, struct lwp *l)
{
int unit = DEV_UNIT(dev);
struct scn_softc *sc = SOFTC(unit);
@@ -1262,10 +1235,7 @@ scnclose(dev, flag, mode, l)
}
int
-scnread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
+scnread(dev_t dev, struct uio *uio, int flag)
{
struct scn_softc *sc = SOFTC(DEV_UNIT(dev));
struct tty *tp = sc->sc_tty;
@@ -1274,10 +1244,7 @@ scnread(dev, uio, flag)
}
int
-scnwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
+scnwrite(dev_t dev, struct uio *uio, int flag)
{
struct scn_softc *sc = SOFTC(DEV_UNIT(dev));
struct tty *tp = sc->sc_tty;
@@ -1286,10 +1253,7 @@ scnwrite(dev, uio, flag)
}
int
-scnpoll(dev, events, l)
- dev_t dev;
- int events;
- struct lwp *l;
+scnpoll(dev_t dev, int events, struct lwp *l)
{
struct scn_softc *sc = SOFTC(DEV_UNIT(dev));
struct tty *tp = sc->sc_tty;
@@ -1298,8 +1262,7 @@ scnpoll(dev, events, l)
}
struct tty *
-scntty(dev)
- dev_t dev;
+scntty(dev_t dev)
{
struct scn_softc *sc = SOFTC(DEV_UNIT(dev));
@@ -1308,11 +1271,9 @@ scntty(dev)
/* Worker routines for interrupt processing */
static inline void
-dcd_int(sc, tp, new)
- struct scn_softc *sc;
- struct tty *tp;
- u_char new;
+dcd_int(struct scn_softc *sc, struct tty *tp, u_char new)
{
+
if (sc->sc_swflags & SCN_SW_SOFTCAR)
return;
@@ -1336,11 +1297,9 @@ dcd_int(sc, tp, new)
* Print out a ring or fifo overrun error message.
*/
static void
-scnoverrun(unit, ptime, what)
- int unit;
- long *ptime;
- const char *what;
+scnoverrun(int unit, long *ptime, const char *what)
{
+
if (*ptime != time.tv_sec) {
*ptime = time.tv_sec;
log(LOG_WARNING, "scn%d: %s overrun\n", unit, what);
@@ -1354,9 +1313,7 @@ scnoverrun(unit, ptime, what)
* be set or cleared according to the "stop" arg passed.
*/
int
-scnhwiflow(tp, stop)
- struct tty *tp;
- int stop;
+scnhwiflow(struct tty *tp, int stop)
{
int unit = DEV_UNIT(tp->t_dev);
struct scn_softc *sc = SOFTC(unit);
@@ -1373,8 +1330,7 @@ scnhwiflow(tp, stop)
}
static void
-scnintr(arg)
- void *arg;
+scnintr(void *arg)
{
struct duart *duart = arg;
struct scn_softc *sc0 = duart->chan[0].sc;
@@ -1515,8 +1471,7 @@ scn_rxintr(struct scn_softc *sc)
}
static void
-scnrxintr(arg)
- void *arg;
+scnrxintr(void *arg)
{
struct duart *duart = arg;
int work = 0;
@@ -1550,8 +1505,7 @@ scnrxintr(arg)
* -plb.
*/
static void
-scnsoft(arg)
- void *arg;
+scnsoft(void *arg)
{
int s, unit;
#ifdef SCN_TIMING
@@ -1663,21 +1617,15 @@ scnsoft(arg)
/* Convert TIOCM_xxx bits to output port bits. */
static unsigned char
-opbits(sc, tioc_bits)
- struct scn_softc *sc;
- int tioc_bits;
+opbits(struct scn_softc *sc, int tioc_bits)
{
+
return ((((tioc_bits) & TIOCM_DTR) ? sc->sc_op_dtr : 0) |
(((tioc_bits) & TIOCM_RTS) ? sc->sc_op_rts : 0));
}
int
-scnioctl(dev, cmd, data, flag, l)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct lwp *l;
+scnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
{
int unit = DEV_UNIT(dev);
struct scn_softc *sc = SOFTC(unit);
@@ -1812,9 +1760,7 @@ scnioctl(dev, cmd, data, flag, l)
}
int
-scnparam(tp, t)
- struct tty *tp;
- struct termios *t;
+scnparam(struct tty *tp, struct termios *t)
{
int cflag = t->c_cflag;
int unit = DEV_UNIT(tp->t_dev);
@@ -1884,8 +1830,7 @@ scnparam(tp, t)
}
void
-scnstart(tp)
- struct tty *tp;
+scnstart(struct tty *tp)
{
int s, c;
int unit = DEV_UNIT(tp->t_dev);
@@ -1922,9 +1867,7 @@ out:
*/
/*ARGSUSED*/
void
-scnstop(tp, flag)
- struct tty *tp;
- int flag;
+scnstop(struct tty *tp, int flag)
{
int s;
@@ -1952,41 +1895,41 @@ extern int _mapped;
(SCN_CONSDUART * 2 + SCN_CONSCHAN) * CH_SZ)
void
-scncnprobe(cp)
- struct consdev *cp;
+scncnprobe(struct consdev *cp)
{
+
/* initialize required fields */
cp->cn_dev = makedev(cdevsw_lookup_major(&scn_cdevsw), SCN_CONSOLE);
cp->cn_pri = CN_NORMAL;
}
void
-scncnreinit(v)
- void *v;
+scncnreinit(void *v)
{
volatile u_char *du_base = DUADDR();
- du_base[DU_OPSET] = SCN_CONSCHAN ? (OP_RTSB | OP_DTRB) : (OP_RTSA | OP_DTRA);
+ du_base[DU_OPSET] =
+ SCN_CONSCHAN ? (OP_RTSB | OP_DTRB) : (OP_RTSA | OP_DTRA);
}
void
-scncninit(cp)
- struct consdev *cp;
+scncninit(struct consdev *cp)
{
+
scninit(cp->cn_dev, scnconsrate);
}
/* Used by scncninit and kgdb startup. */
int
-scninit(dev, rate)
- dev_t dev;
- int rate;
+scninit(dev_t dev, int rate)
{
volatile u_char *du_base = DUADDR();
int unit = DEV_UNIT(dev);
- du_base[DU_OPSET] = SCN_CONSCHAN ? (OP_RTSB | OP_DTRB) : (OP_RTSA | OP_DTRA);
- scn_config(unit, SCN_CONSCHAN, rate, rate, MR1_PNONE | MR1_CS8, MR2_STOP1);
+ du_base[DU_OPSET] =
+ SCN_CONSCHAN ? (OP_RTSB | OP_DTRB) : (OP_RTSA | OP_DTRA);
+ scn_config(unit, SCN_CONSCHAN, rate, rate,
+ MR1_PNONE | MR1_CS8, MR2_STOP1);
return (0);
}
@@ -2012,10 +1955,9 @@ scncngetc(void *arg)
/* The pc532 does not turn off console polling. */
void
-scncnpollc(dev, on)
- dev_t dev;
- int on;
+scncnpollc(dev_t dev, int on)
{
+
}
/*
diff --git a/sys/arch/pc532/dev/scnvar.h b/sys/arch/pc532/dev/scnvar.h
index 9f18aa709f7..28416a1e474 100644
--- a/sys/arch/pc532/dev/scnvar.h
+++ b/sys/arch/pc532/dev/scnvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: scnvar.h,v 1.5 2005/12/11 12:18:31 christos Exp $ */
+/* $NetBSD: scnvar.h,v 1.6 2006/05/12 06:05:22 simonb Exp $ */
/*
* Copyright (c) 1996, 1997 Philip L. Budne.
@@ -45,7 +45,7 @@
#define SCN_SIZE 0x8 /* address space for port */
-#define SCN_CONSOLE 0 /* minor number of console */
+#define SCN_CONSOLE 0 /* minor number of console */
#define SCN_CONSDUART 0
#define SCN_CONSCHAN 0
@@ -53,8 +53,8 @@
#define SCN_CON_MAP_DATA 0xFFC80003 /* Mapped .... */
#define SCN_CON_MAP_ISR 0xFFC80005
-#define SCN_CON_STAT 0x28000001 /* raw addresses for console */
-#define SCN_CON_DATA 0x28000003 /* Unmapped .... */
+#define SCN_CON_STAT 0x28000001 /* raw addresses for console */
+#define SCN_CON_DATA 0x28000003 /* Unmapped .... */
#define SCN_CON_ISR 0x28000005
/* output port bits */
@@ -108,8 +108,8 @@ struct duart {
u_char new_mr2; /* held changes */
} chan[2];
enum scntype { SCNUNK, SCN2681, SCN2692, SC26C92 } type;
- u_int16_t counter; /* C/T generated bps, or zero */
- u_int16_t ocounter; /* last C/T generated bps, or zero */
+ uint16_t counter; /* C/T generated bps, or zero */
+ uint16_t ocounter; /* last C/T generated bps, or zero */
u_char mode; /* ACR[7] + MR0[2:0] */
u_char acr; /* ACR[6:0]*/
u_char imr; /* IMR bits */