mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-23 03:06:52 -04:00
os: refactor/rewrite entire namespace.
This commit is contained in:
parent
6193283f03
commit
065485b971
181 changed files with 5353 additions and 1929 deletions
|
@ -15,35 +15,56 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "os_managed_handle.hpp"
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/os/os_event_common.hpp>
|
||||
#include <stratosphere/os/os_interrupt_event_common.hpp>
|
||||
#include <stratosphere/os/os_interrupt_event_types.hpp>
|
||||
#include <stratosphere/os/os_interrupt_event_api.hpp>
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
namespace impl {
|
||||
|
||||
class WaitableHolderOfInterruptEvent;
|
||||
|
||||
}
|
||||
|
||||
class InterruptEvent {
|
||||
friend class impl::WaitableHolderOfInterruptEvent;
|
||||
NON_COPYABLE(InterruptEvent);
|
||||
NON_MOVEABLE(InterruptEvent);
|
||||
private:
|
||||
ManagedHandle handle;
|
||||
bool auto_clear;
|
||||
bool is_initialized;
|
||||
InterruptEventType event;
|
||||
public:
|
||||
InterruptEvent() : auto_clear(true), is_initialized(false) { }
|
||||
InterruptEvent(u32 interrupt_id, bool autoclear = true);
|
||||
explicit InterruptEvent(InterruptName name, EventClearMode clear_mode) {
|
||||
InitializeInterruptEvent(std::addressof(this->event), name, clear_mode);
|
||||
}
|
||||
|
||||
Result Initialize(u32 interrupt_id, bool autoclear = true);
|
||||
void Finalize();
|
||||
~InterruptEvent() {
|
||||
FinalizeInterruptEvent(std::addressof(this->event));
|
||||
}
|
||||
|
||||
void Reset();
|
||||
void Wait();
|
||||
bool TryWait();
|
||||
bool TimedWait(u64 ns);
|
||||
void Wait() {
|
||||
return WaitInterruptEvent(std::addressof(this->event));
|
||||
}
|
||||
|
||||
bool TryWait() {
|
||||
return TryWaitInterruptEvent(std::addressof(this->event));
|
||||
}
|
||||
|
||||
bool TimedWait(TimeSpan timeout) {
|
||||
return TimedWaitInterruptEvent(std::addressof(this->event), timeout);
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
return ClearInterruptEvent(std::addressof(this->event));
|
||||
}
|
||||
|
||||
operator InterruptEventType &() {
|
||||
return this->event;
|
||||
}
|
||||
|
||||
operator const InterruptEventType &() const {
|
||||
return this->event;
|
||||
}
|
||||
|
||||
InterruptEventType *GetBase() {
|
||||
return std::addressof(this->event);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue