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>
10 crisv32_io_dir_in
= 0,
11 crisv32_io_dir_out
= 1
18 unsigned long* data_in
;
19 unsigned int pin_count
;
24 struct crisv32_ioport
* port
;
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
,
41 *iopin
->port
->data
|= iopin
->bit
;
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
;
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
,
66 #define LED_GREEN 0x01
68 #define LED_ORANGE (LED_GREEN | LED_RED)
70 #define LED_NETWORK_SET(x) \
72 LED_NETWORK_SET_G((x) & LED_GREEN); \
73 LED_NETWORK_SET_R((x) & LED_RED); \
75 #define LED_ACTIVE_SET(x) \
77 LED_ACTIVE_SET_G((x) & LED_GREEN); \
78 LED_ACTIVE_SET_R((x) & LED_RED); \
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) \
91 crisv32_io_set(&crisv32_led3_green, !(x)); \
92 crisv32_io_set(&crisv32_led3_red, !(x)); \
94 #define LED_DISK_READ(x) \
95 crisv32_io_set(&crisv32_led3_green, !(x));