2003-06-19 23:01:32 +00:00
|
|
|
/*
|
|
|
|
* asm/status_led.h
|
|
|
|
*
|
|
|
|
* MPC8xx/MPC8260/MPC5xx based status led support functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASM_STATUS_LED_H__
|
|
|
|
#define __ASM_STATUS_LED_H__
|
|
|
|
|
2016-07-15 17:44:45 +00:00
|
|
|
/* if not overridden */
|
2017-01-19 08:51:45 +00:00
|
|
|
#ifndef CONFIG_LED_STATUS_BOARD_SPECIFIC
|
2003-06-19 23:01:32 +00:00
|
|
|
# if defined(CONFIG_8xx)
|
|
|
|
# include <mpc8xx.h>
|
2014-03-05 08:40:10 +00:00
|
|
|
# elif defined(CONFIG_MPC8260)
|
2003-06-19 23:01:32 +00:00
|
|
|
# include <mpc8260.h>
|
|
|
|
# elif defined(CONFIG_5xx)
|
|
|
|
# include <mpc5xx.h>
|
|
|
|
# else
|
|
|
|
# error CPU specific Status LED header file missing.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* led_id_t is unsigned long mask */
|
|
|
|
typedef unsigned long led_id_t;
|
|
|
|
|
|
|
|
static inline void __led_init (led_id_t mask, int state)
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
|
2003-06-19 23:01:32 +00:00
|
|
|
|
|
|
|
#ifdef STATUS_LED_PAR
|
|
|
|
immr->STATUS_LED_PAR &= ~mask;
|
|
|
|
#endif
|
|
|
|
#ifdef STATUS_LED_ODR
|
|
|
|
immr->STATUS_LED_ODR &= ~mask;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (STATUS_LED_ACTIVE == 0)
|
2017-01-19 08:51:45 +00:00
|
|
|
if (state == CONFIG_LED_STATUS_ON)
|
2003-06-19 23:01:32 +00:00
|
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
|
|
else
|
|
|
|
immr->STATUS_LED_DAT |= mask;
|
|
|
|
#else
|
2017-01-19 08:51:45 +00:00
|
|
|
if (state == CONFIG_LED_STATUS_ON)
|
2003-06-19 23:01:32 +00:00
|
|
|
immr->STATUS_LED_DAT |= mask;
|
|
|
|
else
|
|
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
|
|
#endif
|
|
|
|
#ifdef STATUS_LED_DIR
|
|
|
|
immr->STATUS_LED_DIR |= mask;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __led_toggle (led_id_t mask)
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
((immap_t *) CONFIG_SYS_IMMR)->STATUS_LED_DAT ^= mask;
|
2003-06-19 23:01:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __led_set (led_id_t mask, int state)
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
|
2003-06-19 23:01:32 +00:00
|
|
|
|
|
|
|
#if (STATUS_LED_ACTIVE == 0)
|
2017-01-19 08:51:45 +00:00
|
|
|
if (state == CONFIG_LED_STATUS_ON)
|
2003-06-19 23:01:32 +00:00
|
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
|
|
else
|
|
|
|
immr->STATUS_LED_DAT |= mask;
|
|
|
|
#else
|
2017-01-19 08:51:45 +00:00
|
|
|
if (state == CONFIG_LED_STATUS_ON)
|
2003-06-19 23:01:32 +00:00
|
|
|
immr->STATUS_LED_DAT |= mask;
|
|
|
|
else
|
|
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ASM_STATUS_LED_H__ */
|