Revert "hoc-clk: add live vdd2, live boost clock and basic pwm dimming"
This reverts commit 15b7df8ef1.
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
#include <stratosphere/time/time_posix_time.hpp>
|
||||
#include <stratosphere/time/time_steady_clock_time_point.hpp>
|
||||
|
||||
namespace ams::time::impl::util {
|
||||
|
||||
Result GetSpanBetween(s64 *out, const SteadyClockTimePoint &from, const SteadyClockTimePoint &to);
|
||||
|
||||
bool IsLeapYear(int year);
|
||||
bool IsValidDate(int year, int month, int day);
|
||||
|
||||
int GetDaysInMonth(int year, int month);
|
||||
|
||||
int DateToDays(int year, int month, int day);
|
||||
void DaysToDate(int *out_year, int *out_month, int *out_day, int days);
|
||||
|
||||
CalendarTime ToCalendarTimeInUtc(const PosixTime &posix_time);
|
||||
PosixTime ToPosixTimeFromUtc(const CalendarTime &calendar_time);
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
#include <stratosphere/time/time_posix_time.hpp>
|
||||
#include <stratosphere/time/time_steady_clock_time_point.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
Result Initialize();
|
||||
Result InitializeForSystem();
|
||||
Result InitializeForSystemUser();
|
||||
|
||||
Result Finalize();
|
||||
|
||||
bool IsInitialized();
|
||||
|
||||
bool IsValidDate(int year, int month, int day);
|
||||
|
||||
Result GetElapsedSecondsBetween(s64 *out, const SteadyClockTimePoint &from, const SteadyClockTimePoint &to);
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
struct CalendarTime {
|
||||
s16 year;
|
||||
s8 month;
|
||||
s8 day;
|
||||
s8 hour;
|
||||
s8 minute;
|
||||
s8 second;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
CalendarTime &operator+=(const TimeSpan &ts);
|
||||
CalendarTime &operator-=(const TimeSpan &ts);
|
||||
|
||||
friend CalendarTime operator+(const CalendarTime &lhs, const TimeSpan &rhs);
|
||||
friend CalendarTime operator-(const CalendarTime &lhs, const TimeSpan &rhs);
|
||||
|
||||
friend TimeSpan operator-(const CalendarTime &lhs, const CalendarTime &rhs);
|
||||
|
||||
constexpr friend bool operator==(const CalendarTime &lhs, const CalendarTime &rhs) { return lhs.year == rhs.year && lhs.month == rhs.month && lhs.day == rhs.day && lhs.hour == rhs.hour && lhs.minute == rhs.minute && lhs.second == rhs.second; }
|
||||
constexpr friend bool operator!=(const CalendarTime &lhs, const CalendarTime &rhs) { return !(lhs == rhs); }
|
||||
|
||||
constexpr friend bool operator<=(const CalendarTime &lhs, const CalendarTime &rhs) { return !(rhs < lhs); }
|
||||
constexpr friend bool operator>=(const CalendarTime &lhs, const CalendarTime &rhs) { return !(lhs < rhs); }
|
||||
constexpr friend bool operator> (const CalendarTime &lhs, const CalendarTime &rhs) { return rhs < lhs; }
|
||||
|
||||
constexpr friend bool operator< (const CalendarTime &lhs, const CalendarTime &rhs) {
|
||||
if (!std::is_constant_evaluated()) {
|
||||
AMS_ASSERT(lhs.IsValid());
|
||||
AMS_ASSERT(rhs.IsValid());
|
||||
}
|
||||
|
||||
constexpr auto ToUint64 = [](const time::CalendarTime &time) ALWAYS_INLINE_LAMBDA {
|
||||
return (static_cast<u64>(time.year) << 40) |
|
||||
(static_cast<u64>(time.month) << 32) |
|
||||
(static_cast<u64>(time.day) << 24) |
|
||||
(static_cast<u64>(time.hour) << 16) |
|
||||
(static_cast<u64>(time.minute) << 8) |
|
||||
(static_cast<u64>(time.second) << 0);
|
||||
};
|
||||
|
||||
return ToUint64(lhs) < ToUint64(rhs);
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(CalendarTime) == sizeof(u64));
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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::time {
|
||||
|
||||
using SourceId = util::Uuid;
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
struct PosixTime {
|
||||
s64 value;
|
||||
|
||||
constexpr PosixTime &operator+=(const TimeSpan &ts) { this->value += ts.GetSeconds(); return *this; }
|
||||
constexpr PosixTime &operator-=(const TimeSpan &ts) { this->value -= ts.GetSeconds(); return *this; }
|
||||
|
||||
constexpr friend PosixTime operator+(const PosixTime &lhs, const TimeSpan &rhs) { return { .value = lhs.value + rhs.GetSeconds() }; }
|
||||
constexpr friend PosixTime operator-(const PosixTime &lhs, const TimeSpan &rhs) { return { .value = lhs.value - rhs.GetSeconds() }; }
|
||||
|
||||
constexpr friend TimeSpan operator-(const PosixTime &lhs, const PosixTime &rhs) { return TimeSpan::FromSeconds(lhs.value - rhs.value); }
|
||||
|
||||
constexpr friend bool operator==(const PosixTime &lhs, const PosixTime &rhs) { return lhs.value == rhs.value; }
|
||||
constexpr friend bool operator!=(const PosixTime &lhs, const PosixTime &rhs) { return lhs.value != rhs.value; }
|
||||
constexpr friend bool operator<=(const PosixTime &lhs, const PosixTime &rhs) { return lhs.value <= rhs.value; }
|
||||
constexpr friend bool operator>=(const PosixTime &lhs, const PosixTime &rhs) { return lhs.value >= rhs.value; }
|
||||
constexpr friend bool operator< (const PosixTime &lhs, const PosixTime &rhs) { return lhs.value < rhs.value; }
|
||||
constexpr friend bool operator> (const PosixTime &lhs, const PosixTime &rhs) { return lhs.value > rhs.value; }
|
||||
};
|
||||
static_assert(sizeof(PosixTime) == sizeof(s64));
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
#include <stratosphere/time/time_system_clock_common.hpp>
|
||||
#include <stratosphere/time/time_posix_time.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
class StandardNetworkSystemClock {
|
||||
public:
|
||||
using rep = SystemClockTraits::rep;
|
||||
using period = SystemClockTraits::period;
|
||||
using duration = SystemClockTraits::duration;
|
||||
using time_point = SystemClockTraits::time_point;
|
||||
static constexpr bool is_steady = false;
|
||||
public:
|
||||
static time_point now();
|
||||
static std::time_t to_time_t(const StandardUserSystemClock::time_point &t);
|
||||
static time_point from_time_t(std::time_t t);
|
||||
public:
|
||||
static Result GetCurrentTime(PosixTime *out);
|
||||
/* TODO: static Result GetSystemClockContext(SystemClockContext *out); */
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
#include <stratosphere/time/time_steady_clock_time_point.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
class StandardSteadyClock {
|
||||
public:
|
||||
using rep = s64;
|
||||
using period = std::ratio<1>;
|
||||
using duration = std::chrono::duration<rep, period>;
|
||||
using time_point = std::chrono::time_point<StandardSteadyClock>;
|
||||
static constexpr bool is_steady = true;
|
||||
public:
|
||||
static time_point now();
|
||||
public:
|
||||
static Result GetCurrentTimePoint(SteadyClockTimePoint *out);
|
||||
};
|
||||
|
||||
Result GetStandardSteadyClockCurrentTimePoint(SteadyClockTimePoint *out);
|
||||
TimeSpan GetStandardSteadyClockInternalOffset();
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
#include <stratosphere/time/time_system_clock_common.hpp>
|
||||
#include <stratosphere/time/time_posix_time.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
class StandardUserSystemClock {
|
||||
public:
|
||||
using rep = SystemClockTraits::rep;
|
||||
using period = SystemClockTraits::period;
|
||||
using duration = SystemClockTraits::duration;
|
||||
using time_point = SystemClockTraits::time_point;
|
||||
static constexpr bool is_steady = false;
|
||||
public:
|
||||
static time_point now();
|
||||
static std::time_t to_time_t(const StandardUserSystemClock::time_point &t);
|
||||
static time_point from_time_t(std::time_t t);
|
||||
public:
|
||||
static Result GetCurrentTime(PosixTime *out);
|
||||
/* TODO: static Result GetSystemClockContext(SystemClockContext *out); */
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
struct SteadyClockTimePoint {
|
||||
s64 value;
|
||||
SourceId source_id;
|
||||
|
||||
constexpr SteadyClockTimePoint &operator+=(const TimeSpan &ts) { this->value += ts.GetSeconds(); return *this; }
|
||||
constexpr SteadyClockTimePoint &operator-=(const TimeSpan &ts) { this->value -= ts.GetSeconds(); return *this; }
|
||||
|
||||
constexpr friend SteadyClockTimePoint operator+(const SteadyClockTimePoint &lhs, const TimeSpan &rhs) { return { .value = lhs.value + rhs.GetSeconds(), .source_id = lhs.source_id }; }
|
||||
constexpr friend SteadyClockTimePoint operator-(const SteadyClockTimePoint &lhs, const TimeSpan &rhs) { return { .value = lhs.value - rhs.GetSeconds(), .source_id = lhs.source_id }; }
|
||||
|
||||
constexpr friend bool operator==(const SteadyClockTimePoint &lhs, const SteadyClockTimePoint &rhs) { return lhs.value == rhs.value && lhs.source_id == rhs.source_id; }
|
||||
constexpr friend bool operator!=(const SteadyClockTimePoint &lhs, const SteadyClockTimePoint &rhs) { return !(lhs == rhs); }
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_common.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
class SystemClockTraits {
|
||||
public:
|
||||
using rep = s64;
|
||||
using period = std::ratio<1>;
|
||||
using duration = std::chrono::duration<rep, period>;
|
||||
using time_point = std::chrono::time_point<SystemClockTraits>;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/time/time_calendar_time.hpp>
|
||||
#include <stratosphere/time/time_posix_time.hpp>
|
||||
|
||||
namespace ams::time {
|
||||
|
||||
CalendarTime ToCalendarTimeInUtc(const PosixTime &posix_time);
|
||||
PosixTime ToPosixTimeFromUtc(const CalendarTime &calendar_time);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user