diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/makemap.awk | 10 | ||||
-rw-r--r-- | sys/dev/usb/ukbdmap.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/usb.h | 6 | ||||
-rw-r--r-- | sys/dev/usb/usb_port.h | 143 |
4 files changed, 147 insertions, 15 deletions
diff --git a/sys/dev/usb/makemap.awk b/sys/dev/usb/makemap.awk index 2336aea35d3..6b0900fa8c1 100644 --- a/sys/dev/usb/makemap.awk +++ b/sys/dev/usb/makemap.awk @@ -1,5 +1,5 @@ #! /usr/bin/awk -f -# $OpenBSD: makemap.awk,v 1.6 2005/05/23 21:33:03 miod Exp $ +# $OpenBSD: makemap.awk,v 1.7 2007/06/17 07:53:11 mbalmer Exp $ # # Copyright (c) 2005, Miodrag Vallat # @@ -31,7 +31,7 @@ # BEGIN { - rcsid = "$OpenBSD: makemap.awk,v 1.6 2005/05/23 21:33:03 miod Exp $" + rcsid = "$OpenBSD: makemap.awk,v 1.7 2007/06/17 07:53:11 mbalmer Exp $" ifdepth = 0 ignore = 0 declk = 0 @@ -205,10 +205,8 @@ $1 == "#include" { if (ignore) next if ($2 == "<dev/pckbc/wskbdmap_mfii.h>") - print "#include <dev/usb/usb_port.h>" - else - printf("#include %s\n", $2) - + next + printf("#include %s\n", $2) next } $1 == "#define" || $1 == "#undef" { diff --git a/sys/dev/usb/ukbdmap.c b/sys/dev/usb/ukbdmap.c index d4b62f44de8..78064e79dfe 100644 --- a/sys/dev/usb/ukbdmap.c +++ b/sys/dev/usb/ukbdmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukbdmap.c,v 1.26 2006/12/05 21:28:42 otto Exp $ */ +/* $OpenBSD: ukbdmap.c,v 1.27 2007/06/17 07:53:11 mbalmer Exp $ */ /* * THIS FILE IS AUTOMAGICALLY GENERATED. DO NOT EDIT. @@ -56,7 +56,6 @@ #include <sys/types.h> #include <dev/wscons/wsksymdef.h> #include <dev/wscons/wsksymvar.h> -#include <dev/usb/usb_port.h> #define KC(n) KS_KEYCODE(n) diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 7524faa067d..ac1c866d202 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.h,v 1.27 2007/06/09 11:06:53 mbalmer Exp $ */ +/* $OpenBSD: usb.h,v 1.28 2007/06/17 07:53:11 mbalmer Exp $ */ /* $NetBSD: usb.h,v 1.69 2002/09/22 23:20:50 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ @@ -48,10 +48,6 @@ #include <sys/ioctl.h> -#if defined(_KERNEL) -#include <dev/usb/usb_port.h> -#endif /* _KERNEL */ - #define USB_STACK_VERSION 2 #define USB_MAX_DEVICES 128 diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 32d28bff049..eb02e01aa0b 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_port.h,v 1.95 2007/06/15 11:41:48 mbalmer Exp $ */ +/* $OpenBSD: usb_port.h,v 1.96 2007/06/17 07:53:11 mbalmer Exp $ */ /* $NetBSD: usb_port.h,v 1.62 2003/02/15 18:33:30 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -43,7 +43,146 @@ #define _USB_PORT_H /* - * Macro's to cope with the differences between operating systems. + * Macros to ease the import of USB drivers from other operating systems, e.g. + * NetBSD or FreeBSD. */ +#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS +#define USB_USE_SOFTINTR +#else +#undef USB_USE_SOFTINTR +#endif + +#define Static + +#define UMASS_ATAPISTR "atapiscsi" + +/* periph_quirks */ +#define PQUIRK_NOSENSE ADEV_NOSENSE /* can't REQUEST SENSE */ +#define PQUIRK_ONLYBIG SDEV_ONLYBIG + +#define sel_klist si_note + +typedef struct proc *usb_proc_ptr; + +#define UCOMBUSCF_PORTNO 0 +#define UCOMBUSCF_PORTNO_DEFAULT -1 +#define UHIDBUSCF_REPORTID 0 +#define UHIDBUSCF_REPORTID_DEFAULT -1 + +#define mstohz(ms) ((ms) * hz / 1000) + +#define sel_klist si_note + +typedef int usb_malloc_type; + +#define if_deactivate(x) +#define IF_INPUT(ifp, m) ether_input_mbuf((ifp), (m)) + +#define swap_bytes_change_sign16_le swap_bytes_change_sign16 +#define change_sign16_swap_bytes_le change_sign16_swap_bytes +#define change_sign16_le change_sign16 + +#define ulinear8_to_slinear16_le ulinear8_to_linear16_le +#define ulinear8_to_slinear16_be ulinear8_to_linear16_be +#define slinear16_to_ulinear8_le linear16_to_ulinear8_le +#define slinear16_to_ulinear8_be linear16_to_ulinear8_be + +typedef struct device *device_ptr_t; +#define USBBASEDEVICE struct device +#define USBDEV(bdev) (&(bdev)) +#define USBDEVNAME(bdev) ((bdev).dv_xname) +#define USBDEVUNIT(bdev) ((bdev).dv_unit) +#define USBDEVPTRNAME(bdevptr) ((bdevptr)->dv_xname) +#define USBGETSOFTC(d) ((void *)(d)) + +#define DECLARE_USB_DMA_T \ + struct usb_dma_block; \ + typedef struct { \ + struct usb_dma_block *block; \ + u_int offs; \ + } usb_dma_t + +typedef struct timeout usb_callout_t; +#define usb_callout_init(h) timeout_set(&(h), NULL, NULL) +#define usb_callout(h, t, f, d) \ + do { \ + timeout_del(&(h)); \ + timeout_set(&(h), (f), (d)); \ + timeout_add(&(h), (t)); \ + } while (0) +#define usb_callout_pending(h) timeout_pending(&(h)) +#define usb_uncallout(h, f, d) timeout_del(&(h)) + +#define USB_DECLARE_DRIVER_CLASS(dname, devclass) \ +int __CONCAT(dname,_match)(struct device *, void *, void *); \ +void __CONCAT(dname,_attach)(struct device *, struct device *, void *); \ +int __CONCAT(dname,_detach)(struct device *, int); \ +int __CONCAT(dname,_activate)(struct device *, enum devact); \ +\ +struct cfdriver __CONCAT(dname,_cd) = { \ + NULL, #dname, devclass \ +}; \ +\ +const struct cfattach __CONCAT(dname,_ca) = { \ + sizeof(struct __CONCAT(dname,_softc)), \ + __CONCAT(dname,_match), \ + __CONCAT(dname,_attach), \ + __CONCAT(dname,_detach), \ + __CONCAT(dname,_activate), \ +} + +#define USB_DECLARE_DRIVER(dname) USB_DECLARE_DRIVER_CLASS(dname, DV_DULL) + +#define USB_MATCH(dname) \ +int \ +__CONCAT(dname,_match)(parent, match, aux) \ + struct device *parent; \ + void *match; \ + void *aux; + +#define USB_MATCH_START(dname, uaa) \ + struct usb_attach_arg *uaa = aux + +#define USB_ATTACH(dname) \ +void \ +__CONCAT(dname,_attach)(parent, self, aux) \ + struct device *parent; \ + struct device *self; \ + void *aux; + +#define USB_ATTACH_START(dname, sc, uaa) \ + struct __CONCAT(dname,_softc) *sc = \ + (struct __CONCAT(dname,_softc) *)self; \ + struct usb_attach_arg *uaa = aux + +/* Returns from attach */ +#define USB_ATTACH_ERROR_RETURN return +#define USB_ATTACH_SUCCESS_RETURN return + +#define USB_ATTACH_SETUP printf("\n") + +#define USB_DETACH(dname) \ +int \ +__CONCAT(dname,_detach)(self, flags) \ + struct device *self; \ + int flags; + +#define USB_DETACH_START(dname, sc) \ + struct __CONCAT(dname,_softc) *sc = \ + (struct __CONCAT(dname,_softc) *)self + +#define USB_GET_SC_OPEN(dname, unit, sc) \ + if (unit >= __CONCAT(dname,_cd).cd_ndevs) \ + return (ENXIO); \ + sc = __CONCAT(dname,_cd).cd_devs[unit]; \ + if (sc == NULL) \ + return (ENXIO) + +#define USB_GET_SC(dname, unit, sc) \ + sc = __CONCAT(dname,_cd).cd_devs[unit] + +#define USB_DO_ATTACH(dev, bdev, parent, args, print, sub) \ + (config_found_sm(parent, args, print, sub)) + #endif /* _USB_PORT_H */ |