2018-08-13 17:14:21 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
2018-04-24 05:24:20 +00:00
|
|
|
#include <fnd/SimpleTextOutput.h>
|
2018-10-06 08:45:09 +00:00
|
|
|
#include <fnd/OffsetAdjustedIFile.h>
|
2018-08-07 07:17:51 +00:00
|
|
|
#include <nn/hac/XciUtils.h>
|
2018-05-12 15:02:53 +00:00
|
|
|
#include "XciProcess.h"
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-06-03 08:48:12 +00:00
|
|
|
XciProcess::XciProcess() :
|
2018-09-23 03:29:22 +00:00
|
|
|
mFile(),
|
2018-06-18 15:30:19 +00:00
|
|
|
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
2018-06-03 08:48:12 +00:00
|
|
|
mVerify(false),
|
|
|
|
mListFs(false),
|
|
|
|
mRootPfs(),
|
|
|
|
mExtractInfo()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void XciProcess::process()
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
importHeader();
|
2018-06-03 08:48:12 +00:00
|
|
|
|
|
|
|
// validate header signature
|
|
|
|
if (mVerify)
|
|
|
|
validateXciSignature();
|
|
|
|
|
|
|
|
// display header
|
2018-06-18 15:30:19 +00:00
|
|
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_BASIC))
|
2018-06-03 08:48:12 +00:00
|
|
|
displayHeader();
|
|
|
|
|
|
|
|
// process root partition
|
|
|
|
processRootPfs();
|
|
|
|
|
|
|
|
// process partitions
|
|
|
|
processPartitionPfs();
|
|
|
|
}
|
|
|
|
|
2018-09-23 03:29:22 +00:00
|
|
|
void XciProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
2018-06-03 08:48:12 +00:00
|
|
|
{
|
|
|
|
mFile = file;
|
|
|
|
}
|
|
|
|
|
2018-08-21 12:03:19 +00:00
|
|
|
void XciProcess::setKeyCfg(const KeyConfiguration& keycfg)
|
2018-06-03 08:48:12 +00:00
|
|
|
{
|
2018-08-21 12:03:19 +00:00
|
|
|
mKeyCfg = keycfg;
|
2018-06-03 08:48:12 +00:00
|
|
|
}
|
|
|
|
|
2018-06-18 15:30:19 +00:00
|
|
|
void XciProcess::setCliOutputMode(CliOutputMode type)
|
2018-06-03 08:48:12 +00:00
|
|
|
{
|
2018-06-18 15:30:19 +00:00
|
|
|
mCliOutputMode = type;
|
2018-06-03 08:48:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void XciProcess::setVerifyMode(bool verify)
|
|
|
|
{
|
|
|
|
mVerify = verify;
|
|
|
|
}
|
|
|
|
|
|
|
|
void XciProcess::setPartitionForExtract(const std::string& partition_name, const std::string& extract_path)
|
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
mExtractInfo.addElement({partition_name, extract_path});
|
2018-06-03 08:48:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void XciProcess::setListFs(bool list_fs)
|
|
|
|
{
|
|
|
|
mListFs = list_fs;
|
|
|
|
}
|
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
void XciProcess::importHeader()
|
|
|
|
{
|
|
|
|
fnd::Vec<byte_t> scratch;
|
|
|
|
|
2018-09-23 03:29:22 +00:00
|
|
|
if (*mFile == nullptr)
|
2018-08-13 17:14:21 +00:00
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "No file reader set.");
|
|
|
|
}
|
|
|
|
|
|
|
|
// read header page
|
2018-09-23 03:29:22 +00:00
|
|
|
(*mFile)->read((byte_t*)&mHdrPage, 0, sizeof(nn::hac::sXciHeaderPage));
|
2018-08-13 17:14:21 +00:00
|
|
|
|
|
|
|
// allocate memory for and decrypt sXciHeader
|
|
|
|
scratch.alloc(sizeof(nn::hac::sXciHeader));
|
2018-08-21 12:03:19 +00:00
|
|
|
|
|
|
|
fnd::aes::sAes128Key header_key;
|
|
|
|
mKeyCfg.getXciHeaderKey(header_key);
|
|
|
|
nn::hac::XciUtils::decryptXciHeader((const byte_t*)&mHdrPage.header, scratch.data(), header_key.key);
|
2018-08-13 17:14:21 +00:00
|
|
|
|
|
|
|
// deserialise header
|
|
|
|
mHdr.fromBytes(scratch.data(), scratch.size());
|
|
|
|
}
|
|
|
|
|
2018-04-24 05:24:20 +00:00
|
|
|
void XciProcess::displayHeader()
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << "[XCI Header]" << std::endl;
|
|
|
|
std::cout << " CardHeaderVersion: " << std::dec << (uint32_t)mHdr.getCardHeaderVersion() << std::endl;
|
|
|
|
std::cout << " RomSize: " << getRomSizeStr(mHdr.getRomSizeType());
|
2018-07-01 11:18:38 +00:00
|
|
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " (0x" << std::hex << (uint32_t)mHdr.getRomSizeType() << ")";
|
|
|
|
std::cout << std::endl;
|
|
|
|
std::cout << " PackageId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mHdr.getPackageId() << std::endl;
|
|
|
|
std::cout << " Flags: 0x" << std::dec << (uint32_t)mHdr.getFlags() << std::endl;
|
2018-07-01 11:18:38 +00:00
|
|
|
if (mHdr.getFlags() != 0)
|
|
|
|
{
|
|
|
|
for (uint32_t i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
if (_HAS_BIT(mHdr.getFlags(), i))
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " " << getHeaderFlagStr(i) << std::endl;
|
2018-07-01 11:18:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-18 15:30:19 +00:00
|
|
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " InitialData:" << std::endl;
|
|
|
|
std::cout << " KekIndex: " << std::dec << (uint32_t)mHdr.getKekIndex() << std::endl;
|
|
|
|
std::cout << " TitleKeyDecIndex: " << std::dec << (uint32_t)mHdr.getTitleKeyDecIndex() << std::endl;
|
|
|
|
std::cout << " Hash:" << std::endl;
|
2018-08-24 08:10:03 +00:00
|
|
|
std::cout << " " << fnd::SimpleTextOutput::arrayToString(mHdr.getInitialDataHash().bytes, 0x10, true, ":") << std::endl;
|
|
|
|
std::cout << " " << fnd::SimpleTextOutput::arrayToString(mHdr.getInitialDataHash().bytes+0x10, 0x10, true, ":") << std::endl;
|
2018-06-18 15:30:19 +00:00
|
|
|
}
|
|
|
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
|
|
|
{
|
2018-08-24 08:10:03 +00:00
|
|
|
std::cout << " Extended Header AesCbc IV:" << std::endl;
|
|
|
|
std::cout << " " << fnd::SimpleTextOutput::arrayToString(mHdr.getAesCbcIv().iv, sizeof(mHdr.getAesCbcIv().iv), true, ":") << std::endl;
|
2018-06-18 15:30:19 +00:00
|
|
|
}
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " SelSec: 0x" << std::hex << mHdr.getSelSec() << std::endl;
|
|
|
|
std::cout << " SelT1Key: 0x" << std::hex << mHdr.getSelT1Key() << std::endl;
|
|
|
|
std::cout << " SelKey: 0x" << std::hex << mHdr.getSelKey() << std::endl;
|
2018-06-18 15:30:19 +00:00
|
|
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_LAYOUT))
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " RomAreaStartPage: 0x" << std::hex << mHdr.getRomAreaStartPage();
|
2018-06-18 15:30:19 +00:00
|
|
|
if (mHdr.getRomAreaStartPage() != (uint32_t)(-1))
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getRomAreaStartPage()) << ")";
|
|
|
|
std::cout << std::endl;
|
2018-06-18 15:30:19 +00:00
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " BackupAreaStartPage: 0x" << std::hex << mHdr.getBackupAreaStartPage();
|
2018-06-18 15:30:19 +00:00
|
|
|
if (mHdr.getBackupAreaStartPage() != (uint32_t)(-1))
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getBackupAreaStartPage()) << ")";
|
|
|
|
std::cout << std::endl;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " ValidDataEndPage: 0x" << std::hex << mHdr.getValidDataEndPage();
|
2018-06-18 15:30:19 +00:00
|
|
|
if (mHdr.getValidDataEndPage() != (uint32_t)(-1))
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getValidDataEndPage()) << ")";
|
|
|
|
std::cout << std::endl;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " LimArea: 0x" << std::hex << mHdr.getLimAreaPage();
|
2018-06-18 15:30:19 +00:00
|
|
|
if (mHdr.getLimAreaPage() != (uint32_t)(-1))
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getLimAreaPage()) << ")";
|
|
|
|
std::cout << std::endl;
|
2018-06-18 15:30:19 +00:00
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " PartitionFs Header:" << std::endl;
|
|
|
|
std::cout << " Offset: 0x" << std::hex << mHdr.getPartitionFsAddress() << std::endl;
|
|
|
|
std::cout << " Size: 0x" << std::hex << mHdr.getPartitionFsSize() << std::endl;
|
2018-06-18 15:30:19 +00:00
|
|
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " Hash:" << std::endl;
|
2018-08-24 08:10:03 +00:00
|
|
|
std::cout << " " << fnd::SimpleTextOutput::arrayToString(mHdr.getPartitionFsHash().bytes, 0x10, true, ":") << std::endl;
|
|
|
|
std::cout << " " << fnd::SimpleTextOutput::arrayToString(mHdr.getPartitionFsHash().bytes+0x10, 0x10, true, ":") << std::endl;
|
2018-06-18 15:30:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-01 11:18:38 +00:00
|
|
|
|
|
|
|
if (mHdr.getFwVerMinor() != 0)
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << "[XCI Extended Header]" << std::endl;
|
|
|
|
std::cout << " FwVersion: v" << std::dec << mHdr.getFwVerMajor() << "." << mHdr.getFwVerMinor() << std::endl;
|
|
|
|
std::cout << " AccCtrl1: 0x" << std::hex << mHdr.getAccCtrl1() << std::endl;
|
|
|
|
std::cout << " CardClockRate: " << getCardClockRate(mHdr.getAccCtrl1()) << std::endl;
|
|
|
|
std::cout << " Wait1TimeRead: 0x" << std::hex << mHdr.getWait1TimeRead() << std::endl;
|
|
|
|
std::cout << " Wait2TimeRead: 0x" << std::hex << mHdr.getWait2TimeRead() << std::endl;
|
|
|
|
std::cout << " Wait1TimeWrite: 0x" << std::hex << mHdr.getWait1TimeWrite() << std::endl;
|
|
|
|
std::cout << " Wait2TimeWrite: 0x" << std::hex << mHdr.getWait2TimeWrite() << std::endl;
|
|
|
|
std::cout << " FwMode: 0x" << std::hex << mHdr.getFwMode() << std::endl;
|
|
|
|
std::cout << " Update Partition Info:" << std::endl;
|
|
|
|
#define _SPLIT_VER(ver) std::dec << ((ver>>26) & 0x3f) << "." << ((ver>>20) & 0x3f) << "." << ((ver>>16) & 0xf) << "." << (ver & 0xffff)
|
|
|
|
std::cout << " CUP Version: v" << std::dec << mHdr.getUppVersion() << " (" << _SPLIT_VER(mHdr.getUppVersion()) << ")" << std::endl;
|
2018-05-12 16:04:07 +00:00
|
|
|
#undef _SPLIT_VER
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << " CUP TitleId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mHdr.getUppId() << std::endl;
|
2018-08-24 08:10:03 +00:00
|
|
|
std::cout << " Partition Hash: " << fnd::SimpleTextOutput::arrayToString(mHdr.getUppHash(), 8, true, ":") << std::endl;
|
2018-08-13 17:14:21 +00:00
|
|
|
}
|
2018-04-24 05:24:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool XciProcess::validateRegionOfFile(size_t offset, size_t len, const byte_t* test_hash)
|
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
fnd::Vec<byte_t> scratch;
|
2018-08-07 08:35:03 +00:00
|
|
|
fnd::sha::sSha256Hash calc_hash;
|
2018-04-24 05:24:20 +00:00
|
|
|
scratch.alloc(len);
|
2018-09-23 03:29:22 +00:00
|
|
|
(*mFile)->read(scratch.data(), offset, scratch.size());
|
2018-08-07 08:35:03 +00:00
|
|
|
fnd::sha::Sha256(scratch.data(), scratch.size(), calc_hash.bytes);
|
2018-04-24 05:24:20 +00:00
|
|
|
return calc_hash.compare(test_hash);
|
|
|
|
}
|
|
|
|
|
|
|
|
void XciProcess::validateXciSignature()
|
|
|
|
{
|
2018-08-21 12:03:19 +00:00
|
|
|
fnd::rsa::sRsa2048Key header_sign_key;
|
2018-08-07 08:35:03 +00:00
|
|
|
fnd::sha::sSha256Hash calc_hash;
|
|
|
|
fnd::sha::Sha256((byte_t*)&mHdrPage.header, sizeof(nn::hac::sXciHeader), calc_hash.bytes);
|
2018-08-21 12:03:19 +00:00
|
|
|
mKeyCfg.getXciHeaderSignKey(header_sign_key);
|
|
|
|
if (fnd::rsa::pkcs::rsaVerify(header_sign_key, fnd::sha::HASH_SHA256, calc_hash.bytes, mHdrPage.signature) != 0)
|
2018-04-24 05:24:20 +00:00
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << "[WARNING] XCI Header Signature: FAIL" << std::endl;
|
2018-04-24 05:24:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void XciProcess::processRootPfs()
|
|
|
|
{
|
2018-06-06 13:27:46 +00:00
|
|
|
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize(), mHdr.getPartitionFsHash().bytes) == false)
|
2018-04-24 05:24:20 +00:00
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << "[WARNING] XCI Root HFS0: FAIL (bad hash)" << std::endl;
|
2018-04-24 05:24:20 +00:00
|
|
|
}
|
2018-10-06 08:45:09 +00:00
|
|
|
mRootPfs.setInputFile(new fnd::OffsetAdjustedIFile(mFile, mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize()));
|
2018-04-24 05:24:20 +00:00
|
|
|
mRootPfs.setListFs(mListFs);
|
2018-06-06 13:27:46 +00:00
|
|
|
mRootPfs.setVerifyMode(false);
|
2018-06-18 15:30:19 +00:00
|
|
|
mRootPfs.setCliOutputMode(mCliOutputMode);
|
2018-04-24 05:24:20 +00:00
|
|
|
mRootPfs.setMountPointName(kXciMountPointName);
|
|
|
|
mRootPfs.process();
|
|
|
|
}
|
|
|
|
|
|
|
|
void XciProcess::processPartitionPfs()
|
|
|
|
{
|
2018-08-07 07:17:51 +00:00
|
|
|
const fnd::List<nn::hac::PfsHeader::sFile>& rootPartitions = mRootPfs.getPfsHeader().getFileList();
|
2018-06-24 15:01:16 +00:00
|
|
|
for (size_t i = 0; i < rootPartitions.size(); i++)
|
2018-06-06 13:27:46 +00:00
|
|
|
{
|
|
|
|
// this must be validated here because only the size of the root partiton header is known at verification time
|
|
|
|
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress() + rootPartitions[i].offset, rootPartitions[i].hash_protected_size, rootPartitions[i].hash.bytes) == false)
|
|
|
|
{
|
2018-08-13 17:14:21 +00:00
|
|
|
std::cout << "[WARNING] XCI " << rootPartitions[i].name << " Partition HFS0: FAIL (bad hash)" << std::endl;
|
2018-06-06 13:27:46 +00:00
|
|
|
}
|
|
|
|
|
2018-04-24 05:24:20 +00:00
|
|
|
PfsProcess tmp;
|
2018-10-06 08:45:09 +00:00
|
|
|
tmp.setInputFile(new fnd::OffsetAdjustedIFile(mFile, mHdr.getPartitionFsAddress() + rootPartitions[i].offset, rootPartitions[i].size));
|
2018-04-24 05:24:20 +00:00
|
|
|
tmp.setListFs(mListFs);
|
|
|
|
tmp.setVerifyMode(mVerify);
|
2018-06-18 15:30:19 +00:00
|
|
|
tmp.setCliOutputMode(mCliOutputMode);
|
2018-04-24 05:24:20 +00:00
|
|
|
tmp.setMountPointName(kXciMountPointName + rootPartitions[i].name);
|
2018-06-24 15:01:16 +00:00
|
|
|
if (mExtractInfo.hasElement<std::string>(rootPartitions[i].name))
|
|
|
|
tmp.setExtractPath(mExtractInfo.getElement<std::string>(rootPartitions[i].name).extract_path);
|
|
|
|
|
2018-04-24 05:24:20 +00:00
|
|
|
tmp.process();
|
|
|
|
}
|
2018-07-01 11:18:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* XciProcess::getRomSizeStr(byte_t rom_size) const
|
|
|
|
{
|
2018-08-12 05:23:57 +00:00
|
|
|
const char* str = nullptr;
|
|
|
|
|
2018-07-01 11:18:38 +00:00
|
|
|
switch (rom_size)
|
|
|
|
{
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::ROM_SIZE_1GB):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "1GB";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::ROM_SIZE_2GB):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "2GB";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::ROM_SIZE_4GB):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "4GB";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::ROM_SIZE_8GB):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "8GB";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::ROM_SIZE_16GB):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "16GB";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::ROM_SIZE_32GB):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "32GB";
|
|
|
|
break;
|
2018-08-12 05:23:57 +00:00
|
|
|
default:
|
|
|
|
str = "Unknown";
|
|
|
|
break;
|
2018-07-01 11:18:38 +00:00
|
|
|
}
|
2018-08-12 05:23:57 +00:00
|
|
|
|
2018-07-01 11:18:38 +00:00
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* XciProcess::getHeaderFlagStr(byte_t flag) const
|
|
|
|
{
|
2018-08-12 05:23:57 +00:00
|
|
|
const char* str = nullptr;
|
|
|
|
|
2018-07-01 11:18:38 +00:00
|
|
|
switch (flag)
|
|
|
|
{
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::FLAG_AUTOBOOT):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "AutoBoot";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::FLAG_HISTORY_ERASE):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "HistoryErase";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::FLAG_REPAIR_TOOL):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "RepairTool";
|
|
|
|
break;
|
2018-08-12 05:23:57 +00:00
|
|
|
default:
|
|
|
|
str = "Unknown";
|
|
|
|
break;
|
2018-07-01 11:18:38 +00:00
|
|
|
}
|
2018-08-12 05:23:57 +00:00
|
|
|
|
2018-07-01 11:18:38 +00:00
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char* XciProcess::getCardClockRate(uint32_t acc_ctrl_1) const
|
|
|
|
{
|
2018-08-12 05:23:57 +00:00
|
|
|
const char* str = nullptr;
|
|
|
|
|
2018-07-01 11:18:38 +00:00
|
|
|
switch (acc_ctrl_1)
|
|
|
|
{
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::CLOCK_RATE_25):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "20 MHz";
|
|
|
|
break;
|
2018-08-07 07:17:51 +00:00
|
|
|
case (nn::hac::xci::CLOCK_RATE_50):
|
2018-07-01 11:18:38 +00:00
|
|
|
str = "50 MHz";
|
|
|
|
break;
|
2018-08-12 05:23:57 +00:00
|
|
|
default:
|
|
|
|
str = "Unknown";
|
|
|
|
break;
|
2018-07-01 11:18:38 +00:00
|
|
|
}
|
2018-08-12 05:23:57 +00:00
|
|
|
|
2018-07-01 11:18:38 +00:00
|
|
|
return str;
|
|
|
|
}
|