2017-02-20 18:35:57 +03:00
|
|
|
/*
|
|
|
|
* ARMv7M CPU object
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017 Linaro Ltd
|
|
|
|
* Written by Peter Maydell <peter.maydell@linaro.org>
|
|
|
|
*
|
|
|
|
* This code is licensed under the GPL version 2 or later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HW_ARM_ARMV7M_H
|
|
|
|
#define HW_ARM_ARMV7M_H
|
|
|
|
|
|
|
|
#include "hw/sysbus.h"
|
2017-09-04 17:21:53 +03:00
|
|
|
#include "hw/intc/armv7m_nvic.h"
|
2018-03-02 13:45:36 +03:00
|
|
|
#include "target/arm/idau.h"
|
2017-02-20 18:35:57 +03:00
|
|
|
|
|
|
|
#define TYPE_BITBAND "ARM,bitband-memory"
|
|
|
|
#define BITBAND(obj) OBJECT_CHECK(BitBandState, (obj), TYPE_BITBAND)
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
2017-09-21 11:51:08 +03:00
|
|
|
AddressSpace source_as;
|
2017-02-20 18:35:57 +03:00
|
|
|
MemoryRegion iomem;
|
|
|
|
uint32_t base;
|
2017-02-20 18:36:01 +03:00
|
|
|
MemoryRegion *source_memory;
|
2017-02-20 18:35:57 +03:00
|
|
|
} BitBandState;
|
|
|
|
|
|
|
|
#define TYPE_ARMV7M "armv7m"
|
|
|
|
#define ARMV7M(obj) OBJECT_CHECK(ARMv7MState, (obj), TYPE_ARMV7M)
|
|
|
|
|
|
|
|
#define ARMV7M_NUM_BITBANDS 2
|
|
|
|
|
|
|
|
/* ARMv7M container object.
|
|
|
|
* + Unnamed GPIO input lines: external IRQ lines for the NVIC
|
2020-08-03 19:55:03 +03:00
|
|
|
* + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ.
|
|
|
|
* If this GPIO is not wired up then the NVIC will default to performing
|
|
|
|
* a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET).
|
2017-09-13 19:04:57 +03:00
|
|
|
* + Property "cpu-type": CPU type to instantiate
|
2017-02-20 18:35:57 +03:00
|
|
|
* + Property "num-irq": number of external IRQ lines
|
2017-02-20 18:35:59 +03:00
|
|
|
* + Property "memory": MemoryRegion defining the physical address space
|
|
|
|
* that CPU accesses see. (The NVIC, bitbanding and other CPU-internal
|
|
|
|
* devices will be automatically layered on top of this view.)
|
2018-03-02 13:45:36 +03:00
|
|
|
* + Property "idau": IDAU interface (forwarded to CPU object)
|
2018-03-02 13:45:37 +03:00
|
|
|
* + Property "init-svtor": secure VTOR reset value (forwarded to CPU object)
|
2019-05-17 20:40:45 +03:00
|
|
|
* + Property "vfp": enable VFP (forwarded to CPU object)
|
|
|
|
* + Property "dsp": enable DSP (forwarded to CPU object)
|
2018-08-16 16:05:28 +03:00
|
|
|
* + Property "enable-bitband": expose bitbanded IO
|
2017-02-20 18:35:57 +03:00
|
|
|
*/
|
|
|
|
typedef struct ARMv7MState {
|
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
NVICState nvic;
|
|
|
|
BitBandState bitband[ARMV7M_NUM_BITBANDS];
|
|
|
|
ARMCPU *cpu;
|
|
|
|
|
2017-02-20 18:35:59 +03:00
|
|
|
/* MemoryRegion we pass to the CPU, with our devices layered on
|
|
|
|
* top of the ones the board provides in board_memory.
|
|
|
|
*/
|
|
|
|
MemoryRegion container;
|
|
|
|
|
2017-02-20 18:35:57 +03:00
|
|
|
/* Properties */
|
2017-09-13 19:04:57 +03:00
|
|
|
char *cpu_type;
|
2017-02-20 18:35:59 +03:00
|
|
|
/* MemoryRegion the board provides to us (with its devices, RAM, etc) */
|
|
|
|
MemoryRegion *board_memory;
|
2018-03-02 13:45:36 +03:00
|
|
|
Object *idau;
|
2018-03-02 13:45:37 +03:00
|
|
|
uint32_t init_svtor;
|
2018-08-16 16:05:28 +03:00
|
|
|
bool enable_bitband;
|
2019-02-01 17:55:41 +03:00
|
|
|
bool start_powered_off;
|
2019-05-17 20:40:45 +03:00
|
|
|
bool vfp;
|
|
|
|
bool dsp;
|
2017-02-20 18:35:57 +03:00
|
|
|
} ARMv7MState;
|
|
|
|
|
|
|
|
#endif
|