1 #ifndef _LINUX_ETRAXVIRTEX_FPGA_H
2 #define _LINUX_ETRAXVIRTEX_FPGA_H
3 
4 /* etraxvirtex_fpga _IOC_TYPE, bits 8 to 15 in ioctl cmd */
5 
6 #define ETRAXVIRTEX_FPGA_IOCTYPE 45
7 
8 /* supported ioctl _IOC_NR's */
9 
10 /* in write operations, the argument contains both virtex
11  * register and value.
12  */
13 
14 #define VIRTEX_FPGA_WRITEARG(reg, value) (((reg) << 16) | (value))
15 #define VIRTEX_FPGA_READARG(reg) ((reg) << 16)
16 
17 #define VIRTEX_FPGA_ARGREG(arg) (((arg) >> 16) & 0x0fff)
18 #define VIRTEX_FPGA_ARGVALUE(arg) ((arg) & 0xffff)
19 
20 #define VIRTEX_FPGA_WRITEREG 0x1   /* write to an (FPGA implemented) register */
21 #define VIRTEX_FPGA_READREG  0x2   /* read from an (FPGA implemented register */
22 
23 /*
24 EXAMPLE usage:
25 
26     virtex_arg = VIRTEX_FPGA_WRITEARG( reg, val);
27     ioctl(fd, _IO(ETRAXVIRTEX_FPGA_IOCTYPE, VIRTEX_FPGA_WRITEREG), virtex_arg);
28 
29     virtex_arg = VIRTEX_FPGA_READARG( reg);
30     val = ioctl(fd, _IO(ETRAXVIRTEX_FPGA_IOCTYPE, VIRTEX_FPGA_READREG), virtex_arg);
31 
32 */
33 #endif
34