2017-07-07 07:09:03 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
|
|
|
#include <nx/KernelCapability.h>
|
|
|
|
|
|
|
|
namespace nx
|
|
|
|
{
|
|
|
|
class InteruptEntry
|
|
|
|
{
|
|
|
|
public:
|
2017-07-12 14:02:10 +00:00
|
|
|
static const u32 kInteruptBits = 10;
|
|
|
|
static const u32 kInteruptMax = BIT(kInteruptBits) - 1;
|
|
|
|
static const u32 kInteruptNum = 2;
|
|
|
|
|
2017-07-07 07:09:03 +00:00
|
|
|
InteruptEntry();
|
|
|
|
InteruptEntry(const KernelCapability& kernel_cap);
|
|
|
|
InteruptEntry(u32 interupt0, u32 interupt1);
|
|
|
|
|
|
|
|
// kernel capability
|
|
|
|
const KernelCapability& getKernelCapability() const;
|
|
|
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
|
|
|
|
|
|
|
// variables
|
2017-07-12 14:02:10 +00:00
|
|
|
u32 operator[](size_t index) const;
|
|
|
|
|
|
|
|
u32 getInterupt(size_t index) const;
|
|
|
|
void setInterupt(size_t index, u32 interupt);
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string kModuleName = "INTERUPT_ENTRY";
|
|
|
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_ENABLE_INTERUPTS;
|
|
|
|
|
|
|
|
KernelCapability mCap;
|
2017-07-12 14:02:10 +00:00
|
|
|
u32 mInterupt[kInteruptNum];
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
inline void updateCapField()
|
|
|
|
{
|
|
|
|
u32 field = 0;
|
|
|
|
field |= (u32)(mInterupt[0] & kInteruptMax) << 0;
|
|
|
|
field |= (u32)(mInterupt[1] & kInteruptMax) << kInteruptBits;
|
|
|
|
mCap.setField(field);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void processCapField()
|
|
|
|
{
|
|
|
|
u32 field = mCap.getField();
|
|
|
|
mInterupt[0] = (field >> 0) & kInteruptMax;
|
|
|
|
mInterupt[1] = (field >> kInteruptBits) & kInteruptMax;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|