Add USB revision strings and numbers.

This commit is contained in:
Nick Hibma 1999-11-28 20:46:29 +00:00
parent 052331f45b
commit 17d98133fb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53849
2 changed files with 41 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: usb.c,v 1.28 1999/10/13 08:10:57 augustss Exp $ */
/* $NetBSD: usb.c,v 1.33 1999/11/22 21:57:09 augustss Exp $ */
/* $FreeBSD$ */
/*
@ -94,6 +94,11 @@ extern int uhcidebug;
#ifdef OHCI_DEBUG
extern int ohcidebug;
#endif
/*
* 0 - do usual exploration
* 1 - do not use timeout exploration
* >1 - do no exploration
*/
int usb_noexplore = 0;
#else
#define DPRINTF(x)
@ -167,6 +172,8 @@ static int usb_get_next_event __P((struct usb_event *));
extern int cold;
#endif
static const char *usbrev_str[] = USBREV_STR;
USB_DECLARE_DRIVER(usb);
USB_MATCH(usb)
@ -182,25 +189,34 @@ USB_ATTACH(usb)
#elif defined(__FreeBSD__)
struct usb_softc *sc = device_get_softc(self);
void *aux = device_get_ivars(self);
static int global_init_done = 0;
#endif
usbd_device_handle dev;
usbd_status err;
static int global_init_done = 0;
int usbrev;
#if defined(__NetBSD__) || defined(__OpenBSD__)
printf("\n");
#elif defined(__FreeBSD__)
sc->sc_dev = self;
#endif
DPRINTF(("usbd_attach\n"));
usbd_init();
sc->sc_bus = aux;
sc->sc_bus->usbctl = sc;
sc->sc_port.power = USB_MAX_POWER;
#if defined(__FreeBSD__)
printf("%s", USBDEVNAME(sc->sc_dev));
#endif
usbrev = sc->sc_bus->usbrev;
printf(": USB revision %s", usbrev_str[usbrev]);
if (usbrev != USBREV_1_0 && usbrev != USBREV_1_1) {
printf(", not supported\n");
USB_ATTACH_ERROR_RETURN;
}
printf("\n");
err = usbd_new_device(USBDEV(sc->sc_dev), sc->sc_bus, 0, 0, 0,
&sc->sc_port);
if (!err) {
dev = sc->sc_port.device;
if (dev->hub == NULL) {
@ -231,9 +247,11 @@ USB_ATTACH(usb)
kthread_create(usb_create_event_thread, sc);
#if defined(__FreeBSD__)
/* The per controller devices (used for usb_discover) */
make_dev(&usb_cdevsw, device_get_unit(self), UID_ROOT, GID_OPERATOR,
0644, "usb%d", device_get_unit(self));
if (!global_init_done) {
/* The device spitting out events */
make_dev(&usb_cdevsw, USB_DEV_MINOR, UID_ROOT, GID_OPERATOR,
0644, "usb");
global_init_done = 1;
@ -268,11 +286,15 @@ usb_event_thread(arg)
while (!sc->sc_dying) {
#ifdef USB_DEBUG
if (!usb_noexplore)
if (usb_noexplore < 2)
#endif
usb_discover(sc);
(void)tsleep(&sc->sc_bus->needs_explore,
PWAIT, "usbevt", hz*60);
(void)tsleep(&sc->sc_bus->needs_explore, PWAIT, "usbevt",
#ifdef USB_DEBUG
usb_noexplore ? 0 :
#endif
hz*60
);
DPRINTFN(2,("usb_event_thread: woke up\n"));
}
sc->sc_event_thread = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbdivar.h,v 1.39 1999/11/10 04:19:59 mycroft Exp $ */
/* $NetBSD: usbdivar.h,v 1.41 1999/11/18 23:32:37 augustss Exp $ */
/* $FreeBSD$ */
/*
@ -101,6 +101,13 @@ struct usbd_bus {
struct usb_device_stats stats;
int intr_context;
u_int no_intrs;
int usbrev; /* USB revision */
#define USBREV_UNKNOWN 0
#define USBREV_PRE_1_0 1
#define USBREV_1_0 2
#define USBREV_1_1 3
#define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1" }
#if defined(__NetBSD__) || defined(__OpenBSD__)
bus_dma_tag_t dmatag; /* DMA tag */
#endif
@ -148,7 +155,7 @@ struct usbd_pipe {
SIMPLEQ_HEAD(, usbd_xfer) queue;
LIST_ENTRY(usbd_pipe) next;
usbd_xfer_handle intrxfer; /* used for repeating requests */
usbd_xfer_handle intrxfer; /* used for repeating requests */
char repeat;
/* Filled by HC driver. */