2017-02-20 16:36:03 +01:00
|
|
|
/*
|
|
|
|
* ARMv7M SysTick timer
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006-2007 CodeSourcery.
|
|
|
|
* Written by Paul Brook
|
|
|
|
* Copyright (c) 2017 Linaro Ltd
|
|
|
|
* Written by Peter Maydell
|
|
|
|
*
|
|
|
|
* This code is licensed under the GPL (version 2 or later).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HW_TIMER_ARMV7M_SYSTICK_H
|
|
|
|
#define HW_TIMER_ARMV7M_SYSTICK_H
|
|
|
|
|
|
|
|
#include "hw/sysbus.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2020-10-15 17:18:29 +02:00
|
|
|
#include "hw/ptimer.h"
|
2021-08-12 11:33:36 +02:00
|
|
|
#include "hw/clock.h"
|
2017-02-20 16:36:03 +01:00
|
|
|
|
|
|
|
#define TYPE_SYSTICK "armv7m_systick"
|
|
|
|
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(SysTickState, SYSTICK)
|
2017-02-20 16:36:03 +01:00
|
|
|
|
2021-08-12 11:33:35 +02:00
|
|
|
/*
|
|
|
|
* QEMU interface:
|
|
|
|
* + sysbus MMIO region 0 is the register interface (covering
|
|
|
|
* the registers which are mapped at address 0xE000E010)
|
|
|
|
* + sysbus IRQ 0 is the interrupt line to the NVIC
|
2021-08-12 11:33:36 +02:00
|
|
|
* + Clock input "refclk" is the external reference clock
|
|
|
|
* (used when SYST_CSR.CLKSOURCE == 0)
|
|
|
|
* + Clock input "cpuclk" is the main CPU clock
|
|
|
|
* (used when SYST_CSR.CLKSOURCE == 1)
|
2021-08-12 11:33:35 +02:00
|
|
|
*/
|
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct SysTickState {
|
2017-02-20 16:36:03 +01:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
uint32_t control;
|
|
|
|
uint32_t reload;
|
|
|
|
int64_t tick;
|
2020-10-15 17:18:29 +02:00
|
|
|
ptimer_state *ptimer;
|
2017-02-20 16:36:03 +01:00
|
|
|
MemoryRegion iomem;
|
|
|
|
qemu_irq irq;
|
2021-08-12 11:33:36 +02:00
|
|
|
Clock *refclk;
|
|
|
|
Clock *cpuclk;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2017-02-20 16:36:03 +01:00
|
|
|
|
|
|
|
#endif
|