pcser_var.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 1999,2001-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _PCSER_VAR_H
#define _PCSER_VAR_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define PCSER_DEBUG_LOWMASK 0x0000000ff
#define PCSER_DEBUG_DEFAULT 0x000000100
#define PCSER_DEBUG_POLL 0x000000200
#define PCSER_DEBUG_XMIT 0x000000400
#define PCSER_DEBUG_RCV 0x000000800
#define PCSER_DEBUG_MODEM 0x000001000
#define PCSER_DEBUG_RCVEX 0x000002000
#define PCSER_DEBUG_CIS 0x000004000
#define PCSER_DEBUG_RTSCTS 0x000020000
#define PCSER_DEBUG_DRAINSILO 0x000040000
#define PCSER_DEBUG_PARAM 0x000080000
#define PCSER_DEBUG_READY 0x000100000
#define PCSER_DEBUG_MANUSPEC 0x000200000
#define PCSER_DEBUG_READY_DELAY 0x000400000
#define PCSER_DEBUG_CISVARS 0x000800000
#define PCSER_DEBUG_SOFTINT 0x001000000
/* #define DEBUG_PCSERIOCTL */
/*
* Values for CS_EVENT_CLIENT_INFO event handler
*/
#define PCSER_CLIENT_DESCRIPTION "PCMCIA serial/modem card driver"
#define PCSER_REV_LEVEL 0x100
#define PCSER_REV_DAY 31
#define PCSER_REV_MONTH 3
#define PCSER_REV_YEAR 16
#define PCSER_REV_DATE CS_CLIENT_INFO_MAKE_DATE( \
/*
* Private data structures for PCMCIA async serial communications cards
* and modems using the 8250-type UART.
*
* various device things
*/
#define MAX_TX_BUF_SIZE 64
#ifdef CBAUDEXT
#define PCSER_DUALHW_FLOW "pcser_use_dualflow"
#endif
#ifndef CBAUDEXT
#define PCSER_HIGHSPEED_PROP "pcser_use_hispeed"
#endif
/*
* These macros return device minor numbers given a socket number.
*/
/*
* The driver uses a two-level interrupt scheme; the hardware interrupts
* at a high level, and the driver schedules a softint on a lower
* level to deal with the STREAMS processing.
*/
/*
* some general sizing and enumeration constants
* the silo sizes are the same for both the cd180 and the ppc, and are
* located in pcserio.h as PCSER_SILOSIZE
* the TXBUF sizes determine how many characters pcser_start() will try to
* stuff into the soft tx buffers in the line struct. you should leave
* PCSER_TXBUFSIZE at 8 since the interrupt handler for the cd180 doesn't
* know what to do if it gets larger.
* PPC_TXBUFSIZE is made a little larger since the ppc interrupt handler
* is smart enough to take data from the soft tx buffer if there is any
* both PCSER_TXBUFSIZE and PPC_TXBUFSIZE must be <= to LINE_TXBUFSIZE
*/
#define PCSER_HIWATER 960
#define PCSER_LOWWATER 300
/* default STREAMS buffer size in pcser_drainsilo() */
#define PCSER_DRAIN_BSIZE 16
/*
* If CRTSXOFF is not defined, then we're probably being built on
* a pre-2.5 kernel, so alias CRTSXOFF to CRTSCTS. This will
* cause the driver to treat CRTSCTS as a bidirectional flow
* control enable bit rather than a unidirectional flow control
* enable bit as it is in 2.5 and above.
*/
#ifndef CRTSXOFF
#endif
/*
* The number of unidentified IRQ's that we allow before we
* shut down the card.
*/
/*
* The number of different possible line speeds (not all of which
* may be supported)
*/
/*
* timeout and timing parameters
*
* serial lines
* NQFRETRY and QFRETRYTIME are used in pcser_drainsilo()
*/
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/* CSTYLED */
/*
* The next two items are used in pcser_card_insertion() to handle
* cards that require a delay after resetting and after
* configuring the card.
*
* PCSER_INSERT_READY_TMO1 - time to wait between checking READY before
* doing a RequestConfiguration
* PCSER_INSERT_READY_TMO2 - time to wait between checking READY after
* doing a RequestConfiguration
*/
/* CSTYLED */
/*
* UNTIMEOUT() macro to make sure we're not trying untimeout a bogus timeout
*/
if (utt) { \
utt = 0; \
} \
}
/*
* XXX card present macro
*/
#define CARD_INSERT_CHECK(pm) \
/*
* user-level audio control - note that we overload the TIOCMBIS and
* TIOCMBIC ioctls by using the TIOCM_SR bit to control
* the audio signal from the modem to the system speaker XXX
*/
#define TIOCM_AUDIO TIOCM_SR
/*
* for modem_init()
*/
/*
* UART defines
*/
/*
* IIR - interrupt identification register
*/
#define MODEM_CHANGE 0x000
#define XMIT_DATA 0x002
#define RCV_DATA 0x004
#define RCV_EXP 0x006
/*
* IER - interrupt enable register
*/
/*
* LSR - line status register
*/
/*
* MCR - modem control register
*/
#define DTR_ON_MCR 0x001
#define RTS_ON_MCR 0x002
#define OUT1_ON_MCR 0x004
#define OUT2_ON_MCR 0x008
#define LOOP_ON_MCR 0x010
/*
* MSR - modem status register
*/
#define CTS_CHANGE 0x001
#define DSR_CHANGE 0x002
#define RI_CHANGE 0x004
#define CD_CHANGE 0x008
#define CTS_ON_MSR 0x010
#define DSR_ON_MSR 0x020
#define RI_ON_MSR 0x040
#define CD_ON_MSR 0x080
/*
* LCR - line control register
*/
#define CHAR_5 0x00
#define CHAR_6 0x01
#define CHAR_7 0x02
#define CHAR_8 0x03
#define STOP_1 0x00
#define STOP_15 0x04
#define STOP_2 0x04
#define USE_P 0x08
#define ODD_P 0x00
#define EVEN_P 0x10
#define MARK_P 0x00
#define SPACE_P 0x20
#define SET_BREAK 0x040
#define DLAB 0x080
/*
* DTR latch values
*/
/*
*/
#define DTR_SET(L, S) (L->dtr_shadow = S)
/*
* define driver defaults for all the serial lines; these can be manipulated
* via the PCSER_SDEFAULTS/PCSER_GDEFAULTS ioctl()'s; see "pcserio.h"
*/
/* assert DTR on open, use zs DTR semantics on close */
#define SDFLAGS DTR_ASSERT
/*
* all the bytes we get from the modem get put into a soft silo before being
* handed off to STREAMS; the following macros handle the RTS line if
* CHECK_RTS_OFF(line) should be called by the Rx interrupt handler for
* each character put into the soft silo; if the soft silo nears
* full, RTS will be deasserted
* CHECK_RTS_ON(line) should be called by the soft interrupt soft silo
* drain code; once the soft silo level has gone below the low
* water mark, RTS will be asserted
* FLUSHSILO(line) is used to flush the silo in case there's an error
* PUTSILO(line,char) puts a character into the soft silo and calls
* CHECK_RTS_OFF(line) to see if RTS should be deasserted
*/
#ifdef USE_MACRO_RTSCTS
#define CHECK_RTS_OFF(line) { \
} \
}
#define CHECK_RTS_ON(line) { \
} \
}
#endif /* USE_MACRO_RTSCTS */
#ifdef PX_IFLUSH_DEBUG
zline->pcser_sscnt = 0; \
}
#else
line->pcser_sscnt = 0; \
}
#endif /* PX_IFLUSH_DEBUG */
zline->pcser_sscnt++;\
*zline->pcser_source++ = c; \
CHECK_RTS_OFF(zline); \
} else { \
CHECK_RTS_ON(zline); \
} \
}
/*
* pcser_cftable_t and pcser_cftable_params_t structures are used
* to store values from the CISTPL_CFTABLE_ENTRY tuples.
*/
typedef struct pcser_cftable_params_t {
unsigned modem_vcc;
unsigned modem_vpp1;
unsigned modem_vpp2;
typedef struct pcser_cftable_t {
pcser_cftable_params_t p; /* parameters */
struct pcser_cftable_t *prev;
struct pcser_cftable_t *next;
/*
* pcser_cis_vars_t structure used to save interesting information
* gleaned from the CIS.
* The configuration registers present flags are defined in the Card
* Services header files.
*/
typedef struct pcser_cis_vars_t {
/* resource configuration */
unsigned modem_vcc;
unsigned modem_vpp1;
unsigned modem_vpp2;
/* UART features */
/*
* Flgas for pcser_cis_vars_t.flags field
*/
/*
* Per line structure
* there is one of these for each serial line plus one more for
* the ppc.
*/
typedef struct pcser_line_t {
/* stuff common to both the cd180 and the ppc */
unsigned state; /* various state flags */
unsigned flags; /* default mode flags */
unsigned saved_state; /* saved over open/close */
int pcser_ignore_cd_time; /* ignore CD in mS */
struct pcser_unit_t *pcser;
int pcser_max_txbufsize; /* soft Tx buf size */
int pcser_txbufsize; /* soft Tx buf size */
int pcser_rxfifo_size; /* size of Rx FIFO */
int pcser_txcount; /* num chars in pcser_txbuf */
int pcser_silosize; /* size of rx silo */
int pcser_sscnt; /* silo count */
int pcser_qfcnt; /* queue full retry count */
/* stuff that affects the reception of data */
int drain_size; /* buf size pcser_drainsilo */
int pcser_hiwater; /* high water mark CHECK_RTS */
int pcser_lowwater; /* low water mark CHECK_RTS */
int rx_fifo_thld; /* cd-180 RxFIFO threshold */
} pcser_line_t;
/*
* flags in pcser_line_t.state field
*/
#define PCSER_RTSOFF_MESSAGE 0x00000010
/* flags used with pcser_softint() */
#define PCSER_RTSON_MESSAGE 0x40000000
/*
* flags in pcser_line_t.saved_state field
*/
/*
* flags in pcser_line_t.flags field are in pcser_io.h
*/
/*
* private flags for pcser_xmit and pcser_modem
*/
/*
* Per board (controller) structure
*/
typedef struct pcser_unit_t {
int instance; /* instance number */
int unid_irq; /* unknown IRQ count */
unsigned flags;
struct pcser_line_t line;
struct pcser_line_t control_line;
} pcser_unit_t;
/*
* flags in pcser_unit_t.flags field
*/
#ifdef CBAUDEXT
#endif
#ifndef CBAUDEXT
#endif
/*
* flags in pcser_unit_t.card_state field
*/
/*
* the state struct for transparent ioctl()s
*/
struct pcser_state_t {
int state;
};
/*
* state for transparent ioctl()'s used in pcser_state_t
*/
#define PCSER_COPYIN 1
#define PCSER_COPYOUT 2
#ifdef __cplusplus
}
#endif
#endif /* _PCSER_VAR_H */