summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/gpib.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/i386/isa/gpib.c
parentaaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff)
downloadFreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip
FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
Diffstat (limited to 'sys/i386/isa/gpib.c')
-rw-r--r--sys/i386/isa/gpib.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c
index 1d0b1ac..76e11d9 100644
--- a/sys/i386/isa/gpib.c
+++ b/sys/i386/isa/gpib.c
@@ -33,6 +33,11 @@
#include "uio.h"
#include "kernel.h"
#include "malloc.h"
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -47,14 +52,6 @@
#define SLEEP_MAX 1000
#define SLEEP_MIN 4
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 44
-#endif /*JREMOD*/
int initgpib(void);
@@ -79,6 +76,17 @@ int gpattach();
struct isa_driver gpdriver = {gpprobe, gpattach, "gp"};
+static d_open_t gpopen;
+static d_close_t gpclose;
+static d_write_t gpwrite;
+static d_ioctl_t gpioctl;
+
+#define CDEV_MAJOR 44
+struct cdevsw gp_cdevsw =
+ { gpopen, gpclose, noread, gpwrite, /*44*/
+ gpioctl, nostop, nullreset, nodevtotty,/* GPIB */
+ seltrue, nommap, NULL, "gp", NULL, -1 };
+
#define BUFSIZE 1024
#define ATTACHED 0x08
#define OPEN 0x04
@@ -92,7 +100,10 @@ static struct gpib_softc {
u_char sc_flags; /* flags (open and internal) */
char sc_unit; /* gpib device number */
char *sc_inbuf; /* buffer for data */
-} gpib_sc;
+#ifdef DEVFS
+ void *devfs_token; /* handle for devfs entry */
+#endif
+} gpib_sc; /* only support one of these? */
static int oldcount;
static char oldbytes[2];
/*Probe routine*/
@@ -134,6 +145,10 @@ gpattach(isdp)
printf ("gp%d: type AT-GPIB chip NAT4882A\n",sc->sc_unit);
sc->sc_flags |=ATTACHED;
+#ifdef DEVFS
+ sc->devfs_token = devfs_add_devsw( "/", "gp", &gp_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
@@ -144,7 +159,7 @@ gpattach(isdp)
* More than 1 open is not allowed on the entire device.
* i.e. even if gpib5 is open, we can't open another minor device
*/
-int
+static int
gpopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -222,7 +237,7 @@ enableremote(unit);
* gpclose()
* Close gpib device.
*/
-int
+static int
gpclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -325,7 +340,7 @@ while (!(inb(ISR1)&2)&&(status==EWOULDBLOCK));
* Copy from user's buffer, then write to GPIB device referenced
* by minor(dev).
*/
-int
+static int
gpwrite(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
@@ -378,7 +393,7 @@ gpwrite(dev, uio, ioflag)
An exception would be a plotter or printer that you can just
write to using a minor device = its GPIB address */
-int
+static int
gpioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
struct gpibdata *gd = (struct gpibdata *)data;
@@ -1264,36 +1279,21 @@ outb(CDOR,95); /*untalk*/
}
-#ifdef JREMOD
-struct cdevsw gp_cdevsw =
- { gpopen, gpclose, noread, gpwrite, /*44*/
- gpioctl, nostop, nullreset, nodevtotty,/* GPIB */
- seltrue, nommap, NULL };
-
static gp_devsw_installed = 0;
-static void gp_drvinit(void *unused)
+static void
+gp_drvinit(void *unused)
{
dev_t dev;
if( ! gp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&gp_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&gp_cdevsw, NULL);
gp_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "gp", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(gpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gp_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NGPIB > 0 */
OpenPOWER on IntegriCloud