ptimer: move declarations to ptimer.h
PATCH v5 1/2 ptimer: move declarations to ptimer.h
Signed-off-by Paolo Bonzini <[email protected]>
--- hw/arm_timer.c | 1 + hw/etraxfs_timer.c | 1 + hw/grlib_apbuart.c | 1 + hw/grlib_gptimer.c | 1 + hw/lan9118.c | 1 + hw/leon3.c | 1 + hw/lm32_timer.c | 1 + hw/mcf5206.c | 1 + hw/mcf5208.c | 1 + hw/milkymist-sysctl.c | 1 + hw/musicpal.c | 1 + hw/ptimer.c | 1 + hw/ptimer.h | 27 +++++++++++++++++++++++++++ hw/sh_timer.c | 1 + hw/slavio_timer.c | 1 + hw/xilinx_axidma.c | 1 + hw/xilinx_timer.c | 1 + qemu-timer.h | 13 ------------- 18 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 hw/ptimer.h
hw/arm_timer.c +1 -0
@@ -9,6 +9,7 @@#include "sysbus.h" #include "qemu-timer.h" +#include "ptimer.h" /* Common timer implementation. */
hw/etraxfs_timer.c +1 -0
@@ -24,6 +24,7 @@#include "sysbus.h" #include "sysemu.h" #include "qemu-timer.h" +#include "ptimer.h" #define D (x)
hw/grlib_apbuart.c +1 -0
@@ -24,6 +24,7 @@#include "sysbus.h" #include "qemu-char.h" +#include "ptimer.h" #include "trace.h"
hw/grlib_gptimer.c +1 -0
@@ -24,6 +24,7 @@#include "sysbus.h" #include "qemu-timer.h" +#include "ptimer.h" #include "trace.h"
hw/lan9118.c +1 -0
@@ -11,6 +11,7 @@#include "net.h" #include "devices.h" #include "sysemu.h" +#include "ptimer.h" /* For crc32 */ #include <zlib.h>
hw/leon3.c +1 -0
@@ -23,6 +23,7 @@*/ #include "hw.h" #include "qemu-timer.h" +#include "ptimer.h" #include "qemu-char.h" #include "sysemu.h" #include "boards.h"
hw/lm32_timer.c +1 -0
@@ -25,6 +25,7 @@#include "sysbus.h" #include "trace.h" #include "qemu-timer.h" +#include "ptimer.h" #include "qemu-error.h" #define DEFAULT_FREQUENCY (50*1000000)
hw/mcf5206.c +1 -0
@@ -8,6 +8,7 @@#include "hw.h" #include "mcf.h" #include "qemu-timer.h" +#include "ptimer.h" #include "sysemu.h" #include "exec-memory.h"
hw/mcf5208.c +1 -0
@@ -8,6 +8,7 @@#include "hw.h" #include "mcf.h" #include "qemu-timer.h" +#include "ptimer.h" #include "sysemu.h" #include "net.h" #include "boards.h"
hw/milkymist-sysctl.c +1 -0
@@ -26,6 +26,7 @@#include "sysemu.h" #include "trace.h" #include "qemu-timer.h" +#include "ptimer.h" #include "qemu-error.h" enum {
hw/musicpal.c +1 -0
@@ -14,6 +14,7 @@#include "boards.h" #include "pc.h" #include "qemu-timer.h" +#include "ptimer.h" #include "block.h" #include "flash.h" #include "console.h"
hw/ptimer.c +1 -0
@@ -7,6 +7,7 @@*/ #include "hw.h" #include "qemu-timer.h" +#include "ptimer.h" #include "host-utils.h" struct ptimer_state
hw/ptimer.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* General purpose implementation of a simple periodic countdown timer. +* +* Copyright (c) 2007 CodeSourcery. +* +* This code is licensed under the GNU LGPL. +*/ +#ifndef PTIMER_H +#define PTIMER_H + +#include "qemu-common.h" +#include "qemu-timer.h" + +/* ptimer.c */ +typedef struct ptimer_state ptimer_state ; +typedef void (*ptimer_cb )(void *opaque); + +ptimer_state *ptimer_init (QEMUBH *bh); +void ptimer_set_period (ptimer_state *s,int64_t period); +void ptimer_set_freq (ptimer_state *s,uint32_t freq); +void ptimer_set_limit (ptimer_state *s,uint64_t limit,int reload); +uint64_t ptimer_get_count (ptimer_state *s); +void ptimer_set_count (ptimer_state *s,uint64_t count); +void ptimer_run (ptimer_state *s,int oneshot); +void ptimer_stop (ptimer_state *s); + +#endif
hw/sh_timer.c +1 -0
@@ -12,6 +12,7 @@#include "sh.h" #include "qemu-timer.h" #include "exec-memory.h" +#include "ptimer.h" //#define DEBUG_TIMER
hw/slavio_timer.c +1 -0
@@ -24,6 +24,7 @@#include "sun4m.h" #include "qemu-timer.h" +#include "ptimer.h" #include "sysbus.h" #include "trace.h"
hw/xilinx_axidma.c +1 -0
@@ -25,6 +25,7 @@#include "sysbus.h" #include "qemu-char.h" #include "qemu-timer.h" +#include "ptimer.h" #include "qemu-log.h" #include "qdev-addr.h"
hw/xilinx_timer.c +1 -0
@@ -24,6 +24,7 @@#include "sysbus.h" #include "qemu-timer.h" +#include "ptimer.h" #define D (x)
qemu-timer.h +0 -13
@@ -139,19 +139,6 @@ static inline int64_t get_clock(void)void qemu_get_timer (QEMUFile *f,QEMUTimer *ts);void qemu_put_timer (QEMUFile *f,QEMUTimer *ts); -/* ptimer.c */ -typedef struct ptimer_state ptimer_state ; -typedef void (*ptimer_cb )(void *opaque); - -ptimer_state *ptimer_init (QEMUBH *bh); -void ptimer_set_period (ptimer_state *s,int64_t period); -void ptimer_set_freq (ptimer_state *s,uint32_t freq); -void ptimer_set_limit (ptimer_state *s,uint64_t limit,int reload); -uint64_t ptimer_get_count (ptimer_state *s); -void ptimer_set_count (ptimer_state *s,uint64_t count); -void ptimer_run (ptimer_state *s,int oneshot); -void ptimer_stop (ptimer_state *s); -/* icount */ int64_t cpu_get_icount (void );int64_t cpu_get_clock (void );
Signature · 1 line
1.7.7.1
PATCH v5 2/2 vmstate: extract declarations out of hw/hw.h
Signed-off-by Paolo Bonzini <[email protected]>
--- hw/hid.h | 23 ++ hw/hw.h | 888 +---------------------------------------------------------- hw/i2c.h | 10 + hw/pci.h | 20 ++ hw/pcie.h | 11 + hw/ptimer.h | 12 + hw/usb.h | 12 + net.h | 13 + qemu-file.h | 238 ++++++++++++++++ vmstate.h | 613 +++++++++++++++++++++++++++++++++++++++++ 10 files changed, 954 insertions(+), 886 deletions(-) create mode 100644 qemu-file.h create mode 100644 vmstate.h
hw/hid.h +23 -0
@@ -1,6 +1,8 @@#ifndef QEMU_HID_H #define QEMU_HID_H +#include "vmstate.h" +#define HID_MOUSE 1#define HID_TABLET 2#define HID_KEYBOARD 3
@@ -56,4 +58,25 @@ int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len);int hid_keyboard_poll (HIDState *hs,uint8_t *buf,int len);int hid_keyboard_write (HIDState *hs,uint8_t *buf,int len); +extern const VMStateDescription vmstate_hid_keyboard_device; + +#define VMSTATE_HID_KEYBOARD_DEVICE (_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(HIDState), \ + .vmsd = &vmstate_hid_keyboard_device, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, HIDState), \ +} + +extern const VMStateDescription vmstate_hid_ptr_device; + +#define VMSTATE_HID_POINTER_DEVICE (_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(HIDState), \ + .vmsd = &vmstate_hid_ptr_device, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, HIDState), \ +} + +#endif /* QEMU_HID_H */
hw/hw.h +2 -886
910 lines not on this page · raw message
hw/i2c.h +10 -0
@@ -74,4 +74,14 @@ void tmp105_set(i2c_slave *i2c, int temp);/* lm832x.c */ void lm832x_key_event (DeviceState *dev,int key,int state); +extern const VMStateDescription vmstate_i2c_slave; + +#define VMSTATE_I2C_SLAVE (_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(i2c_slave), \ + .vmsd = &vmstate_i2c_slave, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, i2c_slave), \ +} +#endif
hw/pci.h +20 -0
@@ -6,6 +6,7 @@#include "qdev.h" #include "memory.h" #include "dma.h" +#include "vmstate.h" /* PCI includes legacy ISA access. */ #include "isa.h"
@@ -552,4 +553,23 @@ static inline void pci_dma_sglist_init(QEMUSGList *qsg, PCIDevice *dev, qemu_sglist_init(qsg, alloc_hint); } +extern const VMStateDescription vmstate_pci_device; + +#define VMSTATE_PCI_DEVICE (_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(PCIDevice), \ + .vmsd = &vmstate_pci_device, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, PCIDevice), \ +} + +#define VMSTATE_PCI_DEVICE_POINTER (_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(PCIDevice), \ + .vmsd = &vmstate_pci_device, \ + .flags = VMS_STRUCT|VMS_POINTER, \ + .offset = vmstate_offset_pointer(_state, _field, PCIDevice), \ +} + +#endif
hw/pcie.h +11 -0
@@ -129,4 +129,15 @@ void pcie_add_capability(PCIDevice *dev,void pcie_ari_init (PCIDevice *dev,uint16_t offset,uint16_t nextfn); +extern const VMStateDescription vmstate_pcie_device; + +#define VMSTATE_PCIE_DEVICE (_field, _state) { \ + .name = (stringify(_field)), \ + .version_id = 2, \ + .size = sizeof(PCIDevice), \ + .vmsd = &vmstate_pcie_device, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, PCIDevice), \ +} +#endif /* QEMU_PCIE_H */
hw/ptimer.h +12 -0
@@ -10,6 +10,7 @@#include "qemu-common.h" #include "qemu-timer.h" +#include "vmstate.h" /* ptimer.c */ typedef struct ptimer_state ptimer_state ;
@@ -24,4 +25,15 @@ void ptimer_set_count(ptimer_state *s, uint64_t count);void ptimer_run (ptimer_state *s,int oneshot);void ptimer_stop (ptimer_state *s); +extern const VMStateDescription vmstate_ptimer; + +#define VMSTATE_PTIMER (_field, _state) { \ + .name = (stringify(_field)), \ + .version_id = (1), \ + .vmsd = &vmstate_ptimer, \ + .size = sizeof(ptimer_state *), \ + .flags = VMS_STRUCT|VMS_POINTER, \ + .offset = vmstate_offset_pointer(_state, _field, ptimer_state), \ +} +#endif
hw/usb.h +12 -0
@@ -392,3 +392,15 @@ static inline USBBus *usb_bus_from_device(USBDevice *d) {return DO_UPCAST (USBBus, qbus, d->qdev.parent_bus); } + +extern const VMStateDescription vmstate_usb_device; + +#define VMSTATE_USB_DEVICE (_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(USBDevice), \ + .vmsd = &vmstate_usb_device, \ + .flags = VMS_STRUCT, \ + .offset = vmstate_offset_value(_state, _field, USBDevice), \ +} + +
net.h +13 -0
@@ -6,6 +6,7 @@#include "qdict.h" #include "qemu-option.h" #include "net/queue.h" +#include "vmstate.h" struct MACAddr {uint8_t a[6 ];
@@ -178,4 +179,16 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);int net_handle_fd_param (Monitor *mon,const char *param); +#define vmstate_offset_macaddr (_state, _field) \ + vmstate_offset_array(_state, _field.a, uint8_t, \ + sizeof(typeof_field(_state, _field))) + +#define VMSTATE_MACADDR (_field, _state) { \ + .name = (stringify(_field)), \ + .size = sizeof(MACAddr), \ + .info = &vmstate_info_buffer, \ + .flags = VMS_BUFFER, \ + .offset = vmstate_offset_macaddr(_state, _field), \ +} +#endif
qemu-file.h new file +238 -0
238 lines not on this page · raw message
vmstate.h new file +613 -0
613 lines not on this page · raw message
Signature · 1 line
1.7.7.1