mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-23 04:41:12 +00:00
Add KInterruptEvent skeleton; remove useless funcs
This commit is contained in:
parent
2949d08eb2
commit
5222b429c5
8 changed files with 83 additions and 19 deletions
|
@ -19,6 +19,10 @@ namespace mesosphere
|
||||||
class KProcess;
|
class KProcess;
|
||||||
class KResourceLimit;
|
class KResourceLimit;
|
||||||
class KThread;
|
class KThread;
|
||||||
|
class KEvent;
|
||||||
|
class KReadableEvent;
|
||||||
|
class KWritableEvent;
|
||||||
|
class KInterruptEvent;
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KProcess *obj);
|
void intrusive_ptr_add_ref(KProcess *obj);
|
||||||
void intrusive_ptr_release(KProcess *obj);
|
void intrusive_ptr_release(KProcess *obj);
|
||||||
|
@ -26,6 +30,18 @@ void intrusive_ptr_release(KProcess *obj);
|
||||||
void intrusive_ptr_add_ref(KResourceLimit *obj);
|
void intrusive_ptr_add_ref(KResourceLimit *obj);
|
||||||
void intrusive_ptr_release(KResourceLimit *obj);
|
void intrusive_ptr_release(KResourceLimit *obj);
|
||||||
|
|
||||||
|
void intrusive_ptr_add_ref(KEvent *obj);
|
||||||
|
void intrusive_ptr_release(KEvent *obj);
|
||||||
|
|
||||||
|
void intrusive_ptr_add_ref(KReadableEvent *obj);
|
||||||
|
void intrusive_ptr_release(KReadableEvent *obj);
|
||||||
|
|
||||||
|
void intrusive_ptr_add_ref(KWritableEvent *obj);
|
||||||
|
void intrusive_ptr_release(KWritableEvent *obj);
|
||||||
|
|
||||||
|
void intrusive_ptr_add_ref(KInterruptEvent *obj);
|
||||||
|
void intrusive_ptr_release(KInterruptEvent *obj);
|
||||||
|
|
||||||
class KAutoObject {
|
class KAutoObject {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,6 @@ class IClient : public IClientTag {
|
||||||
void *operator new(size_t sz) noexcept = delete;
|
void *operator new(size_t sz) noexcept = delete;
|
||||||
void operator delete(void *ptr) noexcept {}
|
void operator delete(void *ptr) noexcept {}
|
||||||
|
|
||||||
~IClient()
|
|
||||||
{
|
|
||||||
parent->HandleClientDestroyed();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SharedPtr<Parent>& GetParent() const { return parent; }
|
const SharedPtr<Parent>& GetParent() const { return parent; }
|
||||||
|
|
||||||
void SetParent(SharedPtr<Parent> parent)
|
void SetParent(SharedPtr<Parent> parent)
|
||||||
|
|
|
@ -21,11 +21,6 @@ class IServer : public IServerTag {
|
||||||
void *operator new(size_t sz) noexcept = delete;
|
void *operator new(size_t sz) noexcept = delete;
|
||||||
void operator delete(void *ptr) noexcept {};
|
void operator delete(void *ptr) noexcept {};
|
||||||
|
|
||||||
~IServer()
|
|
||||||
{
|
|
||||||
parent->HandleServerDestroyed();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SharedPtr<Parent> &GetParent() const { return parent; }
|
const SharedPtr<Parent> &GetParent() const { return parent; }
|
||||||
|
|
||||||
void SetParentAndClient(SharedPtr<Parent> parent, SharedPtr<Client> client)
|
void SetParentAndClient(SharedPtr<Parent> parent, SharedPtr<Client> client)
|
||||||
|
|
38
mesosphere/include/mesosphere/interrupts/KInterruptEvent.hpp
Normal file
38
mesosphere/include/mesosphere/interrupts/KInterruptEvent.hpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <mesosphere/processes/KReadableEvent.hpp>
|
||||||
|
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
||||||
|
|
||||||
|
namespace mesosphere
|
||||||
|
{
|
||||||
|
|
||||||
|
class KInterruptEvent final : public KReadableEvent, public ISetAllocated<KInterruptEvent> {
|
||||||
|
public:
|
||||||
|
MESOSPHERE_AUTO_OBJECT_TRAITS(ReadableEvent, InterruptEvent);
|
||||||
|
|
||||||
|
void *operator new(size_t sz) noexcept { return ISetAllocated<KInterruptEvent>::operator new(sz); }
|
||||||
|
void operator delete(void *ptr) noexcept { ISetAllocated<KInterruptEvent>::operator delete(ptr); }
|
||||||
|
|
||||||
|
virtual ~KInterruptEvent();
|
||||||
|
Result Initialize(int irqId, u32 flags);
|
||||||
|
|
||||||
|
// KAutoObject
|
||||||
|
virtual bool IsAlive() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// TODO: receiver
|
||||||
|
int irqId = -1;
|
||||||
|
bool isInitialized = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void intrusive_ptr_add_ref(KInterruptEvent *obj)
|
||||||
|
{
|
||||||
|
intrusive_ptr_add_ref((KAutoObject *)obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void intrusive_ptr_release(KInterruptEvent *obj)
|
||||||
|
{
|
||||||
|
intrusive_ptr_release((KAutoObject *)obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,10 +31,6 @@ class KEvent final :
|
||||||
/* KAutoObject */
|
/* KAutoObject */
|
||||||
virtual bool IsAlive() const override;
|
virtual bool IsAlive() const override;
|
||||||
|
|
||||||
/* IClientServerParent */
|
|
||||||
void HandleServerDestroyed() { }
|
|
||||||
void HandleClientDestroyed() { }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isInitialized = false;
|
bool isInitialized = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <mesosphere/core/Result.hpp>
|
#include <mesosphere/core/Result.hpp>
|
||||||
#include <mesosphere/core/KAutoObject.hpp>
|
#include <mesosphere/core/KAutoObject.hpp>
|
||||||
#include <mesosphere/core/KSynchronizationObject.hpp>
|
#include <mesosphere/core/KSynchronizationObject.hpp>
|
||||||
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
|
||||||
#include <mesosphere/interfaces/IClient.hpp>
|
#include <mesosphere/interfaces/IClient.hpp>
|
||||||
|
|
||||||
namespace mesosphere
|
namespace mesosphere
|
||||||
|
|
25
mesosphere/source/interrupts/KInterruptEvent.cpp
Normal file
25
mesosphere/source/interrupts/KInterruptEvent.cpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include <mesosphere/interrupts/KInterruptEvent.hpp>
|
||||||
|
|
||||||
|
namespace mesosphere
|
||||||
|
{
|
||||||
|
|
||||||
|
KInterruptEvent::~KInterruptEvent()
|
||||||
|
{
|
||||||
|
// delete receiver?
|
||||||
|
}
|
||||||
|
|
||||||
|
Result KInterruptEvent::Initialize(int irqId, u32 flags)
|
||||||
|
{
|
||||||
|
// TODO implement
|
||||||
|
(void)flags;
|
||||||
|
this->irqId = irqId;
|
||||||
|
isInitialized = true;
|
||||||
|
return ResultSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KInterruptEvent::IsAlive() const
|
||||||
|
{
|
||||||
|
return isInitialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
#include <mesosphere/core/make_object.hpp>
|
#include <mesosphere/core/make_object.hpp>
|
||||||
#include <mesosphere/processes/KEvent.hpp>
|
#include <mesosphere/interrupts/KInterruptEvent.hpp>
|
||||||
|
|
||||||
using namespace mesosphere;
|
using namespace mesosphere;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
auto [res, h1, h2] = MakeObjectWithHandle<KEvent>();
|
auto [res, h1] = MakeObjectWithHandle<KInterruptEvent>(3, -1);
|
||||||
(void)res; (void)h1; (void)h2;
|
(void)res; (void)h1; //(void)h2;
|
||||||
for(;;);
|
for(;;);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue