-# Copyright (c) 2012-2013, 2017-2019 ARM Limited
+# Copyright (c) 2012-2013, 2017-2020 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
assert self._state.interrupt_cells == 3
return [ int_type, int_num, int_flag ]
+class ArmInterruptType(ScopedEnum):
+ """
+ The values of the scoped enum are matching Linux macroes
+ defined in include/linux/irq.h. They are mainly meant
+ to be used for DTB autogen
+ """
+ map = {
+ 'IRQ_TYPE_EDGE_RISING' : 0x1,
+ 'IRQ_TYPE_EDGE_FALLING' : 0x2,
+ 'IRQ_TYPE_LEVEL_HIGH' : 0x4,
+ 'IRQ_TYPE_LEVEL_LOW' : 0x8
+ }
+
class ArmInterruptPin(SimObject):
type = 'ArmInterruptPin'
cxx_header = "dev/arm/base_gic.hh"
platform = Param.Platform(Parent.any, "Platform with interrupt controller")
num = Param.UInt32("Interrupt number in GIC")
+ int_type = Param.ArmInterruptType('IRQ_TYPE_LEVEL_HIGH',
+ "Interrupt type (level/edge triggered)")
class ArmSPI(ArmInterruptPin):
type = 'ArmSPI'
}
ArmSPIGen::ArmSPIGen(const ArmSPIParams &p)
- : ArmInterruptPinGen(p), pin(new ArmSPI(p.platform, p.num))
+ : ArmInterruptPinGen(p), pin(new ArmSPI(p))
{
}
} else {
// Generate PPI Pin
auto &p = static_cast<const ArmPPIParams &>(_params);
- ArmPPI *pin = new ArmPPI(p.platform, tc, p.num);
+ ArmPPI *pin = new ArmPPI(p, tc);
pins.insert({cid, pin});
}
ArmInterruptPin::ArmInterruptPin(
- Platform *_platform, ThreadContext *tc, uint32_t int_num)
- : threadContext(tc), platform(dynamic_cast<RealView*>(_platform)),
- intNum(int_num), _active(false)
+ const ArmInterruptPinParams &p, ThreadContext *tc)
+ : threadContext(tc), platform(dynamic_cast<RealView*>(p.platform)),
+ intNum(p.num), triggerType(p.int_type), _active(false)
{
fatal_if(!platform, "Interrupt not connected to a RealView platform");
}
}
ArmSPI::ArmSPI(
- Platform *_platform, uint32_t int_num)
- : ArmInterruptPin(_platform, nullptr, int_num)
+ const ArmSPIParams &p)
+ : ArmInterruptPin(p, nullptr)
{
}
}
ArmPPI::ArmPPI(
- Platform *_platform, ThreadContext *tc, uint32_t int_num)
- : ArmInterruptPin(_platform, tc, int_num)
+ const ArmPPIParams &p, ThreadContext *tc)
+ : ArmInterruptPin(p, tc)
{
}
#include "arch/arm/system.hh"
#include "dev/io_device.hh"
+#include "enums/ArmInterruptType.hh"
+
class Platform;
class RealView;
class ThreadContext;
{
friend class ArmInterruptPinGen;
protected:
- ArmInterruptPin(Platform *platform, ThreadContext *tc,
- uint32_t int_num);
+ ArmInterruptPin(const ArmInterruptPinParams &p, ThreadContext *tc);
public: /* Public interface */
/**
/** Interrupt number to generate */
const uint32_t intNum;
+ /** Interrupt triggering type */
+ const ArmInterruptType triggerType;
+
/** True if interrupt pin is active, false otherwise */
bool _active;
};
{
friend class ArmSPIGen;
private:
- ArmSPI(Platform *platform, uint32_t int_num);
+ ArmSPI(const ArmSPIParams &p);
public:
void raise() override;
{
friend class ArmPPIGen;
private:
- ArmPPI(Platform *platform, ThreadContext *tc, uint32_t int_num);
+ ArmPPI(const ArmPPIParams &p, ThreadContext *tc);
public:
void raise() override;