CRIS: Rename LED macros to CRIS_LED to avoid name clash in io.h

This is done to avoid collision with linux/leds.h
This commit is contained in:
Jesper Nilsson 2008-01-28 16:49:39 +01:00
parent a1a7dc1d06
commit 0d9f2e6f86
2 changed files with 77 additions and 72 deletions

View File

@ -23,7 +23,7 @@ extern volatile unsigned long *port_cse1_addr;
extern volatile unsigned long *port_csp0_addr; extern volatile unsigned long *port_csp0_addr;
extern volatile unsigned long *port_csp4_addr; extern volatile unsigned long *port_csp4_addr;
/* macro for setting regs through a shadow - /* macro for setting regs through a shadow -
* r = register name (like R_PORT_PA_DATA) * r = register name (like R_PORT_PA_DATA)
* s = shadow name (like port_pa_data_shadow) * s = shadow name (like port_pa_data_shadow)
* b = bit number * b = bit number
@ -38,83 +38,89 @@ extern volatile unsigned long *port_csp4_addr;
#undef CONFIG_ETRAX_PA_LEDS #undef CONFIG_ETRAX_PA_LEDS
#undef CONFIG_ETRAX_PB_LEDS #undef CONFIG_ETRAX_PB_LEDS
#undef CONFIG_ETRAX_CSP0_LEDS #undef CONFIG_ETRAX_CSP0_LEDS
#define LED_NETWORK_SET_G(x) #define CRIS_LED_NETWORK_SET_G(x)
#define LED_NETWORK_SET_R(x) #define CRIS_LED_NETWORK_SET_R(x)
#define LED_ACTIVE_SET_G(x) #define CRIS_LED_ACTIVE_SET_G(x)
#define LED_ACTIVE_SET_R(x) #define CRIS_LED_ACTIVE_SET_R(x)
#define LED_DISK_WRITE(x) #define CRIS_LED_DISK_WRITE(x)
#define LED_DISK_READ(x) #define CRIS_LED_DISK_READ(x)
#endif #endif
#if !defined(CONFIG_ETRAX_CSP0_LEDS) #if !defined(CONFIG_ETRAX_CSP0_LEDS)
#define LED_BIT_SET(x) #define CRIS_LED_BIT_SET(x)
#define LED_BIT_CLR(x) #define CRIS_LED_BIT_CLR(x)
#endif #endif
#define LED_OFF 0x00 #define CRIS_LED_OFF 0x00
#define LED_GREEN 0x01 #define CRIS_LED_GREEN 0x01
#define LED_RED 0x02 #define CRIS_LED_RED 0x02
#define LED_ORANGE (LED_GREEN | LED_RED) #define CRIS_LED_ORANGE (CRIS_LED_GREEN | CRIS_LED_RED)
#if CONFIG_ETRAX_LED1G == CONFIG_ETRAX_LED1R #if defined(CONFIG_ETRAX_NO_LEDS)
#define LED_NETWORK_SET(x) \ #define CRIS_LED_NETWORK_SET(x)
#else
#if CONFIG_ETRAX_LED1G == CONFIG_ETRAX_LED1R
#define CRIS_LED_NETWORK_SET(x) \
do { \ do { \
LED_NETWORK_SET_G((x) & LED_GREEN); \ CRIS_LED_NETWORK_SET_G((x) & CRIS_LED_GREEN); \
} while (0) } while (0)
#else #else
#define LED_NETWORK_SET(x) \ #define CRIS_LED_NETWORK_SET(x) \
do { \ do { \
LED_NETWORK_SET_G((x) & LED_GREEN); \ CRIS_LED_NETWORK_SET_G((x) & CRIS_LED_GREEN); \
LED_NETWORK_SET_R((x) & LED_RED); \ CRIS_LED_NETWORK_SET_R((x) & CRIS_LED_RED); \
} while (0) } while (0)
#endif #endif
#if CONFIG_ETRAX_LED2G == CONFIG_ETRAX_LED2R #if CONFIG_ETRAX_LED2G == CONFIG_ETRAX_LED2R
#define LED_ACTIVE_SET(x) \ #define CRIS_LED_ACTIVE_SET(x) \
do { \ do { \
LED_ACTIVE_SET_G((x) & LED_GREEN); \ CRIS_LED_ACTIVE_SET_G((x) & CRIS_LED_GREEN); \
} while (0) } while (0)
#else #else
#define LED_ACTIVE_SET(x) \ #define CRIS_LED_ACTIVE_SET(x) \
do { \ do { \
LED_ACTIVE_SET_G((x) & LED_GREEN); \ CRIS_LED_ACTIVE_SET_G((x) & CRIS_LED_GREEN); \
LED_ACTIVE_SET_R((x) & LED_RED); \ CRIS_LED_ACTIVE_SET_R((x) & CRIS_LED_RED); \
} while (0) } while (0)
#endif #endif
#endif
#ifdef CONFIG_ETRAX_PA_LEDS #ifdef CONFIG_ETRAX_PA_LEDS
#define LED_NETWORK_SET_G(x) \ #define CRIS_LED_NETWORK_SET_G(x) \
REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED1G, !(x)) REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED1G, !(x))
#define LED_NETWORK_SET_R(x) \ #define CRIS_LED_NETWORK_SET_R(x) \
REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED1R, !(x)) REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED1R, !(x))
#define LED_ACTIVE_SET_G(x) \ #define CRIS_LED_ACTIVE_SET_G(x) \
REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED2G, !(x)) REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED2G, !(x))
#define LED_ACTIVE_SET_R(x) \ #define CRIS_LED_ACTIVE_SET_R(x) \
REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED2R, !(x)) REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED2R, !(x))
#define LED_DISK_WRITE(x) \ #define CRIS_LED_DISK_WRITE(x) \
do{\ do{\
REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3G, !(x));\ REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3G, !(x));\
REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3R, !(x));\ REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3R, !(x));\
}while(0) }while(0)
#define LED_DISK_READ(x) \ #define CRIS_LED_DISK_READ(x) \
REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3G, !(x)) REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, \
CONFIG_ETRAX_LED3G, !(x))
#endif #endif
#ifdef CONFIG_ETRAX_PB_LEDS #ifdef CONFIG_ETRAX_PB_LEDS
#define LED_NETWORK_SET_G(x) \ #define CRIS_LED_NETWORK_SET_G(x) \
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED1G, !(x)) REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED1G, !(x))
#define LED_NETWORK_SET_R(x) \ #define CRIS_LED_NETWORK_SET_R(x) \
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED1R, !(x)) REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED1R, !(x))
#define LED_ACTIVE_SET_G(x) \ #define CRIS_LED_ACTIVE_SET_G(x) \
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED2G, !(x)) REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED2G, !(x))
#define LED_ACTIVE_SET_R(x) \ #define CRIS_LED_ACTIVE_SET_R(x) \
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED2R, !(x)) REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED2R, !(x))
#define LED_DISK_WRITE(x) \ #define CRIS_LED_DISK_WRITE(x) \
do{\ do{\
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3G, !(x));\ REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3G, !(x));\
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3R, !(x));\ REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3R, !(x));\
}while(0) }while(0)
#define LED_DISK_READ(x) \ #define CRIS_LED_DISK_READ(x) \
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3G, !(x)) REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, \
CONFIG_ETRAX_LED3G, !(x))
#endif #endif
#ifdef CONFIG_ETRAX_CSP0_LEDS #ifdef CONFIG_ETRAX_CSP0_LEDS
@ -130,27 +136,27 @@ extern volatile unsigned long *port_csp4_addr;
(1 << CONFIG_ETRAX_LED10Y ) |(1 << CONFIG_ETRAX_LED11Y )|\ (1 << CONFIG_ETRAX_LED10Y ) |(1 << CONFIG_ETRAX_LED11Y )|\
(1 << CONFIG_ETRAX_LED12R )) (1 << CONFIG_ETRAX_LED12R ))
#define LED_NETWORK_SET_G(x) \ #define CRIS_LED_NETWORK_SET_G(x) \
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED1G, !(x)) REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED1G, !(x))
#define LED_NETWORK_SET_R(x) \ #define CRIS_LED_NETWORK_SET_R(x) \
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED1R, !(x)) REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED1R, !(x))
#define LED_ACTIVE_SET_G(x) \ #define CRIS_LED_ACTIVE_SET_G(x) \
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED2G, !(x)) REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED2G, !(x))
#define LED_ACTIVE_SET_R(x) \ #define CRIS_LED_ACTIVE_SET_R(x) \
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED2R, !(x)) REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED2R, !(x))
#define LED_DISK_WRITE(x) \ #define CRIS_LED_DISK_WRITE(x) \
do{\ do{\
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3G, !(x));\ REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3G, !(x));\
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3R, !(x));\ REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3R, !(x));\
}while(0) }while(0)
#define LED_DISK_READ(x) \ #define CRIS_LED_DISK_READ(x) \
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3G, !(x)) REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3G, !(x))
#define LED_BIT_SET(x)\ #define CRIS_LED_BIT_SET(x)\
do{\ do{\
if((( 1 << x) & CONFIGURABLE_LEDS) != 0)\ if((( 1 << x) & CONFIGURABLE_LEDS) != 0)\
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, x, 1);\ REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, x, 1);\
}while(0) }while(0)
#define LED_BIT_CLR(x)\ #define CRIS_LED_BIT_CLR(x)\
do{\ do{\
if((( 1 << x) & CONFIGURABLE_LEDS) != 0)\ if((( 1 << x) & CONFIGURABLE_LEDS) != 0)\
REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, x, 0);\ REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, x, 0);\

View File

@ -41,8 +41,7 @@ extern struct crisv32_iopin crisv32_led_net0_red;
extern struct crisv32_iopin crisv32_led_net1_green; extern struct crisv32_iopin crisv32_led_net1_green;
extern struct crisv32_iopin crisv32_led_net1_red; extern struct crisv32_iopin crisv32_led_net1_red;
static inline void crisv32_io_set(struct crisv32_iopin* iopin, static inline void crisv32_io_set(struct crisv32_iopin *iopin, int val)
int val)
{ {
long flags; long flags;
spin_lock_irqsave(&iopin->port->lock, flags); spin_lock_irqsave(&iopin->port->lock, flags);
@ -79,59 +78,59 @@ int crisv32_io_get(struct crisv32_iopin* iopin,
int crisv32_io_get_name(struct crisv32_iopin* iopin, int crisv32_io_get_name(struct crisv32_iopin* iopin,
const char *name); const char *name);
#define LED_OFF 0x00 #define CRIS_LED_OFF 0x00
#define LED_GREEN 0x01 #define CRIS_LED_GREEN 0x01
#define LED_RED 0x02 #define CRIS_LED_RED 0x02
#define LED_ORANGE (LED_GREEN | LED_RED) #define CRIS_LED_ORANGE (CRIS_LED_GREEN | CRIS_LED_RED)
#if (defined(CONFIG_ETRAX_NBR_LED_GRP_ONE) || defined(CONFIG_ETRAX_NBR_LED_GRP_TWO)) #if (defined(CONFIG_ETRAX_NBR_LED_GRP_ONE) || defined(CONFIG_ETRAX_NBR_LED_GRP_TWO))
#define LED_NETWORK_GRP0_SET(x) \ #define CRIS_LED_NETWORK_GRP0_SET(x) \
do { \ do { \
LED_NETWORK_GRP0_SET_G((x) & LED_GREEN); \ CRIS_LED_NETWORK_GRP0_SET_G((x) & CRIS_LED_GREEN); \
LED_NETWORK_GRP0_SET_R((x) & LED_RED); \ CRIS_LED_NETWORK_GRP0_SET_R((x) & CRIS_LED_RED); \
} while (0) } while (0)
#else #else
#define LED_NETWORK_GRP0_SET(x) while (0) {} #define CRIS_LED_NETWORK_GRP0_SET(x) while (0) {}
#endif #endif
#define LED_NETWORK_GRP0_SET_G(x) \ #define CRIS_LED_NETWORK_GRP0_SET_G(x) \
crisv32_io_set(&crisv32_led_net0_green, !(x)); crisv32_io_set(&crisv32_led_net0_green, !(x));
#define LED_NETWORK_GRP0_SET_R(x) \ #define CRIS_LED_NETWORK_GRP0_SET_R(x) \
crisv32_io_set(&crisv32_led_net0_red, !(x)); crisv32_io_set(&crisv32_led_net0_red, !(x));
#if defined(CONFIG_ETRAX_NBR_LED_GRP_TWO) #if defined(CONFIG_ETRAX_NBR_LED_GRP_TWO)
#define LED_NETWORK_GRP1_SET(x) \ #define CRIS_LED_NETWORK_GRP1_SET(x) \
do { \ do { \
LED_NETWORK_GRP1_SET_G((x) & LED_GREEN); \ CRIS_LED_NETWORK_GRP1_SET_G((x) & CRIS_LED_GREEN); \
LED_NETWORK_GRP1_SET_R((x) & LED_RED); \ CRIS_LED_NETWORK_GRP1_SET_R((x) & CRIS_LED_RED); \
} while (0) } while (0)
#else #else
#define LED_NETWORK_GRP1_SET(x) while (0) {} #define CRIS_LED_NETWORK_GRP1_SET(x) while (0) {}
#endif #endif
#define LED_NETWORK_GRP1_SET_G(x) \ #define CRIS_LED_NETWORK_GRP1_SET_G(x) \
crisv32_io_set(&crisv32_led_net1_green, !(x)); crisv32_io_set(&crisv32_led_net1_green, !(x));
#define LED_NETWORK_GRP1_SET_R(x) \ #define CRIS_LED_NETWORK_GRP1_SET_R(x) \
crisv32_io_set(&crisv32_led_net1_red, !(x)); crisv32_io_set(&crisv32_led_net1_red, !(x));
#define LED_ACTIVE_SET(x) \ #define CRIS_LED_ACTIVE_SET(x) \
do { \ do { \
LED_ACTIVE_SET_G((x) & LED_GREEN); \ CRIS_LED_ACTIVE_SET_G((x) & CRIS_LED_GREEN); \
LED_ACTIVE_SET_R((x) & LED_RED); \ CRIS_LED_ACTIVE_SET_R((x) & CRIS_LED_RED); \
} while (0) } while (0)
#define LED_ACTIVE_SET_G(x) \ #define CRIS_LED_ACTIVE_SET_G(x) \
crisv32_io_set(&crisv32_led2_green, !(x)); crisv32_io_set(&crisv32_led2_green, !(x));
#define LED_ACTIVE_SET_R(x) \ #define CRIS_LED_ACTIVE_SET_R(x) \
crisv32_io_set(&crisv32_led2_red, !(x)); crisv32_io_set(&crisv32_led2_red, !(x));
#define LED_DISK_WRITE(x) \ #define CRIS_LED_DISK_WRITE(x) \
do{\ do{\
crisv32_io_set(&crisv32_led3_green, !(x)); \ crisv32_io_set(&crisv32_led3_green, !(x)); \
crisv32_io_set(&crisv32_led3_red, !(x)); \ crisv32_io_set(&crisv32_led3_red, !(x)); \
}while(0) }while(0)
#define LED_DISK_READ(x) \ #define CRIS_LED_DISK_READ(x) \
crisv32_io_set(&crisv32_led3_green, !(x)); crisv32_io_set(&crisv32_led3_green, !(x));
#endif #endif