Add boot namespace and adjust names

This commit is contained in:
2023-01-12 22:02:11 +01:00
parent 974793c17b
commit e3499dcd1e
9 changed files with 199 additions and 175 deletions

View File

@@ -4,6 +4,10 @@
namespace JabyEngine { namespace JabyEngine {
//boot namespace? //boot namespace?
namespace boot {
namespace BootFile {
JabyEngine::NextRoutine setup();
}
namespace CD { namespace CD {
void setup(); void setup();
@@ -19,11 +23,7 @@ namespace JabyEngine {
void setup(); void setup();
} }
namespace Setup { namespace Start {
JabyEngine::NextRoutine start();
}
namespace BootFile {
JabyEngine::NextRoutine setup(); JabyEngine::NextRoutine setup();
} }
@@ -31,4 +31,5 @@ namespace JabyEngine {
void setup(); void setup();
} }
} }
}
#endif //!BOOT_LOADER_HPP #endif //!BOOT_LOADER_HPP

View File

@@ -4,6 +4,7 @@
extern JabyEngine::NextRoutine main(); extern JabyEngine::NextRoutine main();
namespace JabyEngine { namespace JabyEngine {
namespace boot {
namespace BootFile { namespace BootFile {
JabyEngine::NextRoutine setup() { JabyEngine::NextRoutine setup() {
printf("Running main!\n"); printf("Running main!\n");
@@ -11,3 +12,4 @@ namespace JabyEngine {
} }
} }
} }
}

View File

@@ -2,6 +2,7 @@
#include <stdio.h> #include <stdio.h>
namespace JabyEngine { namespace JabyEngine {
namespace boot {
namespace BootFile { namespace BootFile {
JabyEngine::NextRoutine setup() { JabyEngine::NextRoutine setup() {
printf("Overlay boot not implemented!\n"); printf("Overlay boot not implemented!\n");
@@ -9,3 +10,4 @@ namespace JabyEngine {
} }
} }
} }
}

View File

@@ -2,9 +2,11 @@
#include <PSX/System/IOPorts/cd_io.hpp> #include <PSX/System/IOPorts/cd_io.hpp>
namespace JabyEngine { namespace JabyEngine {
namespace boot {
namespace CD { namespace CD {
void setup() { void setup() {
CD_IO::change_to_index0(); CD_IO::change_to_index0();
} }
} }
} }
}

View File

@@ -13,7 +13,10 @@
extern "C" uint32_t __boot_loader_end; extern "C" uint32_t __boot_loader_end;
namespace JabyEngine { namespace JabyEngine {
namespace boot {
namespace GPU { namespace GPU {
using namespace JabyEngine::GPU;
static size_t decompress_logo() { static size_t decompress_logo() {
LZ4Decompressor lz4_decomp(reinterpret_cast<uint8_t*>(&__boot_loader_end)); LZ4Decompressor lz4_decomp(reinterpret_cast<uint8_t*>(&__boot_loader_end));
@@ -55,3 +58,4 @@ namespace JabyEngine {
} }
} }
} }
}

View File

@@ -3,6 +3,7 @@
#include <limits.h> #include <limits.h>
namespace JabyEngine { namespace JabyEngine {
namespace boot {
namespace SPU { namespace SPU {
using namespace JabyEngine; using namespace JabyEngine;
@@ -97,3 +98,4 @@ namespace JabyEngine {
} }
} }
} }
}

View File

@@ -5,12 +5,13 @@
#include <stdio.h> #include <stdio.h>
namespace JabyEngine { namespace JabyEngine {
namespace Setup { namespace boot {
namespace Start {
static void enable_DMA() { static void enable_DMA() {
DMA_IO::DPCR.write(DMA_IO::DPCR.read() | DMA_IO::DMAControlRegister::SPUEnable | DMA_IO::DMAControlRegister::GPUEnable); DMA_IO::DPCR.write(DMA_IO::DPCR.read() | DMA_IO::DMAControlRegister::SPUEnable | DMA_IO::DMAControlRegister::GPUEnable);
} }
JabyEngine::NextRoutine start() { JabyEngine::NextRoutine setup() {
enable_DMA(); enable_DMA();
SPU::stop_voices(); SPU::stop_voices();
@@ -30,3 +31,4 @@ namespace JabyEngine {
} }
} }
} }
}

View File

@@ -9,6 +9,12 @@
namespace JabyEngine { namespace JabyEngine {
namespace Timer { namespace Timer {
extern InterrupCallback IRQCallback; extern InterrupCallback IRQCallback;
}
namespace boot {
namespace Timer {
using namespace JabyEngine::Timer;
void setup() { void setup() {
using namespace Timer_IO; using namespace Timer_IO;
@@ -27,11 +33,14 @@
} }
} }
} }
}
#else #else
namespace JabyEngine { namespace JabyEngine {
namespace boot {
namespace Timer { namespace Timer {
void setup() { void setup() {
} }
} }
} }
}
#endif //JABYENGINE_USE_HIGH_PERCISION_TIMER #endif //JABYENGINE_USE_HIGH_PERCISION_TIMER

View File

@@ -8,7 +8,7 @@ namespace JabyEngine {
} }
void start() { void start() {
NextRoutine next_routine = JabyEngine::NextRoutine::from(Setup::start); NextRoutine next_routine = JabyEngine::NextRoutine::from(boot::Start::setup);
printf("Starting Planschbecken 0x%p\n", next_routine.value); printf("Starting Planschbecken 0x%p\n", next_routine.value);
while(true) { while(true) {