Add boot namespace and adjust names

This commit is contained in:
Jaby 2023-01-12 22:02:11 +01:00 committed by Jaby
parent 954f660929
commit 25fc43064a
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,16 +23,13 @@ namespace JabyEngine {
void setup(); void setup();
} }
namespace Setup { namespace Start {
JabyEngine::NextRoutine start();
}
namespace BootFile {
JabyEngine::NextRoutine setup(); JabyEngine::NextRoutine setup();
} }
namespace Timer { namespace Timer {
void setup(); void setup();
} }
}
} }
#endif //!BOOT_LOADER_HPP #endif //!BOOT_LOADER_HPP

View File

@ -4,10 +4,12 @@
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");
return JabyEngine::NextRoutine::from(main); return JabyEngine::NextRoutine::from(main);
} }
} }
}
} }

View File

@ -2,10 +2,12 @@
#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");
return JabyEngine::NextRoutine::null(); return JabyEngine::NextRoutine::null();
} }
} }
}
} }

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));
@ -54,4 +57,5 @@ namespace JabyEngine {
GPU::internal::quick_fill_fast(Color24::Black(), PositionU16(32, 0), SizeU16(Display::Width, Display::Height)); GPU::internal::quick_fill_fast(Color24::Black(), PositionU16(32, 0), SizeU16(Display::Width, Display::Height));
} }
} }
}
} }

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;
@ -96,4 +97,5 @@ namespace JabyEngine {
setup_control_register(); setup_control_register();
} }
} }
}
} }

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();
@ -29,4 +30,5 @@ namespace JabyEngine {
return BootFile::setup(); return BootFile::setup();
} }
} }
}
} }

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) {