Using new IO Port

This commit is contained in:
Jaby 2022-08-31 23:02:40 +02:00
parent f056972b15
commit bcb6191431
3 changed files with 9 additions and 16 deletions

View File

@ -100,11 +100,11 @@ public:
return this->value; return this->value;
} }
constexpr IOPort<T>& operator=(T value) { constexpr void operator=(T value) {
this->value = value; this->value = value;
} }
constexpr volatile IOPort<T>& operator=(T value) volatile { constexpr void operator=(T value) volatile {
this->value = value; this->value = value;
} }
}; };

View File

@ -1,8 +1,10 @@
#ifndef __JABYENGINE_SPU_IO_HPP__ #ifndef __JABYENGINE_SPU_IO_HPP__
#define __JABYENGINE_SPU_IO_HPP__ #define __JABYENGINE_SPU_IO_HPP__
#include "../../Auxiliary/io_class_helper.hpp" #include "IOPort.hpp"
#include <limits.h> #include <limits.h>
#include "../../Auxiliary/io_class_helper.hpp"
namespace SPU { namespace SPU {
struct __no_align ubus32_t struct __no_align ubus32_t
{ {
@ -213,10 +215,9 @@ namespace SPU {
io_class__2option_map_getter_is(bool, cd_audio_disable, cd_audio_enable, 0); io_class__2option_map_getter_is(bool, cd_audio_disable, cd_audio_enable, 0);
}; };
struct __no_align DataTransferControl { struct DataTransferControl {
static inline __always_inline auto& Register = *reinterpret_cast<DataTransferControl*>(0x1F801DAC); static inline __always_inline auto& Register = *reinterpret_cast<IOPort<uint16_t>*>(0x1F801DAC);
static inline __always_inline volatile auto& vRegister = *reinterpret_cast<IOPort<uint16_t>*>(0x1F801DAC);
uint16_t raw_value = 0;
}; };
} }

View File

@ -33,15 +33,7 @@ namespace SPU {
io_class__update_with(Control::Register, Control()); io_class__update_with(Control::Register, Control());
} }
void test() {
static __always_inline volatile auto& Dino = *reinterpret_cast<IOPort<uint16_t>*>(0x120);
while(Dino.is_bit_set(0));
}
void setup() { void setup() {
test();
clear_main_volume(); clear_main_volume();
clear_keys(); clear_keys();
disable_control(); disable_control();
@ -50,7 +42,7 @@ namespace SPU {
clear_voice(voice); clear_voice(voice);
} }
io_class__update_with(DataTransferControl::Register, (2 << 1)); DataTransferControl::Register = (2 << 1);
enable_control(); enable_control();
} }
} }