1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_USB_EHCI_ISOCH_UTIL_H 28 #define _SYS_USB_EHCI_ISOCH_UTIL_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* 37 * Isochronous pool functions 38 */ 39 extern int ehci_allocate_isoc_pools( 40 ehci_state_t *ehcip); 41 extern int ehci_get_itd_pool_size(); 42 43 /* 44 * Isochronous Transfer Wrapper Functions 45 */ 46 extern ehci_isoc_xwrapper_t *ehci_allocate_itw_resources( 47 ehci_state_t *ehcip, 48 ehci_pipe_private_t *pp, 49 size_t itw_length, 50 usb_flags_t usb_flags, 51 size_t pkt_count); 52 extern void ehci_deallocate_itw( 53 ehci_state_t *ehcip, 54 ehci_pipe_private_t *pp, 55 ehci_isoc_xwrapper_t *itw); 56 57 /* 58 * Isochronous transfer descripter functions 59 */ 60 extern ehci_itd_t *ehci_allocate_itd( 61 ehci_state_t *ehcip); 62 63 extern void ehci_deallocate_itd( 64 ehci_state_t *ehcip, 65 ehci_isoc_xwrapper_t *itw, 66 ehci_itd_t *old_itd); 67 extern uint_t ehci_calc_num_itds( 68 ehci_isoc_xwrapper_t *itw, 69 size_t pkt_count); 70 extern int ehci_allocate_itds_for_itw( 71 ehci_state_t *ehcip, 72 ehci_isoc_xwrapper_t *itw, 73 uint_t itd_count); 74 extern void ehci_insert_itd_on_itw( 75 ehci_state_t *ehcip, 76 ehci_isoc_xwrapper_t *itw, 77 ehci_itd_t *itd); 78 extern void ehci_insert_itd_into_active_list( 79 ehci_state_t *ehcip, 80 ehci_itd_t *itd); 81 extern void ehci_remove_itd_from_active_list( 82 ehci_state_t *ehcip, 83 ehci_itd_t *itd); 84 extern ehci_itd_t *ehci_create_done_itd_list( 85 ehci_state_t *ehcip); 86 extern int ehci_insert_isoc_to_pfl( 87 ehci_state_t *ehcip, 88 ehci_pipe_private_t *pp, 89 ehci_isoc_xwrapper_t *itw); 90 extern void ehci_remove_isoc_from_pfl( 91 ehci_state_t *ehcip, 92 ehci_itd_t *curr_itd); 93 94 /* 95 * Isochronous in resource functions 96 */ 97 extern int ehci_allocate_isoc_in_resource( 98 ehci_state_t *ehcip, 99 ehci_pipe_private_t *pp, 100 ehci_isoc_xwrapper_t *tw, 101 usb_flags_t flags); 102 extern void ehci_deallocate_isoc_in_resource( 103 ehci_state_t *ehcip, 104 ehci_pipe_private_t *pp, 105 ehci_isoc_xwrapper_t *itw); 106 107 /* 108 * Isochronous memory addr functions 109 */ 110 extern uint32_t ehci_itd_cpu_to_iommu( 111 ehci_state_t *ehcip, 112 ehci_itd_t *addr); 113 114 extern ehci_itd_t *ehci_itd_iommu_to_cpu( 115 ehci_state_t *ehcip, 116 uintptr_t addr); 117 118 /* 119 * Error parsing functions 120 */ 121 extern void ehci_parse_isoc_error( 122 ehci_state_t *ehcip, 123 ehci_isoc_xwrapper_t *itw, 124 ehci_itd_t *itd); 125 126 /* 127 * print functions 128 */ 129 extern void ehci_print_itd( 130 ehci_state_t *ehcip, 131 ehci_itd_t *itd); 132 133 #ifdef __cplusplus 134 } 135 #endif 136 137 #endif /* _SYS_USB_EHCI_ISOCH_UTIL_H */ 138