boot: add rgltr/clkrst overrides, skel I2cBusAccessor
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <stratosphere/boot2.hpp>
|
||||
#include <stratosphere/capsrv.hpp>
|
||||
#include <stratosphere/cfg.hpp>
|
||||
#include <stratosphere/clkrst.hpp>
|
||||
#include <stratosphere/ddsf.hpp>
|
||||
#include <stratosphere/dmnt.hpp>
|
||||
#include <stratosphere/erpt.hpp>
|
||||
@@ -63,6 +64,8 @@
|
||||
#include <stratosphere/pgl.hpp>
|
||||
#include <stratosphere/psc.hpp>
|
||||
#include <stratosphere/pm.hpp>
|
||||
#include <stratosphere/pwm.hpp>
|
||||
#include <stratosphere/regulator.hpp>
|
||||
#include <stratosphere/ro.hpp>
|
||||
#include <stratosphere/settings.hpp>
|
||||
#include <stratosphere/sf.hpp>
|
||||
|
||||
21
libraries/libstratosphere/include/stratosphere/clkrst.hpp
Normal file
21
libraries/libstratosphere/include/stratosphere/clkrst.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stratosphere/clkrst/clkrst_types.hpp>
|
||||
#include <stratosphere/clkrst/clkrst_api.hpp>
|
||||
#include <stratosphere/clkrst/clkrst_session_api.hpp>
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/clkrst/clkrst_types.hpp>
|
||||
|
||||
namespace ams::clkrst {
|
||||
|
||||
void Initialize();
|
||||
void Finalize();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/clkrst/clkrst_types.hpp>
|
||||
|
||||
namespace ams::clkrst {
|
||||
|
||||
struct ClkRstSession {
|
||||
void *_session;
|
||||
};
|
||||
|
||||
Result OpenSession(ClkRstSession *out, DeviceCode device_code);
|
||||
void CloseSession(ClkRstSession *session);
|
||||
|
||||
void SetResetAsserted(ClkRstSession *session);
|
||||
void SetResetDeasserted(ClkRstSession *session);
|
||||
|
||||
void SetClockRate(ClkRstSession *session, u32 hz);
|
||||
|
||||
void SetClockDisabled(ClkRstSession *session);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::clkrst {
|
||||
|
||||
/* ... */
|
||||
|
||||
}
|
||||
@@ -33,19 +33,19 @@ namespace ams::i2c::driver {
|
||||
virtual void InitializeDriver() = 0;
|
||||
virtual void FinalizeDriver() = 0;
|
||||
|
||||
virtual Result Open() = 0;
|
||||
virtual void Close() = 0;
|
||||
virtual Result InitializeDevice(I2cDeviceProperty *device) = 0;
|
||||
virtual void FinalizeDevice(I2cDeviceProperty *device) = 0;
|
||||
|
||||
virtual Result Send(I2cDeviceProperty *device, const void *src, size_t src_size, TransactionOption option) = 0;
|
||||
virtual Result Receive(void *dst, size_t dst_size, I2cDeviceProperty *device, TransactionOption option) = 0;
|
||||
|
||||
virtual os::SdkMutex &GetTransactionOrderMutex() = 0;
|
||||
|
||||
virtual void SuspendBus();
|
||||
virtual void SuspendPowerBus();
|
||||
virtual void SuspendBus() = 0;
|
||||
virtual void SuspendPowerBus() = 0;
|
||||
|
||||
virtual void ResumeBus();
|
||||
virtual void ResumePowerBus();
|
||||
virtual void ResumeBus() = 0;
|
||||
virtual void ResumePowerBus() = 0;
|
||||
|
||||
virtual const DeviceCode &GetDeviceCode() const = 0;
|
||||
};
|
||||
|
||||
20
libraries/libstratosphere/include/stratosphere/pwm.hpp
Normal file
20
libraries/libstratosphere/include/stratosphere/pwm.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stratosphere/pwm/pwm_types.hpp>
|
||||
#include <stratosphere/pwm/pwm_select_channel_name.hpp>
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/pwm/pwm_types.hpp>
|
||||
|
||||
namespace ams::pwm {
|
||||
|
||||
enum ChannelName {
|
||||
ChannelName_Invalid = 0,
|
||||
ChannelName_CpuFan = 1,
|
||||
ChannelName_LcdBacklight = 2,
|
||||
ChannelName_BlinkLed = 3,
|
||||
};
|
||||
|
||||
constexpr inline const DeviceCode DeviceCode_CpuFan = 0x3D000001;
|
||||
constexpr inline const DeviceCode DeviceCode_LcdBacklight = 0x3400003D;
|
||||
constexpr inline const DeviceCode DeviceCode_BlinkLed = 0x35000065;
|
||||
|
||||
constexpr inline DeviceCode ConvertToDeviceCode(ChannelName cn) {
|
||||
switch (cn) {
|
||||
case ChannelName_CpuFan: return DeviceCode_CpuFan;
|
||||
case ChannelName_LcdBacklight: return DeviceCode_LcdBacklight;
|
||||
case ChannelName_BlinkLed: return DeviceCode_BlinkLed;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
constexpr inline ChannelName ConvertToChannelName(DeviceCode dc) {
|
||||
switch (dc.GetInternalValue()) {
|
||||
case DeviceCode_CpuFan .GetInternalValue(): return ChannelName_CpuFan;
|
||||
case DeviceCode_LcdBacklight.GetInternalValue(): return ChannelName_LcdBacklight;
|
||||
case DeviceCode_BlinkLed .GetInternalValue(): return ChannelName_BlinkLed;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/pwm/pwm_types.hpp>
|
||||
|
||||
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
|
||||
#include <stratosphere/pwm/pwm_channel_name.board.nintendo_nx.hpp>
|
||||
#else
|
||||
/* Error? */
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pwm {
|
||||
|
||||
/* ... */
|
||||
|
||||
}
|
||||
21
libraries/libstratosphere/include/stratosphere/regulator.hpp
Normal file
21
libraries/libstratosphere/include/stratosphere/regulator.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stratosphere/regulator/regulator_types.hpp>
|
||||
#include <stratosphere/regulator/regulator_api.hpp>
|
||||
#include <stratosphere/regulator/regulator_session_api.hpp>
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/regulator/regulator_types.hpp>
|
||||
|
||||
namespace ams::regulator {
|
||||
|
||||
void Initialize();
|
||||
void Finalize();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/regulator/regulator_types.hpp>
|
||||
|
||||
namespace ams::regulator {
|
||||
|
||||
struct RegulatorSession {
|
||||
void *_session;
|
||||
};
|
||||
|
||||
Result OpenSession(RegulatorSession *out, DeviceCode device_code);
|
||||
void CloseSession(RegulatorSession *session);
|
||||
|
||||
bool GetVoltageEnabled(RegulatorSession *session);
|
||||
Result SetVoltageEnabled(RegulatorSession *session);
|
||||
|
||||
Result SetVoltageValue(RegulatorSession *session, u32 micro_volts);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::regulator {
|
||||
|
||||
/* ... */
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user