Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / timer / imx_epit.h
blob79aff0cec2076d23113ba2fdd17d3294a2099220
1 /*
2 * i.MX EPIT Timer
4 * Copyright (c) 2008 OK Labs
5 * Copyright (c) 2011 NICTA Pty Ltd
6 * Originally written by Hans Jiang
7 * Updated by Peter Chubb
8 * Updated by Jean-Christophe Dubois <jcd@tribudubois.net>
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this software and associated documentation files (the "Software"), to deal
12 * in the Software without restriction, including without limitation the rights
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 * THE SOFTWARE.
29 #ifndef IMX_EPIT_H
30 #define IMX_EPIT_H
32 #include "hw/sysbus.h"
33 #include "hw/ptimer.h"
34 #include "hw/misc/imx_ccm.h"
35 #include "qom/object.h"
38 * EPIT: Enhanced periodic interrupt timer
41 #define CR_EN (1 << 0)
42 #define CR_ENMOD (1 << 1)
43 #define CR_OCIEN (1 << 2)
44 #define CR_RLD (1 << 3)
45 #define CR_PRESCALE_SHIFT (4)
46 #define CR_PRESCALE_BITS (12)
47 #define CR_SWR (1 << 16)
48 #define CR_IOVW (1 << 17)
49 #define CR_DBGEN (1 << 18)
50 #define CR_WAITEN (1 << 19)
51 #define CR_DOZEN (1 << 20)
52 #define CR_STOPEN (1 << 21)
53 #define CR_CLKSRC_SHIFT (24)
54 #define CR_CLKSRC_BITS (2)
56 #define SR_OCIF (1 << 0)
58 #define EPIT_TIMER_MAX 0XFFFFFFFFUL
60 #define TYPE_IMX_EPIT "imx.epit"
61 OBJECT_DECLARE_SIMPLE_TYPE(IMXEPITState, IMX_EPIT)
63 struct IMXEPITState {
64 /*< private >*/
65 SysBusDevice parent_obj;
67 /*< public >*/
68 ptimer_state *timer_reload;
69 ptimer_state *timer_cmp;
70 MemoryRegion iomem;
71 IMXCCMState *ccm;
73 uint32_t cr;
74 uint32_t sr;
75 uint32_t lr;
76 uint32_t cmp;
78 qemu_irq irq;
81 #endif /* IMX_EPIT_H */