sys/bus/u4b/usb_busdma.c
/*------------------------------------------------------------------------*
 *  usbd_get_page - lookup DMA-able memory for the given offset
 *
 * NOTE: Only call this function when the "page_cache" structure has
 * been properly initialized !
 *------------------------------------------------------------------------*/
lookup DMA-able memory for the given offset
NOTE: Only call this function when the "page_cache" structure has
been properly initialized !
lookup DMA - able memory for the given offset NOTE : Only call this function when the " page_cache " structure has been properly initialized !
void
usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
    struct usb_page_search *res)
{
#if USB_HAVE_BUSDMA
	struct usb_page *page;
	if (pc->page_start) {
		if (pc->buffer) {
			res->buffer = USB_ADD_BYTES(pc->buffer, offset);
		}
		offset += pc->page_offset_buf;
		page = pc->page_start;
		if (pc->ismultiseg) {
			page += (offset / USB_PAGE_SIZE);
			offset %= USB_PAGE_SIZE;
			res->length = USB_PAGE_SIZE - offset;
			res->physaddr = page->physaddr + offset;
		} else {
			res->length = (usb_size_t)-1;
			res->physaddr = page->physaddr + offset;
		}
		if (!pc->buffer) {
			res->buffer = USB_ADD_BYTES(page->buffer, offset);
		}
		return;
	}
#endif
	res->buffer = USB_ADD_BYTES(pc->buffer, offset);
	res->length = (usb_size_t)-1;
#if USB_HAVE_BUSDMA
	res->physaddr = 0;
#endif
}
void usbd_get_page ( struct usb_page_cache * pc , usb_frlength_t offset , struct usb_page_search * res ) { #if USB_HAVE_BUSDMA struct usb_page * page ; if ( pc -> page_start ) { if ( pc -> buffer ) { res -> buffer = USB_ADD_BYTES ( pc -> buffer , offset ) ; } offset += pc -> page_offset_buf ; page = pc -> page_start ; if ( pc -> ismultiseg ) { page += ( offset / USB_PAGE_SIZE ) ; offset %= USB_PAGE_SIZE ; res -> length = USB_PAGE_SIZE - offset ; res -> physaddr = page -> physaddr + offset ; } else { res -> length = ( usb_size_t ) - 1 ; res -> physaddr = page -> physaddr + offset ; } if ( ! pc -> buffer ) { res -> buffer = USB_ADD_BYTES ( page -> buffer , offset ) ; } return ; } #endif res -> buffer = USB_ADD_BYTES ( pc -> buffer , offset ) ; res -> length = ( usb_size_t ) - 1 ; #if USB_HAVE_BUSDMA res -> physaddr = 0 ; #endif }
usbd_get_page - lookup DMA-able memory for the given offset
 NOTE: Only call this function when the "page_cache" structure has
 been properly initialized !
usbd_get_page - lookup DMA - able memory for the given offset NOTE : Only call this function when the " page_cache " structure has been properly initialized !
/* Case 1 - something has been loaded into DMA */ /* Case 1a - Kernel Virtual Address */ /* compute destination page */ /* Case 1b - Non Kernel Virtual Address */ /* Case 2 - Plain PIO */