hw/misc/max111x: Create header file for documentation, TYPE_ macros

Create a header file for the hw/misc/max111x device, in the
usual modern style for QOM devices:
 * definition of the TYPE_ constants and macros
 * definition of the device's state struct so that it can
   be embedded in other structs if desired
 * documentation of the interface

This allows us to use TYPE_MAX_1111 in the spitz.c code rather
than the string "max1111".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20200628142429.17111-12-peter.maydell@linaro.org
This commit is contained in:
Peter Maydell 2020-07-03 16:59:45 +01:00
parent 871f82722c
commit 3029681235
4 changed files with 60 additions and 24 deletions

View file

@ -29,6 +29,7 @@
#include "audio/audio.h"
#include "hw/boards.h"
#include "hw/sysbus.h"
#include "hw/misc/max111x.h"
#include "migration/vmstate.h"
#include "exec/address-spaces.h"
#include "cpu.h"
@ -732,7 +733,7 @@ static void spitz_ssp_attach(SpitzMachineState *sms)
qdev_get_gpio_in(sms->mpu->gpio, SPITZ_GPIO_TP_INT));
bus = qdev_get_child_bus(sms->mux, "ssi2");
sms->max1111 = qdev_new("max1111");
sms->max1111 = qdev_new(TYPE_MAX_1111);
max1111 = sms->max1111;
qdev_prop_set_uint8(sms->max1111, "input1" /* BATT_VOLT */,
SPITZ_BATTERY_VOLT);