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>
7 #include <linux/config.h>
11 crisv32_io_dir_in
= 0,
12 crisv32_io_dir_out
= 1
19 unsigned long* data_in
;
20 unsigned int pin_count
;
25 struct crisv32_ioport
* port
;
29 extern struct crisv32_ioport crisv32_ioports
[];
31 extern struct crisv32_iopin crisv32_led1_green
;
32 extern struct crisv32_iopin crisv32_led1_red
;
33 extern struct crisv32_iopin crisv32_led2_green
;
34 extern struct crisv32_iopin crisv32_led2_red
;
35 extern struct crisv32_iopin crisv32_led3_green
;
36 extern struct crisv32_iopin crisv32_led3_red
;
38 static inline void crisv32_io_set(struct crisv32_iopin
* iopin
,
42 *iopin
->port
->data
|= iopin
->bit
;
44 *iopin
->port
->data
&= ~iopin
->bit
;
47 static inline void crisv32_io_set_dir(struct crisv32_iopin
* iopin
,
48 enum crisv32_io_dir dir
)
50 if (dir
== crisv32_io_dir_in
)
51 *iopin
->port
->oe
&= ~iopin
->bit
;
53 *iopin
->port
->oe
|= iopin
->bit
;
56 static inline int crisv32_io_rd(struct crisv32_iopin
* iopin
)
58 return ((*iopin
->port
->data_in
& iopin
->bit
) ? 1 : 0);
61 int crisv32_io_get(struct crisv32_iopin
* iopin
,
62 unsigned int port
, unsigned int pin
);
63 int crisv32_io_get_name(struct crisv32_iopin
* iopin
,
67 #define LED_GREEN 0x01
69 #define LED_ORANGE (LED_GREEN | LED_RED)
71 #define LED_NETWORK_SET(x) \
73 LED_NETWORK_SET_G((x) & LED_GREEN); \
74 LED_NETWORK_SET_R((x) & LED_RED); \
76 #define LED_ACTIVE_SET(x) \
78 LED_ACTIVE_SET_G((x) & LED_GREEN); \
79 LED_ACTIVE_SET_R((x) & LED_RED); \
82 #define LED_NETWORK_SET_G(x) \
83 crisv32_io_set(&crisv32_led1_green, !(x));
84 #define LED_NETWORK_SET_R(x) \
85 crisv32_io_set(&crisv32_led1_red, !(x));
86 #define LED_ACTIVE_SET_G(x) \
87 crisv32_io_set(&crisv32_led2_green, !(x));
88 #define LED_ACTIVE_SET_R(x) \
89 crisv32_io_set(&crisv32_led2_red, !(x));
90 #define LED_DISK_WRITE(x) \
92 crisv32_io_set(&crisv32_led3_green, !(x)); \
93 crisv32_io_set(&crisv32_led3_red, !(x)); \
95 #define LED_DISK_READ(x) \
96 crisv32_io_set(&crisv32_led3_green, !(x));