keyspan_var.h revision 60b08185ce63023f22fd6b2ed0db8c0d119b2023
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 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
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* keyspan implementation definitions
*/
#include <sys/dditypes.h>
#ifdef KEYSPAN_USA49WLC
#endif /* If KEYSPAN_USA49WLC defined */
#ifdef __cplusplus
extern "C" {
#endif
/* product id */
#define KEYSPAN_USA19HS_PID 0x121
#define KEYSPAN_USA49WLC_PID 0x12a
#define KEYSPAN_MAX_PORT_NUM 4
/*
* forward typedefs needed to resolve recursive header dependencies
*/
typedef struct keyspan_pre_state keyspan_pre_state_t;
typedef struct keyspan_state keyspan_state_t;
typedef struct keyspan_port keyspan_port_t;
/*
* temporary soft state for pre_attach
*/
struct keyspan_pre_state {
int kb_instance; /* instance */
};
/*
* 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 {
#ifdef KEYSPAN_USA49WLC
#endif /* If KEYSPAN_USA49WLC defined */
/*
* To support different keyspan adapters, use union type
* for different status msg format.
*/
typedef union keyspan_port_status_msg {
#ifdef KEYSPAN_USA49WLC
#endif /* If KEYSPAN_USA49WLC defined */
/*
* 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 */
int ks_dev_state; /* USB device state */
};
}))
/*
* per port structure
*/
struct keyspan_port {
int kp_state; /* port state */
int kp_flags; /* port flags */
/*
* 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 */
KEYSPAN_PORT_CTRLRESP = 0x0020,
};
/* port state */
enum {
KEYSPAN_PORT_NOT_INIT = 0, /* port is not initialized */
KEYSPAN_PORT_CLOSED, /* port is closed */
KEYSPAN_PORT_OPENING, /* port is being opened */
KEYSPAN_PORT_OPEN /* port is open */
};
/* port flags */
enum {
};
/* various tunables */
enum {
};
/* This flag indicates if the firmware already downloaded to the device */
#define KEYSPAN_FW_FLAG 0x8000
#define KEYSPAN_REQ_SET 0xa0
/*
* debug printing masks
*/
#define DPRINT_ATTACH 0x00000001
#define DPRINT_OPEN 0x00000002
#define DPRINT_CLOSE 0x00000004
#define DPRINT_DEF_PIPE 0x00000010
#define DPRINT_IN_PIPE 0x00000020
#define DPRINT_OUT_PIPE 0x00000040
#define DPRINT_INTR_PIPE 0x00000080
#define DPRINT_PIPE_RESET 0x00000100
#define DPRINT_IN_DATA 0x00000200
#define DPRINT_OUT_DATA 0x00000400
#define DPRINT_CTLOP 0x00000800
#define DPRINT_HOTPLUG 0x00001000
#define DPRINT_PM 0x00002000
#define DPRINT_MASK_ALL 0xFFFFFFFF
/*
* 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 */