xref: /OK3568_Linux_fs/kernel/drivers/net/wan/cosa.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /* $Id: cosa.h,v 1.6 1999/01/06 14:02:44 kas Exp $ */
3*4882a593Smuzhiyun 
4*4882a593Smuzhiyun /*
5*4882a593Smuzhiyun  *  Copyright (C) 1995-1997  Jan "Yenya" Kasprzak <kas@fi.muni.cz>
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef COSA_H__
9*4882a593Smuzhiyun #define COSA_H__
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include <linux/ioctl.h>
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #ifdef __KERNEL__
14*4882a593Smuzhiyun /* status register - output bits */
15*4882a593Smuzhiyun #define SR_RX_DMA_ENA   0x04    /* receiver DMA enable bit */
16*4882a593Smuzhiyun #define SR_TX_DMA_ENA   0x08    /* transmitter DMA enable bit */
17*4882a593Smuzhiyun #define SR_RST          0x10    /* SRP reset */
18*4882a593Smuzhiyun #define SR_USR_INT_ENA  0x20    /* user interrupt enable bit */
19*4882a593Smuzhiyun #define SR_TX_INT_ENA   0x40    /* transmitter interrupt enable bit */
20*4882a593Smuzhiyun #define SR_RX_INT_ENA   0x80    /* receiver interrupt enable bit */
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /* status register - input bits */
23*4882a593Smuzhiyun #define SR_USR_RQ       0x20    /* user interrupt request pending */
24*4882a593Smuzhiyun #define SR_TX_RDY       0x40    /* transmitter empty (ready) */
25*4882a593Smuzhiyun #define SR_RX_RDY       0x80    /* receiver data ready */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #define SR_UP_REQUEST   0x02    /* request from SRP to transfer data
28*4882a593Smuzhiyun                                    up to PC */
29*4882a593Smuzhiyun #define SR_DOWN_REQUEST 0x01    /* SRP is able to transfer data down
30*4882a593Smuzhiyun                                    from PC to SRP */
31*4882a593Smuzhiyun #define SR_END_OF_TRANSFER      0x03    /* SRP signalize end of
32*4882a593Smuzhiyun                                            transfer (up or down) */
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun #define SR_CMD_FROM_SRP_MASK    0x03    /* mask to get SRP command */
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun /* bits in driver status byte definitions : */
37*4882a593Smuzhiyun #define SR_RDY_RCV      0x01    /* ready to receive packet */
38*4882a593Smuzhiyun #define SR_RDY_SND      0x02    /* ready to send packet */
39*4882a593Smuzhiyun #define SR_CMD_PND      0x04    /* command pending */ /* not currently used */
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /* ???? */
42*4882a593Smuzhiyun #define SR_PKT_UP       0x01    /* transfer of packet up in progress */
43*4882a593Smuzhiyun #define SR_PKT_DOWN     0x02    /* transfer of packet down in progress */
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #endif /* __KERNEL__ */
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #define SR_LOAD_ADDR    0x4400  /* SRP microcode load address */
48*4882a593Smuzhiyun #define SR_START_ADDR   0x4400  /* SRP microcode start address */
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #define COSA_LOAD_ADDR    0x400  /* SRP microcode load address */
51*4882a593Smuzhiyun #define COSA_MAX_FIRMWARE_SIZE	0x10000
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun /* ioctls */
54*4882a593Smuzhiyun struct cosa_download {
55*4882a593Smuzhiyun 	int addr, len;
56*4882a593Smuzhiyun 	char __user *code;
57*4882a593Smuzhiyun };
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun /* Reset the device */
60*4882a593Smuzhiyun #define COSAIORSET	_IO('C',0xf0)
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun /* Start microcode at given address */
63*4882a593Smuzhiyun #define COSAIOSTRT	_IOW('C',0xf1, int)
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun /* Read the block from the device memory */
66*4882a593Smuzhiyun #define COSAIORMEM	_IOWR('C',0xf2, struct cosa_download *)
67*4882a593Smuzhiyun 	/* actually the struct cosa_download itself; this is to keep
68*4882a593Smuzhiyun 	 * the ioctl number same as in 2.4 in order to keep the user-space
69*4882a593Smuzhiyun 	 * utils compatible. */
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun /* Write the block to the device memory (i.e. download the microcode) */
72*4882a593Smuzhiyun #define COSAIODOWNLD	_IOW('C',0xf2, struct cosa_download *)
73*4882a593Smuzhiyun 	/* actually the struct cosa_download itself; this is to keep
74*4882a593Smuzhiyun 	 * the ioctl number same as in 2.4 in order to keep the user-space
75*4882a593Smuzhiyun 	 * utils compatible. */
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun /* Read the device type (one of "srp", "cosa", and "cosa8" for now) */
78*4882a593Smuzhiyun #define COSAIORTYPE	_IOR('C',0xf3, char *)
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun /* Read the device identification string */
81*4882a593Smuzhiyun #define COSAIORIDSTR	_IOR('C',0xf4, char *)
82*4882a593Smuzhiyun /* Maximum length of the identification string. */
83*4882a593Smuzhiyun #define COSA_MAX_ID_STRING 128
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun /* Increment/decrement the module usage count :-) */
86*4882a593Smuzhiyun /* #define COSAIOMINC	_IO('C',0xf5) */
87*4882a593Smuzhiyun /* #define COSAIOMDEC	_IO('C',0xf6) */
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun /* Get the total number of cards installed */
90*4882a593Smuzhiyun #define COSAIONRCARDS	_IO('C',0xf7)
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun /* Get the number of channels on this card */
93*4882a593Smuzhiyun #define COSAIONRCHANS	_IO('C',0xf8)
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun /* Set the driver for the bus-master operations */
96*4882a593Smuzhiyun #define COSAIOBMSET	_IOW('C', 0xf9, unsigned short)
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun #define COSA_BM_OFF	0	/* Bus-mastering off - use ISA DMA (default) */
99*4882a593Smuzhiyun #define COSA_BM_ON	1	/* Bus-mastering on - faster but untested */
100*4882a593Smuzhiyun 
101*4882a593Smuzhiyun /* Gets the busmaster status */
102*4882a593Smuzhiyun #define COSAIOBMGET	_IO('C', 0xfa)
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun #endif /* !COSA_H__ */
105