2 * Copyright 2012 Tilera Corporation. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
17 #include <gxio/common.h>
19 #include <hv/drv_usb_host_intf.h>
24 * An API for manipulating general-purpose I/O pins.
29 * The USB shim allows access to the processor's Universal Serial Bus
33 /* A context object used to manage USB hardware resources. */
36 /* File descriptor for calling up to the hypervisor. */
39 /* The VA at which our MMIO registers are mapped. */
41 } gxio_usb_host_context_t
;
43 /* Initialize a USB context.
45 * A properly initialized context must be obtained before any of the other
46 * gxio_usb_host routines may be used.
48 * @param context Pointer to a gxio_usb_host_context_t, which will be
49 * initialized by this routine, if it succeeds.
50 * @param usb_index Index of the USB shim to use.
51 * @param is_ehci Nonzero to use the EHCI interface; zero to use the OHCI
53 * @return Zero if the context was successfully initialized, else a
54 * GXIO_ERR_xxx error code.
56 extern int gxio_usb_host_init(gxio_usb_host_context_t
*context
, int usb_index
,
59 /* Destroy a USB context.
61 * Once destroyed, a context may not be used with any gxio_usb_host routines
62 * other than gxio_usb_host_init(). After this routine returns, no further
63 * interrupts or signals requested on this context will be delivered. The
64 * state and configuration of the pins which had been attached to this
65 * context are unchanged by this operation.
67 * @param context Pointer to a gxio_usb_host_context_t.
68 * @return Zero if the context was successfully destroyed, else a
69 * GXIO_ERR_xxx error code.
71 extern int gxio_usb_host_destroy(gxio_usb_host_context_t
*context
);
73 /* Retrieve the address of the shim's MMIO registers.
75 * @param context Pointer to a properly initialized gxio_usb_host_context_t.
76 * @return The address of the shim's MMIO registers.
78 extern void *gxio_usb_host_get_reg_start(gxio_usb_host_context_t
*context
);
80 /* Retrieve the length of the shim's MMIO registers.
82 * @param context Pointer to a properly initialized gxio_usb_host_context_t.
83 * @return The length of the shim's MMIO registers.
85 extern size_t gxio_usb_host_get_reg_len(gxio_usb_host_context_t
*context
);
87 #endif /* _GXIO_USB_H_ */