Add different nim types

This commit is contained in:
Nomi 2023-09-26 07:12:48 +02:00
commit d0eda87f8b
2 changed files with 14 additions and 4 deletions

View file

@ -6,7 +6,6 @@
#include "result/result.hpp"
class NIMService {
Handle handle = KernelHandles::NIM;
Memory& mem;
MAKE_LOG_FUNCTION(log, nimLogger)
@ -14,7 +13,12 @@ class NIMService {
void initialize(u32 messagePointer);
public:
enum class Type {
AOC, // nim:aoc
U, // nim:u
};
NIMService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
void handleSyncRequest(u32 messagePointer, Type type);
};

View file

@ -9,10 +9,16 @@ namespace NIMCommands {
void NIMService::reset() {}
void NIMService::handleSyncRequest(u32 messagePointer) {
void NIMService::handleSyncRequest(u32 messagePointer, Type type) {
const u32 command = mem.read32(messagePointer);
switch (command) {
case NIMCommands::Initialize: initialize(messagePointer); break;
if (type == Type::AOC) {
switch (command) {
case NIMCommands::Initialize: initialize(messagePointer); break;
default: Helpers::panic("NIM AOC service requested. Command: %08X\n", command);
}
}
default: Helpers::panic("NIM service requested. Command: %08X\n", command);
}
}