MFp4 //depot/projects/usb @159431,159437,159438

- start using the new USB typedefs in the USB core
- Remove usage of USB_ADD_BYTES()

Submitted by:	Hans Petter Selasky
This commit is contained in:
Andrew Thompson 2009-03-20 21:50:54 +00:00
parent bdc081c60f
commit 578d0eff90
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190181
35 changed files with 291 additions and 285 deletions

View File

@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
#define AT9100_DCI_BUS2SC(bus) \
((struct at91dci_softc *)(((uint8_t *)(bus)) - \
USB_P2U(&(((struct at91dci_softc *)0)->sc_bus))))
((uint8_t *)&(((struct at91dci_softc *)0)->sc_bus))))
#define AT9100_DCI_PC2SC(pc) \
AT9100_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)

View File

@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
#define ATMEGA_BUS2SC(bus) \
((struct atmegadci_softc *)(((uint8_t *)(bus)) - \
USB_P2U(&(((struct atmegadci_softc *)0)->sc_bus))))
((uint8_t *)&(((struct atmegadci_softc *)0)->sc_bus))))
#define ATMEGA_PC2SC(pc) \
ATMEGA_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)

View File

@ -66,8 +66,9 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/ehci.h>
#define EHCI_BUS2SC(bus) ((ehci_softc_t *)(((uint8_t *)(bus)) - \
USB_P2U(&(((ehci_softc_t *)0)->sc_bus))))
#define EHCI_BUS2SC(bus) \
((ehci_softc_t *)(((uint8_t *)(bus)) - \
((uint8_t *)&(((ehci_softc_t *)0)->sc_bus))))
#if USB_DEBUG
static int ehcidebug = 0;
@ -1729,7 +1730,7 @@ ehci_setup_standard_chain(struct usb2_xfer *xfer, ehci_qh_t **qh_last)
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.average = xfer->max_usb2_frame_size;
temp.average = xfer->max_hc_frame_size;
temp.max_frame_size = xfer->max_frame_size;
temp.sc = EHCI_BUS2SC(xfer->xroot->bus);
@ -3563,7 +3564,7 @@ ehci_xfer_setup(struct usb2_setup_params *parm)
nqh = 1;
nqtd = ((2 * xfer->nframes) + 1 /* STATUS */
+ (xfer->max_data_length / xfer->max_usb2_frame_size));
+ (xfer->max_data_length / xfer->max_hc_frame_size));
} else if (parm->methods == &ehci_device_bulk_methods) {
@ -3576,7 +3577,7 @@ ehci_xfer_setup(struct usb2_setup_params *parm)
nqh = 1;
nqtd = ((2 * xfer->nframes)
+ (xfer->max_data_length / xfer->max_usb2_frame_size));
+ (xfer->max_data_length / xfer->max_hc_frame_size));
} else if (parm->methods == &ehci_device_intr_methods) {
@ -3598,7 +3599,7 @@ ehci_xfer_setup(struct usb2_setup_params *parm)
nqh = 1;
nqtd = ((2 * xfer->nframes)
+ (xfer->max_data_length / xfer->max_usb2_frame_size));
+ (xfer->max_data_length / xfer->max_hc_frame_size));
} else if (parm->methods == &ehci_device_isoc_fs_methods) {

View File

@ -55,8 +55,9 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/ohci.h>
#define OHCI_BUS2SC(bus) ((ohci_softc_t *)(((uint8_t *)(bus)) - \
USB_P2U(&(((ohci_softc_t *)0)->sc_bus))))
#define OHCI_BUS2SC(bus) \
((ohci_softc_t *)(((uint8_t *)(bus)) - \
((uint8_t *)&(((ohci_softc_t *)0)->sc_bus))))
#if USB_DEBUG
static int ohcidebug = 0;
@ -1410,7 +1411,7 @@ ohci_setup_standard_chain(struct usb2_xfer *xfer, ohci_ed_t **ed_last)
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.average = xfer->max_usb2_frame_size;
temp.average = xfer->max_hc_frame_size;
temp.max_frame_size = xfer->max_frame_size;
/* toggle the DMA set we are using */
@ -2528,7 +2529,7 @@ ohci_xfer_setup(struct usb2_setup_params *parm)
nitd = 0;
ntd = ((2 * xfer->nframes) + 1 /* STATUS */
+ (xfer->max_data_length / xfer->max_usb2_frame_size));
+ (xfer->max_data_length / xfer->max_hc_frame_size));
nqh = 1;
} else if (parm->methods == &ohci_device_bulk_methods) {
@ -2538,7 +2539,7 @@ ohci_xfer_setup(struct usb2_setup_params *parm)
nitd = 0;
ntd = ((2 * xfer->nframes)
+ (xfer->max_data_length / xfer->max_usb2_frame_size));
+ (xfer->max_data_length / xfer->max_hc_frame_size));
nqh = 1;
} else if (parm->methods == &ohci_device_intr_methods) {
@ -2548,7 +2549,7 @@ ohci_xfer_setup(struct usb2_setup_params *parm)
nitd = 0;
ntd = ((2 * xfer->nframes)
+ (xfer->max_data_length / xfer->max_usb2_frame_size));
+ (xfer->max_data_length / xfer->max_hc_frame_size));
nqh = 1;
} else if (parm->methods == &ohci_device_isoc_methods) {

View File

@ -59,8 +59,9 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/controller/uhci.h>
#define alt_next next
#define UHCI_BUS2SC(bus) ((uhci_softc_t *)(((uint8_t *)(bus)) - \
USB_P2U(&(((uhci_softc_t *)0)->sc_bus))))
#define UHCI_BUS2SC(bus) \
((uhci_softc_t *)(((uint8_t *)(bus)) - \
((uint8_t *)&(((uhci_softc_t *)0)->sc_bus))))
#if USB_DEBUG
static int uhcidebug = 0;

View File

@ -55,7 +55,7 @@
#define USS820_DCI_BUS2SC(bus) \
((struct uss820dci_softc *)(((uint8_t *)(bus)) - \
USB_P2U(&(((struct uss820dci_softc *)0)->sc_bus))))
((uint8_t *)&(((struct uss820dci_softc *)0)->sc_bus))))
#define USS820_DCI_PC2SC(pc) \
USS820_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)

View File

@ -59,8 +59,11 @@ SYSCTL_INT(_hw_usb2_ustorage_fs, OID_AUTO, debug, CTLFLAG_RW,
/* Define some limits */
#define USTORAGE_FS_BULK_SIZE (1UL << 17)
#define USTORAGE_FS_MAX_LUN 8
#ifndef USTORAGE_FS_BULK_SIZE
#define USTORAGE_FS_BULK_SIZE (1UL << 17) /* bytes */
#endif
#define USTORAGE_FS_MAX_LUN 8 /* units */
/*
* The SCSI ID string must be exactly 28 characters long
@ -136,7 +139,7 @@ typedef struct {
struct ustorage_fs_lun {
void *memory_image;
uint8_t *memory_image;
uint32_t num_sectors;
uint32_t sense_data;
@ -1370,8 +1373,7 @@ ustorage_fs_read(struct ustorage_fs_softc *sc)
file_offset = lba;
file_offset <<= 9;
sc->sc_transfer.data_ptr =
USB_ADD_BYTES(currlun->memory_image, (uint32_t)file_offset);
sc->sc_transfer.data_ptr = currlun->memory_image + file_offset;
return (0);
}
@ -1435,8 +1437,7 @@ ustorage_fs_write(struct ustorage_fs_softc *sc)
file_offset = lba;
file_offset <<= 9;
sc->sc_transfer.data_ptr =
USB_ADD_BYTES(currlun->memory_image, (uint32_t)file_offset);
sc->sc_transfer.data_ptr = currlun->memory_image + file_offset;
return (0);
}

View File

@ -81,9 +81,9 @@ struct usb2_bus {
struct usb2_bus_methods *methods; /* filled by HC driver */
struct usb2_device **devices;
uint32_t hw_power_state; /* see USB_HW_POWER_XXX */
uint32_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
uint32_t transfer_count[4];
usb2_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */
usb2_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
uint16_t isoc_time_last; /* in milliseconds */
uint8_t alloc_failed; /* Set if memory allocation failed. */

View File

@ -42,7 +42,7 @@
#include <dev/usb/usb_bus.h>
#if USB_HAVE_BUSDMA
static void usb2_dma_tag_create(struct usb2_dma_tag *, uint32_t, uint32_t);
static void usb2_dma_tag_create(struct usb2_dma_tag *, usb2_size_t, usb2_size_t);
static void usb2_dma_tag_destroy(struct usb2_dma_tag *);
#endif
@ -66,7 +66,7 @@ static void usb2_pc_common_mem_cb(struct usb2_page_cache *,
* been properly initialized !
*------------------------------------------------------------------------*/
void
usb2_get_page(struct usb2_page_cache *pc, uint32_t offset,
usb2_get_page(struct usb2_page_cache *pc, usb2_frlength_t offset,
struct usb2_page_search *res)
{
struct usb2_page *page;
@ -122,8 +122,8 @@ usb2_get_page(struct usb2_page_cache *pc, uint32_t offset,
* usb2_copy_in - copy directly to DMA-able memory
*------------------------------------------------------------------------*/
void
usb2_copy_in(struct usb2_page_cache *cache, uint32_t offset,
const void *ptr, uint32_t len)
usb2_copy_in(struct usb2_page_cache *cache, usb2_frlength_t offset,
const void *ptr, usb2_frlength_t len)
{
struct usb2_page_search buf_res;
@ -151,8 +151,8 @@ usb2_copy_in(struct usb2_page_cache *cache, uint32_t offset,
*------------------------------------------------------------------------*/
#if USB_HAVE_USER_IO
int
usb2_copy_in_user(struct usb2_page_cache *cache, uint32_t offset,
const void *ptr, uint32_t len)
usb2_copy_in_user(struct usb2_page_cache *cache, usb2_frlength_t offset,
const void *ptr, usb2_frlength_t len)
{
struct usb2_page_search buf_res;
int error;
@ -182,10 +182,10 @@ usb2_copy_in_user(struct usb2_page_cache *cache, uint32_t offset,
#if USB_HAVE_MBUF
struct usb2_m_copy_in_arg {
struct usb2_page_cache *cache;
uint32_t dst_offset;
usb2_frlength_t dst_offset;
};
static int32_t
static int
#ifdef __FreeBSD__
usb2_m_copy_in_cb(void *arg, void *src, uint32_t count)
#else
@ -200,11 +200,11 @@ usb2_m_copy_in_cb(void *arg, caddr_t src, uint32_t count)
}
void
usb2_m_copy_in(struct usb2_page_cache *cache, uint32_t dst_offset,
struct mbuf *m, uint32_t src_offset, uint32_t src_len)
usb2_m_copy_in(struct usb2_page_cache *cache, usb2_frlength_t dst_offset,
struct mbuf *m, usb2_size_t src_offset, usb2_frlength_t src_len)
{
struct usb2_m_copy_in_arg arg = {cache, dst_offset};
register int error;
int error;
error = m_apply(m, src_offset, src_len, &usb2_m_copy_in_cb, &arg);
}
@ -216,7 +216,7 @@ usb2_m_copy_in(struct usb2_page_cache *cache, uint32_t dst_offset,
#if USB_HAVE_USER_IO
int
usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio,
uint32_t pc_offset, uint32_t len)
usb2_frlength_t pc_offset, usb2_frlength_t len)
{
struct usb2_page_search res;
int error = 0;
@ -248,8 +248,8 @@ usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio,
* usb2_copy_out - copy directly from DMA-able memory
*------------------------------------------------------------------------*/
void
usb2_copy_out(struct usb2_page_cache *cache, uint32_t offset,
void *ptr, uint32_t len)
usb2_copy_out(struct usb2_page_cache *cache, usb2_frlength_t offset,
void *ptr, usb2_frlength_t len)
{
struct usb2_page_search res;
@ -277,8 +277,8 @@ usb2_copy_out(struct usb2_page_cache *cache, uint32_t offset,
*------------------------------------------------------------------------*/
#if USB_HAVE_USER_IO
int
usb2_copy_out_user(struct usb2_page_cache *cache, uint32_t offset,
void *ptr, uint32_t len)
usb2_copy_out_user(struct usb2_page_cache *cache, usb2_frlength_t offset,
void *ptr, usb2_frlength_t len)
{
struct usb2_page_search res;
int error;
@ -306,7 +306,8 @@ usb2_copy_out_user(struct usb2_page_cache *cache, uint32_t offset,
* usb2_bzero - zero DMA-able memory
*------------------------------------------------------------------------*/
void
usb2_bzero(struct usb2_page_cache *cache, uint32_t offset, uint32_t len)
usb2_bzero(struct usb2_page_cache *cache, usb2_frlength_t offset,
usb2_frlength_t len)
{
struct usb2_page_search res;
@ -343,7 +344,7 @@ usb2_dma_lock_cb(void *arg, bus_dma_lock_op_t op)
*------------------------------------------------------------------------*/
static void
usb2_dma_tag_create(struct usb2_dma_tag *udt,
uint32_t size, uint32_t align)
usb2_size_t size, usb2_size_t align)
{
bus_dma_tag_t tag;
@ -408,7 +409,7 @@ usb2_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs,
struct usb2_dma_parent_tag *uptag;
struct usb2_page_cache *pc;
struct usb2_page *pg;
uint32_t rem;
usb2_size_t rem;
uint8_t owned;
pc = arg;
@ -471,7 +472,7 @@ usb2_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs,
*------------------------------------------------------------------------*/
uint8_t
usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg,
uint32_t size, uint32_t align)
usb2_size_t size, usb2_size_t align)
{
struct usb2_dma_parent_tag *uptag;
struct usb2_dma_tag *utag;
@ -594,7 +595,7 @@ usb2_pc_free_mem(struct usb2_page_cache *pc)
* Else: Error
*------------------------------------------------------------------------*/
uint8_t
usb2_pc_load_mem(struct usb2_page_cache *pc, uint32_t size, uint8_t sync)
usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync)
{
/* setup page cache */
pc->page_offset_buf = 0;
@ -695,7 +696,7 @@ usb2_pc_cpu_flush(struct usb2_page_cache *pc)
* Else: Failure
*------------------------------------------------------------------------*/
uint8_t
usb2_pc_dmamap_create(struct usb2_page_cache *pc, uint32_t size)
usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size)
{
struct usb2_xfer_root *info;
struct usb2_dma_tag *utag;
@ -751,9 +752,9 @@ usb2_pc_dmamap_destroy(struct usb2_page_cache *pc)
*------------------------------------------------------------------------*/
static void
usb2_dma_tag_create(struct usb2_dma_tag *udt,
uint32_t size, uint32_t align)
usb2_size_t size, usb2_size_t align)
{
uint32_t nseg;
usb2_size_t nseg;
if (align == 1) {
nseg = (2 + (size / USB_PAGE_SIZE));
@ -789,7 +790,7 @@ usb2_pc_common_mem_cb(struct usb2_page_cache *pc, bus_dma_segment_t *segs,
{
struct usb2_dma_parent_tag *uptag;
struct usb2_page *pg;
uint32_t rem;
usb2_size_t rem;
uint8_t ext_seg; /* extend last segment */
uptag = pc->tag_parent;
@ -855,7 +856,7 @@ usb2_pc_common_mem_cb(struct usb2_page_cache *pc, bus_dma_segment_t *segs,
*------------------------------------------------------------------------*/
uint8_t
usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg,
uint32_t size, uint32_t align)
usb2_size_t size, usb2_size_t align)
{
struct usb2_dma_parent_tag *uptag;
struct usb2_dma_tag *utag;
@ -978,7 +979,7 @@ usb2_pc_free_mem(struct usb2_page_cache *pc)
* Else: Error
*------------------------------------------------------------------------*/
uint8_t
usb2_pc_load_mem(struct usb2_page_cache *pc, uint32_t size, uint8_t sync)
usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync)
{
int error;
@ -1028,7 +1029,7 @@ usb2_pc_load_mem(struct usb2_page_cache *pc, uint32_t size, uint8_t sync)
void
usb2_pc_cpu_invalidate(struct usb2_page_cache *pc)
{
uint32_t len;
usb2_size_t len;
len = pc->page_offset_end - pc->page_offset_buf;
@ -1046,7 +1047,7 @@ usb2_pc_cpu_invalidate(struct usb2_page_cache *pc)
void
usb2_pc_cpu_flush(struct usb2_page_cache *pc)
{
uint32_t len;
usb2_size_t len;
len = pc->page_offset_end - pc->page_offset_buf;
@ -1066,7 +1067,7 @@ usb2_pc_cpu_flush(struct usb2_page_cache *pc)
* Else: Failure
*------------------------------------------------------------------------*/
uint8_t
usb2_pc_dmamap_create(struct usb2_page_cache *pc, uint32_t size)
usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size)
{
struct usb2_xfer_root *info;
struct usb2_dma_tag *utag;
@ -1123,7 +1124,7 @@ usb2_pc_dmamap_destroy(struct usb2_page_cache *pc)
*------------------------------------------------------------------------*/
struct usb2_dma_tag *
usb2_dma_tag_find(struct usb2_dma_parent_tag *udpt,
uint32_t size, uint32_t align)
usb2_size_t size, usb2_size_t align)
{
struct usb2_dma_tag *udt;
uint8_t nudt;
@ -1232,7 +1233,7 @@ usb2_bdma_work_loop(struct usb2_xfer_queue *pq)
{
struct usb2_xfer_root *info;
struct usb2_xfer *xfer;
uint32_t nframes;
usb2_frcount_t nframes;
xfer = pq->curr;
info = xfer->xroot;
@ -1248,7 +1249,7 @@ usb2_bdma_work_loop(struct usb2_xfer_queue *pq)
}
if (!xfer->flags_int.bdma_setup) {
struct usb2_page *pg;
uint32_t frlength_0;
usb2_frlength_t frlength_0;
uint8_t isread;
xfer->flags_int.bdma_setup = 1;
@ -1381,7 +1382,7 @@ void
usb2_bdma_pre_sync(struct usb2_xfer *xfer)
{
struct usb2_page_cache *pc;
uint32_t nframes;
usb2_frcount_t nframes;
if (xfer->flags_int.isochronous_xfr) {
/* only one frame buffer */
@ -1414,7 +1415,7 @@ void
usb2_bdma_post_sync(struct usb2_xfer *xfer)
{
struct usb2_page_cache *pc;
uint32_t nframes;
usb2_frcount_t nframes;
if (xfer->flags_int.isochronous_xfr) {
/* only one frame buffer */

View File

@ -76,7 +76,7 @@ struct usb2_page_search {
#if USB_HAVE_BUSDMA
bus_size_t physaddr;
#endif
uint32_t length;
usb2_size_t length;
};
/*
@ -103,8 +103,8 @@ struct usb2_page_cache {
int n_seg;
#endif
#if USB_HAVE_BUSDMA
uint32_t page_offset_buf;
uint32_t page_offset_end;
usb2_size_t page_offset_buf;
usb2_size_t page_offset_end;
uint8_t isread:1; /* set if we are currently reading
* from the memory. Else write. */
uint8_t ismultiseg:1; /* set if we can have multiple
@ -142,47 +142,47 @@ struct usb2_dma_tag {
struct usb2_dma_parent_tag *tag_parent;
bus_dma_tag_t tag;
uint32_t align;
uint32_t size;
usb2_size_t align;
usb2_size_t size;
#endif
#if USB_HAVE_BUSDMA && defined(__NetBSD__)
uint32_t n_seg;
usb2_size_t n_seg;
#endif
};
/* function prototypes */
int usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio,
uint32_t pc_offset, uint32_t len);
usb2_frlength_t pc_offset, usb2_frlength_t len);
struct usb2_dma_tag *usb2_dma_tag_find(struct usb2_dma_parent_tag *udpt,
uint32_t size, uint32_t align);
usb2_size_t size, usb2_size_t align);
uint8_t usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg,
uint32_t size, uint32_t align);
uint8_t usb2_pc_dmamap_create(struct usb2_page_cache *pc, uint32_t size);
uint8_t usb2_pc_load_mem(struct usb2_page_cache *pc, uint32_t size,
usb2_size_t size, usb2_size_t align);
uint8_t usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size);
uint8_t usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size,
uint8_t sync);
void usb2_bdma_done_event(struct usb2_dma_parent_tag *udpt);
void usb2_bdma_post_sync(struct usb2_xfer *xfer);
void usb2_bdma_pre_sync(struct usb2_xfer *xfer);
void usb2_bdma_work_loop(struct usb2_xfer_queue *pq);
void usb2_bzero(struct usb2_page_cache *cache, uint32_t offset,
uint32_t len);
void usb2_copy_in(struct usb2_page_cache *cache, uint32_t offset,
const void *ptr, uint32_t len);
int usb2_copy_in_user(struct usb2_page_cache *cache, uint32_t offset,
const void *ptr, uint32_t len);
void usb2_copy_out(struct usb2_page_cache *cache, uint32_t offset,
void *ptr, uint32_t len);
int usb2_copy_out_user(struct usb2_page_cache *cache, uint32_t offset,
void *ptr, uint32_t len);
void usb2_bzero(struct usb2_page_cache *cache, usb2_frlength_t offset,
usb2_frlength_t len);
void usb2_copy_in(struct usb2_page_cache *cache, usb2_frlength_t offset,
const void *ptr, usb2_frlength_t len);
int usb2_copy_in_user(struct usb2_page_cache *cache, usb2_frlength_t offset,
const void *ptr, usb2_frlength_t len);
void usb2_copy_out(struct usb2_page_cache *cache, usb2_frlength_t offset,
void *ptr, usb2_frlength_t len);
int usb2_copy_out_user(struct usb2_page_cache *cache, usb2_frlength_t offset,
void *ptr, usb2_frlength_t len);
void usb2_dma_tag_setup(struct usb2_dma_parent_tag *udpt,
struct usb2_dma_tag *udt, bus_dma_tag_t dmat, struct mtx *mtx,
usb2_dma_callback_t *func, uint8_t ndmabits, uint8_t nudt);
void usb2_dma_tag_unsetup(struct usb2_dma_parent_tag *udpt);
void usb2_get_page(struct usb2_page_cache *pc, uint32_t offset,
void usb2_get_page(struct usb2_page_cache *pc, usb2_frlength_t offset,
struct usb2_page_search *res);
void usb2_m_copy_in(struct usb2_page_cache *cache, uint32_t dst_offset,
struct mbuf *m, uint32_t src_offset, uint32_t src_len);
void usb2_m_copy_in(struct usb2_page_cache *cache, usb2_frlength_t dst_offset,
struct mbuf *m, usb2_size_t src_offset, usb2_frlength_t src_len);
void usb2_pc_cpu_flush(struct usb2_page_cache *pc);
void usb2_pc_cpu_invalidate(struct usb2_page_cache *pc);
void usb2_pc_dmamap_destroy(struct usb2_page_cache *pc);

View File

@ -67,7 +67,7 @@ static usb2_callback_t usb_linux_non_isoc_callback;
static usb_complete_t usb_linux_wait_complete;
static uint16_t usb_max_isoc_frames(struct usb_device *);
static int usb_start_wait_urb(struct urb *, uint32_t, uint16_t *);
static int usb_start_wait_urb(struct urb *, usb2_timeout_t, uint16_t *);
static const struct usb_device_id *usb_linux_lookup_id(
const struct usb_device_id *, struct usb2_attach_arg *);
static struct usb_driver *usb_linux_get_usb_driver(struct usb_linux_softc *);
@ -564,7 +564,7 @@ usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe)
* Linux USB transfers.
*------------------------------------------------------------------------*/
static int
usb_start_wait_urb(struct urb *urb, uint32_t timeout, uint16_t *p_actlen)
usb_start_wait_urb(struct urb *urb, usb2_timeout_t timeout, uint16_t *p_actlen)
{
int err;
@ -620,7 +620,7 @@ int
usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
uint8_t request, uint8_t requesttype,
uint16_t value, uint16_t index, void *data,
uint16_t size, uint32_t timeout)
uint16_t size, usb2_timeout_t timeout)
{
struct usb2_device_request req;
struct urb *urb;
@ -741,7 +741,7 @@ usb_set_interface(struct usb_device *dev, uint8_t iface_no, uint8_t alt_index)
*------------------------------------------------------------------------*/
int
usb_setup_endpoint(struct usb_device *dev,
struct usb_host_endpoint *uhe, uint32_t bufsize)
struct usb_host_endpoint *uhe, usb2_size_t bufsize)
{
struct usb2_config cfg[2];
uint8_t type = uhe->desc.bmAttributes & UE_XFERTYPE;
@ -836,7 +836,7 @@ usb_linux_create_usb_device(struct usb2_device *udev, device_t dev)
struct usb_interface *p_ui = NULL;
struct usb_host_interface *p_uhi = NULL;
struct usb_host_endpoint *p_uhe = NULL;
uint32_t size;
usb2_size_t size;
uint16_t niface_total;
uint16_t nedesc;
uint16_t iface_no_curr;
@ -971,7 +971,7 @@ struct urb *
usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags)
{
struct urb *urb;
uint32_t size;
usb2_size_t size;
if (iso_packets == 0xFFFF) {
/*
@ -1102,7 +1102,7 @@ usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no)
* usb_buffer_alloc
*------------------------------------------------------------------------*/
void *
usb_buffer_alloc(struct usb_device *dev, uint32_t size, uint16_t mem_flags, uint8_t *dma_addr)
usb_buffer_alloc(struct usb_device *dev, usb2_size_t size, uint16_t mem_flags, uint8_t *dma_addr)
{
return (malloc(size, M_USBDEV, M_WAITOK | M_ZERO));
}
@ -1193,7 +1193,7 @@ usb_linux_free_device(struct usb_device *dev)
* usb_buffer_free
*------------------------------------------------------------------------*/
void
usb_buffer_free(struct usb_device *dev, uint32_t size,
usb_buffer_free(struct usb_device *dev, usb2_size_t size,
void *addr, uint8_t dma_addr)
{
free(addr, M_USBDEV);
@ -1326,9 +1326,9 @@ usb_linux_complete(struct usb2_xfer *xfer)
static void
usb_linux_isoc_callback(struct usb2_xfer *xfer)
{
uint32_t max_frame = xfer->max_frame_size;
uint32_t offset;
uint16_t x;
usb2_frlength_t max_frame = xfer->max_frame_size;
usb2_frlength_t offset;
usb2_frcount_t x;
struct urb *urb = xfer->priv_fifo;
struct usb_host_endpoint *uhe = xfer->priv_sc;
struct usb_iso_packet_descriptor *uipd;
@ -1500,7 +1500,7 @@ usb_linux_non_isoc_callback(struct usb2_xfer *xfer)
struct urb *urb = xfer->priv_fifo;
struct usb_host_endpoint *uhe = xfer->priv_sc;
uint8_t *ptr;
uint32_t max_bulk = xfer->max_data_length;
usb2_frlength_t max_bulk = xfer->max_data_length;
uint8_t data_frame = xfer->flags_int.control_xfr ? 1 : 0;
DPRINTF("\n");

View File

@ -321,7 +321,7 @@ struct usb_host_endpoint {
uint8_t *extra; /* Extra descriptors */
uint32_t fbsd_buf_size;
usb2_frlength_t fbsd_buf_size;
uint16_t extralen;
@ -406,10 +406,10 @@ struct urb {
void *context; /* (in) context for completion */
usb_complete_t *complete; /* (in) completion routine */
uint32_t transfer_buffer_length;/* (in) data buffer length */
uint32_t actual_length; /* (return) actual transfer length */
uint32_t bsd_length_rem;
uint32_t timeout; /* FreeBSD specific */
usb2_size_t transfer_buffer_length;/* (in) data buffer length */
usb2_size_t bsd_length_rem;
usb2_size_t actual_length; /* (return) actual transfer length */
usb2_timeout_t timeout; /* FreeBSD specific */
uint16_t transfer_flags; /* (in) */
#define URB_SHORT_NOT_OK 0x0001 /* report short transfers like errors */
@ -420,8 +420,8 @@ struct urb {
#define URB_WAIT_WAKEUP 0x0010 /* custom flags */
#define URB_IS_SLEEPING 0x0020 /* custom flags */
uint16_t start_frame; /* (modify) start frame (ISO) */
uint16_t number_of_packets; /* (in) number of ISO packets */
usb2_frcount_t start_frame; /* (modify) start frame (ISO) */
usb2_frcount_t number_of_packets; /* (in) number of ISO packets */
uint16_t interval; /* (modify) transfer interval
* (INT/ISO) */
uint16_t error_count; /* (return) number of ISO errors */
@ -441,11 +441,11 @@ int usb_unlink_urb(struct urb *urb);
int usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe);
int usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *pipe,
uint8_t request, uint8_t requesttype, uint16_t value,
uint16_t index, void *data, uint16_t size, uint32_t timeout);
uint16_t index, void *data, uint16_t size, usb2_timeout_t timeout);
int usb_set_interface(struct usb_device *dev, uint8_t ifnum,
uint8_t alternate);
int usb_setup_endpoint(struct usb_device *dev,
struct usb_host_endpoint *uhe, uint32_t bufsize);
struct usb_host_endpoint *uhe, usb2_frlength_t bufsize);
struct usb_host_endpoint *usb_find_host_endpoint(struct usb_device *dev,
uint8_t type, uint8_t ep);
@ -454,11 +454,11 @@ struct usb_host_interface *usb_altnum_to_altsetting(
const struct usb_interface *intf, uint8_t alt_index);
struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no);
void *usb_buffer_alloc(struct usb_device *dev, uint32_t size,
void *usb_buffer_alloc(struct usb_device *dev, usb2_size_t size,
uint16_t mem_flags, uint8_t *dma_addr);
void *usb_get_intfdata(struct usb_interface *intf);
void usb_buffer_free(struct usb_device *dev, uint32_t size, void *addr, uint8_t dma_addr);
void usb_buffer_free(struct usb_device *dev, usb2_size_t size, void *addr, uint8_t dma_addr);
void usb_free_urb(struct urb *urb);
void usb_init_urb(struct urb *urb);
void usb_kill_urb(struct urb *urb);

View File

@ -45,7 +45,7 @@ struct usb2_endpoint_descriptor;
/* typedefs */
typedef void (usb2_bus_mem_sub_cb_t)(struct usb2_bus *bus, struct usb2_page_cache *pc, struct usb2_page *pg, uint32_t size, uint32_t align);
typedef void (usb2_bus_mem_sub_cb_t)(struct usb2_bus *bus, struct usb2_page_cache *pc, struct usb2_page *pg, usb2_size_t size, usb2_size_t align);
typedef void (usb2_bus_mem_cb_t)(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *scb);
/*
@ -175,7 +175,7 @@ struct usb2_hw_ep_scratch {
*/
struct usb2_temp_setup {
void *buf;
uint32_t size;
usb2_size_t size;
uint8_t usb2_speed;
uint8_t self_powered;
uint8_t bNumEndpoints;

View File

@ -163,6 +163,10 @@
* data packet */
#define USB_HUB_MAX_DEPTH 5
#ifndef USB_EP0_BUFSIZE
#define USB_EP0_BUFSIZE 1024 /* bytes */
#endif
/* USB transfer states */
#define USB_ST_SETUP 0
@ -229,30 +233,26 @@ typedef uint8_t usb2_error_t; /* see "USB_ERR_XXX" */
typedef uint32_t usb2_timeout_t; /* milliseconds */
#endif
#ifndef USB_HAVE_LENGTH_T
typedef uint32_t usb2_length_t; /* bytes */
#ifndef USB_HAVE_FRLENGTH_T
typedef uint32_t usb2_frlength_t; /* bytes */
#endif
#ifndef USB_HAVE_FRAMES_T
typedef uint32_t usb2_frames_t; /* units */
#endif
#ifndef USB_HAVE_INTERVAL_T
typedef uint32_t usb2_interval_t; /* milliseconds */
#ifndef USB_HAVE_FRCOUNT_T
typedef uint32_t usb2_frcount_t; /* units */
#endif
#ifndef USB_HAVE_SIZE_T
typedef uint32_t usb2_size_t; /* bytes */
#endif
#ifndef USB_HAVE_REFS_T
typedef uint32_t usb2_refs_t; /* units */
#endif
#ifndef USB_HAVE_TICKS_T
typedef uint32_t usb2_ticks_t; /* system defined */
#endif
#ifndef USB_HAVE_POWER_MASK_T
typedef uint32_t usb2_power_mask_t; /* see "USB_HW_POWER_XXX" */
#endif
/* structures */
/*
@ -339,11 +339,11 @@ struct usb2_xfer_flags_int {
*/
struct usb2_config_sub {
usb2_callback_t *callback; /* USB transfer callback */
uint32_t bufsize; /* total pipe buffer size in bytes */
uint32_t frames; /* maximum number of USB frames */
uint16_t interval; /* interval in milliseconds */
usb2_frlength_t bufsize; /* total pipe buffer size in bytes */
usb2_frcount_t frames; /* maximum number of USB frames */
usb2_timeout_t interval; /* interval in milliseconds */
#define USB_DEFAULT_INTERVAL 0
uint16_t timeout; /* transfer timeout in milliseconds */
usb2_timeout_t timeout; /* transfer timeout in milliseconds */
struct usb2_xfer_flags flags; /* transfer flags */
};
@ -382,29 +382,29 @@ struct usb2_xfer {
void *priv_sc; /* device driver data pointer 1 */
void *priv_fifo; /* device driver data pointer 2 */
void *local_buffer;
uint32_t *frlengths;
usb2_frlength_t *frlengths;
struct usb2_page_cache *frbuffers;
usb2_callback_t *callback;
uint32_t max_usb2_frame_size;
uint32_t max_data_length;
uint32_t sumlen; /* sum of all lengths in bytes */
uint32_t actlen; /* actual length in bytes */
uint32_t timeout; /* milliseconds */
usb2_frlength_t max_hc_frame_size;
usb2_frlength_t max_data_length;
usb2_frlength_t sumlen; /* sum of all lengths in bytes */
usb2_frlength_t actlen; /* actual length in bytes */
usb2_timeout_t timeout; /* milliseconds */
#define USB_NO_TIMEOUT 0
#define USB_DEFAULT_TIMEOUT 5000 /* 5000 ms = 5 seconds */
uint32_t max_frame_count; /* initial value of "nframes" after
usb2_frcount_t max_frame_count; /* initial value of "nframes" after
* setup */
uint32_t nframes; /* number of USB frames to transfer */
uint32_t aframes; /* actual number of USB frames
usb2_frcount_t nframes; /* number of USB frames to transfer */
usb2_frcount_t aframes; /* actual number of USB frames
* transferred */
uint16_t max_packet_size;
uint16_t max_frame_size;
uint16_t qh_pos;
uint16_t isoc_time_complete; /* in ms */
uint16_t interval; /* milliseconds */
usb2_timeout_t interval; /* milliseconds */
uint8_t address; /* physical USB address */
uint8_t endpoint; /* physical USB endpoint */
@ -489,9 +489,9 @@ usb2_error_t usb2_transfer_setup(struct usb2_device *udev,
const struct usb2_config *setup_start, uint16_t n_setup,
void *priv_sc, struct mtx *priv_mtx);
void usb2_set_frame_data(struct usb2_xfer *xfer, void *ptr,
uint32_t frindex);
void usb2_set_frame_offset(struct usb2_xfer *xfer, uint32_t offset,
uint32_t frindex);
usb2_frcount_t frindex);
void usb2_set_frame_offset(struct usb2_xfer *xfer, usb2_frlength_t offset,
usb2_frcount_t frindex);
void usb2_start_hardware(struct usb2_xfer *xfer);
void usb2_transfer_clear_stall(struct usb2_xfer *xfer);
void usb2_transfer_drain(struct usb2_xfer *xfer);

View File

@ -1688,7 +1688,7 @@ usb2_fifo_attach(struct usb2_device *udev, void *priv_sc,
* Else failure
*------------------------------------------------------------------------*/
int
usb2_fifo_alloc_buffer(struct usb2_fifo *f, uint32_t bufsize,
usb2_fifo_alloc_buffer(struct usb2_fifo *f, usb2_size_t bufsize,
uint16_t nbuf)
{
usb2_fifo_free_buffer(f);
@ -1753,11 +1753,11 @@ usb2_fifo_detach(struct usb2_fifo_sc *f_sc)
DPRINTFN(2, "detached %p\n", f_sc);
}
uint32_t
usb2_size_t
usb2_fifo_put_bytes_max(struct usb2_fifo *f)
{
struct usb2_mbuf *m;
uint32_t len;
usb2_size_t len;
USB_IF_POLL(&f->free_q, m);
@ -1778,10 +1778,10 @@ usb2_fifo_put_bytes_max(struct usb2_fifo *f)
*------------------------------------------------------------------------*/
void
usb2_fifo_put_data(struct usb2_fifo *f, struct usb2_page_cache *pc,
uint32_t offset, uint32_t len, uint8_t what)
usb2_frlength_t offset, usb2_frlength_t len, uint8_t what)
{
struct usb2_mbuf *m;
uint32_t io_len;
usb2_frlength_t io_len;
while (len || (what == 1)) {
@ -1816,10 +1816,10 @@ usb2_fifo_put_data(struct usb2_fifo *f, struct usb2_page_cache *pc,
void
usb2_fifo_put_data_linear(struct usb2_fifo *f, void *ptr,
uint32_t len, uint8_t what)
usb2_size_t len, uint8_t what)
{
struct usb2_mbuf *m;
uint32_t io_len;
usb2_size_t io_len;
while (len || (what == 1)) {
@ -1853,7 +1853,7 @@ usb2_fifo_put_data_linear(struct usb2_fifo *f, void *ptr,
}
uint8_t
usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, uint32_t len)
usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, usb2_size_t len)
{
struct usb2_mbuf *m;
@ -1889,11 +1889,11 @@ usb2_fifo_put_data_error(struct usb2_fifo *f)
*------------------------------------------------------------------------*/
uint8_t
usb2_fifo_get_data(struct usb2_fifo *f, struct usb2_page_cache *pc,
uint32_t offset, uint32_t len, uint32_t *actlen,
usb2_frlength_t offset, usb2_frlength_t len, usb2_frlength_t *actlen,
uint8_t what)
{
struct usb2_mbuf *m;
uint32_t io_len;
usb2_frlength_t io_len;
uint8_t tr_data = 0;
actlen[0] = 0;
@ -1955,10 +1955,10 @@ usb2_fifo_get_data(struct usb2_fifo *f, struct usb2_page_cache *pc,
uint8_t
usb2_fifo_get_data_linear(struct usb2_fifo *f, void *ptr,
uint32_t len, uint32_t *actlen, uint8_t what)
usb2_size_t len, usb2_size_t *actlen, uint8_t what)
{
struct usb2_mbuf *m;
uint32_t io_len;
usb2_size_t io_len;
uint8_t tr_data = 0;
actlen[0] = 0;
@ -2019,7 +2019,7 @@ usb2_fifo_get_data_linear(struct usb2_fifo *f, void *ptr,
}
uint8_t
usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, uint32_t *plen)
usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, usb2_size_t *plen)
{
struct usb2_mbuf *m;

View File

@ -135,9 +135,9 @@ struct usb2_fifo {
void *priv_sc0; /* client data */
void *priv_sc1; /* client data */
void *queue_data;
uint32_t timeout; /* timeout in milliseconds */
uint32_t bufsize; /* BULK and INTERRUPT buffer size */
uint16_t nframes; /* for isochronous mode */
usb2_timeout_t timeout; /* timeout in milliseconds */
usb2_frlength_t bufsize; /* BULK and INTERRUPT buffer size */
usb2_frcount_t nframes; /* for isochronous mode */
uint16_t dev_ep_index; /* our device endpoint index */
uint8_t flag_sleeping; /* set if FIFO is sleeping */
uint8_t flag_iscomplete; /* set if a USB transfer is complete */
@ -175,17 +175,18 @@ int usb2_fifo_attach(struct usb2_device *udev, void *priv_sc,
void usb2_fifo_detach(struct usb2_fifo_sc *f_sc);
uint32_t usb2_fifo_put_bytes_max(struct usb2_fifo *fifo);
void usb2_fifo_put_data(struct usb2_fifo *fifo, struct usb2_page_cache *pc,
uint32_t offset, uint32_t len, uint8_t what);
usb2_frlength_t offset, usb2_frlength_t len, uint8_t what);
void usb2_fifo_put_data_linear(struct usb2_fifo *fifo, void *ptr,
uint32_t len, uint8_t what);
uint8_t usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, uint32_t len);
usb2_size_t len, uint8_t what);
uint8_t usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, usb2_size_t len);
void usb2_fifo_put_data_error(struct usb2_fifo *fifo);
uint8_t usb2_fifo_get_data(struct usb2_fifo *fifo, struct usb2_page_cache *pc,
uint32_t offset, uint32_t len, uint32_t *actlen, uint8_t what);
usb2_frlength_t offset, usb2_frlength_t len, usb2_frlength_t *actlen,
uint8_t what);
uint8_t usb2_fifo_get_data_linear(struct usb2_fifo *fifo, void *ptr,
uint32_t len, uint32_t *actlen, uint8_t what);
usb2_size_t len, usb2_size_t *actlen, uint8_t what);
uint8_t usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr,
uint32_t *plen);
usb2_size_t *plen);
void usb2_fifo_get_data_error(struct usb2_fifo *fifo);
uint8_t usb2_fifo_opened(struct usb2_fifo *fifo);
void usb2_fifo_free(struct usb2_fifo *f);

View File

@ -1397,7 +1397,7 @@ usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
udev->depth = depth;
udev->bus = bus;
udev->address = USB_START_ADDR; /* default value */
udev->plugtime = (uint32_t)ticks;
udev->plugtime = (usb2_ticks_t)ticks;
/*
* We need to force the power mode to "on" because there are plenty
* of USB devices out there that do not work very well with

View File

@ -87,10 +87,10 @@ struct usb2_device_flags {
* in this structure is protected by the USB BUS lock.
*/
struct usb2_power_save {
int last_xfer_time; /* copy of "ticks" */
uint32_t type_refs[4]; /* transfer reference count */
uint32_t read_refs; /* data read references */
uint32_t write_refs; /* data write references */
usb2_ticks_t last_xfer_time; /* copy of "ticks" */
usb2_size_t type_refs[4]; /* transfer reference count */
usb2_size_t read_refs; /* data read references */
usb2_size_t write_refs; /* data write references */
uint8_t suspended; /* set if USB device is suspended */
};
@ -128,7 +128,7 @@ struct usb2_device {
LIST_HEAD(,usb2_fs_privdata) pd_list;
uint32_t plugtime; /* copy of "ticks" */
usb2_ticks_t plugtime; /* copy of "ticks" */
uint16_t refcount;
#define USB_DEV_REF_MAX 0xffff

View File

@ -428,7 +428,7 @@ static void
ugen_default_write_callback(struct usb2_xfer *xfer)
{
struct usb2_fifo *f = xfer->priv_sc;
uint32_t actlen;
usb2_frlength_t actlen;
DPRINTFN(4, "actlen=%u, aframes=%u\n", xfer->actlen, xfer->aframes);
@ -500,8 +500,8 @@ static void
ugen_isoc_read_callback(struct usb2_xfer *xfer)
{
struct usb2_fifo *f = xfer->priv_sc;
uint32_t offset;
uint16_t n;
usb2_frlength_t offset;
usb2_frcount_t n;
DPRINTFN(4, "actlen=%u, aframes=%u\n", xfer->actlen, xfer->aframes);
@ -539,9 +539,9 @@ static void
ugen_isoc_write_callback(struct usb2_xfer *xfer)
{
struct usb2_fifo *f = xfer->priv_sc;
uint32_t actlen;
uint32_t offset;
uint16_t n;
usb2_frlength_t actlen;
usb2_frlength_t offset;
usb2_frcount_t n;
DPRINTFN(4, "actlen=%u, aframes=%u\n", xfer->actlen, xfer->aframes);
@ -1020,10 +1020,10 @@ ugen_fs_copy_in(struct usb2_fifo *f, uint8_t ep_index)
struct usb2_fs_endpoint fs_ep;
void *uaddr; /* userland pointer */
void *kaddr;
uint32_t offset;
usb2_frlength_t offset;
usb2_frlength_t rem;
usb2_frcount_t n;
uint32_t length;
uint32_t n;
uint32_t rem;
int error;
uint8_t isread;
@ -1197,21 +1197,21 @@ ugen_fs_copy_out(struct usb2_fifo *f, uint8_t ep_index)
struct usb2_fs_endpoint *fs_ep_uptr; /* userland ptr */
void *uaddr; /* userland ptr */
void *kaddr;
uint32_t offset;
usb2_frlength_t offset;
usb2_frlength_t rem;
usb2_frcount_t n;
uint32_t length;
uint32_t temp;
uint32_t n;
uint32_t rem;
int error;
uint8_t isread;
if (ep_index >= f->fs_ep_max) {
if (ep_index >= f->fs_ep_max)
return (EINVAL);
}
xfer = f->fs_xfer[ep_index];
if (xfer == NULL) {
if (xfer == NULL)
return (EINVAL);
}
mtx_lock(f->priv_mtx);
if (usb2_transfer_pending(xfer)) {
mtx_unlock(f->priv_mtx);
@ -1614,7 +1614,7 @@ ugen_get_frame_size(struct usb2_fifo *f, void *addr)
static int
ugen_set_buffer_size(struct usb2_fifo *f, void *addr)
{
uint32_t t;
usb2_frlength_t t;
if (*(int *)addr < 1024)
t = 1024;

View File

@ -105,7 +105,7 @@ hid_clear_local(struct hid_item *c)
* hid_start_parse
*------------------------------------------------------------------------*/
struct hid_data *
hid_start_parse(const void *d, int len, int kindset)
hid_start_parse(const void *d, usb2_size_t len, int kindset)
{
struct hid_data *s;
@ -490,7 +490,7 @@ hid_get_item(struct hid_data *s, struct hid_item *h)
* hid_report_size
*------------------------------------------------------------------------*/
int
hid_report_size(const void *buf, int len, enum hid_kind k, uint8_t *id)
hid_report_size(const void *buf, usb2_size_t len, enum hid_kind k, uint8_t *id)
{
struct hid_data *d;
struct hid_item h;
@ -543,7 +543,7 @@ hid_report_size(const void *buf, int len, enum hid_kind k, uint8_t *id)
* hid_locate
*------------------------------------------------------------------------*/
int
hid_locate(const void *desc, int size, uint32_t u, enum hid_kind k,
hid_locate(const void *desc, usb2_size_t size, uint32_t u, enum hid_kind k,
struct hid_location *loc, uint32_t *flags, uint8_t *id)
{
struct hid_data *d;
@ -575,7 +575,7 @@ hid_locate(const void *desc, int size, uint32_t u, enum hid_kind k,
* hid_get_data
*------------------------------------------------------------------------*/
uint32_t
hid_get_data(const uint8_t *buf, uint32_t len, struct hid_location *loc)
hid_get_data(const uint8_t *buf, usb2_size_t len, struct hid_location *loc)
{
uint32_t hpos = loc->pos;
uint32_t hsize = loc->size;
@ -618,7 +618,7 @@ hid_get_data(const uint8_t *buf, uint32_t len, struct hid_location *loc)
* hid_is_collection
*------------------------------------------------------------------------*/
int
hid_is_collection(const void *desc, int size, uint32_t usage)
hid_is_collection(const void *desc, usb2_size_t size, uint32_t usage)
{
struct hid_data *hd;
struct hid_item hi;

View File

@ -74,17 +74,17 @@ struct hid_item {
/* prototypes from "usb2_hid.c" */
struct hid_data *hid_start_parse(const void *d, int len, int kindset);
struct hid_data *hid_start_parse(const void *d, usb2_size_t len, int kindset);
void hid_end_parse(struct hid_data *s);
int hid_get_item(struct hid_data *s, struct hid_item *h);
int hid_report_size(const void *buf, int len, enum hid_kind k,
int hid_report_size(const void *buf, usb2_size_t len, enum hid_kind k,
uint8_t *id);
int hid_locate(const void *desc, int size, uint32_t usage,
int hid_locate(const void *desc, usb2_size_t size, uint32_t usage,
enum hid_kind kind, struct hid_location *loc,
uint32_t *flags, uint8_t *id);
uint32_t hid_get_data(const uint8_t *buf, uint32_t len,
uint32_t hid_get_data(const uint8_t *buf, usb2_size_t len,
struct hid_location *loc);
int hid_is_collection(const void *desc, int size, uint32_t usage);
int hid_is_collection(const void *desc, usb2_size_t size, uint32_t usage);
struct usb2_hid_descriptor *hid_get_descriptor_from_usb(
struct usb2_config_descriptor *cd,
struct usb2_interface_descriptor *id);

View File

@ -1030,9 +1030,9 @@ uhub_child_pnpinfo_string(device_t parent, device_t child,
* The best Transaction Translation slot for an interrupt endpoint.
*------------------------------------------------------------------------*/
static uint8_t
usb2_intr_find_best_slot(uint32_t *ptr, uint8_t start, uint8_t end)
usb2_intr_find_best_slot(usb2_size_t *ptr, uint8_t start, uint8_t end)
{
uint32_t max = 0xffffffff;
usb2_size_t max = 0 - 1;
uint8_t x;
uint8_t y;
@ -1422,7 +1422,7 @@ usb2_bus_power_update(struct usb2_bus *bus)
void
usb2_transfer_power_ref(struct usb2_xfer *xfer, int val)
{
static const uint32_t power_mask[4] = {
static const usb2_power_mask_t power_mask[4] = {
[UE_CONTROL] = USB_HW_POWER_CONTROL,
[UE_BULK] = USB_HW_POWER_BULK,
[UE_INTERRUPT] = USB_HW_POWER_INTERRUPT,
@ -1501,10 +1501,10 @@ void
usb2_bus_powerd(struct usb2_bus *bus)
{
struct usb2_device *udev;
unsigned int temp;
unsigned int limit;
unsigned int mintime;
uint32_t type_refs[5];
usb2_ticks_t temp;
usb2_ticks_t limit;
usb2_ticks_t mintime;
usb2_size_t type_refs[5];
uint8_t x;
uint8_t rem_wakeup;
@ -1727,7 +1727,6 @@ usb2_dev_suspend_peer(struct usb2_device *udev)
{
struct usb2_device *hub;
struct usb2_device *child;
uint32_t temp;
int err;
uint8_t x;
uint8_t nports;
@ -1800,6 +1799,7 @@ usb2_dev_suspend_peer(struct usb2_device *udev)
USB_BUS_UNLOCK(udev->bus);
if (udev->bus->methods->device_suspend != NULL) {
usb2_timeout_t temp;
/* suspend device on the USB controller */
(udev->bus->methods->device_suspend) (udev);

View File

@ -56,7 +56,7 @@ struct usb2_hub {
struct usb2_device *hubudev; /* the HUB device */
usb2_error_t (*explore) (struct usb2_device *hub);
void *hubsoftc;
uint32_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
usb2_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
uint16_t portpower; /* mA per USB port */
uint8_t isoc_last_time;
uint8_t nports;

View File

@ -42,7 +42,7 @@
* Else: Pointer to matching entry.
*------------------------------------------------------------------------*/
const struct usb2_device_id *
usb2_lookup_id_by_info(const struct usb2_device_id *id, uint32_t sizeof_id,
usb2_lookup_id_by_info(const struct usb2_device_id *id, usb2_size_t sizeof_id,
const struct usb2_lookup_info *info)
{
const struct usb2_device_id *id_end;
@ -121,7 +121,7 @@ usb2_lookup_id_by_info(const struct usb2_device_id *id, uint32_t sizeof_id,
* Else: Failure
*------------------------------------------------------------------------*/
int
usb2_lookup_id_by_uaa(const struct usb2_device_id *id, uint32_t sizeof_id,
usb2_lookup_id_by_uaa(const struct usb2_device_id *id, usb2_size_t sizeof_id,
struct usb2_attach_arg *uaa)
{
id = usb2_lookup_id_by_info(id, sizeof_id, &uaa->info);

View File

@ -114,9 +114,9 @@ struct usb2_device_id {
(((const uint8_t *)((did)->driver_info)) - ((const uint8_t *)0))
const struct usb2_device_id *usb2_lookup_id_by_info(
const struct usb2_device_id *id, uint32_t sizeof_id,
const struct usb2_device_id *id, usb2_size_t sizeof_id,
const struct usb2_lookup_info *info);
int usb2_lookup_id_by_uaa(const struct usb2_device_id *id,
uint32_t sizeof_id, struct usb2_attach_arg *uaa);
usb2_size_t sizeof_id, struct usb2_attach_arg *uaa);
#endif /* _USB2_LOOKUP_H_ */

View File

@ -36,12 +36,12 @@
*------------------------------------------------------------------------*/
void *
usb2_alloc_mbufs(struct malloc_type *type, struct usb2_ifqueue *ifq,
uint32_t block_size, uint16_t nblocks)
usb2_size_t block_size, uint16_t nblocks)
{
struct usb2_mbuf *m_ptr;
uint8_t *data_ptr;
void *free_ptr = NULL;
uint32_t alloc_size;
usb2_size_t alloc_size;
/* align data */
block_size += ((-block_size) & (USB_HOST_ALIGN - 1));

View File

@ -37,8 +37,8 @@ struct usb2_mbuf {
struct usb2_mbuf *usb2_nextpkt;
struct usb2_mbuf *usb2_next;
uint32_t cur_data_len;
uint32_t max_data_len;
usb2_size_t cur_data_len;
usb2_size_t max_data_len;
uint8_t last_packet:1;
uint8_t unused:7;
};
@ -51,8 +51,8 @@ struct usb2_ifqueue {
struct usb2_mbuf *ifq_head;
struct usb2_mbuf *ifq_tail;
uint32_t ifq_len;
uint32_t ifq_maxlen;
usb2_size_t ifq_len;
usb2_size_t ifq_maxlen;
};
#define USB_IF_ENQUEUE(ifq, m) do { \
@ -97,6 +97,6 @@ struct usb2_ifqueue {
/* prototypes */
void *usb2_alloc_mbufs(struct malloc_type *type, struct usb2_ifqueue *ifq,
uint32_t block_size, uint16_t nblocks);
usb2_size_t block_size, uint16_t nblocks);
#endif /* _USB2_MBUF_H_ */

View File

@ -109,10 +109,10 @@ struct bbb_transfer {
uint8_t *data_ptr;
uint32_t data_len; /* bytes */
uint32_t data_rem; /* bytes */
uint32_t data_timeout; /* ms */
uint32_t actlen; /* bytes */
usb2_size_t data_len; /* bytes */
usb2_size_t data_rem; /* bytes */
usb2_timeout_t data_timeout; /* ms */
usb2_frlength_t actlen; /* bytes */
uint8_t cmd_len; /* bytes */
uint8_t dir;
@ -265,7 +265,7 @@ bbb_command_callback(struct usb2_xfer *xfer)
tag = UGETDW(sc->cbw.dCBWTag) + 1;
USETDW(sc->cbw.dCBWSignature, CBWSIGNATURE);
USETDW(sc->cbw.dCBWTag, tag);
USETDW(sc->cbw.dCBWDataTransferLength, sc->data_len);
USETDW(sc->cbw.dCBWDataTransferLength, (uint32_t)sc->data_len);
sc->cbw.bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT);
sc->cbw.bCBWLUN = sc->lun;
sc->cbw.bCDBLength = sc->cmd_len;
@ -289,7 +289,7 @@ static void
bbb_data_read_callback(struct usb2_xfer *xfer)
{
struct bbb_transfer *sc = xfer->priv_sc;
uint32_t max_bulk = xfer->max_data_length;
usb2_frlength_t max_bulk = xfer->max_data_length;
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
@ -340,7 +340,7 @@ static void
bbb_data_write_callback(struct usb2_xfer *xfer)
{
struct bbb_transfer *sc = xfer->priv_sc;
uint32_t max_bulk = xfer->max_data_length;
usb2_frlength_t max_bulk = xfer->max_data_length;
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
@ -438,8 +438,8 @@ bbb_status_callback(struct usb2_xfer *xfer)
*------------------------------------------------------------------------*/
static uint8_t
bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun,
void *data_ptr, uint32_t data_len, uint8_t cmd_len,
uint32_t data_timeout)
void *data_ptr, usb2_size_t data_len, uint8_t cmd_len,
usb2_timeout_t data_timeout)
{
sc->lun = lun;
sc->dir = data_len ? dir : DIR_NONE;

View File

@ -243,7 +243,7 @@ usb2_proc_msignal(struct usb2_process *up, void *_pm0, void *_pm1)
struct usb2_proc_msg *pm0 = _pm0;
struct usb2_proc_msg *pm1 = _pm1;
struct usb2_proc_msg *pm2;
uint32_t d;
usb2_size_t d;
uint8_t t;
/* check if gone, return dummy value */

View File

@ -51,7 +51,7 @@ typedef void (usb2_proc_callback_t)(struct usb2_proc_msg *hdr);
struct usb2_proc_msg {
TAILQ_ENTRY(usb2_proc_msg) pm_qentry;
usb2_proc_callback_t *pm_callback;
uint32_t pm_num;
usb2_size_t pm_num;
};
/*
@ -66,7 +66,7 @@ struct usb2_process {
struct thread *up_curtd;
struct mtx *up_mtx;
uint32_t up_msg_num;
usb2_size_t up_msg_num;
uint8_t up_prio;
uint8_t up_gone;

View File

@ -228,15 +228,15 @@ usb2_do_clear_stall_callback(struct usb2_xfer *xfer)
*------------------------------------------------------------------------*/
usb2_error_t
usb2_do_request_flags(struct usb2_device *udev, struct mtx *mtx,
struct usb2_device_request *req, void *data, uint32_t flags,
uint16_t *actlen, uint32_t timeout)
struct usb2_device_request *req, void *data, uint16_t flags,
uint16_t *actlen, usb2_timeout_t timeout)
{
struct usb2_xfer *xfer;
const void *desc;
int err = 0;
uint32_t start_ticks;
uint32_t delta_ticks;
uint32_t max_ticks;
usb2_ticks_t start_ticks;
usb2_ticks_t delta_ticks;
usb2_ticks_t max_ticks;
uint16_t length;
uint16_t temp;
@ -487,8 +487,8 @@ usb2_do_request_flags(struct usb2_device *udev, struct mtx *mtx,
*------------------------------------------------------------------------*/
usb2_error_t
usb2_do_request_proc(struct usb2_device *udev, struct usb2_process *pproc,
struct usb2_device_request *req, void *data, uint32_t flags,
uint16_t *actlen, uint32_t timeout)
struct usb2_device_request *req, void *data, uint16_t flags,
uint16_t *actlen, usb2_timeout_t timeout)
{
usb2_error_t err;
uint16_t len;

View File

@ -30,11 +30,11 @@
struct usb2_process;
usb2_error_t usb2_do_request_flags(struct usb2_device *udev, struct mtx *mtx,
struct usb2_device_request *req, void *data, uint32_t flags,
uint16_t *actlen, uint32_t timeout);
struct usb2_device_request *req, void *data, uint16_t flags,
uint16_t *actlen, usb2_timeout_t timeout);
usb2_error_t usb2_do_request_proc(struct usb2_device *udev, struct usb2_process *pproc,
struct usb2_device_request *req, void *data, uint32_t flags,
uint16_t *actlen, uint32_t timeout);
struct usb2_device_request *req, void *data, uint16_t flags,
uint16_t *actlen, usb2_timeout_t timeout);
usb2_error_t usb2_req_clear_hub_feature(struct usb2_device *udev,
struct mtx *mtx, uint16_t sel);
usb2_error_t usb2_req_clear_port_feature(struct usb2_device *udev,

View File

@ -62,7 +62,7 @@ usb2_sw_transfer(struct usb2_sw_transfer *std,
usb2_sw_transfer_func_t *func)
{
struct usb2_xfer *xfer;
uint32_t len;
usb2_frlength_t len;
uint8_t shortpkt = 0;
xfer = std->xfer;

View File

@ -98,10 +98,10 @@ static const struct usb2_config usb2_control_ep_cfg[USB_DEFAULT_XFER_MAX] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control endpoint */
.direction = UE_DIR_ANY,
.mh.bufsize = 1024, /* bytes */
.mh.bufsize = USB_EP0_BUFSIZE, /* bytes */
.mh.flags = {.proxy_buffer = 1,.short_xfer_ok = 1,},
.mh.callback = &usb2_do_request_callback,
.md.bufsize = 1024, /* bytes */
.md.bufsize = USB_EP0_BUFSIZE, /* bytes */
.md.flags = {.proxy_buffer = 1,.short_xfer_ok = 0,},
.md.callback = &usb2_handle_request_callback,
},
@ -163,7 +163,7 @@ usb2_update_max_frame_size(struct usb2_xfer *xfer)
* 0: no DMA delay required
* Else: milliseconds of DMA delay
*------------------------------------------------------------------------*/
uint32_t
usb2_timeout_t
usb2_get_dma_delay(struct usb2_bus *bus)
{
uint32_t temp = 0;
@ -194,18 +194,18 @@ usb2_get_dma_delay(struct usb2_bus *bus)
#if USB_HAVE_BUSDMA
uint8_t
usb2_transfer_setup_sub_malloc(struct usb2_setup_params *parm,
struct usb2_page_cache **ppc, uint32_t size, uint32_t align,
uint32_t count)
struct usb2_page_cache **ppc, usb2_size_t size, usb2_size_t align,
usb2_size_t count)
{
struct usb2_page_cache *pc;
struct usb2_page *pg;
void *buf;
uint32_t n_dma_pc;
uint32_t n_obj;
uint32_t x;
uint32_t y;
uint32_t r;
uint32_t z;
usb2_size_t n_dma_pc;
usb2_size_t n_obj;
usb2_size_t x;
usb2_size_t y;
usb2_size_t r;
usb2_size_t z;
USB_ASSERT(align > 1, ("Invalid alignment, 0x%08x!\n",
align));
@ -324,9 +324,9 @@ usb2_transfer_setup_sub(struct usb2_setup_params *parm)
const struct usb2_config_sub *setup_sub = parm->curr_setup_sub;
struct usb2_endpoint_descriptor *edesc;
struct usb2_std_packet_size std_size;
uint32_t n_frlengths;
uint32_t n_frbuffers;
uint32_t x;
usb2_frcount_t n_frlengths;
usb2_frcount_t n_frbuffers;
usb2_frcount_t x;
uint8_t type;
uint8_t zmps;
@ -406,7 +406,7 @@ usb2_transfer_setup_sub(struct usb2_setup_params *parm)
if (type == UE_ISOCHRONOUS) {
uint32_t frame_limit;
uint16_t frame_limit;
xfer->interval = 0; /* not used, must be zero */
xfer->flags_int.isochronous_xfr = 1; /* set flag */
@ -680,11 +680,11 @@ usb2_transfer_setup_sub(struct usb2_setup_params *parm)
}
/* subtract USB frame remainder from "hc_max_frame_size" */
xfer->max_usb2_frame_size =
xfer->max_hc_frame_size =
(parm->hc_max_frame_size -
(parm->hc_max_frame_size % xfer->max_frame_size));
if (xfer->max_usb2_frame_size == 0) {
if (xfer->max_hc_frame_size == 0) {
parm->err = USB_ERR_INVAL;
goto done;
}
@ -717,7 +717,7 @@ usb2_transfer_setup_sub(struct usb2_setup_params *parm)
/*
* Set some dummy values so that we avoid division by zero:
*/
xfer->max_usb2_frame_size = 1;
xfer->max_hc_frame_size = 1;
xfer->max_frame_size = 1;
xfer->max_packet_size = 1;
xfer->max_data_length = 0;
@ -780,8 +780,8 @@ usb2_transfer_setup(struct usb2_device *udev,
/* sanity checks */
for (setup = setup_start, n = 0;
setup != setup_end; setup++, n++) {
if ((setup->mh.bufsize == 0xffffffff) ||
(setup->md.bufsize == 0xffffffff)) {
if ((setup->mh.bufsize == (usb2_frlength_t)-1) ||
(setup->md.bufsize == (usb2_frlength_t)-1)) {
parm.err = USB_ERR_BAD_BUFSIZE;
DPRINTF("invalid bufsize\n");
}
@ -1075,13 +1075,13 @@ static void
usb2_transfer_unsetup_sub(struct usb2_xfer_root *info, uint8_t needs_delay)
{
struct usb2_page_cache *pc;
uint32_t temp;
USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED);
/* wait for any outstanding DMA operations */
if (needs_delay) {
usb2_timeout_t temp;
temp = usb2_get_dma_delay(info->bus);
usb2_pause_mtx(&info->bus->bus_mtx,
USB_MS_TO_TICKS(temp));
@ -1244,7 +1244,7 @@ usb2_control_transfer_init(struct usb2_xfer *xfer)
static uint8_t
usb2_start_hardware_sub(struct usb2_xfer *xfer)
{
uint32_t len;
usb2_frlength_t len;
/* Check for control endpoint stall */
if (xfer->flags.stall_pipe) {
@ -1373,7 +1373,7 @@ usb2_start_hardware_sub(struct usb2_xfer *xfer)
void
usb2_start_hardware(struct usb2_xfer *xfer)
{
uint32_t x;
usb2_frcount_t x;
DPRINTF("xfer=%p, pipe=%p, nframes=%d, dir=%s\n",
xfer, xfer->pipe, xfer->nframes, USB_GET_DATA_ISREAD(xfer) ?
@ -1775,7 +1775,7 @@ usb2_transfer_drain(struct usb2_xfer *xfer)
* than zero gives undefined results!
*------------------------------------------------------------------------*/
void
usb2_set_frame_data(struct usb2_xfer *xfer, void *ptr, uint32_t frindex)
usb2_set_frame_data(struct usb2_xfer *xfer, void *ptr, usb2_frcount_t frindex)
{
/* set virtual address to load and length */
xfer->frbuffers[frindex].buffer = ptr;
@ -1788,8 +1788,8 @@ usb2_set_frame_data(struct usb2_xfer *xfer, void *ptr, uint32_t frindex)
* of the USB DMA buffer allocated for this USB transfer.
*------------------------------------------------------------------------*/
void
usb2_set_frame_offset(struct usb2_xfer *xfer, uint32_t offset,
uint32_t frindex)
usb2_set_frame_offset(struct usb2_xfer *xfer, usb2_frlength_t offset,
usb2_frcount_t frindex)
{
USB_ASSERT(!xfer->flags.ext_buffer, ("Cannot offset data frame "
"when the USB buffer is external!\n"));
@ -2307,7 +2307,7 @@ usb2_pipe_start(struct usb2_xfer_queue *pq)
*------------------------------------------------------------------------*/
void
usb2_transfer_timeout_ms(struct usb2_xfer *xfer,
void (*cb) (void *arg), uint32_t ms)
void (*cb) (void *arg), usb2_timeout_t ms)
{
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
@ -2337,7 +2337,7 @@ static uint8_t
usb2_callback_wrapper_sub(struct usb2_xfer *xfer)
{
struct usb2_pipe *pipe;
uint32_t x;
usb2_frcount_t x;
if ((!xfer->flags_int.open) &&
(!xfer->flags_int.did_close)) {
@ -2357,7 +2357,7 @@ usb2_callback_wrapper_sub(struct usb2_xfer *xfer)
(xfer->error == USB_ERR_TIMEOUT)) &&
(!xfer->flags_int.did_dma_delay)) {
uint32_t temp;
usb2_timeout_t temp;
/* only delay once */
xfer->flags_int.did_dma_delay = 1;

View File

@ -39,8 +39,7 @@ struct usb2_done_msg {
#define USB_DMATAG_TO_XROOT(dpt) \
((struct usb2_xfer_root *)( \
((uint8_t *)(dpt)) - \
((uint8_t *)&((struct usb2_xfer_root *)0)->dma_parent_tag) + \
((uint8_t *)0)))
((uint8_t *)&((struct usb2_xfer_root *)0)->dma_parent_tag)))
/*
* The following structure is used to keep information about memory
@ -68,14 +67,15 @@ struct usb2_xfer_root {
struct usb2_bus *bus; /* pointer to USB bus (cached) */
struct usb2_device *udev; /* pointer to USB device */
uint32_t memory_size;
uint32_t setup_refcount;
uint32_t page_size;
uint32_t dma_nframes; /* number of page caches to load */
uint32_t dma_currframe; /* currect page cache number */
uint32_t dma_frlength_0; /* length of page cache zero */
usb2_size_t memory_size;
usb2_size_t setup_refcount;
#if USB_HAVE_BUSDMA
usb2_frcount_t dma_nframes; /* number of page caches to load */
usb2_frcount_t dma_currframe; /* currect page cache number */
usb2_frlength_t dma_frlength_0; /* length of page cache zero */
uint8_t dma_error; /* set if virtual memory could not be
* loaded */
#endif
uint8_t done_sleep; /* set if done thread is sleeping */
};
@ -96,13 +96,13 @@ struct usb2_setup_params {
const struct usb2_config_sub *curr_setup_sub;
const struct usb2_pipe_methods *methods;
void *buf;
uint32_t *xfer_length_ptr;
usb2_frlength_t *xfer_length_ptr;
uint32_t size[7];
uint32_t bufsize;
uint32_t bufsize_max;
uint32_t hc_max_frame_size;
usb2_size_t size[7];
usb2_frlength_t bufsize;
usb2_frlength_t bufsize_max;
uint16_t hc_max_frame_size;
uint16_t hc_max_packet_size;
uint8_t hc_max_packet_count;
uint8_t speed;
@ -113,8 +113,8 @@ struct usb2_setup_params {
/* function prototypes */
uint8_t usb2_transfer_setup_sub_malloc(struct usb2_setup_params *parm,
struct usb2_page_cache **ppc, uint32_t size, uint32_t align,
uint32_t count);
struct usb2_page_cache **ppc, usb2_size_t size, usb2_size_t align,
usb2_size_t count);
void usb2_command_wrapper(struct usb2_xfer_queue *pq,
struct usb2_xfer *xfer);
void usb2_pipe_enter(struct usb2_xfer *xfer);
@ -132,8 +132,8 @@ usb2_callback_t usb2_do_request_callback;
usb2_callback_t usb2_handle_request_callback;
usb2_callback_t usb2_do_clear_stall_callback;
void usb2_transfer_timeout_ms(struct usb2_xfer *xfer,
void (*cb) (void *arg), uint32_t ms);
uint32_t usb2_get_dma_delay(struct usb2_bus *bus);
void (*cb) (void *arg), usb2_timeout_t ms);
usb2_timeout_t usb2_get_dma_delay(struct usb2_bus *bus);
void usb2_transfer_power_ref(struct usb2_xfer *xfer, int val);
#endif /* _USB2_TRANSFER_H_ */