Merge remote-tracking branch 'qemu/master'
[qemu/ar7.git] / qemu-tool-time.c
blobbba48467a1e18c4d6be08482abe1df91f03288aa
1 /*
2 * Copyright (c) 2010-2011 IBM
4 * Authors:
5 * Chunqiang Tang <ctang@us.ibm.com>
7 * This work is licensed under the terms of the GNU GPL, version 2.
8 * See the COPYING file in the top-level directory.
9 */
11 /*=============================================================================
12 * A short description: this module implements the qemu-tool functions that
13 * are related to time. In the simulation mode (see block/sim.c), these
14 * functions are implemented differently in qemu-test.c because they have to
15 * work with the simulation engine block/sim.c
16 *============================================================================*/
18 #include "qemu/timer.h"
19 #include "sysemu.h"
21 struct QEMUBH {
22 QEMUBHFunc *cb;
23 void *opaque;
26 #if 1
27 int64_t qemu_get_clock (QEMUClock * clock)
29 qemu_timeval tv;
30 qemu_gettimeofday (&tv);
31 return (tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000)) / 1000000;
33 #endif
35 QEMUBH *qemu_bh_new (QEMUBHFunc * cb, void *opaque)
37 QEMUBH *bh;
39 bh = g_malloc(sizeof(*bh));
40 bh->cb = cb;
41 bh->opaque = opaque;
43 return bh;
46 int qemu_bh_poll (void)
48 return 0;
51 void qemu_bh_schedule (QEMUBH * bh)
53 bh->cb (bh->opaque);
56 void qemu_bh_cancel (QEMUBH * bh)
60 void qemu_bh_delete (QEMUBH * bh)
62 g_free(bh);
65 void timer_mod(QEMUTimer * ts, int64_t expire_time)
67 fprintf (stderr, "timer_mod() should not be invoked in qemu-tool\n");
68 exit (1);
71 QEMUTimer *qemu_new_timer (QEMUClock * clock, QEMUTimerCB * cb, void *opaque)
73 fprintf (stderr, "qemu_new_timer() should not be invoked in qemu-tool\n");
74 exit (1);
75 return NULL;
78 void timer_free(QEMUTimer * ts)
80 fprintf (stderr, "timer_free() should not be invoked in qemu-tool\n");
81 exit (1);
84 void timer_del(QEMUTimer * ts)
86 fprintf (stderr, "timer_del() should not be invoked in qemu-tool\n");
87 exit (1);