10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 55653Slc152243 * Common Development and Distribution License (the "License"). 65653Slc152243 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*7492SZhigang.Lu@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_USB_UGEN_H 270Sstevel@tonic-gate #define _SYS_USB_UGEN_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifdef __cplusplus 310Sstevel@tonic-gate extern "C" { 320Sstevel@tonic-gate #endif 330Sstevel@tonic-gate 340Sstevel@tonic-gate /* 350Sstevel@tonic-gate * Header file for applications written to USB Generic Driver (UGEN). 360Sstevel@tonic-gate * This provides different status values written to the application by 370Sstevel@tonic-gate * UGEN. 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate 400Sstevel@tonic-gate /* 410Sstevel@tonic-gate * UGEN provides a mechanism to retrieve USB bus specific information 420Sstevel@tonic-gate * through endpoint status minor nodes (See ugen(7D) for more information). 430Sstevel@tonic-gate * Whenever an error occurs on any endpoint, the application can retrieve 440Sstevel@tonic-gate * the last command status (int). Possible values are give below 450Sstevel@tonic-gate */ 460Sstevel@tonic-gate #define USB_LC_STAT_NOERROR 0x00 /* No error */ 470Sstevel@tonic-gate #define USB_LC_STAT_CRC 0x01 /* CRC timeout detected */ 480Sstevel@tonic-gate #define USB_LC_STAT_BITSTUFFING 0x02 /* Bit-stuffing violation */ 490Sstevel@tonic-gate #define USB_LC_STAT_DATA_TOGGLE_MM 0x03 /* Data toggle mismatch */ 500Sstevel@tonic-gate #define USB_LC_STAT_STALL 0x04 /* Endpoint stalled */ 510Sstevel@tonic-gate #define USB_LC_STAT_DEV_NOT_RESP 0x05 /* Device not responding */ 520Sstevel@tonic-gate #define USB_LC_STAT_PID_CHECKFAILURE 0x06 /* PID Check failure */ 530Sstevel@tonic-gate #define USB_LC_STAT_UNEXP_PID 0x07 /* Unexpected PID */ 540Sstevel@tonic-gate #define USB_LC_STAT_DATA_OVERRUN 0x08 /* Data size exceeded */ 550Sstevel@tonic-gate #define USB_LC_STAT_DATA_UNDERRUN 0x09 /* Less data received */ 560Sstevel@tonic-gate #define USB_LC_STAT_BUFFER_OVERRUN 0x0a /* Buffer size exceeded */ 570Sstevel@tonic-gate #define USB_LC_STAT_BUFFER_UNDERRUN 0x0b /* Buffer under run */ 580Sstevel@tonic-gate #define USB_LC_STAT_TIMEOUT 0x0c /* Command timed out */ 590Sstevel@tonic-gate #define USB_LC_STAT_NOT_ACCESSED 0x0d /* Not accessed by h/w */ 600Sstevel@tonic-gate #define USB_LC_STAT_UNSPECIFIED_ERR 0x0e /* Unspecified error */ 610Sstevel@tonic-gate #define USB_LC_STAT_NO_BANDWIDTH 0x41 /* No bandwidth */ 620Sstevel@tonic-gate #define USB_LC_STAT_HW_ERR 0x42 /* Hardware error */ 630Sstevel@tonic-gate #define USB_LC_STAT_SUSPENDED 0x43 /* Device suspended/resumed */ 640Sstevel@tonic-gate #define USB_LC_STAT_DISCONNECTED 0x44 /* Device disconnected */ 650Sstevel@tonic-gate #define USB_LC_STAT_INTR_BUF_FULL 0x45 /* Interrupt buf was full */ 660Sstevel@tonic-gate #define USB_LC_STAT_INVALID_REQ 0x46 /* request was invalid */ 670Sstevel@tonic-gate #define USB_LC_STAT_INTERRUPTED 0x47 /* request was interrupted */ 680Sstevel@tonic-gate #define USB_LC_STAT_NO_RESOURCES 0x48 /* no resources for req */ 690Sstevel@tonic-gate #define USB_LC_STAT_INTR_POLLING_FAILED 0x49 /* failed to restart poll */ 705653Slc152243 #define USB_LC_STAT_ISOC_POLLING_FAILED 0x50 /* failed to restart iso poll */ 715653Slc152243 #define USB_LC_STAT_ISOC_UNINITIALIZED 0x51 /* isoc_info not inited yet */ 725653Slc152243 #define USB_LC_STAT_ISOC_PKT_ERROR 0x52 /* All pkts in last req fail */ 730Sstevel@tonic-gate 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * Endpoint control 760Sstevel@tonic-gate */ 770Sstevel@tonic-gate #define USB_EP_INTR_ONE_XFER 0x01 /* when this bit is set */ 780Sstevel@tonic-gate /* ugen will poll an intr */ 790Sstevel@tonic-gate /* endpoint only once */ 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* 820Sstevel@tonic-gate * Possible Device status (int) values 830Sstevel@tonic-gate * Application can poll(2) and read(2) device status on device status minor 840Sstevel@tonic-gate * nodes (See ugen(7D) for more details). 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate #define USB_DEV_STAT_ONLINE 0x1 /* Device is online */ 870Sstevel@tonic-gate #define USB_DEV_STAT_DISCONNECTED 0x2 /* Device is disconnected */ 880Sstevel@tonic-gate #define USB_DEV_STAT_RESUMED 0x4 /* Device resumed */ 890Sstevel@tonic-gate #define USB_DEV_STAT_UNAVAILABLE 0x5 /* Device unavailable */ 900Sstevel@tonic-gate 915653Slc152243 /* 925653Slc152243 * Structure for holding isoc data packets information. Application and ugen 935653Slc152243 * driver use these structures to exchange isoc packet information. 945653Slc152243 */ 955653Slc152243 typedef struct ugen_isoc_pkt_descr { 965653Slc152243 /* 975653Slc152243 * Set by the application, for all isochronous requests, to the 985653Slc152243 * number of bytes to transfer in a packet. 995653Slc152243 */ 1005653Slc152243 ushort_t dsc_isoc_pkt_len; 1015653Slc152243 1025653Slc152243 /* 1035653Slc152243 * Set by ugen to actual number of bytes sent/received in a packet. 1045653Slc152243 */ 1055653Slc152243 ushort_t dsc_isoc_pkt_actual_len; 1065653Slc152243 1075653Slc152243 /* 1085653Slc152243 * Per packet status set by ugen driver both for the isochronous IN 1095653Slc152243 * and OUT requests. 1105653Slc152243 */ 1115653Slc152243 int dsc_isoc_pkt_status; 1125653Slc152243 } ugen_isoc_pkt_descr_t; 1135653Slc152243 1145653Slc152243 typedef struct ugen_isoc_req_head { 1155653Slc152243 int req_isoc_pkts_count; /* pkt count of the isoc request */ 1165653Slc152243 ugen_isoc_pkt_descr_t req_isoc_pkt_descrs[1]; /* pkt descriptors */ 1175653Slc152243 } ugen_isoc_req_head_t; 1185653Slc152243 1195653Slc152243 1200Sstevel@tonic-gate #ifdef __cplusplus 1210Sstevel@tonic-gate } 1220Sstevel@tonic-gate #endif 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate #endif /* _SYS_USB_UGEN_H */ 125