From 47df2f698339cc49f762e2392bb756e5abb506e9 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 4 Aug 2022 16:31:12 +0200 Subject: [PATCH] bios/cmd_bios: Add buttons command to get buttons value. --- litex/soc/software/bios/cmds/cmd_bios.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/litex/soc/software/bios/cmds/cmd_bios.c b/litex/soc/software/bios/cmds/cmd_bios.c index 1cd290f7b..2006dd540 100644 --- a/litex/soc/software/bios/cmds/cmd_bios.c +++ b/litex/soc/software/bios/cmds/cmd_bios.c @@ -139,6 +139,22 @@ 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 "buttons" + * + * Set Buttons value + * + */ +#ifdef CSR_BUTTONS_BASE +static void buttons_handler(int nb_params, char **params) +{ + unsigned int value; + value = buttons_in_read(); + printf("Buttons value: 0x%x", value); +} +define_command(buttons, buttons_handler, "Get Buttons value", SYSTEM_CMDS); +#endif + /** * Command "leds" *