2017-02-20 18:36:03 +03: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 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2020-10-15 18:18:29 +03:00
|
|
|
#include "hw/ptimer.h"
|
2021-08-12 12:33:36 +03:00
|
|
|
#include "hw/clock.h"
|
2017-02-20 18:36:03 +03:00
|
|
|
|
|
|
|
#define TYPE_SYSTICK "armv7m_systick"
|
|
|
|
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(SysTickState, SYSTICK)
|
2017-02-20 18:36:03 +03:00
|
|
|
|
2021-08-12 12:33:35 +03: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 12:33:36 +03: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 12:33:35 +03:00
|
|
|
*/
|
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct SysTickState {
|
2017-02-20 18:36:03 +03:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
uint32_t control;
|
|
|
|
uint32_t reload;
|
|
|
|
int64_t tick;
|
2020-10-15 18:18:29 +03:00
|
|
|
ptimer_state *ptimer;
|
2017-02-20 18:36:03 +03:00
|
|
|
MemoryRegion iomem;
|
|
|
|
qemu_irq irq;
|
2021-08-12 12:33:36 +03:00
|
|
|
Clock *refclk;
|
|
|
|
Clock *cpuclk;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2017-02-20 18:36:03 +03:00
|
|
|
|
|
|
|
#endif
|