x86: local.h fix checkpatch warnings
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / asm-cris / arch-v32 / io.h
blob5efe4d9490018f6145451f84fec1a781c9be2b8b
1 #ifndef _ASM_ARCH_CRIS_IO_H
2 #define _ASM_ARCH_CRIS_IO_H
4 #include <asm/arch/hwregs/reg_map.h>
5 #include <asm/arch/hwregs/reg_rdwr.h>
6 #include <asm/arch/hwregs/gio_defs.h>
8 enum crisv32_io_dir
10 crisv32_io_dir_in = 0,
11 crisv32_io_dir_out = 1
14 struct crisv32_ioport
16 unsigned long* oe;
17 unsigned long* data;
18 unsigned long* data_in;
19 unsigned int pin_count;
22 struct crisv32_iopin
24 struct crisv32_ioport* port;
25 int bit;
28 extern struct crisv32_ioport crisv32_ioports[];
30 extern struct crisv32_iopin crisv32_led1_green;
31 extern struct crisv32_iopin crisv32_led1_red;
32 extern struct crisv32_iopin crisv32_led2_green;
33 extern struct crisv32_iopin crisv32_led2_red;
34 extern struct crisv32_iopin crisv32_led3_green;
35 extern struct crisv32_iopin crisv32_led3_red;
37 static inline void crisv32_io_set(struct crisv32_iopin* iopin,
38 int val)
40 if (val)
41 *iopin->port->data |= iopin->bit;
42 else
43 *iopin->port->data &= ~iopin->bit;
46 static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin,
47 enum crisv32_io_dir dir)
49 if (dir == crisv32_io_dir_in)
50 *iopin->port->oe &= ~iopin->bit;
51 else
52 *iopin->port->oe |= iopin->bit;
55 static inline int crisv32_io_rd(struct crisv32_iopin* iopin)
57 return ((*iopin->port->data_in & iopin->bit) ? 1 : 0);
60 int crisv32_io_get(struct crisv32_iopin* iopin,
61 unsigned int port, unsigned int pin);
62 int crisv32_io_get_name(struct crisv32_iopin* iopin,
63 char* name);
65 #define LED_OFF 0x00
66 #define LED_GREEN 0x01
67 #define LED_RED 0x02
68 #define LED_ORANGE (LED_GREEN | LED_RED)
70 #define LED_NETWORK_SET(x) \
71 do { \
72 LED_NETWORK_SET_G((x) & LED_GREEN); \
73 LED_NETWORK_SET_R((x) & LED_RED); \
74 } while (0)
75 #define LED_ACTIVE_SET(x) \
76 do { \
77 LED_ACTIVE_SET_G((x) & LED_GREEN); \
78 LED_ACTIVE_SET_R((x) & LED_RED); \
79 } while (0)
81 #define LED_NETWORK_SET_G(x) \
82 crisv32_io_set(&crisv32_led1_green, !(x));
83 #define LED_NETWORK_SET_R(x) \
84 crisv32_io_set(&crisv32_led1_red, !(x));
85 #define LED_ACTIVE_SET_G(x) \
86 crisv32_io_set(&crisv32_led2_green, !(x));
87 #define LED_ACTIVE_SET_R(x) \
88 crisv32_io_set(&crisv32_led2_red, !(x));
89 #define LED_DISK_WRITE(x) \
90 do{\
91 crisv32_io_set(&crisv32_led3_green, !(x)); \
92 crisv32_io_set(&crisv32_led3_red, !(x)); \
93 }while(0)
94 #define LED_DISK_READ(x) \
95 crisv32_io_set(&crisv32_led3_green, !(x));
97 #endif