Support High Percision Counter
This commit is contained in:
@@ -32,7 +32,7 @@ namespace JabyEngine {
|
||||
return Status.read().is_bit_set(irq);
|
||||
}
|
||||
|
||||
static void ack_irg(Bit<uint32_t> irq) {
|
||||
static void ack_irq(Bit<uint32_t> irq) {
|
||||
Status.write(Status.read().clear_bit(irq));
|
||||
}
|
||||
|
||||
|
@@ -12,9 +12,19 @@ namespace JabyEngine {
|
||||
constexpr TimeStamp(size_t value) : value(value) {}
|
||||
|
||||
public:
|
||||
#ifdef JABYENGINE_USE_HIGH_PERCISION_TIMER
|
||||
constexpr size_t microseconds_to(const TimeStamp& ts) const {
|
||||
return (ts.value - this->value)*100;
|
||||
}
|
||||
|
||||
constexpr size_t milliseconds_to(const TimeStamp& ts) const {
|
||||
return microseconds_to(ts)/1000;
|
||||
}
|
||||
#else
|
||||
constexpr size_t milliseconds_to(const TimeStamp& ts) const {
|
||||
return (ts.value - this->value)*10;
|
||||
}
|
||||
#endif //JABYENGINE_USE_HIGH_PERCISION_TIMER
|
||||
|
||||
friend class GlobalTime;
|
||||
};
|
||||
|
8
include/PSX/jabyengine_config.hpp
Normal file
8
include/PSX/jabyengine_config.hpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __JABYENGINE_CONFIG_HPP__
|
||||
#define __JABYENGINE_CONFIG_HPP__
|
||||
#ifdef USE_CUSTOM_CONFIG
|
||||
#include <jabyengine_custom_config.hpp>
|
||||
#else
|
||||
#define JABYENGINE_USE_HIGH_PERCISION_TIMER
|
||||
#endif //USE_CUSTOM_CONFIG
|
||||
#endif //!__JABYENGINE_CONFIG_HPP__
|
@@ -1,5 +1,6 @@
|
||||
#ifndef __JABYENGINE_DEFINES__H__
|
||||
#define __JABYENGINE_DEFINES__H__
|
||||
#include "jabyengine_config.hpp"
|
||||
#include "../stddef.h"
|
||||
|
||||
#define __keep __attribute__((used))
|
||||
|
Reference in New Issue
Block a user