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 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_USB_USBSER_KEYSPAN_PIPE_H 28 #define _SYS_USB_USBSER_KEYSPAN_PIPE_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * USB pipe management (mostly device-neutral) 34 */ 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /* 41 * pipe structure 42 */ 43 typedef struct keyspan_pipe { 44 kmutex_t pipe_mutex; /* structure lock */ 45 keyspan_state_t *pipe_ksp; /* backpointer to state */ 46 usb_pipe_handle_t pipe_handle; /* pipe handle */ 47 usb_ep_descr_t pipe_ep_descr; /* endpoint descriptor */ 48 usb_pipe_policy_t pipe_policy; /* pipe policy */ 49 int pipe_state; /* pipe state */ 50 usb_log_handle_t pipe_lh; /* log handle */ 51 } keyspan_pipe_t; 52 53 _NOTE(MUTEX_PROTECTS_DATA(keyspan_pipe::pipe_mutex, keyspan_pipe)) 54 _NOTE(DATA_READABLE_WITHOUT_LOCK(keyspan_pipe::{ 55 pipe_ksp 56 pipe_handle 57 pipe_lh 58 pipe_ep_descr 59 pipe_policy 60 })) 61 62 /* pipe states */ 63 enum { 64 KEYSPAN_PIPE_NOT_INIT = 0, 65 KEYSPAN_PIPE_CLOSED, 66 KEYSPAN_PIPE_OPEN 67 }; 68 69 70 int keyspan_init_pipes(keyspan_state_t *); 71 void keyspan_fini_pipes(keyspan_state_t *); 72 int keyspansp_open_pipes(keyspan_state_t *); 73 void keyspansp_close_pipes(keyspan_state_t *); 74 int keyspan_open_dev_pipes(keyspan_state_t *); 75 void keyspan_close_dev_pipes(keyspan_state_t *); 76 int keyspan_open_port_pipes(keyspan_port_t *); 77 void keyspan_close_port_pipes(keyspan_port_t *); 78 int keyspan_reopen_pipes(keyspan_state_t *); 79 void keyspan_close_pipes(keyspan_state_t *); 80 void keyspan_close_open_pipes(keyspan_state_t *esp); 81 82 int keyspan_receive_data(keyspan_pipe_t *, int, void *); 83 int keyspan_send_data(keyspan_pipe_t *, mblk_t **, void *); 84 85 int keyspan_receive_status(keyspan_state_t *); 86 87 #ifdef __cplusplus 88 } 89 #endif 90 91 #endif /* _SYS_USB_USBSER_KEYSPAN_PIPE_H */ 92