boards: spresense: Add CONFIG_ARCH_LEDS_CPU_ACTIVITY to board.h and cxd56_leds.c

Summary:
- This commit adds CPU activity LEDs feature to spresense

Impact:
- CONFIG_ARCH_LEDS_CPU_ACTIVITY=y only

Testing:
- Arch specific code and defconfigs will be commited later

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2021-03-11 16:13:35 +09:00 committed by Alin Jerpelea
parent 70836182f0
commit d4d996cc28
2 changed files with 60 additions and 0 deletions

View File

@ -114,6 +114,18 @@
#define LED_ASSERTION (BOARD_LED1_BIT | BOARD_LED2_BIT | BOARD_LED3_BIT)
#define LED_PANIC (BOARD_LED4_BIT)
#ifdef CONFIG_ARCH_LEDS_CPU_ACTIVITY
/* NOTE: LED_CPUx is not a bit pattern but just a number which
* does not conflict with existing LED bit patterns
*/
#define LED_CPU0 (100)
#define LED_CPU1 (101)
#define LED_CPU2 (102)
#define LED_CPU3 (103)
#define LED_CPU (LED_CPU0 + up_cpu_index())
#endif
/* Buttons definitions ******************************************************/
#define BOARD_NUM_BUTTONS (2)

View File

@ -108,9 +108,33 @@ void board_autoled_initialize(void)
void board_autoled_on(int led)
{
#ifdef CONFIG_ARCH_LEDS_CPU_ACTIVITY
switch (led)
{
case LED_CPU0:
cxd56_gpio_write(GPIO_LED1, 1);
break;
case LED_CPU1:
cxd56_gpio_write(GPIO_LED2, 1);
break;
case LED_CPU2:
cxd56_gpio_write(GPIO_LED3, 1);
break;
case LED_CPU3:
cxd56_gpio_write(GPIO_LED4, 1);
break;
default:
break;
}
#else
led_clrbits(BOARD_LED1_BIT | BOARD_LED2_BIT |
BOARD_LED3_BIT | BOARD_LED4_BIT);
led_setbits(led);
#endif
}
/****************************************************************************
@ -119,7 +143,31 @@ void board_autoled_on(int led)
void board_autoled_off(int led)
{
#ifdef CONFIG_ARCH_LEDS_CPU_ACTIVITY
switch (led)
{
case LED_CPU0:
cxd56_gpio_write(GPIO_LED1, 0);
break;
case LED_CPU1:
cxd56_gpio_write(GPIO_LED2, 0);
break;
case LED_CPU2:
cxd56_gpio_write(GPIO_LED3, 0);
break;
case LED_CPU3:
cxd56_gpio_write(GPIO_LED4, 0);
break;
default:
break;
}
#else
led_clrbits(led);
#endif
}
#endif /* CONFIG_ARCH_LEDS */