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