bios/cmd/cmd_bios: add leds command to set leds value.

Can be used as a first/simple/visual example to start interacting with the hardware from the CPU/BIOS.
This commit is contained in:
Florent Kermarrec 2020-11-04 10:22:14 +01:00
parent db836e8e5d
commit 2c504783ca
1 changed files with 29 additions and 0 deletions

View File

@ -131,6 +131,35 @@ define_command(flush_cpu_dcache, flush_cpu_dcache, "Flush CPU data cache", SYSTE
define_command(flush_l2_cache, flush_l2_cache, "Flush L2 cache", SYSTEM_CMDS);
#endif
/**
* Command "leds"
*
* Set Leds value
*
*/
#ifdef CSR_LEDS_BASE
static void leds_handler(int nb_params, char **params)
{
char *c;
unsigned int value;
if (nb_params < 1) {
printf("leds <value>");
return;
}
value = strtoul(params[0], &c, 0);
if (*c != 0) {
printf("Incorrect value");
return;
}
printf("Settings Leds to 0x%x", value);
leds_out_write(value);
}
define_command(leds, leds_handler, "Set Leds value", SYSTEM_CMDS);
#endif
/**
* Command "trace"