2017-02-20 16:35:57 +01: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 16:21:53 +02:00
|
|
|
#include "hw/intc/armv7m_nvic.h"
|
2017-02-20 16:35:57 +01: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 10:51:08 +02:00
|
|
|
AddressSpace source_as;
|
2017-02-20 16:35:57 +01:00
|
|
|
MemoryRegion iomem;
|
|
|
|
uint32_t base;
|
2017-02-20 16:36:01 +01:00
|
|
|
MemoryRegion *source_memory;
|
2017-02-20 16:35:57 +01: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
|
|
|
|
* + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ
|
2017-09-13 18:04:57 +02:00
|
|
|
* + Property "cpu-type": CPU type to instantiate
|
2017-02-20 16:35:57 +01:00
|
|
|
* + Property "num-irq": number of external IRQ lines
|
2017-02-20 16:35:59 +01: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.)
|
2017-02-20 16:35:57 +01:00
|
|
|
*/
|
|
|
|
typedef struct ARMv7MState {
|
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
NVICState nvic;
|
|
|
|
BitBandState bitband[ARMV7M_NUM_BITBANDS];
|
|
|
|
ARMCPU *cpu;
|
|
|
|
|
2017-02-20 16:35:59 +01: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 16:35:57 +01:00
|
|
|
/* Properties */
|
2017-09-13 18:04:57 +02:00
|
|
|
char *cpu_type;
|
2017-02-20 16:35:59 +01:00
|
|
|
/* MemoryRegion the board provides to us (with its devices, RAM, etc) */
|
|
|
|
MemoryRegion *board_memory;
|
2017-02-20 16:35:57 +01:00
|
|
|
} ARMv7MState;
|
|
|
|
|
|
|
|
#endif
|