@@ -35,6 +35,7 @@ typedef struct LEDState {
DeviceState parent_obj;
/* Public */
+ uint16_t current_intensity;
qemu_irq irq;
/* Properties */
@@ -32,6 +32,11 @@ void led_set_intensity(LEDState *s, uint16_t new_intensity)
{
trace_led_set_intensity(s->description ? s->description : "n/a",
s->color, new_intensity);
+ if (new_intensity != s->current_intensity) {
+ trace_led_change_intensity(s->description ? s->description : "n/a",
+ s->color,
+ s->current_intensity, new_intensity);
+ }
s->current_intensity = new_intensity;
}
@@ -209,6 +209,7 @@ grlib_apb_pnp_read(uint64_t addr, uint32_t value) "APB PnP read addr:0x%03"PRIx6
# led.c
led_set_intensity(const char *color, const char *desc, uint16_t intensity) "LED desc:'%s' color:%s intensity: 0x%04"PRIx16
+led_change_intensity(const char *color, const char *desc, uint16_t old_intensity, uint16_t new_intensity) "LED desc:'%s' color:%s intensity 0x%04"PRIx16" -> 0x%04"PRIx16""
# pca9552.c
pca9552_gpio_status(const char *description, const char *buf) "%s GPIOs 0-15 [%s]"
Track the LED intensity, and emit a trace event when it changes. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- include/hw/misc/led.h | 1 + hw/misc/led.c | 5 +++++ hw/misc/trace-events | 1 + 3 files changed, 7 insertions(+)