Use GlobalTime

This commit is contained in:
Jaby
2023-01-08 16:20:30 +01:00
parent 3c1d965cc5
commit 149105a3fa
8 changed files with 55 additions and 12 deletions

View File

@@ -36,6 +36,10 @@ namespace JabyEngine {
Status.write(Status.read().clear_bit(irq));
}
static void disable_irq(Bit<uint32_t> irq) {
Mask.write(Mask.read().clear_bit(irq));
}
static void enable_irq(Bit<uint32_t> irq) {
Mask.write(Mask.read().set_bit(irq));
}

View File

@@ -32,10 +32,11 @@ namespace JabyEngine {
};
struct __no_align Timer {
IOPort<uint32_t> value;
IOPort<CounterMode> mode;
IOPort<CounterTarget> target;
private:
uint32_t _unused[2];
uint32_t _unused[1];
};
namespace Counter0 {
@@ -86,7 +87,7 @@ namespace JabyEngine {
};
}
__declare_io_port_global_array(Timer, Counter, 0x1F801104, 3);
__declare_io_port_global_array(Timer, Counter, 0x1F801100, 3);
static_assert(sizeof(Timer) == 0x10);
}
}

View File

@@ -13,14 +13,14 @@ namespace JabyEngine {
public:
constexpr size_t milliseconds_to(const TimeStamp& ts) const {
return (ts.value - this->value);
return (ts.value - this->value)*10;
}
friend class GlobalTime;
};
private:
static size_t global_counter;
static volatile size_t global_counter;
public:
GlobalTime() = delete;