more debug output
[linux-2.4.git] / include / asm-cris / etraxgpio.h
1 /*
2  * The following devices are accessable using this driver using
3  * GPIO_MAJOR (120) and a couple of minor numbers:
4  * /dev/gpioa  minor 0, 8 bit GPIO, each bit can change direction
5  * /dev/gpiob  minor 1, 8 bit GPIO, each bit can change direction
6  * /dev/leds   minor 2, Access to leds depending on kernelconfig
7  * /dev/gpiog  minor 3
8  *       g0dir, g8_15dir, g16_23dir, g24 dir configurable in R_GEN_CONFIG
9  *       g1-g7 and g25-g31 is both input and outputs but on different pins
10  *       Also note that some bits change pins depending on what interfaces
11  *       are enabled.
12  */
13
14 #ifndef _ASM_ETRAXGPIO_H
15 #define _ASM_ETRAXGPIO_H
16
17 /* etraxgpio _IOC_TYPE, bits 8 to 15 in ioctl cmd */
18
19 #define ETRAXGPIO_IOCTYPE 43
20 #define GPIO_MINOR_A 0
21 #define GPIO_MINOR_B 1
22 #define GPIO_MINOR_LEDS 2
23 #define GPIO_MINOR_G 3
24 #define GPIO_MINOR_LAST 3
25
26 /* supported ioctl _IOC_NR's */
27
28 #define IO_READBITS  0x1  /* read and return current port bits (obsolete) */
29 #define IO_SETBITS   0x2  /* set the bits marked by 1 in the argument */
30 #define IO_CLRBITS   0x3  /* clear the bits marked by 1 in the argument */
31
32 /* the alarm is waited for by select() */
33
34 #define IO_HIGHALARM 0x4  /* set alarm on high for bits marked by 1 */
35 #define IO_LOWALARM  0x5  /* set alarm on low for bits marked by 1 */
36 #define IO_CLRALARM  0x6  /* clear alarm for bits marked by 1 */
37
38 /* LED ioctl */
39 #define IO_LEDACTIVE_SET 0x7 /* set active led
40                               * 0=off, 1=green, 2=red, 3=yellow */
41
42 /* GPIO direction ioctl's */
43 #define IO_READDIR    0x8  /* Read direction 0=input 1=output  (obsolete) */
44 #define IO_SETINPUT   0x9  /* Set direction for bits set, 0=unchanged 1=input,
45                               returns mask with current inputs (obsolete) */
46 #define IO_SETOUTPUT  0xA  /* Set direction for bits set, 0=unchanged 1=output,
47                               returns mask with current outputs (obsolete)*/
48
49 /* LED ioctl extended */
50 #define IO_LED_SETBIT 0xB
51 #define IO_LED_CLRBIT 0xC
52
53 /* SHUTDOWN ioctl */
54 #define IO_SHUTDOWN   0xD
55 #define IO_GET_PWR_BT 0xE
56
57 /* Bit toggling in driver settings */
58 /* bit set in low byte0 is CLK mask (0x00FF),
59    bit set in byte1 is DATA mask    (0xFF00)
60    msb, data_mask[7:0] , clk_mask[7:0]
61  */
62 #define IO_CFG_WRITE_MODE 0xF
63 #define IO_CFG_WRITE_MODE_VALUE(msb, data_mask, clk_mask) \
64   ( (((msb)&1) << 16) | (((data_mask) &0xFF) << 8) | ((clk_mask) & 0xFF) )
65
66 /* The following 4 ioctl's take a pointer as argument and handles
67  * 32 bit ports (port G) properly.
68  * These replaces IO_READBITS,IO_SETINPUT AND IO_SETOUTPUT
69  */
70 #define IO_READ_INBITS   0x10 /* *arg is result of reading the input pins */
71 #define IO_READ_OUTBITS  0x11 /* *arg is result of reading the output shadow */
72 #define IO_SETGET_INPUT  0x12 /* bits set in *arg is set to input,
73                                * *arg updated with current input pins.
74                                */
75 #define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output,
76                                * *arg updated with current output pins.
77                                */
78
79 #endif