1 /*
2  * Copyright (c) 2017 Linaro Limited.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_DRIVERS_COUNTER_DUALTIMER_CMSDK_APB_H_
7 #define ZEPHYR_DRIVERS_COUNTER_DUALTIMER_CMSDK_APB_H_
8 
9 #include <zephyr/drivers/counter.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 struct dualtimer_cmsdk_apb {
16 	/* Offset: 0x000 (R/W) Timer 1 Load */
17 	volatile uint32_t timer1load;
18 	/* Offset: 0x004 (R/ ) Timer 1 Counter Current Value */
19 	volatile uint32_t timer1value;
20 	/* Offset: 0x008 (R/W) Timer 1 Control */
21 	volatile uint32_t timer1ctrl;
22 	/* Offset: 0x00C ( /W) Timer 1 Interrupt Clear */
23 	volatile uint32_t timer1intclr;
24 	/* Offset: 0x010 (R/ ) Timer 1 Raw Interrupt Status */
25 	volatile uint32_t timer1ris;
26 	/* Offset: 0x014 (R/ ) Timer 1 Masked Interrupt Status */
27 	volatile uint32_t timer1mis;
28 	/* Offset: 0x018 (R/W) Background Load Register */
29 	volatile uint32_t timer1bgload;
30 	/* Reserved */
31 	volatile uint32_t reserved0;
32 	/* Offset: 0x020 (R/W) Timer 2 Load */
33 	volatile uint32_t timer2load;
34 	/* Offset: 0x024 (R/ ) Timer 2 Counter Current Value */
35 	volatile uint32_t timer2value;
36 	/* Offset: 0x028 (R/W) Timer 2 Control */
37 	volatile uint32_t timer2ctrl;
38 	/* Offset: 0x02C ( /W) Timer 2 Interrupt Clear */
39 	volatile uint32_t timer2intclr;
40 	/* Offset: 0x030 (R/ ) Timer 2 Raw Interrupt Status */
41 	volatile uint32_t timer2ris;
42 	/* Offset: 0x034 (R/ ) Timer 2 Masked Interrupt Status */
43 	volatile uint32_t timer2mis;
44 	/* Offset: 0x038 (R/W) Background Load Register */
45 	volatile uint32_t timer2bgload;
46 	/* Reserved */
47 	volatile uint32_t reserved1[945];
48 	/* Offset: 0xF00 (R/W) Integration Test Control Register */
49 	volatile uint32_t itcr;
50 	/* Offset: 0xF04 ( /W) Integration Test Output Set Register */
51 	volatile uint32_t itop;
52 };
53 
54 #define DUALTIMER_CTRL_EN	(1 << 7)
55 #define DUALTIMER_CTRL_MODE	(1 << 6)
56 #define DUALTIMER_CTRL_INTEN	(1 << 5)
57 #define DUALTIMER_CTRL_PRESCALE	(3 << 2)
58 #define DUALTIMER_CTRL_SIZE_32	(1 << 1)
59 #define DUALTIMER_CTRL_ONESHOOT	(1 << 0)
60 #define DUALTIMER_INTCLR	(1 << 0)
61 #define DUALTIMER_RAWINTSTAT	(1 << 0)
62 #define DUALTIMER_MASKINTSTAT	(1 << 0)
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif /* ZEPHYR_DRIVERS_COUNTER_DUALTIMER_CMSDK_APB_H_ */
69