2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/InteruptEntry.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
nx::InteruptEntry::InteruptEntry() :
|
|
|
|
mCap(kCapId),
|
|
|
|
mInterupt{0,0}
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
nx::InteruptEntry::InteruptEntry(const KernelCapabilityEntry & kernel_cap) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mInterupt{ 0,0 }
|
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
nx::InteruptEntry::InteruptEntry(uint32_t interupt0, uint32_t interupt1) :
|
2017-07-07 07:09:03 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::InteruptEntry::operator=(const InteruptEntry& other)
|
|
|
|
{
|
|
|
|
mInterupt[0] = other.mInterupt[0];
|
|
|
|
mInterupt[1] = other.mInterupt[1];
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::InteruptEntry::operator==(const InteruptEntry& other) const
|
|
|
|
{
|
|
|
|
return (mInterupt[0] == other.mInterupt[0]) \
|
|
|
|
&& (mInterupt[1] == other.mInterupt[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::InteruptEntry::operator!=(const InteruptEntry& other) const
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
const nx::KernelCapabilityEntry & nx::InteruptEntry::getKernelCapability() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
void nx::InteruptEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
2018-06-29 04:24:39 +00:00
|
|
|
throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'EnableInterupts'");
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t 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
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t 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
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::InteruptEntry::setInterupt(size_t index, uint32_t 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
|
|
|
}
|