homebrew to query clkrst registers, requires rebuilding nx-hbloader to allow access; emc pllm(b) divm accepts 1/2/4 only

This commit is contained in:
KazushiM
2022-02-09 15:27:57 +08:00
parent c701de9ca5
commit 94ac52e80b
8 changed files with 130 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ export CC := g++-11
all: test
test:
$(CC) ldr_oc_suite.cpp test.cpp -o ./test -O2 -std=c++20 -DOC_TEST
$(CC) ldr_oc_suite.cpp test.cpp -o ./test -O2 -std=c++20
clean:
rm ./test

View File

@@ -29,7 +29,7 @@ static const volatile CustomizeTable C = {
/* Mariko EMC:
* - RAM Clock in kHz:
* Values should be > 1600000, and divided evenly by 9600 or 12800.
* Values should be > 1600000, and divided evenly by 9600.
* [WARNING]
* RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM:
* - Graphical glitches

View File

@@ -16,7 +16,7 @@
//#define EXPERIMENTAL
#ifdef OC_TEST
#ifndef ATMOSPHERE_IS_STRATOSPHERE
#include "ldr_oc_suite_test.hpp"
#else
#include <stratosphere.hpp>
@@ -170,7 +170,7 @@ namespace ams::ldr::oc {
} pllmb_div;
constexpr pllmb_div div[] = {
{3, 4}, {2, 3}, {1, 2}, {1, 3}, {1, 4}, {0, 1}
{3, 4}, {1, 2}, {1, 4}, {0, 1}
};
constexpr u32 pll_osc_in = 38400;
@@ -1124,7 +1124,7 @@ namespace ams::ldr::oc {
void Patch(uintptr_t mapped_nso, size_t nso_size) {
SafetyCheck();
#ifdef OC_TEST
#ifndef ATMOSPHERE_IS_STRATOSPHERE
void* buf = malloc(nso_size);
uintptr_t mapped_exe = reinterpret_cast<uintptr_t>(buf);
std::memcpy(buf, reinterpret_cast<void *>(mapped_nso), nso_size);
@@ -1144,7 +1144,7 @@ namespace ams::ldr::oc {
namespace ptm {
void Patch(uintptr_t mapped_nso, size_t nso_size) {
#ifndef OC_TEST
#ifdef ATMOSPHERE_IS_STRATOSPHERE
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
if (!isMariko)
return;

View File

@@ -48,7 +48,7 @@ namespace ams::ldr::oc {
inline Result ResultFailure() { return -1; }
#ifndef OC_TEST
#ifdef ATMOSPHERE_IS_STRATOSPHERE
#define LOGGING(fmt, ...) ((void)0)
#endif

View File

@@ -1,4 +1,4 @@
#ifdef OC_TEST
#ifndef ATMOSPHERE_IS_STRATOSPHERE
#include <iostream>
#include <cstdint>
#include <cstring>

View File

@@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef OC_TEST
#ifndef ATMOSPHERE_IS_STRATOSPHERE
#include <cstdio>
#include <cstring>
#include <cstdlib>