/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_USB_USBSER_KEYSPAN_VAR_H
#define _SYS_USB_USBSER_KEYSPAN_VAR_H
/*
* keyspan implementation definitions
*/
#include <sys/dditypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/* product id */
/*
* forward typedefs needed to resolve recursive header dependencies
*/
/*
* temporary soft state for pre_attach
*/
struct keyspan_pre_state {
};
/* Firmware structure */
typedef struct usbser_keyspan_fw_record {
/*
* PM support
*/
typedef struct keyspan_power {
} keyspan_pm_t;
/*
* device specific info structure
*/
typedef struct keyspan_dev_spec {
/* Endpoint used to get data from device */
/*
* To support different keyspan adapters, use union type
* for different cmd msg format.
*/
typedef union keyspan_port_ctrl_msg {
/*
* To support different keyspan adapters, use union type
* for different status msg format.
*/
typedef union keyspan_port_status_msg {
/*
* per device state structure
*/
struct keyspan_state {
/*
* mutex could be used too, but it causes trouble when warlocking
* with USBA: some functions inside usb_pipe_close() wait on cv
*
* since semaphore is only used for serialization during
*/
/*
* USBA related
*/
/* bulk in pipe for getting device status */
/* bulk out pipe for sending control cmd to device */
/*
* The following only used on USA_49WG
*/
/* Shared bulk in pipe handle */
/* counter for opened bulk in pipe */
/* Flag for device reconnect */
};
}))
/*
* per port structure
*/
struct keyspan_port {
/*
* data receipt and transmit
*/
/* The control cmd sent to the port */
/* status msg of the port */
/*
* the current port status, including: rts, dtr,
* break, loopback, enable.
*/
};
}))
/* lock relationships */
/* port status flags */
enum {
/* the ctrl cmd sent to this port is responded */
};
/* port state */
enum {
};
/* port flags */
enum {
};
/* various tunables */
enum {
/*
* From keyspan spec, USA49WLC max packet length for bulk out transfer
* is 64, the format is [status byte][up to 63 data bytes], so the
* max data length per transfer is 63 bytes, USA19HS doesn't need
* extra status byte. USA49WG max packet length for bulk out transfer
* is 512, the format is [status byte][63 data bytes]...[status byte]
* [up to 63 data bytes], so the max data length per transfer is 504
* bytes, while the port0 use intr out pipe send data, the packet
* format is the same as USA49WLC, so the max data length for USA49WG
* port0 is 63 bytes.
*/
};
/* This flag indicates if the firmware already downloaded to the device */
/* Vendor specific ctrl req, used to send ctrl command for USA_49WG model */
/*
* debug printing masks
*/
/*
* misc macros
*/
#define NELEM(a) (sizeof (a) / sizeof (*(a)))
/* common DSD functions */
void keyspan_tx_start(keyspan_port_t *, int *);
int keyspan_send_cmd(keyspan_port_t *);
int keyspan_dev_is_online(keyspan_state_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_USBSER_KEYSPAN_VAR_H */