00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
#ifndef _LINUX_GUPPI_H
00017
#define _LINUX_GUPPI_H
00018
00019
#include <linux/ioctl.h>
00020
#include <linux/pci.h>
00021
00022
#ifdef __KERNEL__
00023
#include <asm/spinlock.h>
00024
#endif
00025
00026
#ifndef PCI_VENDOR_ID_TNS
00027 #define PCI_VENDOR_ID_TNS 0x6969
00028
#endif
00029
00030
#ifndef PCI_DEVICE_ID_GUPPI
00031 #define PCI_DEVICE_ID_GUPPI 0x9696
00032
#endif
00033
00034 #define NR_CARDS 1
00035
00036
00037
00038
00039
00040
00041
00042 #define GUP_TXDATA_FIFO_RS 0x00000001
00043 #define GUP_RXDATA_FIFO_RS 0x00000002
00044 #define GUP_TXPG_FIFO_RS 0x00000004
00045 #define GUP_RXPG_FIFO_RS 0x00000008
00046 #define GUP_RXREG_RS 0x00000010
00047 #define GUP_TXREG_RS 0x00000020
00048 #define GUP_BCK_CTRL 0x000003c0
00049 #define GUP_BCK_RS 0x00000400
00050 #define GUP_PROG_FLAGS 0x00000800
00051 #define GUP_USE_AEFLAG 0x00001000
00052 #define GUP_BCK_EN 0x00002000
00053 #define GUP_TX_EN 0x00004000
00054 #define GUP_RX_EN 0x00008000
00055 #define GUP_FAVOR_TX 0x00010000
00056 #define GUP_FAVOR_RX 0x00020000
00057 #define GUP_TXDONEINT_EN 0x00040000
00058 #define GUP_RXPGAEINT_EN 0x00080000
00059 #define GUP_TXPGAEINT_EN 0x00100000
00060 #define GUP_BCKSTATINT_EN 0x00200000
00061
00062 #define GUP_TXDONE_INT_RS 0x00400000
00063 #define GUP_RXPGAE_INT_RS 0x00800000
00064 #define GUP_TXPGAE_INT_RS 0x01000000
00065 #define GUP_BCKSTAT_INT_RS 0x02000000
00066 #define GUP_BCSTATINT_REG 0x3c000000
00067
00068 #define GUP_RX_RS 0x0080001a
00069 #define GUP_TX_RS 0x01400025
00070 #define GUP_ALL_RS 0x03c0003f
00071 #define GUP_INT_MASK 0x03c00000
00072
00073
00074
00075
00076
00077 #define GUP_BCKID 0x0000000f
00078 #define GUP_BCKSTAT 0x000000f0
00079 #define GUP_TXDAT_FLAGS 0x00001f00
00080 #define GUP_TXDAT_EF 0x00000100
00081 #define GUP_TXDAT_AE 0x00000200
00082 #define GUP_TXDAT_HF 0x00000400
00083 #define GUP_TXDAT_AF 0x00000800
00084 #define GUP_TXDAT_FF 0x00001000
00085
00086 #define GUP_RXDAT_FLAGS 0x0003e000
00087 #define GUP_RXDAT_EF 0x00002000
00088 #define GUP_RXDAT_AE 0x00004000
00089 #define GUP_RXDAT_HF 0x00008000
00090 #define GUP_RXDAT_AF 0x00010000
00091 #define GUP_RXDAT_FF 0x00020000
00092
00093 #define GUP_TXPG_FLAGS 0x007c0000
00094 #define GUP_TXPG_EF 0x00040000
00095 #define GUP_TXPG_AE 0x00080000
00096 #define GUP_TXPG_HF 0x00100000
00097 #define GUP_TXPG_AF 0x00200000
00098 #define GUP_TXPG_FF 0x00400000
00099
00100 #define GUP_RXPG_FLAGS 0x0f800000
00101 #define GUP_RXPG_EF 0x00800000
00102 #define GUP_RXPG_AE 0x01000000
00103 #define GUP_RXPG_HF 0x02000000
00104 #define GUP_RXPG_AF 0x04000000
00105 #define GUP_RXPG_FF 0x08000000
00106
00107 #define GUP_TX_PENDING 0x10000000
00108 #define GUP_RX_PENDING 0x20000000
00109 #define GUP_LAST_TRANS 0x40000000
00110
00111
00112
00113
00114
00115 #define GUP_CONTROL_OFF 0x00000000
00116 #define GUP_STATUS_OFF 0x00000004
00117 #define GUP_TXPGADDR_OFF 0x00000008
00118 #define GUP_RXPGADDR_OFF 0x0000000c
00119
00120
00121
00122
00123
00124 #define GUP_DATA_FIFO_OFF 0x00000400
00125 #define GUP_TXPG_FIFO_OFF 0x00000800
00126 #define GUP_RXPG_FIFO_OFF 0x00000c00
00127
00128
00129
00130
00131
00132 struct guppi_status {
00133 unsigned int index;
00134 unsigned int num;
00135
00136
00137
00138
00139
00140 unsigned int lost;
00141 };
00142
00143
#ifdef __KERNEL__
00144
00145
struct guppi_buf {
00146
char *buf;
00147
unsigned long *busaddrs;
00148 };
00149
00150
struct guppi_reg {
00151
volatile unsigned int gup_ctrl;
00152
volatile unsigned int gup_stat;
00153
volatile unsigned int gup_txpgreg;
00154
volatile unsigned int gup_rxpgreg;
00155 };
00156
00157
struct guppi_board {
00158
unsigned long base_addr;
00159
unsigned long phys_addr;
00160
int irq;
00161
00162
struct pci_dev *dev;
00163
unsigned int minor;
00164
unsigned int users;
00165 spinlock_t lock;
00166
00167
00168
unsigned int rxbufsize;
00169
unsigned char is_rxing;
00170
unsigned int rxoverruns;
00171
struct guppi_buf *rx_buffer;
00172
00173
00174
unsigned int rx_empty_index;
00175
unsigned int rx_user_index;
00176
00177
00178
00179
00180
00181
00182
unsigned int rx_user_num;
00183
00184
struct guppi_buf *rxjunkpage;
00185
00186
00187
00188
unsigned int txbufsize;
00189
unsigned char is_txing;
00190
unsigned int txoverruns;
00191
struct guppi_buf *tx_buffer;
00192
00193
00194
unsigned int tx_empty_index;
00195
unsigned int tx_user_index;
00196
00197
00198
00199
00200
00201
00202
unsigned int tx_user_num;
00203
00204
struct guppi_buf *txjunkpage;
00205
00206
struct guppi_board *next;
00207 };
00208
00209
00210
00211
00212
00213
#define GUPPI_MAJOR 127
00214
00215
00216
00217
00218
00219
#define TXFIFOSIZE 1024
00220
00221
00222
00223
00224
00225
#define RXFIFOSIZE 1024
00226
00227
00228
00229
#define RXAEPAGES 400
00230
00231
00232
#define RXAFPAGES (RXFIFOSIZE-2)
00233
00234
00235
00236
00237
#define RXSAFETY 20
00238
00239
00240
00241
#define TXAEPAGES 400
00242
00243
00244
#define TXAFPAGES (TXFIFOSIZE-2)
00245
00246
00247
00248
00249
#define TXSAFETY 20
00250
00251
#endif
00252
00253
00254
00255
00256
00257
00258
00259
00260 #define GIOCBRDRD _IOR( 'G', 0x00, unsigned long )
00261
00262
00263 #define GIOCBRDWR _IOW( 'G', 0x01, unsigned long )
00264
00265
00266 #define GIOCGUPRD _IOR( 'G', 0x02, unsigned long )
00267
00268
00269 #define GIOCGUPWR _IOW( 'G', 0x03, unsigned long )
00270
00271
00272 #define GIOCTSCRD _IOR( 'G', 0x04, unsigned long )
00273
00274
00275 #define GIOCTSCWR _IOW( 'G', 0x05, unsigned long )
00276
00277
00278 #define GIOCSETBUFSIZE _IOW( 'G', 0x06, unsigned int )
00279
00280
00281 #define GIOCSTART _IO( 'G', 0x07 )
00282
00283
00284 #define GIOCSTOP _IO( 'G', 0x08 )
00285
00286
00287
00288 #define GIOCSETGETSTATUS _IOWR( 'G', 0x09, struct guppi_status )
00289
00290
00291
extern int guppi_init(
void);
00292
00293
#endif