1#ifndef REMOTE_PORT_DEVICE_H 2#define REMOTE_PORT_DEVICE_H 3 4#include "qemu-common.h" 5#include "qom/object.h" 6#include "hw/remote-port-proto.h" 7 8#define TYPE_REMOTE_PORT_DEVICE "remote-port-device" 9 10#define REMOTE_PORT_DEVICE_CLASS(klass) \ 11 OBJECT_CLASS_CHECK(RemotePortDeviceClass, (klass), TYPE_REMOTE_PORT_DEVICE) 12#define REMOTE_PORT_DEVICE_GET_CLASS(obj) \ 13 OBJECT_GET_CLASS(RemotePortDeviceClass, (obj), TYPE_REMOTE_PORT_DEVICE) 14#define REMOTE_PORT_DEVICE(obj) \ 15 INTERFACE_CHECK(RemotePortDevice, (obj), TYPE_REMOTE_PORT_DEVICE) 16 17typedef struct RemotePort RemotePort; 18 19typedef struct RemotePortDevice { 20 /*< private >*/ 21 Object parent_obj; 22} RemotePortDevice; 23 24typedef struct RemotePortDeviceClass { 25 /*< private >*/ 26 InterfaceClass parent_class; 27 28 /*< public >*/ 29 /** 30 * ops - operations to perform when remote port packets are recieved for 31 * this device. Function N will be called for a remote port packet with 32 * cmd == N in the header. 33 * 34 * @obj - Remote port device to recieve packet 35 * @pkt - remote port packets 36 */ 37 38 void (*ops[RP_CMD_max+1])(RemotePortDevice *obj, struct rp_pkt *pkt); 39 40} RemotePortDeviceClass; 41 42uint32_t rp_new_id(RemotePort *s); 43/* FIXME: Cleanup and reduce the API complexity for dealing with responses. */ 44void rp_rsp_mutex_lock(RemotePort *s); 45void rp_rsp_mutex_unlock(RemotePort *s); 46void rp_restart_sync_timer(RemotePort *s); 47 48ssize_t rp_write(RemotePort *s, const void *buf, size_t count); 49 50RemotePortDynPkt rp_wait_resp(RemotePort *s); 51 52int64_t rp_normalized_vmclk(RemotePort *s); 53 54struct rp_peer_state *rp_get_peer(RemotePort *s); 55 56#endif 57