|   | 
      | 
  
  
      | 
      | 
  
 
     | 
    | 
  
  
     | 
    | 
  
  
    |   | 
      | 
  
  
    | 
         
xen-devel
[Xen-devel] [PATCH RFC V1 02/11] qemu-timer: Introduce	qemu_run_one_time
 
Used by the Xen PCI Passthrough code to run the timer about the power
state transition.
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 qemu-timer.c |   15 +++++++++++++++
 qemu-timer.h |    3 +++
 2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/qemu-timer.c b/qemu-timer.c
index 46dd483..15e659b 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -1163,3 +1163,18 @@ int qemu_calculate_timeout(void)
     return 1000;
 }
 
+/* run the specified timer */
+void qemu_run_one_timer(QEMUTimer *ts)
+{
+    uint64_t current_time;
+
+    /* remove timer from the list before calling the callback */
+    qemu_del_timer(ts);
+
+    while ((current_time = qemu_get_clock_ms(rt_clock)) < ts->expire_time)
+        /* sleep until the expire time */
+        usleep((ts->expire_time - current_time) * 1000);
+
+    /* run the callback */
+    ts->cb(ts->opaque);
+}
diff --git a/qemu-timer.h b/qemu-timer.h
index 0a43469..b7b907b 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -338,4 +338,7 @@ extern int64_t tlb_flush_time;
 extern int64_t dev_time;
 #endif
 
+/* run the specified timer */
+void qemu_run_one_timer(QEMUTimer *ts);
+
 #endif
-- 
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 |   
 
| <Prev in Thread] | 
Current Thread | 
[Next in Thread>
 |  
- [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Anthony PERARD
- [Xen-devel] [PATCH RFC V1 01/11] Introduce HostPCIDevice to access	a pci device on the host., Anthony PERARD
 
- [Xen-devel] [PATCH RFC V1 04/11] pci_regs: Fix value of	PCI_EXP_TYPE_RC_EC., Anthony PERARD
 
- [Xen-devel] [PATCH RFC V1 03/11] pci_ids: Add INTEL_82599_VF id., Anthony PERARD
 
- [Xen-devel] [PATCH RFC V1 02/11] qemu-timer: Introduce	qemu_run_one_timer,
Anthony PERARD <=
 
- [Xen-devel] [PATCH RFC V1 05/11] pci_regs: Add	PCI_EXP_TYPE_PCIE_BRIDGE, Anthony PERARD
 
- [Xen-devel] [PATCH RFC V1 06/11] pci.c: Add pci_check_bar_overlap, Anthony PERARD
 
- [Xen-devel] [PATCH RFC V1 07/11] host-pci-device: Add	host_pci_find_ext_cap_offset, Anthony PERARD
 
- [Xen-devel] [PATCH RFC V1 08/11] Introduce Xen PCI Passthrough,	qdevice (1/3), Anthony PERARD
 
- [Xen-devel] [PATCH RFC V1 11/11] config/make: Introduce	--enable-xen-pci-passthrough, built it., Anthony PERARD
 
 
 
 
 |  
  
 | 
    | 
  
  
    |   | 
    |