summaryrefslogtreecommitdiffstats
path: root/sys/dev/ieee488
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ieee488')
-rw-r--r--sys/dev/ieee488/upd7210.c24
-rw-r--r--sys/dev/ieee488/upd7210.h2
2 files changed, 21 insertions, 5 deletions
diff --git a/sys/dev/ieee488/upd7210.c b/sys/dev/ieee488/upd7210.c
index e4b50ac..69b8c0b 100644
--- a/sys/dev/ieee488/upd7210.c
+++ b/sys/dev/ieee488/upd7210.c
@@ -81,6 +81,7 @@ upd7210_rd(struct upd7210 *u, enum upd7210_rreg reg)
void
upd7210_wr(struct upd7210 *u, enum upd7210_wreg reg, u_int val)
{
+
bus_space_write_1(
u->reg_tag[reg],
u->reg_handle[reg],
@@ -271,21 +272,34 @@ static struct cdevsw gpib_l_cdevsw = {
/* Housekeeping */
+static struct unrhdr *units;
+
void
upd7210attach(struct upd7210 *u)
{
- int unit = 0;
struct cdev *dev;
+ if (units == NULL)
+ units = new_unrhdr(0, minor2unit(MAXMINOR), NULL);
+ u->unit = alloc_unr(units);
mtx_init(&u->mutex, "gpib", NULL, MTX_DEF);
- u->cdev = make_dev(&gpib_l_cdevsw, unit,
+ u->cdev = make_dev(&gpib_l_cdevsw, u->unit,
UID_ROOT, GID_WHEEL, 0444,
- "gpib%ul", unit);
+ "gpib%ul", u->unit);
u->cdev->si_drv1 = u;
- dev = make_dev(&gpib_ib_cdevsw, unit,
+ dev = make_dev(&gpib_ib_cdevsw, u->unit,
UID_ROOT, GID_WHEEL, 0444,
- "gpib%uib", unit);
+ "gpib%uib", u->unit);
dev->si_drv1 = u;
dev_depends(u->cdev, dev);
}
+
+void
+upd7210detach(struct upd7210 *u)
+{
+
+ destroy_dev(u->cdev);
+ mtx_destroy(&u->mutex);
+ free_unr(units, u->unit);
+}
diff --git a/sys/dev/ieee488/upd7210.h b/sys/dev/ieee488/upd7210.h
index b50fddb..7c18b7e 100644
--- a/sys/dev/ieee488/upd7210.h
+++ b/sys/dev/ieee488/upd7210.h
@@ -51,6 +51,7 @@ struct upd7210 {
bus_space_tag_t reg_tag[8];
u_int reg_offset[8];
int dmachan;
+ int unit;
/* private stuff */
struct mtx mutex;
@@ -72,6 +73,7 @@ struct upd7210 {
#ifdef UPD7210_HW_DRIVER
void upd7210intr(void *);
void upd7210attach(struct upd7210 *);
+void upd7210detach(struct upd7210 *);
#endif
#ifdef UPD7210_SW_DRIVER
OpenPOWER on IntegriCloud