hw/mips/malta: Split FPGA LEDs/ASCII display updates

No need to refresh the ASCII bar when a LED is toggled
(and vice versa).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230104133935.4639-3-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2022-12-30 15:35:24 +01:00
parent 3db29dcac2
commit e7a65ba694

View File

@ -106,11 +106,10 @@ static struct _loaderparams {
} loaderparams;
/* Malta FPGA */
static void malta_fpga_update_display(void *opaque)
static void malta_fpga_update_display_leds(MaltaFPGAState *s)
{
char leds_text[9];
int i;
MaltaFPGAState *s = opaque;
for (i = 7 ; i >= 0 ; i--) {
if (s->leds & (1 << i)) {
@ -123,6 +122,10 @@ static void malta_fpga_update_display(void *opaque)
qemu_chr_fe_printf(&s->display, "\e[H\n\n|\e[32m%-8.8s\e[00m|\r\n",
leds_text);
}
static void malta_fpga_update_display_ascii(MaltaFPGAState *s)
{
qemu_chr_fe_printf(&s->display, "\n\n\n\n|\e[31m%-8.8s\e[00m|",
s->display_text);
}
@ -457,13 +460,13 @@ static void malta_fpga_write(void *opaque, hwaddr addr,
/* LEDBAR Register */
case 0x00408:
s->leds = val & 0xff;
malta_fpga_update_display(s);
malta_fpga_update_display_leds(s);
break;
/* ASCIIWORD Register */
case 0x00410:
snprintf(s->display_text, 9, "%08X", (uint32_t)val);
malta_fpga_update_display(s);
malta_fpga_update_display_ascii(s);
break;
/* ASCIIPOS0 to ASCIIPOS7 Registers */
@ -476,7 +479,7 @@ static void malta_fpga_write(void *opaque, hwaddr addr,
case 0x00448:
case 0x00450:
s->display_text[(saddr - 0x00418) >> 3] = (char) val;
malta_fpga_update_display(s);
malta_fpga_update_display_ascii(s);
break;
/* SOFTRES Register */