mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-03 08:08:39 -04:00
ams: support building unit test programs on windows/linux/macos
This commit is contained in:
parent
9a38be201a
commit
64a97576d0
756 changed files with 33359 additions and 9372 deletions
|
@ -44,11 +44,15 @@ namespace ams::gpio::driver {
|
|||
}
|
||||
|
||||
void SetInitialGpioConfig() {
|
||||
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
|
||||
return board::SetInitialGpioConfig();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetInitialWakePinConfig() {
|
||||
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
|
||||
return board::SetInitialWakePinConfig();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,10 +22,12 @@ namespace ams::gpio {
|
|||
|
||||
constinit os::SdkMutex g_init_mutex;
|
||||
constinit int g_initialize_count = 0;
|
||||
constinit bool g_remote = false;
|
||||
ams::sf::SharedPointer<gpio::sf::IManager> g_manager;
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
constinit bool g_remote = false;
|
||||
ams::sf::UnmanagedServiceObject<gpio::sf::IManager, RemoteManagerImpl> g_remote_manager_impl;
|
||||
#endif
|
||||
|
||||
gpio::sf::IPadSession *GetInterface(GpioPadSession *session) {
|
||||
AMS_ASSERT(session->_session != nullptr);
|
||||
|
@ -38,9 +40,13 @@ namespace ams::gpio {
|
|||
std::scoped_lock lk(g_init_mutex);
|
||||
|
||||
if ((g_initialize_count++) == 0) {
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
R_ABORT_UNLESS(::gpioInitialize());
|
||||
g_manager = g_remote_manager_impl.GetShared();
|
||||
g_remote = true;
|
||||
#else
|
||||
AMS_ABORT("TODO");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,9 +66,13 @@ namespace ams::gpio {
|
|||
|
||||
if ((--g_initialize_count) == 0) {
|
||||
g_manager = nullptr;
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
if (g_remote) {
|
||||
::gpioExit();
|
||||
}
|
||||
#else
|
||||
AMS_ABORT("TODO");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
namespace ams::gpio {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
namespace {
|
||||
|
||||
struct GpioRemoteManagerTag;
|
||||
|
@ -48,5 +49,6 @@ namespace ams::gpio {
|
|||
out.SetValue(RemoteObjectFactory::CreateSharedEmplaced<gpio::sf::IPadSession, RemotePadSessionImpl>(p));
|
||||
return ResultSuccess();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
namespace ams::gpio {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class RemoteManagerImpl {
|
||||
public:
|
||||
RemoteManagerImpl() { /* ... */ }
|
||||
|
@ -82,5 +83,6 @@ namespace ams::gpio {
|
|||
|
||||
};
|
||||
static_assert(gpio::sf::IsIManager<RemoteManagerImpl>);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
namespace ams::gpio {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class RemotePadSessionImpl {
|
||||
private:
|
||||
::GpioPadSession m_srv;
|
||||
|
@ -111,5 +112,6 @@ namespace ams::gpio {
|
|||
}
|
||||
};
|
||||
static_assert(gpio::sf::IsIPadSession<RemotePadSessionImpl>);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue