xref: /linux/include/uapi/linux/scc.h (revision c95baf12f5077419db01313ab61c2aac007d40cd)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells /* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */
3607ca46eSDavid Howells 
4607ca46eSDavid Howells #ifndef _UAPI_SCC_H
5607ca46eSDavid Howells #define _UAPI_SCC_H
6607ca46eSDavid Howells 
7*1a18374fSMasahiro Yamada #include <linux/sockios.h>
8607ca46eSDavid Howells 
9607ca46eSDavid Howells /* selection of hardware types */
10607ca46eSDavid Howells 
11607ca46eSDavid Howells #define PA0HZP		0x00	/* hardware type for PA0HZP SCC card and compatible */
12607ca46eSDavid Howells #define EAGLE		0x01    /* hardware type for EAGLE card */
13607ca46eSDavid Howells #define PC100		0x02	/* hardware type for PC100 card */
14607ca46eSDavid Howells #define PRIMUS		0x04	/* hardware type for PRIMUS-PC (DG9BL) card */
15607ca46eSDavid Howells #define DRSI		0x08	/* hardware type for DRSI PC*Packet card */
16607ca46eSDavid Howells #define BAYCOM		0x10	/* hardware type for BayCom (U)SCC */
17607ca46eSDavid Howells 
18607ca46eSDavid Howells /* DEV ioctl() commands */
19607ca46eSDavid Howells 
20607ca46eSDavid Howells enum SCC_ioctl_cmds {
21607ca46eSDavid Howells 	SIOCSCCRESERVED = SIOCDEVPRIVATE,
22607ca46eSDavid Howells 	SIOCSCCCFG,
23607ca46eSDavid Howells 	SIOCSCCINI,
24607ca46eSDavid Howells 	SIOCSCCCHANINI,
25607ca46eSDavid Howells 	SIOCSCCSMEM,
26607ca46eSDavid Howells 	SIOCSCCGKISS,
27607ca46eSDavid Howells 	SIOCSCCSKISS,
28607ca46eSDavid Howells 	SIOCSCCGSTAT,
29607ca46eSDavid Howells 	SIOCSCCCAL
30607ca46eSDavid Howells };
31607ca46eSDavid Howells 
32607ca46eSDavid Howells /* Device parameter control (from WAMPES) */
33607ca46eSDavid Howells 
34607ca46eSDavid Howells enum L1_params {
35607ca46eSDavid Howells 	PARAM_DATA,
36607ca46eSDavid Howells 	PARAM_TXDELAY,
37607ca46eSDavid Howells 	PARAM_PERSIST,
38607ca46eSDavid Howells 	PARAM_SLOTTIME,
39607ca46eSDavid Howells 	PARAM_TXTAIL,
40607ca46eSDavid Howells 	PARAM_FULLDUP,
41607ca46eSDavid Howells 	PARAM_SOFTDCD,		/* was: PARAM_HW */
42607ca46eSDavid Howells 	PARAM_MUTE,		/* ??? */
43607ca46eSDavid Howells 	PARAM_DTR,
44607ca46eSDavid Howells 	PARAM_RTS,
45607ca46eSDavid Howells 	PARAM_SPEED,
46607ca46eSDavid Howells 	PARAM_ENDDELAY,		/* ??? */
47607ca46eSDavid Howells 	PARAM_GROUP,
48607ca46eSDavid Howells 	PARAM_IDLE,
49607ca46eSDavid Howells 	PARAM_MIN,
50607ca46eSDavid Howells 	PARAM_MAXKEY,
51607ca46eSDavid Howells 	PARAM_WAIT,
52607ca46eSDavid Howells 	PARAM_MAXDEFER,
53607ca46eSDavid Howells 	PARAM_TX,
54607ca46eSDavid Howells 	PARAM_HWEVENT = 31,
55607ca46eSDavid Howells 	PARAM_RETURN = 255	/* reset kiss mode */
56607ca46eSDavid Howells };
57607ca46eSDavid Howells 
58607ca46eSDavid Howells /* fulldup parameter */
59607ca46eSDavid Howells 
60607ca46eSDavid Howells enum FULLDUP_modes {
61607ca46eSDavid Howells 	KISS_DUPLEX_HALF,	/* normal CSMA operation */
62607ca46eSDavid Howells 	KISS_DUPLEX_FULL,	/* fullduplex, key down trx after transmission */
63607ca46eSDavid Howells 	KISS_DUPLEX_LINK,	/* fullduplex, key down trx after 'idletime' sec */
64607ca46eSDavid Howells 	KISS_DUPLEX_OPTIMA	/* fullduplex, let the protocol layer control the hw */
65607ca46eSDavid Howells };
66607ca46eSDavid Howells 
67607ca46eSDavid Howells /* misc. parameters */
68607ca46eSDavid Howells 
69607ca46eSDavid Howells #define TIMER_OFF	65535U	/* to switch off timers */
70607ca46eSDavid Howells #define NO_SUCH_PARAM	65534U	/* param not implemented */
71607ca46eSDavid Howells 
72607ca46eSDavid Howells /* HWEVENT parameter */
73607ca46eSDavid Howells 
74607ca46eSDavid Howells enum HWEVENT_opts {
75607ca46eSDavid Howells 	HWEV_DCD_ON,
76607ca46eSDavid Howells 	HWEV_DCD_OFF,
77607ca46eSDavid Howells 	HWEV_ALL_SENT
78607ca46eSDavid Howells };
79607ca46eSDavid Howells 
80607ca46eSDavid Howells /* channel grouping */
81607ca46eSDavid Howells 
82607ca46eSDavid Howells #define RXGROUP		0100	/* if set, only tx when all channels clear */
83607ca46eSDavid Howells #define TXGROUP		0200	/* if set, don't transmit simultaneously */
84607ca46eSDavid Howells 
85607ca46eSDavid Howells /* Tx/Rx clock sources */
86607ca46eSDavid Howells 
87607ca46eSDavid Howells enum CLOCK_sources {
88607ca46eSDavid Howells 	CLK_DPLL,	/* normal halfduplex operation */
89607ca46eSDavid Howells 	CLK_EXTERNAL,	/* external clocking (G3RUH/DF9IC modems) */
90607ca46eSDavid Howells 	CLK_DIVIDER,	/* Rx = DPLL, Tx = divider (fullduplex with */
91607ca46eSDavid Howells 			/* modems without clock regeneration */
92607ca46eSDavid Howells 	CLK_BRG		/* experimental fullduplex mode with DPLL/BRG for */
93607ca46eSDavid Howells 			/* MODEMs without clock recovery */
94607ca46eSDavid Howells };
95607ca46eSDavid Howells 
96607ca46eSDavid Howells /* Tx state */
97607ca46eSDavid Howells 
98607ca46eSDavid Howells enum TX_state {
99607ca46eSDavid Howells 	TXS_IDLE,	/* Transmitter off, no data pending */
100607ca46eSDavid Howells 	TXS_BUSY,	/* waiting for permission to send / tailtime */
101607ca46eSDavid Howells 	TXS_ACTIVE,	/* Transmitter on, sending data */
102607ca46eSDavid Howells 	TXS_NEWFRAME,	/* reset CRC and send (next) frame */
103607ca46eSDavid Howells 	TXS_IDLE2,	/* Transmitter on, no data pending */
104607ca46eSDavid Howells 	TXS_WAIT,	/* Waiting for Mintime to expire */
105607ca46eSDavid Howells 	TXS_TIMEOUT	/* We had a transmission timeout */
106607ca46eSDavid Howells };
107607ca46eSDavid Howells 
108607ca46eSDavid Howells typedef unsigned long io_port;	/* type definition for an 'io port address' */
109607ca46eSDavid Howells 
110607ca46eSDavid Howells /* SCC statistical information */
111607ca46eSDavid Howells 
112607ca46eSDavid Howells struct scc_stat {
113607ca46eSDavid Howells         long rxints;            /* Receiver interrupts */
114607ca46eSDavid Howells         long txints;            /* Transmitter interrupts */
115607ca46eSDavid Howells         long exints;            /* External/status interrupts */
116607ca46eSDavid Howells         long spints;            /* Special receiver interrupts */
117607ca46eSDavid Howells 
118607ca46eSDavid Howells         long txframes;          /* Packets sent */
119607ca46eSDavid Howells         long rxframes;          /* Number of Frames Actually Received */
120607ca46eSDavid Howells         long rxerrs;            /* CRC Errors */
121607ca46eSDavid Howells         long txerrs;		/* KISS errors */
122607ca46eSDavid Howells 
123607ca46eSDavid Howells 	unsigned int nospace;	/* "Out of buffers" */
124607ca46eSDavid Howells 	unsigned int rx_over;	/* Receiver Overruns */
125607ca46eSDavid Howells 	unsigned int tx_under;	/* Transmitter Underruns */
126607ca46eSDavid Howells 
127607ca46eSDavid Howells 	unsigned int tx_state;	/* Transmitter state */
128607ca46eSDavid Howells 	int tx_queued;		/* tx frames enqueued */
129607ca46eSDavid Howells 
130607ca46eSDavid Howells 	unsigned int maxqueue;	/* allocated tx_buffers */
131607ca46eSDavid Howells 	unsigned int bufsize;	/* used buffersize */
132607ca46eSDavid Howells };
133607ca46eSDavid Howells 
134607ca46eSDavid Howells struct scc_modem {
135607ca46eSDavid Howells 	long speed;		/* Line speed, bps */
136607ca46eSDavid Howells 	char clocksrc;		/* 0 = DPLL, 1 = external, 2 = divider */
137607ca46eSDavid Howells 	char nrz;		/* NRZ instead of NRZI */
138607ca46eSDavid Howells };
139607ca46eSDavid Howells 
140607ca46eSDavid Howells struct scc_kiss_cmd {
141607ca46eSDavid Howells 	int  	 command;	/* one of the KISS-Commands defined above */
142607ca46eSDavid Howells 	unsigned param;		/* KISS-Param */
143607ca46eSDavid Howells };
144607ca46eSDavid Howells 
145607ca46eSDavid Howells struct scc_hw_config {
146607ca46eSDavid Howells 	io_port data_a;		/* data port channel A */
147607ca46eSDavid Howells 	io_port ctrl_a;		/* control port channel A */
148607ca46eSDavid Howells 	io_port data_b;		/* data port channel B */
149607ca46eSDavid Howells 	io_port ctrl_b;		/* control port channel B */
150607ca46eSDavid Howells 	io_port vector_latch;	/* INTACK-Latch (#) */
151607ca46eSDavid Howells 	io_port	special;	/* special function port */
152607ca46eSDavid Howells 
153607ca46eSDavid Howells 	int	irq;		/* irq */
154607ca46eSDavid Howells 	long	clock;		/* clock */
155607ca46eSDavid Howells 	char	option;		/* command for function port */
156607ca46eSDavid Howells 
157607ca46eSDavid Howells 	char brand;		/* hardware type */
158607ca46eSDavid Howells 	char escc;		/* use ext. features of a 8580/85180/85280 */
159607ca46eSDavid Howells };
160607ca46eSDavid Howells 
161607ca46eSDavid Howells /* (#) only one INTACK latch allowed. */
162607ca46eSDavid Howells 
163607ca46eSDavid Howells 
164607ca46eSDavid Howells struct scc_mem_config {
165607ca46eSDavid Howells 	unsigned int dummy;
166607ca46eSDavid Howells 	unsigned int bufsize;
167607ca46eSDavid Howells };
168607ca46eSDavid Howells 
169607ca46eSDavid Howells struct scc_calibrate {
170607ca46eSDavid Howells 	unsigned int time;
171607ca46eSDavid Howells 	unsigned char pattern;
172607ca46eSDavid Howells };
173607ca46eSDavid Howells 
174607ca46eSDavid Howells #endif /* _UAPI_SCC_H */
175