2017-07-07 07:09:03 +00:00
|
|
|
#include "InteruptEntry.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nx::InteruptEntry::InteruptEntry() :
|
|
|
|
mCap(kCapId),
|
|
|
|
mInterupt{0,0}
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
nx::InteruptEntry::InteruptEntry(const KernelCapability & kernel_cap) :
|
|
|
|
mCap(kCapId),
|
|
|
|
mInterupt{ 0,0 }
|
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
|
|
|
nx::InteruptEntry::InteruptEntry(u32 interupt0, u32 interupt1) :
|
|
|
|
mCap(kCapId),
|
|
|
|
mInterupt{ 0,0 }
|
|
|
|
{
|
2017-07-12 14:02:10 +00:00
|
|
|
setInterupt(0, interupt0);
|
|
|
|
setInterupt(1, interupt1);
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const nx::KernelCapability & nx::InteruptEntry::getKernelCapability() const
|
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::InteruptEntry::setKernelCapability(const KernelCapability & kernel_cap)
|
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "KernelCapability is not type 'EnableInterupts'");
|
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
2017-07-12 14:02:10 +00:00
|
|
|
u32 nx::InteruptEntry::operator[](size_t index) const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
2017-07-12 14:02:10 +00:00
|
|
|
return getInterupt(index);
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 14:02:10 +00:00
|
|
|
u32 nx::InteruptEntry::getInterupt(size_t index) const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
2017-07-12 14:02:10 +00:00
|
|
|
return mInterupt[index % kInteruptNum];
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 14:02:10 +00:00
|
|
|
void nx::InteruptEntry::setInterupt(size_t index, u32 interupt)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (interupt > kInteruptMax)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal interupt value.");
|
|
|
|
}
|
|
|
|
|
2017-07-12 14:02:10 +00:00
|
|
|
mInterupt[index % kInteruptNum] = interupt;
|
2017-07-07 07:09:03 +00:00
|
|
|
updateCapField();
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|