blob: c7ca6c821daeff72a442490d70b8e97aa717126c [file] [log] [blame]
Yongbok Kim40514052016-03-28 19:35:50 -07001/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2016 Imagination Technologies
7 *
8 */
9
Markus Armbruster2a6a4072016-06-29 13:47:03 +020010#ifndef MIPS_GICTIMER_H
11#define MIPS_GICTIMER_H
Yongbok Kim40514052016-03-28 19:35:50 -070012
13typedef struct MIPSGICTimerVPState MIPSGICTimerVPState;
14typedef struct MIPSGICTimerState MIPSGICTimerState;
15
16typedef void MIPSGICTimerCB(void *opaque, uint32_t vp_index);
17
18struct MIPSGICTimerVPState {
19 QEMUTimer *qtimer;
20 uint32_t vp_index;
21 uint32_t comparelo;
22 MIPSGICTimerState *gictimer;
23};
24
25struct MIPSGICTimerState {
26 void *opaque;
27 uint8_t countstop;
28 uint32_t sh_counterlo;
29 int32_t num_vps;
30 MIPSGICTimerVPState *vptimers;
31 MIPSGICTimerCB *cb;
32};
33
Paul Burtoneb90ab92016-09-08 15:51:52 +010034uint32_t mips_gictimer_get_freq(MIPSGICTimerState *gic);
Yongbok Kim40514052016-03-28 19:35:50 -070035uint32_t mips_gictimer_get_sh_count(MIPSGICTimerState *gic);
36void mips_gictimer_store_sh_count(MIPSGICTimerState *gic, uint64_t count);
37uint32_t mips_gictimer_get_vp_compare(MIPSGICTimerState *gictimer,
38 uint32_t vp_index);
39void mips_gictimer_store_vp_compare(MIPSGICTimerState *gic, uint32_t vp_index,
40 uint64_t compare);
41uint8_t mips_gictimer_get_countstop(MIPSGICTimerState *gic);
42void mips_gictimer_start_count(MIPSGICTimerState *gic);
43void mips_gictimer_stop_count(MIPSGICTimerState *gic);
44MIPSGICTimerState *mips_gictimer_init(void *opaque, uint32_t nvps,
45 MIPSGICTimerCB *cb);
46
Markus Armbruster2a6a4072016-06-29 13:47:03 +020047#endif /* MIPS_GICTIMER_H */