2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/KernelVersionEntry.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nx::KernelVersionEntry::KernelVersionEntry() :
|
|
|
|
mCap(kCapId),
|
|
|
|
mVerMajor(0),
|
|
|
|
mVerMinor(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
nx::KernelVersionEntry::KernelVersionEntry(const KernelCapability & kernel_cap) :
|
|
|
|
mCap(kCapId),
|
|
|
|
mVerMajor(0),
|
|
|
|
mVerMinor(0)
|
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
nx::KernelVersionEntry::KernelVersionEntry(uint16_t major, uint8_t minor) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mVerMajor(0),
|
|
|
|
mVerMinor(0)
|
|
|
|
{
|
|
|
|
setVerMajor(major);
|
|
|
|
setVerMinor(minor);
|
|
|
|
}
|
|
|
|
|
|
|
|
const nx::KernelCapability & nx::KernelVersionEntry::getKernelCapability() const
|
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::KernelVersionEntry::setKernelCapability(const KernelCapability & kernel_cap)
|
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "KernelCapability is not type 'KernelVersion'");
|
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint16_t nx::KernelVersionEntry::getVerMajor() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mVerMajor;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::KernelVersionEntry::setVerMajor(uint16_t major)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (major > kVerMajorMax)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal KernelVersionMajor. (range: 0-0x1fff)");
|
|
|
|
}
|
|
|
|
|
|
|
|
mVerMajor = major;
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint8_t nx::KernelVersionEntry::getVerMinor() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mVerMinor;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::KernelVersionEntry::setVerMinor(uint8_t minor)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (minor > kVerMinorMax)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal KernelVersionMinor. (range: 0-0xf)");
|
|
|
|
}
|
|
|
|
|
|
|
|
mVerMinor = minor;
|
|
|
|
updateCapField();
|
|
|
|
}
|