1 /* $Id: cosa.h,v 1.6 1999/01/06 14:02:44 kas Exp $ */
2 
3 /*
4  *  Copyright (C) 1995-1997  Jan "Yenya" Kasprzak <kas@fi.muni.cz>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 #ifndef COSA_H__
22 #define COSA_H__
23 
24 #include <linux/ioctl.h>
25 
26 #ifdef __KERNEL__
27 /* status register - output bits */
28 #define SR_RX_DMA_ENA   0x04    /* receiver DMA enable bit */
29 #define SR_TX_DMA_ENA   0x08    /* transmitter DMA enable bit */
30 #define SR_RST          0x10    /* SRP reset */
31 #define SR_USR_INT_ENA  0x20    /* user interrupt enable bit */
32 #define SR_TX_INT_ENA   0x40    /* transmitter interrupt enable bit */
33 #define SR_RX_INT_ENA   0x80    /* receiver interrupt enable bit */
34 
35 /* status register - input bits */
36 #define SR_USR_RQ       0x20    /* user interrupt request pending */
37 #define SR_TX_RDY       0x40    /* transmitter empty (ready) */
38 #define SR_RX_RDY       0x80    /* receiver data ready */
39 
40 #define SR_UP_REQUEST   0x02    /* request from SRP to transfer data
41                                    up to PC */
42 #define SR_DOWN_REQUEST 0x01    /* SRP is able to transfer data down
43                                    from PC to SRP */
44 #define SR_END_OF_TRANSFER      0x03    /* SRP signalize end of
45                                            transfer (up or down) */
46 
47 #define SR_CMD_FROM_SRP_MASK    0x03    /* mask to get SRP command */
48 
49 /* bits in driver status byte definitions : */
50 #define SR_RDY_RCV      0x01    /* ready to receive packet */
51 #define SR_RDY_SND      0x02    /* ready to send packet */
52 #define SR_CMD_PND      0x04    /* command pending */ /* not currently used */
53 
54 /* ???? */
55 #define SR_PKT_UP       0x01    /* transfer of packet up in progress */
56 #define SR_PKT_DOWN     0x02    /* transfer of packet down in progress */
57 
58 #endif /* __KERNEL__ */
59 
60 #define SR_LOAD_ADDR    0x4400  /* SRP microcode load address */
61 #define SR_START_ADDR   0x4400  /* SRP microcode start address */
62 
63 #define COSA_LOAD_ADDR    0x400  /* SRP microcode load address */
64 #define COSA_MAX_FIRMWARE_SIZE	0x10000
65 
66 /* ioctls */
67 struct cosa_download {
68 	int addr, len;
69 	char __user *code;
70 };
71 
72 /* Reset the device */
73 #define COSAIORSET	_IO('C',0xf0)
74 
75 /* Start microcode at given address */
76 #define COSAIOSTRT	_IOW('C',0xf1, int)
77 
78 /* Read the block from the device memory */
79 #define COSAIORMEM	_IOWR('C',0xf2, struct cosa_download *)
80 	/* actually the struct cosa_download itself; this is to keep
81 	 * the ioctl number same as in 2.4 in order to keep the user-space
82 	 * utils compatible. */
83 
84 /* Write the block to the device memory (i.e. download the microcode) */
85 #define COSAIODOWNLD	_IOW('C',0xf2, struct cosa_download *)
86 	/* actually the struct cosa_download itself; this is to keep
87 	 * the ioctl number same as in 2.4 in order to keep the user-space
88 	 * utils compatible. */
89 
90 /* Read the device type (one of "srp", "cosa", and "cosa8" for now) */
91 #define COSAIORTYPE	_IOR('C',0xf3, char *)
92 
93 /* Read the device identification string */
94 #define COSAIORIDSTR	_IOR('C',0xf4, char *)
95 /* Maximum length of the identification string. */
96 #define COSA_MAX_ID_STRING 128
97 
98 /* Increment/decrement the module usage count :-) */
99 /* #define COSAIOMINC	_IO('C',0xf5) */
100 /* #define COSAIOMDEC	_IO('C',0xf6) */
101 
102 /* Get the total number of cards installed */
103 #define COSAIONRCARDS	_IO('C',0xf7)
104 
105 /* Get the number of channels on this card */
106 #define COSAIONRCHANS	_IO('C',0xf8)
107 
108 /* Set the driver for the bus-master operations */
109 #define COSAIOBMSET	_IOW('C', 0xf9, unsigned short)
110 
111 #define COSA_BM_OFF	0	/* Bus-mastering off - use ISA DMA (default) */
112 #define COSA_BM_ON	1	/* Bus-mastering on - faster but untested */
113 
114 /* Gets the busmaster status */
115 #define COSAIOBMGET	_IO('C', 0xfa)
116 
117 #endif /* !COSA_H__ */
118