4 * MPC8xx/MPC8260/MPC5xx based status led support functions
7 #ifndef __ASM_STATUS_LED_H__
8 #define __ASM_STATUS_LED_H__
10 /* if not overriden */
11 #ifndef CONFIG_BOARD_SPECIFIC_LED
12 # if defined(CONFIG_8xx)
14 # elif defined(CONFIG_8260)
16 # elif defined(CONFIG_5xx)
19 # error CPU specific Status LED header file missing.
22 /* led_id_t is unsigned long mask */
23 typedef unsigned long led_id_t;
25 static inline void __led_init (led_id_t mask, int state)
27 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
30 immr->STATUS_LED_PAR &= ~mask;
33 immr->STATUS_LED_ODR &= ~mask;
36 #if (STATUS_LED_ACTIVE == 0)
37 if (state == STATUS_LED_ON)
38 immr->STATUS_LED_DAT &= ~mask;
40 immr->STATUS_LED_DAT |= mask;
42 if (state == STATUS_LED_ON)
43 immr->STATUS_LED_DAT |= mask;
45 immr->STATUS_LED_DAT &= ~mask;
48 immr->STATUS_LED_DIR |= mask;
52 static inline void __led_toggle (led_id_t mask)
54 ((immap_t *) CONFIG_SYS_IMMR)->STATUS_LED_DAT ^= mask;
57 static inline void __led_set (led_id_t mask, int state)
59 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
61 #if (STATUS_LED_ACTIVE == 0)
62 if (state == STATUS_LED_ON)
63 immr->STATUS_LED_DAT &= ~mask;
65 immr->STATUS_LED_DAT |= mask;
67 if (state == STATUS_LED_ON)
68 immr->STATUS_LED_DAT |= mask;
70 immr->STATUS_LED_DAT &= ~mask;
77 #endif /* __ASM_STATUS_LED_H__ */