17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50a05e705Slc  * Common Development and Distribution License (the "License").
60a05e705Slc  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*d29f5a71Szhigang lu - Sun Microsystems - Beijing China  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_UGEN_H
277c478bd9Sstevel@tonic-gate #define	_SYS_USB_UGEN_H
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Header  file  for  applications  written to  USB  Generic Driver (UGEN).
367c478bd9Sstevel@tonic-gate  * This  provides different  status  values written  to the application by
377c478bd9Sstevel@tonic-gate  * UGEN.
387c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * UGEN  provides a mechanism  to  retrieve  USB bus  specific information
427c478bd9Sstevel@tonic-gate  * through endpoint status minor nodes (See ugen(7D) for more information).
437c478bd9Sstevel@tonic-gate  * Whenever an error occurs on any endpoint, the application can retrieve
447c478bd9Sstevel@tonic-gate  * the last command status (int). Possible values are give below
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_NOERROR		0x00	/* No error		  */
477c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_CRC			0x01	/* CRC timeout detected   */
487c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_BITSTUFFING		0x02	/* Bit-stuffing violation */
497c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_DATA_TOGGLE_MM	0x03	/* Data toggle mismatch	  */
507c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_STALL		0x04	/* Endpoint stalled	  */
517c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_DEV_NOT_RESP	0x05	/* Device not responding  */
527c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_PID_CHECKFAILURE	0x06	/* PID Check failure	  */
537c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_UNEXP_PID		0x07	/* Unexpected PID	  */
547c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_DATA_OVERRUN	0x08	/* Data size exceeded	  */
557c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_DATA_UNDERRUN	0x09	/* Less data received	  */
567c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_BUFFER_OVERRUN	0x0a	/* Buffer size exceeded	  */
577c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_BUFFER_UNDERRUN	0x0b	/* Buffer under run	  */
587c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_TIMEOUT		0x0c	/* Command timed out	  */
597c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_NOT_ACCESSED	0x0d	/* Not accessed by h/w	  */
607c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_UNSPECIFIED_ERR	0x0e	/* Unspecified error	  */
617c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_NO_BANDWIDTH	0x41	/* No bandwidth		  */
627c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_HW_ERR		0x42	/* Hardware error	  */
637c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_SUSPENDED		0x43	/* Device suspended/resumed */
647c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_DISCONNECTED	0x44	/* Device disconnected	  */
657c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_INTR_BUF_FULL	0x45	/* Interrupt buf was full */
667c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_INVALID_REQ		0x46	/* request was invalid	  */
677c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_INTERRUPTED		0x47	/* request was interrupted  */
687c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_NO_RESOURCES	0x48	/* no resources for req	  */
697c478bd9Sstevel@tonic-gate #define	USB_LC_STAT_INTR_POLLING_FAILED	0x49	/* failed to restart poll  */
700a05e705Slc #define	USB_LC_STAT_ISOC_POLLING_FAILED	0x50	/* failed to restart iso poll */
710a05e705Slc #define	USB_LC_STAT_ISOC_UNINITIALIZED	0x51	/* isoc_info not inited yet */
720a05e705Slc #define	USB_LC_STAT_ISOC_PKT_ERROR	0x52	/* All pkts in last req fail */
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * Endpoint control
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate #define	USB_EP_INTR_ONE_XFER		0x01	/* when this bit is set	*/
787c478bd9Sstevel@tonic-gate 						/* ugen will poll an intr */
797c478bd9Sstevel@tonic-gate 						/* endpoint only once	*/
817c478bd9Sstevel@tonic-gate /*
827c478bd9Sstevel@tonic-gate  * Possible Device status (int) values
837c478bd9Sstevel@tonic-gate  * Application can poll(2) and read(2) device status on device status minor
847c478bd9Sstevel@tonic-gate  * nodes (See ugen(7D) for more details).
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate #define	USB_DEV_STAT_ONLINE		0x1	/* Device is online	  */
877c478bd9Sstevel@tonic-gate #define	USB_DEV_STAT_DISCONNECTED	0x2	/* Device is disconnected */
887c478bd9Sstevel@tonic-gate #define	USB_DEV_STAT_RESUMED		0x4	/* Device resumed	  */
897c478bd9Sstevel@tonic-gate #define	USB_DEV_STAT_UNAVAILABLE	0x5	/* Device unavailable	  */
910a05e705Slc /*
920a05e705Slc  * Structure for holding isoc data packets information. Application and ugen
930a05e705Slc  * driver use these structures to exchange isoc packet information.
940a05e705Slc  */
950a05e705Slc typedef struct ugen_isoc_pkt_descr {
960a05e705Slc 	/*
970a05e705Slc 	 * Set by the application, for all isochronous requests, to the
980a05e705Slc 	 * number of bytes to transfer in a packet.
990a05e705Slc 	 */
1000a05e705Slc 	ushort_t	dsc_isoc_pkt_len;
1020a05e705Slc 	/*
1030a05e705Slc 	 * Set by ugen to actual number of bytes sent/received in a packet.
1040a05e705Slc 	 */
1050a05e705Slc 	ushort_t	dsc_isoc_pkt_actual_len;
1070a05e705Slc 	/*
1080a05e705Slc 	 * Per packet status set by ugen driver both for the isochronous IN
1090a05e705Slc 	 * and OUT requests.
1100a05e705Slc 	 */
1110a05e705Slc 	int	dsc_isoc_pkt_status;
1120a05e705Slc } ugen_isoc_pkt_descr_t;
1140a05e705Slc typedef struct ugen_isoc_req_head {
1150a05e705Slc 	int	req_isoc_pkts_count; /* pkt count of the isoc request */
1160a05e705Slc 	ugen_isoc_pkt_descr_t req_isoc_pkt_descrs[1]; /* pkt descriptors */
1170a05e705Slc } ugen_isoc_req_head_t;
1207c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1217c478bd9Sstevel@tonic-gate }
1227c478bd9Sstevel@tonic-gate #endif
1247c478bd9Sstevel@tonic-gate #endif	/* _SYS_USB_UGEN_H */