7#ifndef ZEPHYR_INCLUDE_ARCH_ARM_AARCH32_CORTEX_A_R_TIMER_H_
8#define ZEPHYR_INCLUDE_ARCH_ARM_AARCH32_CORTEX_A_R_TIMER_H_
10#ifdef CONFIG_ARM_ARCH_TIMER
22#define ARM_ARCH_TIMER_BASE DT_REG_ADDR_BY_IDX(ARM_TIMER_NODE, 0)
23#define ARM_ARCH_TIMER_IRQ ARM_TIMER_VIRTUAL_IRQ
24#define ARM_ARCH_TIMER_PRIO ARM_TIMER_VIRTUAL_PRIO
25#define ARM_ARCH_TIMER_FLAGS ARM_TIMER_VIRTUAL_FLAGS
27#define TIMER_CNT_LOWER 0x00
28#define TIMER_CNT_UPPER 0x04
29#define TIMER_CTRL 0x08
31#define TIMER_CMP_LOWER 0x10
32#define TIMER_CMP_UPPER 0x14
34#define TIMER_IRQ_ENABLE BIT(2)
35#define TIMER_COMP_ENABLE BIT(1)
36#define TIMER_ENABLE BIT(0)
40#define TIMER_REG_GET(offs) (DEVICE_MMIO_TOPLEVEL_GET(timer_regs) + offs)
55 ctrl &= ~(TIMER_COMP_ENABLE | TIMER_IRQ_ENABLE);
62 ctrl |= TIMER_COMP_ENABLE;
74 ctrl &= ~TIMER_ENABLE;
86 ctrl &= ~TIMER_IRQ_ENABLE;
88 ctrl |= TIMER_IRQ_ENABLE;
108 upper =
sys_read32(TIMER_REG_GET(TIMER_CNT_UPPER));
111 lower =
sys_read32(TIMER_REG_GET(TIMER_CNT_LOWER));
112 upper =
sys_read32(TIMER_REG_GET(TIMER_CNT_UPPER));
113 }
while (upper != upper_saved);
115 return ((
uint64_t)upper) << 32 | lower;
static ALWAYS_INLINE uint64_t arm_arch_timer_count(void)
Definition: timer.h:62
static ALWAYS_INLINE void arm_arch_timer_set_irq_mask(bool mask)
Definition: timer.h:47
static ALWAYS_INLINE void arm_arch_timer_set_compare(uint64_t val)
Definition: timer.h:27
static ALWAYS_INLINE void arm_arch_timer_enable(unsigned char enable)
Definition: timer.h:32
static ALWAYS_INLINE void arm_arch_timer_init(void)
Definition: timer.h:23
#define ARM_TIMER_NODE
Definition: arm_arch_timer.h:14
#define ALWAYS_INLINE
Definition: common.h:116
#define DEVICE_MMIO_TOPLEVEL_MAP(name, flags)
Set up memory for a driver'sMMIO region.
Definition: device_mmio.h:652
#define K_MEM_CACHE_NONE
Definition: mem_manage.h:18
DEVICE_MMIO_TOPLEVEL_STATIC(foo4, DT_DRV_INST(4))
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT64_TYPE__ uint64_t
Definition: stdint.h:61
static ALWAYS_INLINE void sys_write32(uint32_t data, mem_addr_t addr)
Definition: sys-io-common.h:70
static ALWAYS_INLINE uint32_t sys_read32(mem_addr_t addr)
Definition: sys-io-common.h:59