id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,373
|
fsmitm_romfs.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::mitm::fs::romfs {
enum class DataSourceType : u8 {
Storage,
File,
LooseSdFile,
Metadata,
Memory,
};
enum AllocationType {
AllocationType_FileName,
AllocationType_DirName,
AllocationType_FullPath,
AllocationType_SourceInfo,
AllocationType_BuildFileContext,
AllocationType_BuildDirContext,
AllocationType_TableCache,
AllocationType_DirPointerArray,
AllocationType_DirContextSet,
AllocationType_FileContextSet,
AllocationType_Memory,
AllocationType_Count,
};
void *AllocateTracked(AllocationType type, size_t size);
void FreeTracked(AllocationType type, void *p, size_t size);
template<typename T, typename... Args>
T *AllocateTyped(AllocationType type, Args &&... args) {
void *mem = AllocateTracked(type, sizeof(T));
return std::construct_at(static_cast<T *>(mem), std::forward<Args>(args)...);
}
template<AllocationType AllocType, typename T>
class TrackedAllocator {
public:
using value_type = T;
template<typename U>
struct rebind {
using other = TrackedAllocator<AllocType, U>;
};
public:
TrackedAllocator() = default;
T *allocate(size_t n) {
return static_cast<T *>(AllocateTracked(AllocType, sizeof(T) * n));
}
void deallocate(T *p, size_t n) {
FreeTracked(AllocType, p, sizeof(T) * n);
}
};
struct SourceInfo {
s64 virtual_offset;
s64 size;
union {
struct {
s64 offset;
} storage_source_info;
struct {
s64 offset;
} file_source_info;
struct {
char *path;
} loose_source_info;
struct {
ams::fs::fsa::IFile *file;
} metadata_source_info;
struct {
u8 *data;
} memory_source_info;
};
DataSourceType source_type;
bool cleaned_up;
SourceInfo(s64 v_o, s64 sz, DataSourceType type, s64 p_o) : virtual_offset(v_o), size(sz), source_type(type), cleaned_up(false) {
switch (this->source_type) {
case DataSourceType::Storage:
this->storage_source_info.offset = p_o;
break;
case DataSourceType::File:
this->file_source_info.offset = p_o;
break;
AMS_UNREACHABLE_DEFAULT_CASE();
}
}
SourceInfo(s64 v_o, s64 sz, DataSourceType type, void *arg) : virtual_offset(v_o), size(sz), source_type(type), cleaned_up(false) {
switch (this->source_type) {
case DataSourceType::LooseSdFile:
this->loose_source_info.path = static_cast<char *>(arg);
break;
case DataSourceType::Metadata:
this->metadata_source_info.file = static_cast<ams::fs::fsa::IFile *>(arg);
break;
case DataSourceType::Memory:
this->memory_source_info.data = static_cast<u8 *>(arg);
break;
AMS_UNREACHABLE_DEFAULT_CASE();
}
}
void Cleanup() {
AMS_ABORT_UNLESS(!this->cleaned_up);
this->cleaned_up = true;
switch (this->source_type) {
case DataSourceType::Storage:
case DataSourceType::File:
break;
case DataSourceType::Metadata:
delete this->metadata_source_info.file;
break;
case DataSourceType::LooseSdFile:
FreeTracked(AllocationType_FullPath, this->loose_source_info.path, std::strlen(this->loose_source_info.path) + 1);
break;
case DataSourceType::Memory:
FreeTracked(AllocationType_Memory, this->memory_source_info.data, this->size);
break;
AMS_UNREACHABLE_DEFAULT_CASE();
}
}
};
constexpr inline bool operator<(const SourceInfo &lhs, const SourceInfo &rhs) {
return lhs.virtual_offset < rhs.virtual_offset;
}
constexpr inline bool operator<(const SourceInfo &lhs, const s64 rhs) {
return lhs.virtual_offset <= rhs;
}
struct BuildFileContext;
struct BuildDirectoryContext {
NON_COPYABLE(BuildDirectoryContext);
NON_MOVEABLE(BuildDirectoryContext);
char *path;
union {
BuildDirectoryContext *parent;
};
union {
BuildDirectoryContext *child;
struct {
u32 parent_offset;
u32 child_offset;
};
};
union {
BuildDirectoryContext *sibling;
u32 sibling_offset;
};
union {
BuildFileContext *file;
u32 file_offset;
};
u32 path_len;
u32 entry_offset;
u32 hash_value;
struct RootTag{};
BuildDirectoryContext(RootTag) : parent(nullptr), child(nullptr), sibling(nullptr), file(nullptr), path_len(0), entry_offset(0), hash_value(0xFFFFFFFF) {
this->path = static_cast<char *>(AllocateTracked(AllocationType_DirName, 1));
this->path[0] = '\x00';
}
BuildDirectoryContext(const char *entry_name, size_t entry_name_len) : parent(nullptr), child(nullptr), sibling(nullptr), file(nullptr), entry_offset(0) {
this->path_len = entry_name_len;
this->path = static_cast<char *>(AllocateTracked(AllocationType_DirName, this->path_len + 1));
std::memcpy(this->path, entry_name, entry_name_len);
this->path[this->path_len] = '\x00';
}
~BuildDirectoryContext() {
if (this->path != nullptr) {
FreeTracked(AllocationType_DirName, this->path, this->path_len + 1);
this->path = nullptr;
}
}
void operator delete(void *p) {
FreeTracked(AllocationType_BuildDirContext, p, sizeof(BuildDirectoryContext));
}
size_t GetPathLength() const {
if (this->parent == nullptr) {
return 0;
}
return this->parent->GetPathLength() + 1 + this->path_len;
}
size_t GetPath(char *dst) const {
if (this->parent == nullptr) {
dst[0] = '\x00';
return 0;
}
const size_t parent_len = this->parent->GetPath(dst);
dst[parent_len] = '/';
std::memcpy(dst + parent_len + 1, this->path, this->path_len);
dst[parent_len + 1 + this->path_len] = '\x00';
return parent_len + 1 + this->path_len;
}
bool HasHashMark() const {
return reinterpret_cast<uintptr_t>(this->sibling) & UINT64_C(0x8000000000000000);
}
void SetHashMark() {
this->sibling = reinterpret_cast<BuildDirectoryContext *>(reinterpret_cast<uintptr_t>(this->sibling) | UINT64_C(0x8000000000000000));
}
void ClearHashMark() {
this->sibling = reinterpret_cast<BuildDirectoryContext *>(reinterpret_cast<uintptr_t>(this->sibling) & ~UINT64_C(0x8000000000000000));
}
};
struct BuildFileContext {
NON_COPYABLE(BuildFileContext);
NON_MOVEABLE(BuildFileContext);
char *path;
BuildDirectoryContext *parent;
union {
BuildFileContext *sibling;
u32 sibling_offset;
};
s64 offset;
s64 size;
s64 orig_offset;
u32 path_len;
u32 entry_offset;
u32 hash_value;
DataSourceType source_type;
BuildFileContext(const char *entry_name, size_t entry_name_len, s64 sz, s64 o_o, DataSourceType type) : parent(nullptr), sibling(nullptr), offset(0), size(sz), orig_offset(o_o), entry_offset(0), hash_value(0xFFFFFFFF), source_type(type) {
this->path_len = entry_name_len;
this->path = static_cast<char *>(AllocateTracked(AllocationType_FileName, this->path_len + 1));
std::memcpy(this->path, entry_name, entry_name_len);
this->path[this->path_len] = 0;
}
~BuildFileContext() {
if (this->path != nullptr) {
FreeTracked(AllocationType_FileName, this->path, this->path_len + 1);
this->path = nullptr;
}
}
void operator delete(void *p) {
FreeTracked(AllocationType_BuildFileContext, p, sizeof(BuildFileContext));
}
size_t GetPathLength() const {
if (this->parent == nullptr) {
return 0;
}
return this->parent->GetPathLength() + 1 + this->path_len;
}
size_t GetPath(char *dst) const {
if (this->parent == nullptr) {
dst[0] = '\x00';
return 0;
}
const size_t parent_len = this->parent->GetPath(dst);
dst[parent_len] = '/';
std::memcpy(dst + parent_len + 1, this->path, this->path_len);
dst[parent_len + 1 + this->path_len] = '\x00';
return parent_len + 1 + this->path_len;
}
bool HasHashMark() const {
return reinterpret_cast<uintptr_t>(this->sibling) & UINT64_C(0x8000000000000000);
}
void SetHashMark() {
this->sibling = reinterpret_cast<BuildFileContext *>(reinterpret_cast<uintptr_t>(this->sibling) | UINT64_C(0x8000000000000000));
}
void ClearHashMark() {
this->sibling = reinterpret_cast<BuildFileContext *>(reinterpret_cast<uintptr_t>(this->sibling) & ~UINT64_C(0x8000000000000000));
}
};
class DirectoryTableReader;
class FileTableReader;
class Builder {
NON_COPYABLE(Builder);
NON_MOVEABLE(Builder);
public:
using SourceInfoVector = std::vector<SourceInfo, TrackedAllocator<AllocationType_SourceInfo, SourceInfo>>;
private:
template<typename T>
struct Comparator {
static constexpr inline int Compare(const char *a, const char *b) {
unsigned char c1{}, c2{};
while ((c1 = *a++) == (c2 = *b++)) {
if (c1 == '\x00') {
return 0;
}
}
return (c1 - c2);
}
constexpr bool operator()(const std::unique_ptr<T> &lhs, const std::unique_ptr<T> &rhs) const {
char lhs_path[ams::fs::EntryNameLengthMax + 1];
char rhs_path[ams::fs::EntryNameLengthMax + 1];
lhs->GetPath(lhs_path);
rhs->GetPath(rhs_path);
return Comparator::Compare(lhs_path, rhs_path) < 0;
}
};
template<AllocationType AllocType, typename T>
using ContextSet = std::set<std::unique_ptr<T>, Comparator<T>, TrackedAllocator<AllocType, std::unique_ptr<T>>>;
private:
ncm::ProgramId m_program_id;
BuildDirectoryContext *m_root;
ContextSet<AllocationType_DirContextSet, BuildDirectoryContext> m_directories;
ContextSet<AllocationType_FileContextSet, BuildFileContext> m_files;
size_t m_num_dirs;
size_t m_num_files;
size_t m_dir_table_size;
size_t m_file_table_size;
size_t m_dir_hash_table_size;
size_t m_file_hash_table_size;
size_t m_file_partition_size;
::FsDirectoryEntry m_dir_entry;
DataSourceType m_cur_source_type;
private:
void VisitDirectory(FsFileSystem *fs, BuildDirectoryContext *parent);
void VisitDirectory(BuildDirectoryContext *parent, u32 parent_offset, DirectoryTableReader &dir_table, FileTableReader &file_table);
void AddDirectory(BuildDirectoryContext **out, BuildDirectoryContext *parent_ctx, std::unique_ptr<BuildDirectoryContext> file_ctx);
void AddFile(BuildDirectoryContext *parent_ctx, std::unique_ptr<BuildFileContext> file_ctx);
public:
Builder(ncm::ProgramId pr_id);
~Builder();
void AddSdFiles();
void AddStorageFiles(ams::fs::IStorage *storage, DataSourceType source_type);
void Build(SourceInfoVector *out_infos);
};
Result ConfigureDynamicHeap(u64 *out_size, ncm::ProgramId program_id, const cfg::OverrideStatus &status, bool is_application);
}
| 13,613
|
C++
|
.h
| 324
| 30.259259
| 246
| 0.570576
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,374
|
fsmitm_calibration_binary_storage.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/fs_mitm/fsmitm_calibration_binary_storage.hpp
|
/*
* 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 <stratosphere.hpp>
#include "fsmitm_boot0storage.hpp"
#include "../amsmitm_prodinfo_utils.hpp"
namespace ams::mitm::fs {
/* Represents a protected calibration binary partition. */
class CalibrationBinaryStorage : public SectoredStorageAdapter<ams::fs::RemoteStorage, 0x200> {
public:
using Base = SectoredStorageAdapter<ams::fs::RemoteStorage, 0x200>;
static constexpr s64 BlankStartOffset = 0x0;
static constexpr s64 BlankSize = static_cast<s64>(CalibrationBinarySize);
static constexpr s64 BlankEndOffset = BlankStartOffset + BlankSize;
static constexpr s64 FakeSecureStartOffset = SecureCalibrationInfoBackupOffset;
static constexpr s64 FakeSecureSize = static_cast<s64>(SecureCalibrationBinaryBackupSize);
static constexpr s64 FakeSecureEndOffset = FakeSecureStartOffset + FakeSecureSize;
private:
sm::MitmProcessInfo m_client_info;
bool m_read_blank;
bool m_allow_writes;
public:
CalibrationBinaryStorage(FsStorage &s, const sm::MitmProcessInfo &c)
: Base(s), m_client_info(c),
m_read_blank(mitm::ShouldReadBlankCalibrationBinary()),
m_allow_writes(mitm::IsWriteToCalibrationBinaryAllowed())
{
/* ... */
}
public:
virtual Result Read(s64 offset, void *_buffer, size_t size) override;
virtual Result Write(s64 offset, const void *_buffer, size_t size) override;
};
}
| 2,245
|
C++
|
.h
| 47
| 40.12766
| 109
| 0.683394
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,375
|
sysupdater_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.hpp
|
/*
* 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 <stratosphere.hpp>
#include "sysupdater_apply_manager.hpp"
namespace ams::mitm::sysupdater {
constexpr inline size_t FirmwareVariationCountMax = 16;
struct UpdateInformation {
u32 version;
bool exfat_supported;
u32 firmware_variation_count;
ncm::FirmwareVariationId firmware_variation_ids[FirmwareVariationCountMax];
};
struct UpdateValidationInfo {
ncm::ContentMetaKey invalid_key;
ncm::ContentId invalid_content_id;
};
struct SystemUpdateProgress {
s64 current_size;
s64 total_size;
};
}
#define AMS_SYSUPDATER_SYSTEM_UPDATE_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO(C, H, 0, Result, GetUpdateInformation, (sf::Out<mitm::sysupdater::UpdateInformation> out, const ncm::Path &path), (out, path)) \
AMS_SF_METHOD_INFO(C, H, 1, Result, ValidateUpdate, (sf::Out<Result> out_validate_result, sf::Out<Result> out_validate_exfat_result, sf::Out<mitm::sysupdater::UpdateValidationInfo> out_validate_info, const ncm::Path &path), (out_validate_result, out_validate_exfat_result, out_validate_info, path)) \
AMS_SF_METHOD_INFO(C, H, 2, Result, SetupUpdate, (sf::CopyHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat), (std::move(transfer_memory), transfer_memory_size, path, exfat)) \
AMS_SF_METHOD_INFO(C, H, 3, Result, SetupUpdateWithVariation, (sf::CopyHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id), (std::move(transfer_memory), transfer_memory_size, path, exfat, firmware_variation_id)) \
AMS_SF_METHOD_INFO(C, H, 4, Result, RequestPrepareUpdate, (sf::OutCopyHandle out_event_handle, sf::Out<sf::SharedPointer<ns::impl::IAsyncResult>> out_async), (out_event_handle, out_async)) \
AMS_SF_METHOD_INFO(C, H, 5, Result, GetPrepareUpdateProgress, (sf::Out<mitm::sysupdater::SystemUpdateProgress> out), (out)) \
AMS_SF_METHOD_INFO(C, H, 6, Result, HasPreparedUpdate, (sf::Out<bool> out), (out)) \
AMS_SF_METHOD_INFO(C, H, 7, Result, ApplyPreparedUpdate, (), ())
AMS_SF_DEFINE_INTERFACE(ams::mitm::sysupdater::impl, ISystemUpdateInterface, AMS_SYSUPDATER_SYSTEM_UPDATE_INTERFACE_INFO, 0x00000000)
namespace ams::mitm::sysupdater {
class SystemUpdateService {
private:
SystemUpdateApplyManager m_apply_manager;
util::optional<ncm::PackageSystemDowngradeTask> m_update_task;
util::optional<os::TransferMemory> m_update_transfer_memory;
bool m_setup_update;
bool m_requested_update;
public:
constexpr SystemUpdateService() : m_apply_manager(), m_update_task(), m_update_transfer_memory(), m_setup_update(false), m_requested_update(false) { /* ... */ }
private:
Result SetupUpdateImpl(sf::NativeHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id);
Result InitializeUpdateTask(sf::NativeHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id);
public:
Result GetUpdateInformation(sf::Out<UpdateInformation> out, const ncm::Path &path);
Result ValidateUpdate(sf::Out<Result> out_validate_result, sf::Out<Result> out_validate_exfat_result, sf::Out<UpdateValidationInfo> out_validate_info, const ncm::Path &path);
Result SetupUpdate(sf::CopyHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat);
Result SetupUpdateWithVariation(sf::CopyHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id);
Result RequestPrepareUpdate(sf::OutCopyHandle out_event_handle, sf::Out<sf::SharedPointer<ns::impl::IAsyncResult>> out_async);
Result GetPrepareUpdateProgress(sf::Out<SystemUpdateProgress> out);
Result HasPreparedUpdate(sf::Out<bool> out);
Result ApplyPreparedUpdate();
};
static_assert(impl::IsISystemUpdateInterface<SystemUpdateService>);
}
| 6,191
|
C++
|
.h
| 70
| 81.942857
| 327
| 0.563011
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,376
|
sysupdater_apply_manager.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/sysupdater/sysupdater_apply_manager.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::mitm::sysupdater {
class SystemUpdateApplyManager {
private:
os::SdkMutex m_apply_mutex;
public:
constexpr SystemUpdateApplyManager() : m_apply_mutex() { /* ... */ }
Result ApplyPackageTask(ncm::PackageSystemDowngradeTask *task);
};
}
| 990
|
C++
|
.h
| 26
| 34.076923
| 80
| 0.717708
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,377
|
sysupdater_async_impl.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.hpp
|
/*
* 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 <stratosphere.hpp>
#include "sysupdater_thread_allocator.hpp"
namespace ams::mitm::sysupdater {
class ErrorContextHolder {
private:
err::ErrorContext m_error_context;
public:
constexpr ErrorContextHolder() : m_error_context{} { /* ... */ }
virtual ~ErrorContextHolder() { /* ... */ }
template<typename T>
Result SaveErrorContextIfFailed(T &async, Result result) {
ON_RESULT_FAILURE { async.GetErrorContext(std::addressof(m_error_context)); };
R_RETURN(result);
}
template<typename T>
Result GetAndSaveErrorContext(T &async) {
R_RETURN(this->SaveErrorContextIfFailed(async, async.Get()));
}
template<typename T>
Result SaveInternalTaskErrorContextIfFailed(T &async, Result result) {
ON_RESULT_FAILURE { async.CreateErrorContext(std::addressof(m_error_context)); };
R_RETURN(result);
}
const err::ErrorContext &GetErrorContextImpl() {
return m_error_context;
}
};
class AsyncBase {
public:
virtual ~AsyncBase() { /* ... */ }
static Result ToAsyncResult(Result result);
Result Cancel() {
this->CancelImpl();
R_SUCCEED();
}
virtual Result GetErrorContext(sf::Out<err::ErrorContext> out) {
*out = {};
R_SUCCEED();
}
private:
virtual void CancelImpl() = 0;
};
class AsyncResultBase : public AsyncBase {
public:
virtual ~AsyncResultBase() { /* ... */ }
Result Get() {
R_RETURN(ToAsyncResult(this->GetImpl()));
}
private:
virtual Result GetImpl() = 0;
};
static_assert(ns::impl::IsIAsyncResult<AsyncResultBase>);
/* NOTE: Based off of ns AsyncPrepareCardUpdateImpl. */
/* We don't implement the RequestServer::ManagedStop details, as we don't implement stoppable request list. */
class AsyncPrepareSdCardUpdateImpl : public AsyncResultBase, private ErrorContextHolder {
private:
Result m_result;
os::SystemEvent m_event;
util::optional<ThreadInfo> m_thread_info;
ncm::InstallTaskBase *m_task;
public:
AsyncPrepareSdCardUpdateImpl(ncm::InstallTaskBase *task) : m_result(ResultSuccess()), m_event(os::EventClearMode_ManualClear, true), m_thread_info(), m_task(task) { /* ... */ }
virtual ~AsyncPrepareSdCardUpdateImpl();
os::SystemEvent &GetEvent() { return m_event; }
virtual Result GetErrorContext(sf::Out<err::ErrorContext> out) override {
*out = ErrorContextHolder::GetErrorContextImpl();
R_SUCCEED();
}
Result Run();
private:
Result Execute();
virtual void CancelImpl() override;
virtual Result GetImpl() override { return m_result; }
};
}
| 3,793
|
C++
|
.h
| 91
| 31.725275
| 188
| 0.604184
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,378
|
sysupdater_fs_utils.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::mitm::sysupdater {
class PathView {
private:
util::string_view m_path;
public:
PathView(util::string_view p) : m_path(p) { /* ...*/ }
bool HasPrefix(util::string_view prefix) const;
bool HasSuffix(util::string_view suffix) const;
util::string_view GetFileName() const;
};
Result MountSdCardContentMeta(const char *mount_name, const char *path, ams::fs::ContentAttributes attr);
}
| 1,163
|
C++
|
.h
| 29
| 35.448276
| 109
| 0.700885
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,379
|
sysupdater_thread_allocator.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/sysupdater/sysupdater_thread_allocator.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::mitm::sysupdater {
struct ThreadInfo {
os::ThreadType *thread;
int priority;
void *stack;
size_t stack_size;
};
/* NOTE: Nintendo uses a util::BitArray, but this seems excessive. */
class ThreadAllocator {
private:
os::ThreadType *m_thread_list;
const int m_thread_priority;
const int m_thread_count;
u8 *m_stack_heap;
const size_t m_stack_heap_size;
const size_t m_stack_size;
u64 m_bitmap;
os::SdkMutex m_mutex;
public:
constexpr ThreadAllocator(os::ThreadType *thread_list, int count, int priority, u8 *stack_heap, size_t stack_heap_size, size_t stack_size)
: m_thread_list(thread_list), m_thread_priority(priority), m_thread_count(count), m_stack_heap(stack_heap), m_stack_heap_size(stack_heap_size), m_stack_size(stack_size), m_bitmap()
{
AMS_ASSERT(count <= static_cast<int>(stack_heap_size / stack_size));
AMS_ASSERT(count <= static_cast<int>(BITSIZEOF(m_bitmap)));
}
Result Allocate(ThreadInfo *out);
void Free(const ThreadInfo &info);
};
}
| 1,917
|
C++
|
.h
| 46
| 34.347826
| 196
| 0.650054
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,380
|
sysupdater_module.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/sysupdater/sysupdater_module.hpp
|
/*
* 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 <stratosphere.hpp>
#include "../amsmitm_module.hpp"
namespace ams::mitm::sysupdater {
DEFINE_MITM_MODULE_CLASS(0x8000, AMS_GET_SYSTEM_THREAD_PRIORITY(mitm_sysupdater, IpcServer));
}
| 846
|
C++
|
.h
| 21
| 38.285714
| 97
| 0.761557
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,381
|
sysupdater_async_thread_allocator.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_thread_allocator.hpp
|
/*
* 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 <stratosphere.hpp>
#include "sysupdater_thread_allocator.hpp"
namespace ams::mitm::sysupdater {
ThreadAllocator *GetAsyncThreadAllocator();
}
| 806
|
C++
|
.h
| 21
| 36.380952
| 76
| 0.767263
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,382
|
ns_am_mitm_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/ns_mitm/ns_am_mitm_service.hpp
|
/*
* 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 <stratosphere.hpp>
#define AMS_NS_AM_MITM_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO(C, H, 21, Result, GetApplicationContentPath, (const sf::OutBuffer &out_path, ncm::ProgramId application_id, u8 content_type), (out_path, application_id, content_type)) \
AMS_SF_METHOD_INFO(C, H, 23, Result, ResolveApplicationContentPath, (ncm::ProgramId application_id, u8 content_type), (application_id, content_type)) \
AMS_SF_METHOD_INFO(C, H, 92, Result, GetRunningApplicationProgramId, (sf::Out<ncm::ProgramId> out, ncm::ProgramId application_id), (out, application_id), hos::Version_6_0_0)
AMS_SF_DEFINE_MITM_INTERFACE(ams::mitm::ns::impl, IAmMitmInterface, AMS_NS_AM_MITM_INTERFACE_INFO, 0x059D2C39)
namespace ams::mitm::ns {
class NsAmMitmService : public sf::MitmServiceImplBase {
public:
using MitmServiceImplBase::MitmServiceImplBase;
public:
static bool ShouldMitm(const sm::MitmProcessInfo &client_info) {
/* We will mitm:
* - web applets, to facilitate hbl web browser launching.
*/
return ncm::IsWebAppletId(client_info.program_id);
}
public:
/* Actual command API. */
Result GetApplicationContentPath(const sf::OutBuffer &out_path, ncm::ProgramId application_id, u8 content_type);
Result ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type);
Result GetRunningApplicationProgramId(sf::Out<ncm::ProgramId> out, ncm::ProgramId application_id);
};
static_assert(impl::IsIAmMitmInterface<NsAmMitmService>);
}
| 2,586
|
C++
|
.h
| 41
| 56.780488
| 217
| 0.626378
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,383
|
ns_web_mitm_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.hpp
|
/*
* 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 <stratosphere.hpp>
#include "ns_shim.h"
#define AMS_NS_DOCUMENT_MITM_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO(C, H, 21, Result, GetApplicationContentPath, (const sf::OutBuffer &out_path, sf::Out<ams::fs::ContentAttributes> out_attr, ncm::ProgramId application_id, u8 content_type), (out_path, out_attr, application_id, content_type)) \
AMS_SF_METHOD_INFO(C, H, 23, Result, ResolveApplicationContentPath, (ncm::ProgramId application_id, u8 content_type), (application_id, content_type)) \
AMS_SF_METHOD_INFO(C, H, 92, Result, GetRunningApplicationProgramId, (sf::Out<ncm::ProgramId> out, ncm::ProgramId application_id), (out, application_id), hos::Version_6_0_0) \
AMS_SF_METHOD_INFO(C, H, 2524, Result, GetApplicationContentPath2, (const sf::OutBuffer &out_path, sf::Out<ncm::ProgramId> out_program_id, sf::Out<ams::fs::ContentAttributes> out_attr, ncm::ProgramId application_id, u8 content_type), (out_path, out_program_id, out_attr, application_id, content_type), hos::Version_19_0_0)
AMS_SF_DEFINE_INTERFACE(ams::mitm::ns::impl, IDocumentInterface, AMS_NS_DOCUMENT_MITM_INTERFACE_INFO, 0x0F9B1C00)
#define AMS_NS_WEB_MITM_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO(C, H, 7999, Result, GetDocumentInterface, (sf::Out<sf::SharedPointer<mitm::ns::impl::IDocumentInterface>> out), (out))
AMS_SF_DEFINE_MITM_INTERFACE(ams::mitm::ns::impl, IWebMitmInterface, AMS_NS_WEB_MITM_INTERFACE_INFO, 0xF4EC2D1A)
namespace ams::mitm::ns {
class NsDocumentService {
private:
sm::MitmProcessInfo m_client_info;
std::unique_ptr<::NsDocumentInterface> m_srv;
public:
NsDocumentService(const sm::MitmProcessInfo &cl, std::unique_ptr<::NsDocumentInterface> s) : m_client_info(cl), m_srv(std::move(s)) { /* .. */ }
virtual ~NsDocumentService() {
nsDocumentInterfaceClose(m_srv.get());
}
public:
/* Actual command API. */
Result GetApplicationContentPath(const sf::OutBuffer &out_path, sf::Out<ams::fs::ContentAttributes> out_attr, ncm::ProgramId application_id, u8 content_type);
Result ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type);
Result GetRunningApplicationProgramId(sf::Out<ncm::ProgramId> out, ncm::ProgramId application_id);
Result GetApplicationContentPath2(const sf::OutBuffer &out_path, sf::Out<ncm::ProgramId> out_program_id, sf::Out<ams::fs::ContentAttributes> out_attr, ncm::ProgramId application_id, u8 content_type);
};
static_assert(impl::IsIDocumentInterface<NsDocumentService>);
class NsWebMitmService : public sf::MitmServiceImplBase {
public:
using MitmServiceImplBase::MitmServiceImplBase;
public:
static bool ShouldMitm(const sm::MitmProcessInfo &client_info) {
/* We will mitm:
* - web applets, to facilitate hbl web browser launching.
*/
return ncm::IsWebAppletId(client_info.program_id);
}
public:
Result GetDocumentInterface(sf::Out<sf::SharedPointer<impl::IDocumentInterface>> out);
};
static_assert(impl::IsIWebMitmInterface<NsWebMitmService>);
}
| 4,596
|
C++
|
.h
| 60
| 69.5
| 332
| 0.595228
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,384
|
ns_shim.h
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/ns_mitm/ns_shim.h
|
/**
* @file ns_shim.h
* @brief Nintendo Shell Services (ns) IPC wrapper.
* @author SciresM
* @copyright libnx Authors
*/
#pragma once
#include <switch.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
Service s;
} NsDocumentInterface;
/* Command forwarders. */
Result nsGetDocumentInterfaceFwd(Service* s, NsDocumentInterface* out);
Result nsamGetApplicationContentPathFwd(Service* s, void* out, size_t out_size, u64 app_id, NcmContentType content_type);
Result nsamResolveApplicationContentPathFwd(Service* s, u64 app_id, NcmContentType content_type);
Result nsamGetRunningApplicationProgramIdFwd(Service* s, u64* out_program_id, u64 app_id);
Result nswebGetApplicationContentPath(NsDocumentInterface* doc, void* out, size_t out_size, u8 *out_attr, u64 app_id, NcmContentType content_type);
Result nswebResolveApplicationContentPath(NsDocumentInterface* doc, u64 app_id, NcmContentType content_type);
Result nswebGetRunningApplicationProgramId(NsDocumentInterface* doc, u64* out_program_id, u64 app_id);
Result nswebGetApplicationContentPath2(NsDocumentInterface* doc, void* out, size_t out_size, u64* out_program_id, u8 *out_attr, u64 app_id, NcmContentType content_type);
void nsDocumentInterfaceClose(NsDocumentInterface* doc);
#ifdef __cplusplus
}
#endif
| 1,284
|
C++
|
.h
| 27
| 46
| 169
| 0.807354
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,385
|
nsmitm_module.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/ns_mitm/nsmitm_module.hpp
|
/*
* 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 <stratosphere.hpp>
#include "../amsmitm_module.hpp"
namespace ams::mitm::ns {
DEFINE_MITM_MODULE_CLASS(0x4000, AMS_GET_SYSTEM_THREAD_PRIORITY(ns, ApplicationManagerIpcSession) - 1);
}
| 848
|
C++
|
.h
| 21
| 38.380952
| 107
| 0.759709
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,386
|
mitm_pm_module.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/mitm_pm/mitm_pm_module.hpp
|
/*
* 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 <stratosphere.hpp>
#include "../amsmitm_module.hpp"
namespace ams::mitm::pm {
DEFINE_MITM_MODULE_CLASS(0x1000, AMS_GET_SYSTEM_THREAD_PRIORITY(fs, WorkerThreadPool) - 2);
}
| 836
|
C++
|
.h
| 21
| 37.809524
| 95
| 0.756158
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,387
|
mitm_pm_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/ams_mitm/source/mitm_pm/mitm_pm_service.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::mitm::pm {
class PmService {
public:
Result PrepareLaunchProgram(sf::Out<u64> out, ncm::ProgramId program_id, const cfg::OverrideStatus &status, bool is_application);
};
static_assert(impl::IsIPmInterface<PmService>);
}
| 946
|
C++
|
.h
| 24
| 36.375
| 141
| 0.741023
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,388
|
tio_file_server_packet.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/TioServer/source/tio_file_server_packet.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::tio {
enum class PacketType : u32 {
/* Control commands. */
Connect = 0,
Disconnect = 1,
/* Direct filesystem access. */
CreateDirectory = 500,
DeleteDirectory = 501,
DeleteDirectoryRecursively = 502,
OpenDirectory = 503,
CloseDirectory = 504,
RenameDirectory = 505,
CreateFile = 506,
DeleteFile = 507,
OpenFile = 508,
FlushFile = 509,
CloseFile = 510,
RenameFile = 511,
ReadFile = 512,
WriteFile = 513,
GetEntryType = 514,
ReadDirectory = 515,
GetFileSize = 516,
SetFileSize = 517,
GetTotalSpaceSize = 518,
GetFreeSpaceSize = 519,
/* Utilities. */
Stat = 1000,
ListDirectory = 1001,
};
struct FileServerRequestHeader {
u64 request_id;
PacketType packet_type;
u32 body_size;
};
struct FileServerResponseHeader {
u64 request_id;
Result result;
u32 body_size;
};
static_assert(sizeof(FileServerRequestHeader) == sizeof(FileServerResponseHeader));
struct CreateDirectoryParam {
u32 path_len;
char path[];
};
struct DeleteDirectoryParam {
u32 path_len;
char path[];
};
struct DeleteDirectoryRecursivelyParam {
u32 path_len;
char path[];
};
struct OpenDirectoryParam {
u32 path_len;
fs::OpenDirectoryMode open_mode;
char path[];
};
static_assert(sizeof(OpenDirectoryParam) == 0x8);
struct CloseDirectoryParam {
u64 handle;
};
struct RenameDirectoryParam {
u32 old_len;
u32 new_len;
char data[];
};
struct CreateFileParam {
s64 size;
u32 path_len;
fs::CreateOption option;
char path[];
};
static_assert(sizeof(CreateFileParam) == 0x10);
struct DeleteFileParam {
u32 path_len;
char path[];
};
struct OpenFileParam {
u32 path_len;
fs::OpenMode mode;
char path[];
};
static_assert(sizeof(OpenFileParam) == 0x8);
struct FlushFileParam {
u64 handle;
};
struct CloseFileParam {
u64 handle;
};
struct RenameFileParam {
u32 old_len;
u32 new_len;
char data[];
};
struct ReadFileParam {
u64 handle;
s64 offset;
u64 size;
fs::ReadOption option;
};
static_assert(sizeof(ReadFileParam) == 0x20);
struct WriteFileParam {
u64 handle;
s64 offset;
u64 size;
fs::WriteOption option;
};
static_assert(sizeof(WriteFileParam) == 0x20);
struct GetEntryTypeParam {
u32 path_len;
char path[];
};
struct ReadDirectoryParam {
u64 handle;
s64 count;
};
struct GetFileSizeParam {
u64 handle;
};
struct SetFileSizeParam {
u64 handle;
s64 size;
};
struct GetTotalSpaceSizeParam {
u32 path_len;
char path[];
};
struct GetFreeSpaceSizeParam {
u32 path_len;
char path[];
};
struct StatParam {
u32 path_len;
char path[];
};
struct ListDirectoryParam {
u32 path_len;
char path[];
};
}
| 4,333
|
C++
|
.h
| 158
| 20.531646
| 87
| 0.561987
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,389
|
tio_file_server_processor.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/TioServer/source/tio_file_server_processor.hpp
|
/*
* 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 <stratosphere.hpp>
#include "tio_file_server_htcs_server.hpp"
#include "tio_file_server_packet.hpp"
namespace ams::tio {
class FileServerProcessor {
private:
bool m_is_inserted{};
bool m_is_mounted{};
size_t m_request_buffer_size{};
FileServerHtcsServer &m_htcs_server;
size_t m_open_file_count{};
size_t m_open_directory_count{};
fs::FileHandle m_files[0x80]{};
fs::DirectoryHandle m_directories[0x80]{};
os::SdkMutex m_fs_mutex{};
os::SdkMutex m_mutex{};
public:
constexpr FileServerProcessor(FileServerHtcsServer &htcs_server) : m_htcs_server(htcs_server) { /* ... */ }
void SetInserted(bool ins) { m_is_inserted = ins; }
void SetRequestBufferSize(size_t size) { m_request_buffer_size = size; }
public:
bool ProcessRequest(FileServerRequestHeader *header, u8 *body, int socket);
void Unmount();
private:
bool SendResponse(const FileServerResponseHeader &header, const void *body, int socket);
};
}
| 1,794
|
C++
|
.h
| 43
| 34.906977
| 119
| 0.663423
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,390
|
tio_file_server_htcs_server.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/TioServer/source/tio_file_server_htcs_server.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::tio {
using SocketAcceptedCallback = void(*)(s32 desc);
class FileServerHtcsServer {
private:
SocketAcceptedCallback m_on_socket_accepted;
htcs::HtcsPortName m_port_name;
os::ThreadType m_thread;
os::SdkMutex m_mutex;
public:
constexpr FileServerHtcsServer() : m_on_socket_accepted(nullptr), m_port_name{}, m_thread{}, m_mutex{} { /* ... */ }
private:
static void ThreadEntry(void *arg) {
static_cast<FileServerHtcsServer *>(arg)->ThreadFunc();
}
void ThreadFunc();
public:
os::SdkMutex &GetMutex() { return m_mutex; }
public:
void Initialize(const char *port_name, void *thread_stack, size_t thread_stack_size, SocketAcceptedCallback on_socket_accepted);
void Start();
void Wait();
ssize_t Send(s32 desc, const void *buffer, size_t buffer_size, s32 flags);
};
}
| 1,683
|
C++
|
.h
| 41
| 34.121951
| 140
| 0.6573
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,391
|
tio_file_server.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/TioServer/source/tio_file_server.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::tio {
void InitializeFileServer();
void StartFileServer();
void WaitFileServer();
}
| 789
|
C++
|
.h
| 22
| 33.590909
| 76
| 0.754248
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,392
|
tio_sd_card_observer.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/TioServer/source/tio_sd_card_observer.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::tio {
using SdCardInsertionCallback = void(*)(bool inserted);
class SdCardObserver {
private:
bool m_inserted;
SdCardInsertionCallback m_callback;
os::ThreadType m_thread;
public:
constexpr SdCardObserver() : m_inserted(false), m_callback(nullptr), m_thread{} { /* ... */ }
bool IsSdCardInserted() const { return m_inserted; }
private:
static void ThreadEntry(void *arg) {
static_cast<SdCardObserver *>(arg)->ThreadFunc();
}
void ThreadFunc();
public:
void Initialize(void *thread_stack, size_t thread_stack_size);
void SetCallback(SdCardInsertionCallback callback);
};
}
| 1,448
|
C++
|
.h
| 37
| 32.756757
| 105
| 0.670697
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,393
|
pm_shell_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/pm_shell_service.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::pm {
class ShellService {
public:
/* Actual command implementations. */
Result LaunchProgram(sf::Out<os::ProcessId> out_process_id, const ncm::ProgramLocation &loc, u32 flags);
Result TerminateProcess(os::ProcessId process_id);
Result TerminateProgram(ncm::ProgramId program_id);
void GetProcessEventHandle(sf::OutCopyHandle out);
void GetProcessEventInfo(sf::Out<ProcessEventInfo> out);
Result CleanupProcess(os::ProcessId process_id);
Result ClearExceptionOccurred(os::ProcessId process_id);
void NotifyBootFinished();
Result GetApplicationProcessIdForShell(sf::Out<os::ProcessId> out);
Result BoostSystemMemoryResourceLimit(u64 boost_size);
Result BoostApplicationThreadResourceLimit();
void GetBootFinishedEventHandle(sf::OutCopyHandle out);
Result BoostSystemThreadResourceLimit();
};
static_assert(pm::impl::IsIShellInterface<ShellService>);
}
| 1,740
|
C++
|
.h
| 37
| 40.486486
| 116
| 0.710588
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,394
|
pm_info_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/pm_info_service.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::pm {
class InformationService {
public:
/* Actual command implementations. */
Result GetProgramId(sf::Out<ncm::ProgramId> out, os::ProcessId process_id);
Result GetAppletResourceLimitCurrentValue(sf::Out<pm::ResourceLimitValue> out);
Result GetAppletResourceLimitPeakValue(sf::Out<pm::ResourceLimitValue> out);
/* Atmosphere extension commands. */
Result AtmosphereGetProcessId(sf::Out<os::ProcessId> out, ncm::ProgramId program_id);
Result AtmosphereHasLaunchedBootProgram(sf::Out<bool> out, ncm::ProgramId program_id);
Result AtmosphereGetProcessInfo(sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status, os::ProcessId process_id);
};
static_assert(pm::impl::IsIInformationInterface<InformationService>);
}
| 1,546
|
C++
|
.h
| 31
| 44.548387
| 150
| 0.726671
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,395
|
pm_boot_mode_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/pm_boot_mode_service.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::pm {
class BootModeService {
public:
void GetBootMode(sf::Out<u32> out);
void SetMaintenanceBoot();
void GetUnknown(sf::Out<u32> out);
Result SetUnknown(u32 val);
};
static_assert(pm::impl::IsIBootModeInterface<BootModeService>);
}
| 994
|
C++
|
.h
| 27
| 32.666667
| 76
| 0.71473
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,396
|
pm_debug_monitor_service.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/pm_debug_monitor_service.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::pm {
class DebugMonitorService {
public:
/* Actual command implementations. */
Result GetModuleIdList(sf::Out<u32> out_count, const sf::OutBuffer &out_buf, u64 unused);
Result GetExceptionProcessIdList(sf::Out<u32> out_count, const sf::OutArray<os::ProcessId> &out_process_ids);
Result StartProcess(os::ProcessId process_id);
Result GetProcessId(sf::Out<os::ProcessId> out, ncm::ProgramId program_id);
Result HookToCreateProcess(sf::OutCopyHandle out_hook, ncm::ProgramId program_id);
Result GetApplicationProcessId(sf::Out<os::ProcessId> out);
Result HookToCreateApplicationProcess(sf::OutCopyHandle out_hook);
Result ClearHook(u32 which);
Result GetProgramId(sf::Out<ncm::ProgramId> out, os::ProcessId process_id);
/* Atmosphere extension commands. */
Result AtmosphereGetProcessInfo(sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status, os::ProcessId process_id);
Result AtmosphereGetCurrentLimitInfo(sf::Out<s64> out_cur_val, sf::Out<s64> out_lim_val, u32 group, u32 resource);
};
static_assert(pm::impl::IsIDebugMonitorInterface<DebugMonitorService>);
}
| 1,994
|
C++
|
.h
| 36
| 49
| 188
| 0.71392
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,397
|
pm_process_tracker.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/impl/pm_process_tracker.hpp
|
/*
* 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 <stratosphere.hpp>
#include "pm_process_info.hpp"
namespace ams::pm::impl {
class ProcessTracker {
NON_COPYABLE(ProcessTracker);
NON_MOVEABLE(ProcessTracker);
private:
os::ThreadType m_thread;
os::EventType m_request_event;
os::EventType m_reply_event;
os::SdkMutex m_mutex;
ProcessInfo *m_queued_process_info;
util::Atomic<u32> m_process_count;
public:
constexpr ProcessTracker() : m_thread(), m_request_event(), m_reply_event(), m_mutex(), m_queued_process_info(nullptr), m_process_count(0) {
/* ... */
}
void Initialize(void *stack, size_t stack_size);
void StartThread();
void QueueEntry(ProcessInfo *process_info);
u32 GetProcessCount() const {
return m_process_count;
}
private:
void OnProcessSignaled(ProcessInfo *process_info);
private:
static void ThreadFunction(void *_this) {
static_cast<ProcessTracker *>(_this)->ThreadBody();
}
void ThreadBody();
};
void CreateProcessEvent();
}
| 1,869
|
C++
|
.h
| 49
| 30.326531
| 152
| 0.635762
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,398
|
pm_process_info.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/impl/pm_process_info.hpp
|
/*
* 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 "pm_process_manager.hpp"
namespace ams::pm::impl {
class ProcessList;
class ProcessInfo {
friend class ProcessList;
NON_COPYABLE(ProcessInfo);
NON_MOVEABLE(ProcessInfo);
private:
enum Flag : u32 {
Flag_SignalOnExit = (1 << 0),
Flag_ExceptionOccurred = (1 << 1),
Flag_ExceptionWaitingAttach = (1 << 2),
Flag_SignalOnDebugEvent = (1 << 3),
Flag_SuspendedStateChanged = (1 << 4),
Flag_Suspended = (1 << 5),
Flag_Application = (1 << 6),
Flag_SignalOnStart = (1 << 7),
Flag_StartedStateChanged = (1 << 8),
Flag_UnhandledException = (1 << 9),
};
private:
util::IntrusiveListNode m_list_node;
const os::ProcessId m_process_id;
const ldr::PinId m_pin_id;
const ncm::ProgramLocation m_loc;
const cfg::OverrideStatus m_status;
os::NativeHandle m_handle;
svc::ProcessState m_state;
u32 m_flags;
os::MultiWaitHolderType m_multi_wait_holder;
private:
void SetFlag(Flag flag) {
m_flags |= flag;
}
void ClearFlag(Flag flag) {
m_flags &= ~flag;
}
bool HasFlag(Flag flag) const {
return (m_flags & flag);
}
public:
ProcessInfo(os::NativeHandle h, os::ProcessId pid, ldr::PinId pin, const ncm::ProgramLocation &l, const cfg::OverrideStatus &s);
~ProcessInfo();
void Cleanup();
os::MultiWaitHolderType *GetMultiWaitHolder() {
return std::addressof(m_multi_wait_holder);
}
os::NativeHandle GetHandle() const {
return m_handle;
}
os::ProcessId GetProcessId() const {
return m_process_id;
}
ldr::PinId GetPinId() const {
return m_pin_id;
}
const ncm::ProgramLocation &GetProgramLocation() const {
return m_loc;
}
const cfg::OverrideStatus &GetOverrideStatus() const {
return m_status;
}
svc::ProcessState GetState() const {
return m_state;
}
void SetState(svc::ProcessState state) {
m_state = state;
}
bool HasStarted() const {
return m_state != svc::ProcessState_Created && m_state != svc::ProcessState_CreatedAttached;
}
bool HasTerminated() const {
return m_state == svc::ProcessState_Terminated;
}
#define DEFINE_FLAG_SET(flag) \
void Set##flag() { \
this->SetFlag(Flag_##flag); \
}
#define DEFINE_FLAG_GET(get, flag) \
bool get##flag() const { \
return this->HasFlag(Flag_##flag); \
}
#define DEFINE_FLAG_CLEAR(flag) \
void Clear##flag() { \
this->ClearFlag(Flag_##flag); \
}
DEFINE_FLAG_SET(SignalOnExit)
DEFINE_FLAG_GET(Should, SignalOnExit)
/* This needs a manual setter, because it sets two flags. */
void SetExceptionOccurred() {
this->SetFlag(Flag_ExceptionOccurred);
this->SetFlag(Flag_UnhandledException);
}
DEFINE_FLAG_GET(Has, ExceptionOccurred)
DEFINE_FLAG_GET(Has, ExceptionWaitingAttach)
DEFINE_FLAG_GET(Has, UnhandledException)
DEFINE_FLAG_SET(ExceptionWaitingAttach)
DEFINE_FLAG_CLEAR(ExceptionOccurred)
DEFINE_FLAG_CLEAR(ExceptionWaitingAttach)
DEFINE_FLAG_CLEAR(UnhandledException)
DEFINE_FLAG_SET(SignalOnDebugEvent)
DEFINE_FLAG_GET(Should, SignalOnDebugEvent)
DEFINE_FLAG_SET(SuspendedStateChanged)
DEFINE_FLAG_GET(Has, SuspendedStateChanged)
DEFINE_FLAG_CLEAR(SuspendedStateChanged)
DEFINE_FLAG_SET(Suspended)
DEFINE_FLAG_GET(Is, Suspended)
DEFINE_FLAG_CLEAR(Suspended)
DEFINE_FLAG_SET(Application)
DEFINE_FLAG_GET(Is, Application)
DEFINE_FLAG_SET(SignalOnStart)
DEFINE_FLAG_GET(Should, SignalOnStart)
DEFINE_FLAG_CLEAR(SignalOnStart)
DEFINE_FLAG_SET(StartedStateChanged)
DEFINE_FLAG_GET(Has, StartedStateChanged)
DEFINE_FLAG_CLEAR(StartedStateChanged)
#undef DEFINE_FLAG_SET
#undef DEFINE_FLAG_GET
#undef DEFINE_FLAG_CLEAR
};
class ProcessList final : public util::IntrusiveListMemberTraits<&ProcessInfo::m_list_node>::ListType {
private:
os::SdkMutex m_lock;
public:
constexpr ProcessList() : m_lock() { /* ... */ }
void Lock() {
m_lock.Lock();
}
void Unlock() {
m_lock.Unlock();
}
void Remove(ProcessInfo *process_info) {
this->erase(this->iterator_to(*process_info));
}
ProcessInfo *Find(os::ProcessId process_id) {
for (auto &info : *this) {
if (info.GetProcessId() == process_id) {
return std::addressof(info);
}
}
return nullptr;
}
ProcessInfo *Find(ncm::ProgramId program_id) {
for (auto &info : *this) {
if (info.GetProgramLocation().program_id == program_id) {
return std::addressof(info);
}
}
return nullptr;
}
};
class ProcessListAccessor final {
private:
ProcessList &m_list;
public:
explicit ProcessListAccessor(ProcessList &l) : m_list(l) {
m_list.Lock();
}
~ProcessListAccessor() {
m_list.Unlock();
}
ProcessList *operator->() {
return std::addressof(m_list);
}
const ProcessList *operator->() const {
return std::addressof(m_list);
}
ProcessList &operator*() {
return m_list;
}
const ProcessList &operator*() const {
return m_list;
}
};
ProcessListAccessor GetProcessList();
ProcessListAccessor GetExitList();
ProcessInfo *AllocateProcessInfo(svc::Handle process_handle, os::ProcessId process_id, ldr::PinId pin_id, const ncm::ProgramLocation &location, const cfg::OverrideStatus &override_status);
void CleanupProcessInfo(ProcessListAccessor &list, ProcessInfo *process_info);
}
| 7,699
|
C++
|
.h
| 195
| 27.220513
| 192
| 0.545589
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,399
|
pm_spec.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/impl/pm_spec.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::pm::impl {
Result InitializeSpec();
Result BoostSystemMemoryResourceLimit(u64 boost_size);
Result BoostApplicationThreadResourceLimit();
Result BoostSystemThreadResourceLimit();
Result BoostSystemMemoryResourceLimitForMitm(u64 boost_size);
os::NativeHandle GetResourceLimitHandle(ResourceLimitGroup group);
os::NativeHandle GetResourceLimitHandle(const ldr::ProgramInfo *info);
void WaitResourceAvailable(const ldr::ProgramInfo *info);
Result GetResourceLimitCurrentValue(pm::ResourceLimitValue *out, ResourceLimitGroup group);
Result GetResourceLimitPeakValue(pm::ResourceLimitValue *outm, ResourceLimitGroup group);
Result GetResourceLimitLimitValue(pm::ResourceLimitValue *out, ResourceLimitGroup group);
Result GetResourceLimitValues(s64 *out_cur, s64 *out_lim, ResourceLimitGroup group, svc::LimitableResource resource);
}
| 1,576
|
C++
|
.h
| 31
| 47.548387
| 121
| 0.792969
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,400
|
pm_process_manager.hpp
|
Atmosphere-NX_Atmosphere/stratosphere/pm/source/impl/pm_process_manager.hpp
|
/*
* 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 <stratosphere.hpp>
namespace ams::pm::impl {
/* Initialization. */
Result InitializeProcessManager();
/* Process Management. */
Result LaunchProgram(os::ProcessId *out_process_id, const ncm::ProgramLocation &loc, u32 flags);
Result StartProcess(os::ProcessId process_id);
Result TerminateProcess(os::ProcessId process_id);
Result TerminateProgram(ncm::ProgramId program_id);
Result GetProcessEventHandle(os::NativeHandle *out);
Result GetProcessEventInfo(ProcessEventInfo *out);
Result CleanupProcess(os::ProcessId process_id);
Result ClearExceptionOccurred(os::ProcessId process_id);
/* Information Getters. */
Result GetModuleIdList(u32 *out_count, u8 *out_buf, size_t max_out_count, u64 unused);
Result GetExceptionProcessIdList(u32 *out_count, os::ProcessId *out_process_ids, size_t max_out_count);
Result GetProcessId(os::ProcessId *out, ncm::ProgramId program_id);
Result GetProgramId(ncm::ProgramId *out, os::ProcessId process_id);
Result GetApplicationProcessId(os::ProcessId *out_process_id);
Result AtmosphereGetProcessInfo(os::NativeHandle *out_process_handle, ncm::ProgramLocation *out_loc, cfg::OverrideStatus *out_status, os::ProcessId process_id);
/* Hook API. */
Result HookToCreateProcess(os::NativeHandle *out_hook, ncm::ProgramId program_id);
Result HookToCreateApplicationProcess(os::NativeHandle *out_hook);
Result ClearHook(u32 which);
/* Boot API. */
Result NotifyBootFinished();
Result GetBootFinishedEventHandle(os::NativeHandle *out);
}
| 2,227
|
C++
|
.h
| 44
| 46.863636
| 164
| 0.754596
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,401
|
haze.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze.hpp
|
/*
* 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 <haze/async_usb_server.hpp>
#include <haze/common.hpp>
#include <haze/device_properties.hpp>
#include <haze/event_reactor.hpp>
#include <haze/file_system_proxy.hpp>
#include <haze/ptp.hpp>
#include <haze/ptp_object_database.hpp>
#include <haze/ptp_object_heap.hpp>
#include <haze/ptp_responder.hpp>
#include <haze/usb_session.hpp>
| 989
|
C++
|
.h
| 26
| 36.461538
| 76
| 0.766112
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,402
|
results.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/results.hpp
|
/*
* 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/results.hpp>
/* NOTE: These results are all custom, and not official. */
R_DEFINE_NAMESPACE_RESULT_MODULE(haze, 420);
namespace haze {
R_DEFINE_ERROR_RESULT(RegistrationFailed, 1);
R_DEFINE_ERROR_RESULT(NotConfigured, 2);
R_DEFINE_ERROR_RESULT(TransferFailed, 3);
R_DEFINE_ERROR_RESULT(StopRequested, 4);
R_DEFINE_ERROR_RESULT(FocusLost, 5);
R_DEFINE_ERROR_RESULT(EndOfTransmission, 6);
R_DEFINE_ERROR_RESULT(UnknownPacketType, 7);
R_DEFINE_ERROR_RESULT(SessionNotOpen, 8);
R_DEFINE_ERROR_RESULT(OutOfMemory, 9);
R_DEFINE_ERROR_RESULT(InvalidObjectId, 10);
R_DEFINE_ERROR_RESULT(InvalidStorageId, 11);
R_DEFINE_ERROR_RESULT(OperationNotSupported, 12);
R_DEFINE_ERROR_RESULT(UnknownRequestType, 13);
R_DEFINE_ERROR_RESULT(UnknownPropertyCode, 14);
R_DEFINE_ERROR_RESULT(InvalidPropertyValue, 15);
R_DEFINE_ERROR_RESULT(InvalidArgument, 16);
R_DEFINE_ERROR_RESULT(GroupSpecified, 17);
R_DEFINE_ERROR_RESULT(DepthSpecified, 18);
}
| 1,780
|
C++
|
.h
| 39
| 42.307692
| 76
| 0.703917
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,403
|
assert.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/assert.hpp
|
/*
* 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
#define HAZE_ASSERT(expr) \
{ \
const bool __tmp_haze_assert_val = static_cast<bool>(expr); \
if (AMS_UNLIKELY(!__tmp_haze_assert_val)) { \
svcBreak(BreakReason_Assert, 0, 0); \
} \
}
#define HAZE_R_ABORT_UNLESS(res_expr) \
{ \
const auto _tmp_r_abort_rc = (res_expr); \
HAZE_ASSERT(R_SUCCEEDED(_tmp_r_abort_rc)); \
}
#define HAZE_UNREACHABLE_DEFAULT_CASE() default: HAZE_ASSERT(false)
| 1,315
|
C++
|
.h
| 29
| 42.793103
| 76
| 0.575994
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,404
|
usb_session.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/usb_session.hpp
|
/*
* 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 <haze/common.hpp>
namespace haze {
enum UsbSessionEndpoint {
UsbSessionEndpoint_Read = 0,
UsbSessionEndpoint_Write = 1,
UsbSessionEndpoint_Interrupt = 2,
UsbSessionEndpoint_Count = 3,
};
class UsbSession {
private:
UsbDsInterface *m_interface;
UsbDsEndpoint *m_endpoints[UsbSessionEndpoint_Count];
private:
Result Initialize1x(const UsbCommsInterfaceInfo *info);
Result Initialize5x(const UsbCommsInterfaceInfo *info);
public:
constexpr explicit UsbSession() : m_interface(), m_endpoints() { /* ... */ }
Result Initialize(const UsbCommsInterfaceInfo *info, u16 id_vendor, u16 id_product);
void Finalize();
bool GetConfigured() const;
Event *GetCompletionEvent(UsbSessionEndpoint ep) const;
Result TransferAsync(UsbSessionEndpoint ep, void *buffer, u32 size, u32 *out_urb_id);
Result GetTransferResult(UsbSessionEndpoint ep, u32 urb_id, u32 *out_transferred_size);
};
}
| 1,750
|
C++
|
.h
| 41
| 36.195122
| 99
| 0.688014
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,405
|
ptp_responder_types.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/ptp_responder_types.hpp
|
/*
* 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 <haze.hpp>
namespace haze {
constexpr UsbCommsInterfaceInfo MtpInterfaceInfo = {
.bInterfaceClass = 0x06,
.bInterfaceSubClass = 0x01,
.bInterfaceProtocol = 0x01,
};
/* This is a VID:PID recognized by libmtp. */
constexpr u16 SwitchMtpIdVendor = 0x057e;
constexpr u16 SwitchMtpIdProduct = 0x201d;
/* Constants used for MTP GetDeviceInfo response. */
constexpr u16 MtpStandardVersion = 100;
constexpr u32 MtpVendorExtensionId = 6;
constexpr auto MtpVendorExtensionDesc = "microsoft.com: 1.0;";
constexpr u16 MtpFunctionalModeDefault = 0;
constexpr auto MtpDeviceManufacturer = "Nintendo";
constexpr auto MtpDeviceModel = "Nintendo Switch";
enum StorageId : u32 {
StorageId_SdmcFs = 0xffffffffu - 1,
};
constexpr PtpOperationCode SupportedOperationCodes[] = {
PtpOperationCode_GetDeviceInfo,
PtpOperationCode_OpenSession,
PtpOperationCode_CloseSession,
PtpOperationCode_GetStorageIds,
PtpOperationCode_GetStorageInfo,
PtpOperationCode_GetObjectHandles,
PtpOperationCode_GetObjectInfo,
PtpOperationCode_GetObject,
PtpOperationCode_SendObjectInfo,
PtpOperationCode_SendObject,
PtpOperationCode_DeleteObject,
PtpOperationCode_MtpGetObjectPropsSupported,
PtpOperationCode_MtpGetObjectPropDesc,
PtpOperationCode_MtpGetObjectPropValue,
PtpOperationCode_MtpSetObjectPropValue,
PtpOperationCode_MtpGetObjPropList,
PtpOperationCode_AndroidGetPartialObject64,
PtpOperationCode_AndroidSendPartialObject,
PtpOperationCode_AndroidTruncateObject,
PtpOperationCode_AndroidBeginEditObject,
PtpOperationCode_AndroidEndEditObject,
};
constexpr const PtpEventCode SupportedEventCodes[] = { /* ... */ };
constexpr const PtpDevicePropertyCode SupportedDeviceProperties[] = { /* ... */ };
constexpr const PtpObjectFormatCode SupportedCaptureFormats[] = { /* ... */ };
constexpr const PtpObjectFormatCode SupportedPlaybackFormats[] = {
PtpObjectFormatCode_Undefined,
PtpObjectFormatCode_Association,
};
constexpr const PtpObjectPropertyCode SupportedObjectProperties[] = {
PtpObjectPropertyCode_StorageId,
PtpObjectPropertyCode_ObjectFormat,
PtpObjectPropertyCode_ObjectSize,
PtpObjectPropertyCode_ObjectFileName,
PtpObjectPropertyCode_ParentObject,
PtpObjectPropertyCode_PersistentUniqueObjectIdentifier,
};
constexpr bool IsSupportedObjectPropertyCode(PtpObjectPropertyCode c) {
for (size_t i = 0; i < util::size(SupportedObjectProperties); i++) {
if (SupportedObjectProperties[i] == c) {
return true;
}
}
return false;
}
constexpr const StorageId SupportedStorageIds[] = {
StorageId_SdmcFs,
};
struct PtpStorageInfo {
PtpStorageType storage_type;
PtpFilesystemType filesystem_type;
PtpAccessCapability access_capability;
u64 max_capacity;
u64 free_space_in_bytes;
u32 free_space_in_images;
const char *storage_description;
const char *volume_label;
};
constexpr PtpStorageInfo DefaultStorageInfo = {
.storage_type = PtpStorageType_FixedRam,
.filesystem_type = PtpFilesystemType_GenericHierarchical,
.access_capability = PtpAccessCapability_ReadWrite,
.max_capacity = 0,
.free_space_in_bytes = 0,
.free_space_in_images = 0,
.storage_description = "",
.volume_label = "",
};
struct PtpObjectInfo {
StorageId storage_id;
PtpObjectFormatCode object_format;
PtpProtectionStatus protection_status;
u32 object_compressed_size;
u16 thumb_format;
u32 thumb_compressed_size;
u32 thumb_width;
u32 thumb_height;
u32 image_width;
u32 image_height;
u32 image_depth;
u32 parent_object;
PtpAssociationType association_type;
u32 association_desc;
u32 sequence_number;
const char *filename;
const char *capture_date;
const char *modification_date;
const char *keywords;
};
constexpr PtpObjectInfo DefaultObjectInfo = {
.storage_id = StorageId_SdmcFs,
.object_format = {},
.protection_status = PtpProtectionStatus_NoProtection,
.object_compressed_size = 0,
.thumb_format = 0,
.thumb_compressed_size = 0,
.thumb_width = 0,
.thumb_height = 0,
.image_width = 0,
.image_height = 0,
.image_depth = 0,
.parent_object = PtpGetObjectHandles_RootParent,
.association_type = PtpAssociationType_Undefined,
.association_desc = 0,
.sequence_number = 0,
.filename = nullptr,
.capture_date = "",
.modification_date = "",
.keywords = "",
};
constexpr u32 UsbBulkPacketBufferSize = 1_MB;
constexpr u64 FsBufferSize = UsbBulkPacketBufferSize;
constexpr s64 DirectoryReadSize = 32;
struct PtpBuffers {
char filename_string_buffer[PtpStringMaxLength + 1];
char capture_date_string_buffer[PtpStringMaxLength + 1];
char modification_date_string_buffer[PtpStringMaxLength + 1];
char keywords_string_buffer[PtpStringMaxLength + 1];
FsDirectoryEntry file_system_entry_buffer[DirectoryReadSize];
u8 file_system_data_buffer[FsBufferSize];
alignas(4_KB) u8 usb_bulk_write_buffer[UsbBulkPacketBufferSize];
alignas(4_KB) u8 usb_bulk_read_buffer[UsbBulkPacketBufferSize];
};
}
| 6,615
|
C++
|
.h
| 161
| 33.701863
| 86
| 0.666978
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,406
|
ptp_data_builder.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/ptp_data_builder.hpp
|
/*
* 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 <haze/async_usb_server.hpp>
#include <haze/common.hpp>
#include <haze/ptp.hpp>
namespace haze {
class PtpDataBuilder final {
private:
AsyncUsbServer *m_server;
u32 m_transmitted_size;
u32 m_offset;
u8 *m_data;
bool m_disabled;
private:
Result Flush() {
ON_SCOPE_EXIT {
m_transmitted_size += m_offset;
m_offset = 0;
};
/* If we're disabled, we have nothing to do. */
R_SUCCEED_IF(m_disabled);
/* Otherwise, we should write our buffered data. */
R_RETURN(m_server->WritePacket(m_data, m_offset));
}
public:
constexpr explicit PtpDataBuilder(void *data, AsyncUsbServer *server) : m_server(server), m_transmitted_size(), m_offset(), m_data(static_cast<u8 *>(data)), m_disabled() { /* ... */ }
Result Commit() {
if (m_offset > 0) {
/* If there is remaining data left to write, write it now. */
R_TRY(this->Flush());
}
if (util::IsAligned(m_transmitted_size, PtpUsbBulkHighSpeedMaxPacketLength)) {
/* If the transmission size was a multiple of wMaxPacketSize, send a zero length packet. */
R_TRY(this->Flush());
}
R_SUCCEED();
}
Result AddBuffer(const u8 *buffer, u32 count) {
while (count > 0) {
/* Calculate how many bytes we can write now. */
const u32 write_size = std::min<u32>(count, haze::UsbBulkPacketBufferSize - m_offset);
/* Write this number of bytes. */
std::memcpy(m_data + m_offset, buffer, write_size);
m_offset += write_size;
buffer += write_size;
count -= write_size;
/* If our buffer is full, flush it. */
if (m_offset == haze::UsbBulkPacketBufferSize) {
R_TRY(this->Flush());
}
}
R_SUCCEED();
}
template <typename T>
Result Add(T value) {
u8 bytes[sizeof(T)];
std::memcpy(bytes, std::addressof(value), sizeof(T));
R_RETURN(this->AddBuffer(bytes, sizeof(T)));
}
Result AddDataHeader(PtpUsbBulkContainer &request, u32 data_size) {
R_TRY(this->Add<u32>(PtpUsbBulkHeaderLength + data_size));
R_TRY(this->Add<u16>(PtpUsbBulkContainerType_Data));
R_TRY(this->Add<u16>(request.code));
R_TRY(this->Add<u32>(request.trans_id));
R_SUCCEED();
}
Result AddResponseHeader(PtpUsbBulkContainer &request, PtpResponseCode code, u32 params_size) {
R_TRY(this->Add<u32>(PtpUsbBulkHeaderLength + params_size));
R_TRY(this->Add<u16>(PtpUsbBulkContainerType_Response));
R_TRY(this->Add<u16>(code));
R_TRY(this->Add<u32>(request.trans_id));
R_SUCCEED();
}
template <typename F>
Result WriteVariableLengthData(PtpUsbBulkContainer &request, F &&func) {
HAZE_ASSERT(m_offset == 0 && m_transmitted_size == 0);
/* Declare how many bytes the data will require to write. */
u32 data_size = 0;
{
/* Temporarily disable writing to calculate the size.*/
m_disabled = true;
ON_SCOPE_EXIT {
/* Report how many bytes were required. */
data_size = m_transmitted_size;
/* On exit, enable writing and reset sizes. */
m_transmitted_size = 0;
m_disabled = false;
m_offset = 0;
};
R_TRY(func());
R_TRY(this->Commit());
}
/* Actually copy and write the data. */
R_TRY(this->AddDataHeader(request, data_size));
R_TRY(func());
R_TRY(this->Commit());
/* We succeeded. */
R_SUCCEED();
}
template <typename T>
Result AddString(const T *str) {
/* Use one less than the maximum string length for maximum length with null terminator. */
const u8 len = static_cast<u8>(std::min<s32>(util::Strlen(str), PtpStringMaxLength - 1));
if (len > 0) {
/* Length is padded by null terminator for non-empty strings. */
R_TRY(this->Add<u8>(len + 1));
for (size_t i = 0; i < len; i++) {
R_TRY(this->Add<u16>(str[i]));
}
R_TRY(this->Add<u16>(0));
} else {
R_TRY(this->Add<u8>(len));
}
R_SUCCEED();
}
template <typename T>
Result AddArray(const T *arr, u32 count) {
R_TRY(this->Add<u32>(count));
for (size_t i = 0; i < count; i++) {
R_TRY(this->Add<T>(arr[i]));
}
R_SUCCEED();
}
};
}
| 6,232
|
C++
|
.h
| 139
| 29.755396
| 196
| 0.494553
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,407
|
device_properties.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/device_properties.hpp
|
/*
* 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
namespace haze {
Result LoadDeviceProperties();
const char *GetSerialNumber();
const char *GetFirmwareVersion();
}
| 780
|
C++
|
.h
| 21
| 34.666667
| 76
| 0.754642
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,408
|
ptp_responder.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/ptp_responder.hpp
|
/*
* 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 <haze/common.hpp>
#include <haze/async_usb_server.hpp>
#include <haze/ptp_object_heap.hpp>
#include <haze/ptp_object_database.hpp>
#include <haze/ptp_responder_types.hpp>
namespace haze {
class PtpDataParser;
class PtpResponder final {
private:
AsyncUsbServer m_usb_server;
FileSystemProxy m_fs;
PtpUsbBulkContainer m_request_header;
PtpObjectHeap *m_object_heap;
PtpBuffers* m_buffers;
u32 m_send_object_id;
bool m_session_open;
PtpObjectDatabase m_object_database;
public:
constexpr explicit PtpResponder() : m_usb_server(), m_fs(), m_request_header(), m_object_heap(), m_buffers(), m_send_object_id(), m_session_open(), m_object_database() { /* ... */ }
Result Initialize(EventReactor *reactor, PtpObjectHeap *object_heap);
void Finalize();
public:
Result LoopProcess();
private:
/* Request handling. */
Result HandleRequest();
Result HandleRequestImpl();
Result HandleCommandRequest(PtpDataParser &dp);
void ForceCloseSession();
Result WriteResponse(PtpResponseCode code, const void* data, size_t size);
Result WriteResponse(PtpResponseCode code);
template <typename Data> requires (util::is_pod<Data>::value)
Result WriteResponse(PtpResponseCode code, const Data &data) {
R_RETURN(this->WriteResponse(code, std::addressof(data), sizeof(data)));
}
/* PTP operations. */
Result GetDeviceInfo(PtpDataParser &dp);
Result OpenSession(PtpDataParser &dp);
Result CloseSession(PtpDataParser &dp);
Result GetStorageIds(PtpDataParser &dp);
Result GetStorageInfo(PtpDataParser &dp);
Result GetObjectHandles(PtpDataParser &dp);
Result GetObjectInfo(PtpDataParser &dp);
Result GetObject(PtpDataParser &dp);
Result SendObjectInfo(PtpDataParser &dp);
Result SendObject(PtpDataParser &dp);
Result DeleteObject(PtpDataParser &dp);
/* Android operations. */
Result GetPartialObject64(PtpDataParser &dp);
Result SendPartialObject(PtpDataParser &dp);
Result TruncateObject(PtpDataParser &dp);
Result BeginEditObject(PtpDataParser &dp);
Result EndEditObject(PtpDataParser &dp);
/* MTP operations. */
Result GetObjectPropsSupported(PtpDataParser &dp);
Result GetObjectPropDesc(PtpDataParser &dp);
Result GetObjectPropValue(PtpDataParser &dp);
Result SetObjectPropValue(PtpDataParser &dp);
Result GetObjectPropList(PtpDataParser &dp);
};
}
| 3,503
|
C++
|
.h
| 77
| 36.207792
| 193
| 0.655243
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,409
|
ptp_object_heap.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/ptp_object_heap.hpp
|
/*
* 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 <haze/common.hpp>
namespace haze {
/* This simple linear allocator implementation allows us to rapidly reclaim the entire object graph. */
/* This is critical for maintaining interactivity when a session is closed. */
class PtpObjectHeap {
private:
static constexpr size_t NumHeapBlocks = 2;
private:
void *m_heap_blocks[NumHeapBlocks];
void *m_next_address;
u32 m_heap_block_size;
u32 m_current_heap_block;
public:
constexpr explicit PtpObjectHeap() : m_heap_blocks(), m_next_address(), m_heap_block_size(), m_current_heap_block() { /* ... */ }
void Initialize();
void Finalize();
public:
constexpr size_t GetTotalSize() const {
return m_heap_block_size * NumHeapBlocks;
}
constexpr size_t GetUsedSize() const {
return (m_heap_block_size * m_current_heap_block) + this->GetNextAddress() - this->GetFirstAddress();
}
private:
constexpr u8 *GetNextAddress() const { return static_cast<u8 *>(m_next_address); }
constexpr u8 *GetFirstAddress() const { return static_cast<u8 *>(m_heap_blocks[m_current_heap_block]); }
constexpr u8 *GetCurrentBlockEnd() const {
return this->GetFirstAddress() + m_heap_block_size;
}
constexpr bool AllocationIsPossible(size_t n) const {
return n <= m_heap_block_size;
}
constexpr bool AllocationIsSatisfyable(size_t n) const {
/* Check for overflow. */
if (!util::CanAddWithoutOverflow(reinterpret_cast<uintptr_t>(this->GetNextAddress()), n)) {
return false;
}
/* Check if we would exceed the size of the current block. */
if (this->GetNextAddress() + n > this->GetCurrentBlockEnd()) {
return false;
}
return true;
}
constexpr bool AdvanceToNextBlock() {
if (m_current_heap_block < NumHeapBlocks - 1) {
m_next_address = m_heap_blocks[++m_current_heap_block];
return true;
}
return false;
}
constexpr void *AllocateFromCurrentBlock(size_t n) {
void *result = this->GetNextAddress();
m_next_address = this->GetNextAddress() + n;
return result;
}
public:
template <typename T = void>
constexpr T *Allocate(size_t n) {
/* Check for overflow in alignment. */
if (!util::CanAddWithoutOverflow(n, alignof(u64) - 1)) {
return nullptr;
}
/* Align the amount to satisfy allocation for u64. */
n = util::AlignUp(n, alignof(u64));
/* Check if the allocation is possible. */
if (!this->AllocationIsPossible(n)) {
return nullptr;
}
/* If the allocation is not satisfyable now, we might be able to satisfy it on the next block. */
/* However, if the next block would be empty, we won't be able to satisfy the request. */
if (!this->AllocationIsSatisfyable(n) && !this->AdvanceToNextBlock()) {
return nullptr;
}
/* Allocate the memory. */
return static_cast<T *>(this->AllocateFromCurrentBlock(n));
}
constexpr void Deallocate(void *p, size_t n) {
/* Check for overflow in alignment. */
if (!util::CanAddWithoutOverflow(n, alignof(u64) - 1)) {
return;
}
/* Align the amount to satisfy allocation for u64. */
n = util::AlignUp(n, alignof(u64));
/* If the pointer was the last allocation, return the memory to the heap. */
if (static_cast<u8 *>(p) + n == this->GetNextAddress()) {
m_next_address = this->GetNextAddress() - n;
}
/* Otherwise, do nothing. */
/* ... */
}
};
}
| 5,014
|
C++
|
.h
| 108
| 33.518519
| 141
| 0.552642
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,410
|
async_usb_server.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/async_usb_server.hpp
|
/*
* 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 <haze/common.hpp>
#include <haze/event_reactor.hpp>
namespace haze {
class AsyncUsbServer final {
private:
EventReactor *m_reactor;
public:
constexpr explicit AsyncUsbServer() : m_reactor() { /* ... */ }
Result Initialize(const UsbCommsInterfaceInfo *interface_info, u16 id_vendor, u16 id_product, EventReactor *reactor);
void Finalize();
private:
Result TransferPacketImpl(bool read, void *page, u32 size, u32 *out_size_transferred) const;
public:
Result ReadPacket(void *page, u32 size, u32 *out_size_transferred) const {
R_RETURN(this->TransferPacketImpl(true, page, size, out_size_transferred));
}
Result WritePacket(void *page, u32 size) const {
u32 size_transferred;
R_RETURN(this->TransferPacketImpl(false, page, size, std::addressof(size_transferred)));
}
};
}
| 1,628
|
C++
|
.h
| 38
| 36.157895
| 129
| 0.674874
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,411
|
ptp_object_database.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/ptp_object_database.hpp
|
/*
* 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 <haze/common.hpp>
#include <haze/ptp_object_heap.hpp>
#include <vapours/util.hpp>
namespace haze {
struct PtpObject {
public:
util::IntrusiveRedBlackTreeNode m_name_node;
util::IntrusiveRedBlackTreeNode m_object_id_node;
u32 m_parent_id;
u32 m_object_id;
char m_name[];
public:
const char *GetName() const { return m_name; }
u32 GetParentId() const { return m_parent_id; }
u32 GetObjectId() const { return m_object_id; }
public:
bool GetIsRegistered() const { return m_object_id != 0; }
void Register(u32 object_id) { m_object_id = object_id; }
void Unregister() { m_object_id = 0; }
public:
struct NameComparator {
struct RedBlackKeyType {
const char *m_name;
constexpr RedBlackKeyType(const char *name) : m_name(name) { /* ... */ }
constexpr const char *GetName() const {
return m_name;
}
};
template<typename T> requires (std::same_as<T, PtpObject> || std::same_as<T, RedBlackKeyType>)
static constexpr int Compare(const T &lhs, const PtpObject &rhs) {
/* All SD card filesystems supported by fs are case-insensitive and case-preserving. */
/* Account for that in collation here. */
return strcasecmp(lhs.GetName(), rhs.GetName());
}
};
struct ObjectIdComparator {
struct RedBlackKeyType {
u32 m_object_id;
constexpr RedBlackKeyType(u32 object_id) : m_object_id(object_id) { /* ... */ }
constexpr u32 GetObjectId() const {
return m_object_id;
}
};
template<typename T> requires (std::same_as<T, PtpObject> || std::same_as<T, RedBlackKeyType>)
static constexpr int Compare(const T &lhs, const PtpObject &rhs) {
return lhs.GetObjectId() - rhs.GetObjectId();
}
};
};
class PtpObjectDatabase {
private:
using ObjectNameTreeTraits = util::IntrusiveRedBlackTreeMemberTraitsDeferredAssert<&PtpObject::m_name_node>;
using ObjectNameTree = ObjectNameTreeTraits::TreeType<PtpObject::NameComparator>;
using ObjectIdTreeTraits = util::IntrusiveRedBlackTreeMemberTraitsDeferredAssert<&PtpObject::m_object_id_node>;
using ObjectIdTree = ObjectIdTreeTraits::TreeType<PtpObject::ObjectIdComparator>;
PtpObjectHeap *m_object_heap;
ObjectNameTree m_name_tree;
ObjectIdTree m_object_id_tree;
u32 m_next_object_id;
public:
constexpr explicit PtpObjectDatabase() : m_object_heap(), m_name_tree(), m_object_id_tree(), m_next_object_id() { /* ... */ }
void Initialize(PtpObjectHeap *object_heap);
void Finalize();
public:
/* Object database API. */
Result CreateOrFindObject(const char *parent_name, const char *name, u32 parent_id, PtpObject **out_object);
void RegisterObject(PtpObject *object, u32 desired_id = 0);
void UnregisterObject(PtpObject *object);
void DeleteObject(PtpObject *obj);
Result CreateAndRegisterObjectId(const char *parent_name, const char *name, u32 parent_id, u32 *out_object_id);
public:
PtpObject *GetObjectById(u32 object_id);
PtpObject *GetObjectByName(const char *name);
};
}
| 4,434
|
C++
|
.h
| 91
| 37.10989
| 137
| 0.596256
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,412
|
ptp.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/ptp.hpp
|
/*
* Copyright (c) Atmosphère-NX
* Copyright (c) libmtp project
*
* 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 <haze/common.hpp>
namespace haze {
constexpr inline u32 PtpUsbBulkHighSpeedMaxPacketLength = 0x200;
constexpr inline u32 PtpUsbBulkSuperSpeedMaxPacketLength = 0x400;
constexpr inline u32 PtpUsbBulkHeaderLength = 2 * sizeof(u32) + 2 * sizeof(u16);
constexpr inline u32 PtpStringMaxLength = 255;
enum PtpUsbBulkContainerType : u16 {
PtpUsbBulkContainerType_Undefined = 0x0000,
PtpUsbBulkContainerType_Command = 0x0001,
PtpUsbBulkContainerType_Data = 0x0002,
PtpUsbBulkContainerType_Response = 0x0003,
PtpUsbBulkContainerType_Event = 0x0004,
};
enum PtpOperationCode : u16 {
PtpOperationCode_Undefined = 0x1000,
PtpOperationCode_GetDeviceInfo = 0x1001,
PtpOperationCode_OpenSession = 0x1002,
PtpOperationCode_CloseSession = 0x1003,
PtpOperationCode_GetStorageIds = 0x1004,
PtpOperationCode_GetStorageInfo = 0x1005,
PtpOperationCode_GetNumObjects = 0x1006,
PtpOperationCode_GetObjectHandles = 0x1007,
PtpOperationCode_GetObjectInfo = 0x1008,
PtpOperationCode_GetObject = 0x1009,
PtpOperationCode_GetThumb = 0x100a,
PtpOperationCode_DeleteObject = 0x100b,
PtpOperationCode_SendObjectInfo = 0x100c,
PtpOperationCode_SendObject = 0x100d,
PtpOperationCode_InitiateCapture = 0x100e,
PtpOperationCode_FormatStore = 0x100f,
PtpOperationCode_ResetDevice = 0x1010,
PtpOperationCode_SelfTest = 0x1011,
PtpOperationCode_SetObjectProtection = 0x1012,
PtpOperationCode_PowerDown = 0x1013,
PtpOperationCode_GetDevicePropDesc = 0x1014,
PtpOperationCode_GetDevicePropValue = 0x1015,
PtpOperationCode_SetDevicePropValue = 0x1016,
PtpOperationCode_ResetDevicePropValue = 0x1017,
PtpOperationCode_TerminateOpenCapture = 0x1018,
PtpOperationCode_MoveObject = 0x1019,
PtpOperationCode_CopyObject = 0x101a,
PtpOperationCode_GetPartialObject = 0x101b,
PtpOperationCode_InitiateOpenCapture = 0x101c,
PtpOperationCode_StartEnumHandles = 0x101d,
PtpOperationCode_EnumHandles = 0x101e,
PtpOperationCode_StopEnumHandles = 0x101f,
PtpOperationCode_GetVendorExtensionMaps = 0x1020,
PtpOperationCode_GetVendorDeviceInfo = 0x1021,
PtpOperationCode_GetResizedImageObject = 0x1022,
PtpOperationCode_GetFilesystemManifest = 0x1023,
PtpOperationCode_GetStreamInfo = 0x1024,
PtpOperationCode_GetStream = 0x1025,
PtpOperationCode_AndroidGetPartialObject64 = 0x95c1,
PtpOperationCode_AndroidSendPartialObject = 0x95c2,
PtpOperationCode_AndroidTruncateObject = 0x95c3,
PtpOperationCode_AndroidBeginEditObject = 0x95c4,
PtpOperationCode_AndroidEndEditObject = 0x95c5,
PtpOperationCode_MtpGetObjectPropsSupported = 0x9801,
PtpOperationCode_MtpGetObjectPropDesc = 0x9802,
PtpOperationCode_MtpGetObjectPropValue = 0x9803,
PtpOperationCode_MtpSetObjectPropValue = 0x9804,
PtpOperationCode_MtpGetObjPropList = 0x9805,
PtpOperationCode_MtpSetObjPropList = 0x9806,
PtpOperationCode_MtpGetInterdependendPropdesc = 0x9807,
PtpOperationCode_MtpSendObjectPropList = 0x9808,
PtpOperationCode_MtpGetObjectReferences = 0x9810,
PtpOperationCode_MtpSetObjectReferences = 0x9811,
PtpOperationCode_MtpUpdateDeviceFirmware = 0x9812,
PtpOperationCode_MtpSkip = 0x9820,
};
enum PtpResponseCode : u16 {
PtpResponseCode_Undefined = 0x2000,
PtpResponseCode_Ok = 0x2001,
PtpResponseCode_GeneralError = 0x2002,
PtpResponseCode_SessionNotOpen = 0x2003,
PtpResponseCode_InvalidTransactionId = 0x2004,
PtpResponseCode_OperationNotSupported = 0x2005,
PtpResponseCode_ParameterNotSupported = 0x2006,
PtpResponseCode_IncompleteTransfer = 0x2007,
PtpResponseCode_InvalidStorageId = 0x2008,
PtpResponseCode_InvalidObjectHandle = 0x2009,
PtpResponseCode_DevicePropNotSupported = 0x200a,
PtpResponseCode_InvalidObjectFormatCode = 0x200b,
PtpResponseCode_StoreFull = 0x200c,
PtpResponseCode_ObjectWriteProtected = 0x200d,
PtpResponseCode_StoreReadOnly = 0x200e,
PtpResponseCode_AccessDenied = 0x200f,
PtpResponseCode_NoThumbnailPresent = 0x2010,
PtpResponseCode_SelfTestFailed = 0x2011,
PtpResponseCode_PartialDeletion = 0x2012,
PtpResponseCode_StoreNotAvailable = 0x2013,
PtpResponseCode_SpecificationByFormatUnsupported = 0x2014,
PtpResponseCode_NoValidObjectInfo = 0x2015,
PtpResponseCode_InvalidCodeFormat = 0x2016,
PtpResponseCode_UnknownVendorCode = 0x2017,
PtpResponseCode_CaptureAlreadyTerminated = 0x2018,
PtpResponseCode_DeviceBusy = 0x2019,
PtpResponseCode_InvalidParentObject = 0x201a,
PtpResponseCode_InvalidDevicePropFormat = 0x201b,
PtpResponseCode_InvalidDevicePropValue = 0x201c,
PtpResponseCode_InvalidParameter = 0x201d,
PtpResponseCode_SessionAlreadyOpened = 0x201e,
PtpResponseCode_TransactionCanceled = 0x201f,
PtpResponseCode_SpecificationOfDestinationUnsupported = 0x2020,
PtpResponseCode_InvalidEnumHandle = 0x2021,
PtpResponseCode_NoStreamEnabled = 0x2022,
PtpResponseCode_InvalidDataSet = 0x2023,
PtpResponseCode_MtpUndefined = 0xa800,
PtpResponseCode_MtpInvalidObjectPropCode = 0xa801,
PtpResponseCode_MtpInvalidObjectPropFormat = 0xa802,
PtpResponseCode_MtpInvalidObjectPropValue = 0xa803,
PtpResponseCode_MtpInvalidObjectReference = 0xa804,
PtpResponseCode_MtpInvalidDataset = 0xa806,
PtpResponseCode_MtpSpecificationByGroupUnsupported = 0xa807,
PtpResponseCode_MtpSpecificationByDepthUnsupported = 0xa808,
PtpResponseCode_MtpObjectTooLarge = 0xa809,
PtpResponseCode_MtpObjectPropNotSupported = 0xa80a,
};
enum PtpEventCode : u16 {
PtpEventCode_Undefined = 0x4000,
PtpEventCode_CancelTransaction = 0x4001,
PtpEventCode_ObjectAdded = 0x4002,
PtpEventCode_ObjectRemoved = 0x4003,
PtpEventCode_StoreAdded = 0x4004,
PtpEventCode_StoreRemoved = 0x4005,
PtpEventCode_DevicePropChanged = 0x4006,
PtpEventCode_ObjectInfoChanged = 0x4007,
PtpEventCode_DeviceInfoChanged = 0x4008,
PtpEventCode_RequestObjectTransfer = 0x4009,
PtpEventCode_StoreFull = 0x400a,
PtpEventCode_DeviceReset = 0x400b,
PtpEventCode_StorageInfoChanged = 0x400c,
PtpEventCode_CaptureComplete = 0x400d,
PtpEventCode_UnreportedStatus = 0x400e,
};
enum PtpDataTypeCode : u16 {
PtpDataTypeCode_Undefined = 0x0000,
PtpDataTypeCode_S8 = 0x0001,
PtpDataTypeCode_U8 = 0x0002,
PtpDataTypeCode_S16 = 0x0003,
PtpDataTypeCode_U16 = 0x0004,
PtpDataTypeCode_S32 = 0x0005,
PtpDataTypeCode_U32 = 0x0006,
PtpDataTypeCode_S64 = 0x0007,
PtpDataTypeCode_U64 = 0x0008,
PtpDataTypeCode_S128 = 0x0009,
PtpDataTypeCode_U128 = 0x000a,
PtpDataTypeCode_ArrayMask = (1u << 14),
PtpDataTypeCode_S8Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_S8,
PtpDataTypeCode_U8Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_U8,
PtpDataTypeCode_S16Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_S16,
PtpDataTypeCode_U16Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_U16,
PtpDataTypeCode_S32Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_S32,
PtpDataTypeCode_U32Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_U32,
PtpDataTypeCode_S64Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_S64,
PtpDataTypeCode_U64Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_U64,
PtpDataTypeCode_S128Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_S128,
PtpDataTypeCode_U128Array = PtpDataTypeCode_ArrayMask | PtpDataTypeCode_U128,
PtpDataTypeCode_String = 0xffff,
};
enum PtpPropertyGetSetFlag : u8 {
PtpPropertyGetSetFlag_Get = 0x00,
PtpPropertyGetSetFlag_GetSet = 0x01,
};
enum PtpPropertyGroupCode : u32 {
PtpPropertyGroupCode_Default = 0x00000000,
};
enum PtpPropertyFormFlag : u8 {
PtpPropertyFormFlag_None = 0x00,
PtpPropertyFormFlag_Range = 0x01,
PtpPropertyFormFlag_Enumeration = 0x02,
PtpPropertyFormFlag_DateTime = 0x03,
PtpPropertyFormFlag_FixedLengthArray = 0x04,
PtpPropertyFormFlag_RegularExpression = 0x05,
PtpPropertyFormFlag_ByteArray = 0x06,
PtpPropertyFormFlag_LongString = 0xff,
};
enum PtpObjectPropertyCode : u16 {
PtpObjectPropertyCode_StorageId = 0xdc01,
PtpObjectPropertyCode_ObjectFormat = 0xdc02,
PtpObjectPropertyCode_ProtectionStatus = 0xdc03,
PtpObjectPropertyCode_ObjectSize = 0xdc04,
PtpObjectPropertyCode_AssociationType = 0xdc05,
PtpObjectPropertyCode_AssociationDesc = 0xdc06,
PtpObjectPropertyCode_ObjectFileName = 0xdc07,
PtpObjectPropertyCode_DateCreated = 0xdc08,
PtpObjectPropertyCode_DateModified = 0xdc09,
PtpObjectPropertyCode_Keywords = 0xdc0a,
PtpObjectPropertyCode_ParentObject = 0xdc0b,
PtpObjectPropertyCode_AllowedFolderContents = 0xdc0c,
PtpObjectPropertyCode_Hidden = 0xdc0d,
PtpObjectPropertyCode_SystemObject = 0xdc0e,
PtpObjectPropertyCode_PersistentUniqueObjectIdentifier = 0xdc41,
PtpObjectPropertyCode_SyncId = 0xdc42,
PtpObjectPropertyCode_PropertyBag = 0xdc43,
PtpObjectPropertyCode_Name = 0xdc44,
PtpObjectPropertyCode_CreatedBy = 0xdc45,
PtpObjectPropertyCode_Artist = 0xdc46,
PtpObjectPropertyCode_DateAuthored = 0xdc47,
PtpObjectPropertyCode_Description = 0xdc48,
PtpObjectPropertyCode_UrlReference = 0xdc49,
PtpObjectPropertyCode_LanguageLocale = 0xdc4a,
PtpObjectPropertyCode_CopyrightInformation = 0xdc4b,
PtpObjectPropertyCode_Source = 0xdc4c,
PtpObjectPropertyCode_OriginLocation = 0xdc4d,
PtpObjectPropertyCode_DateAdded = 0xdc4e,
PtpObjectPropertyCode_NonConsumable = 0xdc4f,
PtpObjectPropertyCode_CorruptOrUnplayable = 0xdc50,
PtpObjectPropertyCode_ProducerSerialNumber = 0xdc51,
PtpObjectPropertyCode_RepresentativeSampleFormat = 0xdc81,
PtpObjectPropertyCode_RepresentativeSampleSize = 0xdc82,
PtpObjectPropertyCode_RepresentativeSampleHeight = 0xdc83,
PtpObjectPropertyCode_RepresentativeSampleWidth = 0xdc84,
PtpObjectPropertyCode_RepresentativeSampleDuration = 0xdc85,
PtpObjectPropertyCode_RepresentativeSampleData = 0xdc86,
PtpObjectPropertyCode_Width = 0xdc87,
PtpObjectPropertyCode_Height = 0xdc88,
PtpObjectPropertyCode_Duration = 0xdc89,
PtpObjectPropertyCode_Rating = 0xdc8a,
PtpObjectPropertyCode_Track = 0xdc8b,
PtpObjectPropertyCode_Genre = 0xdc8c,
PtpObjectPropertyCode_Credits = 0xdc8d,
PtpObjectPropertyCode_Lyrics = 0xdc8e,
PtpObjectPropertyCode_SubscriptionContentId = 0xdc8f,
PtpObjectPropertyCode_ProducedBy = 0xdc90,
PtpObjectPropertyCode_UseCount = 0xdc91,
PtpObjectPropertyCode_SkipCount = 0xdc92,
PtpObjectPropertyCode_LastAccessed = 0xdc93,
PtpObjectPropertyCode_ParentalRating = 0xdc94,
PtpObjectPropertyCode_MetaGenre = 0xdc95,
PtpObjectPropertyCode_Composer = 0xdc96,
PtpObjectPropertyCode_EffectiveRating = 0xdc97,
PtpObjectPropertyCode_Subtitle = 0xdc98,
PtpObjectPropertyCode_OriginalReleaseDate = 0xdc99,
PtpObjectPropertyCode_AlbumName = 0xdc9a,
PtpObjectPropertyCode_AlbumArtist = 0xdc9b,
PtpObjectPropertyCode_Mood = 0xdc9c,
PtpObjectPropertyCode_DrmStatus = 0xdc9d,
PtpObjectPropertyCode_SubDescription = 0xdc9e,
PtpObjectPropertyCode_IsCropped = 0xdcd1,
PtpObjectPropertyCode_IsColorCorrected = 0xdcd2,
PtpObjectPropertyCode_ImageBitDepth = 0xdcd3,
PtpObjectPropertyCode_Fnumber = 0xdcd4,
PtpObjectPropertyCode_ExposureTime = 0xdcd5,
PtpObjectPropertyCode_ExposureIndex = 0xdcd6,
PtpObjectPropertyCode_DisplayName = 0xdce0,
PtpObjectPropertyCode_BodyText = 0xdce1,
PtpObjectPropertyCode_Subject = 0xdce2,
PtpObjectPropertyCode_Priority = 0xdce3,
PtpObjectPropertyCode_GivenName = 0xdd00,
PtpObjectPropertyCode_MiddleNames = 0xdd01,
PtpObjectPropertyCode_FamilyName = 0xdd02,
PtpObjectPropertyCode_Prefix = 0xdd03,
PtpObjectPropertyCode_Suffix = 0xdd04,
PtpObjectPropertyCode_PhoneticGivenName = 0xdd05,
PtpObjectPropertyCode_PhoneticFamilyName = 0xdd06,
PtpObjectPropertyCode_EmailPrimary = 0xdd07,
PtpObjectPropertyCode_EmailPersonal1 = 0xdd08,
PtpObjectPropertyCode_EmailPersonal2 = 0xdd09,
PtpObjectPropertyCode_EmailBusiness1 = 0xdd0a,
PtpObjectPropertyCode_EmailBusiness2 = 0xdd0b,
PtpObjectPropertyCode_EmailOthers = 0xdd0c,
PtpObjectPropertyCode_PhoneNumberPrimary = 0xdd0d,
PtpObjectPropertyCode_PhoneNumberPersonal = 0xdd0e,
PtpObjectPropertyCode_PhoneNumberPersonal2 = 0xdd0f,
PtpObjectPropertyCode_PhoneNumberBusiness = 0xdd10,
PtpObjectPropertyCode_PhoneNumberBusiness2 = 0xdd11,
PtpObjectPropertyCode_PhoneNumberMobile = 0xdd12,
PtpObjectPropertyCode_PhoneNumberMobile2 = 0xdd13,
PtpObjectPropertyCode_FaxNumberPrimary = 0xdd14,
PtpObjectPropertyCode_FaxNumberPersonal = 0xdd15,
PtpObjectPropertyCode_FaxNumberBusiness = 0xdd16,
PtpObjectPropertyCode_PagerNumber = 0xdd17,
PtpObjectPropertyCode_PhoneNumberOthers = 0xdd18,
PtpObjectPropertyCode_PrimaryWebAddress = 0xdd19,
PtpObjectPropertyCode_PersonalWebAddress = 0xdd1a,
PtpObjectPropertyCode_BusinessWebAddress = 0xdd1b,
PtpObjectPropertyCode_InstantMessengerAddress = 0xdd1c,
PtpObjectPropertyCode_InstantMessengerAddress2 = 0xdd1d,
PtpObjectPropertyCode_InstantMessengerAddress3 = 0xdd1e,
PtpObjectPropertyCode_PostalAddressPersonalFull = 0xdd1f,
PtpObjectPropertyCode_PostalAddressPersonalFullLine1 = 0xdd20,
PtpObjectPropertyCode_PostalAddressPersonalFullLine2 = 0xdd21,
PtpObjectPropertyCode_PostalAddressPersonalFullCity = 0xdd22,
PtpObjectPropertyCode_PostalAddressPersonalFullRegion = 0xdd23,
PtpObjectPropertyCode_PostalAddressPersonalFullPostalCode = 0xdd24,
PtpObjectPropertyCode_PostalAddressPersonalFullCountry = 0xdd25,
PtpObjectPropertyCode_PostalAddressBusinessFull = 0xdd26,
PtpObjectPropertyCode_PostalAddressBusinessLine1 = 0xdd27,
PtpObjectPropertyCode_PostalAddressBusinessLine2 = 0xdd28,
PtpObjectPropertyCode_PostalAddressBusinessCity = 0xdd29,
PtpObjectPropertyCode_PostalAddressBusinessRegion = 0xdd2a,
PtpObjectPropertyCode_PostalAddressBusinessPostalCode = 0xdd2b,
PtpObjectPropertyCode_PostalAddressBusinessCountry = 0xdd2c,
PtpObjectPropertyCode_PostalAddressOtherFull = 0xdd2d,
PtpObjectPropertyCode_PostalAddressOtherLine1 = 0xdd2e,
PtpObjectPropertyCode_PostalAddressOtherLine2 = 0xdd2f,
PtpObjectPropertyCode_PostalAddressOtherCity = 0xdd30,
PtpObjectPropertyCode_PostalAddressOtherRegion = 0xdd31,
PtpObjectPropertyCode_PostalAddressOtherPostalCode = 0xdd32,
PtpObjectPropertyCode_PostalAddressOtherCountry = 0xdd33,
PtpObjectPropertyCode_OrganizationName = 0xdd34,
PtpObjectPropertyCode_PhoneticOrganizationName = 0xdd35,
PtpObjectPropertyCode_Role = 0xdd36,
PtpObjectPropertyCode_Birthdate = 0xdd37,
PtpObjectPropertyCode_MessageTo = 0xdd40,
PtpObjectPropertyCode_MessageCC = 0xdd41,
PtpObjectPropertyCode_MessageBCC = 0xdd42,
PtpObjectPropertyCode_MessageRead = 0xdd43,
PtpObjectPropertyCode_MessageReceivedTime = 0xdd44,
PtpObjectPropertyCode_MessageSender = 0xdd45,
PtpObjectPropertyCode_ActivityBeginTime = 0xdd50,
PtpObjectPropertyCode_ActivityEndTime = 0xdd51,
PtpObjectPropertyCode_ActivityLocation = 0xdd52,
PtpObjectPropertyCode_ActivityRequiredAttendees = 0xdd54,
PtpObjectPropertyCode_ActivityOptionalAttendees = 0xdd55,
PtpObjectPropertyCode_ActivityResources = 0xdd56,
PtpObjectPropertyCode_ActivityAccepted = 0xdd57,
PtpObjectPropertyCode_Owner = 0xdd5d,
PtpObjectPropertyCode_Editor = 0xdd5e,
PtpObjectPropertyCode_Webmaster = 0xdd5f,
PtpObjectPropertyCode_UrlSource = 0xdd60,
PtpObjectPropertyCode_UrlDestination = 0xdd61,
PtpObjectPropertyCode_TimeBookmark = 0xdd62,
PtpObjectPropertyCode_ObjectBookmark = 0xdd63,
PtpObjectPropertyCode_ByteBookmark = 0xdd64,
PtpObjectPropertyCode_LastBuildDate = 0xdd70,
PtpObjectPropertyCode_TimetoLive = 0xdd71,
PtpObjectPropertyCode_MediaGuid = 0xdd72,
PtpObjectPropertyCode_TotalBitRate = 0xde91,
PtpObjectPropertyCode_BitRateType = 0xde92,
PtpObjectPropertyCode_SampleRate = 0xde93,
PtpObjectPropertyCode_NumberOfChannels = 0xde94,
PtpObjectPropertyCode_AudioBitDepth = 0xde95,
PtpObjectPropertyCode_ScanDepth = 0xde97,
PtpObjectPropertyCode_AudioWaveCodec = 0xde99,
PtpObjectPropertyCode_AudioBitRate = 0xde9a,
PtpObjectPropertyCode_VideoFourCcCodec = 0xde9b,
PtpObjectPropertyCode_VideoBitRate = 0xde9c,
PtpObjectPropertyCode_FramesPerThousandSeconds = 0xde9d,
PtpObjectPropertyCode_KeyFrameDistance = 0xde9e,
PtpObjectPropertyCode_BufferSize = 0xde9f,
PtpObjectPropertyCode_EncodingQuality = 0xdea0,
PtpObjectPropertyCode_EncodingProfile = 0xdea1,
PtpObjectPropertyCode_BuyFlag = 0xd901,
};
enum PtpDevicePropertyCode : u16 {
PtpDevicePropertyCode_Undefined = 0x5000,
PtpDevicePropertyCode_BatteryLevel = 0x5001,
PtpDevicePropertyCode_FunctionalMode = 0x5002,
PtpDevicePropertyCode_ImageSize = 0x5003,
PtpDevicePropertyCode_CompressionSetting = 0x5004,
PtpDevicePropertyCode_WhiteBalance = 0x5005,
PtpDevicePropertyCode_RgbGain = 0x5006,
PtpDevicePropertyCode_FNumber = 0x5007,
PtpDevicePropertyCode_FocalLength = 0x5008,
PtpDevicePropertyCode_FocusDistance = 0x5009,
PtpDevicePropertyCode_FocusMode = 0x500a,
PtpDevicePropertyCode_ExposureMeteringMode = 0x500b,
PtpDevicePropertyCode_FlashMode = 0x500c,
PtpDevicePropertyCode_ExposureTime = 0x500d,
PtpDevicePropertyCode_ExposureProgramMode = 0x500e,
PtpDevicePropertyCode_ExposureIndex = 0x500f,
PtpDevicePropertyCode_ExposureBiasCompensation = 0x5010,
PtpDevicePropertyCode_DateTime = 0x5011,
PtpDevicePropertyCode_CaptureDelay = 0x5012,
PtpDevicePropertyCode_StillCaptureMode = 0x5013,
PtpDevicePropertyCode_Contrast = 0x5014,
PtpDevicePropertyCode_Sharpness = 0x5015,
PtpDevicePropertyCode_DigitalZoom = 0x5016,
PtpDevicePropertyCode_EffectMode = 0x5017,
PtpDevicePropertyCode_BurstNumber = 0x5018,
PtpDevicePropertyCode_BurstInterval = 0x5019,
PtpDevicePropertyCode_TimelapseNumber = 0x501a,
PtpDevicePropertyCode_TimelapseInterval = 0x501b,
PtpDevicePropertyCode_FocusMeteringMode = 0x501c,
PtpDevicePropertyCode_UploadUrl = 0x501d,
PtpDevicePropertyCode_Artist = 0x501e,
PtpDevicePropertyCode_CopyrightInfo = 0x501f,
PtpDevicePropertyCode_SupportedStreams = 0x5020,
PtpDevicePropertyCode_EnabledStreams = 0x5021,
PtpDevicePropertyCode_VideoFormat = 0x5022,
PtpDevicePropertyCode_VideoResolution = 0x5023,
PtpDevicePropertyCode_VideoQuality = 0x5024,
PtpDevicePropertyCode_VideoFrameRate = 0x5025,
PtpDevicePropertyCode_VideoContrast = 0x5026,
PtpDevicePropertyCode_VideoBrightness = 0x5027,
PtpDevicePropertyCode_AudioFormat = 0x5028,
PtpDevicePropertyCode_AudioBitrate = 0x5029,
PtpDevicePropertyCode_AudioSamplingRate = 0x502a,
PtpDevicePropertyCode_AudioBitPerSample = 0x502b,
PtpDevicePropertyCode_AudioVolume = 0x502c,
};
enum PtpObjectFormatCode : u16 {
PtpObjectFormatCode_Undefined = 0x3000,
PtpObjectFormatCode_Association = 0x3001,
PtpObjectFormatCode_Defined = 0x3800,
PtpObjectFormatCode_MtpMediaCard = 0xb211,
};
enum PtpAssociationType : u16 {
PtpAssociationType_Undefined = 0x0000,
PtpAssociationType_GenericFolder = 0x0001,
};
enum PtpGetObjectHandles : u32 {
PtpGetObjectHandles_AllFormats = 0x00000000,
PtpGetObjectHandles_AllAssocs = 0x00000000,
PtpGetObjectHandles_AllStorage = 0xffffffff,
PtpGetObjectHandles_RootParent = 0xffffffff,
};
enum PtpStorageType : u16 {
PtpStorageType_Undefined = 0x0000,
PtpStorageType_FixedRom = 0x0001,
PtpStorageType_RemovableRom = 0x0002,
PtpStorageType_FixedRam = 0x0003,
PtpStorageType_RemovableRam = 0x0004,
};
enum PtpFilesystemType : u16 {
PtpFilesystemType_Undefined = 0x0000,
PtpFilesystemType_GenericFlat = 0x0001,
PtpFilesystemType_GenericHierarchical = 0x0002,
PtpFilesystemType_Dcf = 0x0003,
};
enum PtpAccessCapability : u16 {
PtpAccessCapability_ReadWrite = 0x0000,
PtpAccessCapability_ReadOnly = 0x0001,
PtpAccessCapability_ReadOnlyWithObjectDeletion = 0x0002,
};
enum PtpProtectionStatus : u16 {
PtpProtectionStatus_NoProtection = 0x0000,
PtpProtectionStatus_ReadOnly = 0x0001,
PtpProtectionStatus_MtpReadOnlyData = 0x8002,
PtpProtectionStatus_MtpNonTransferableData = 0x8003,
};
enum PtpThumbFormat : u16 {
PtpThumbFormat_Undefined = 0x0000,
};
struct PtpUsbBulkContainer {
u32 length;
u16 type;
u16 code;
u32 trans_id;
};
static_assert(sizeof(PtpUsbBulkContainer) == PtpUsbBulkHeaderLength);
struct PtpNewObjectInfo {
u32 storage_id;
u32 parent_object_id;
u32 object_id;
};
}
| 29,062
|
C++
|
.h
| 466
| 54.004292
| 85
| 0.597466
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,413
|
event_reactor.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/event_reactor.hpp
|
/*
* 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 <haze/common.hpp>
namespace haze {
class EventConsumer {
public:
virtual ~EventConsumer() = default;
virtual void ProcessEvent() = 0;
};
class EventReactor {
private:
EventConsumer *m_consumers[svc::ArgumentHandleCountMax];
Waiter m_waiters[svc::ArgumentHandleCountMax];
s32 m_num_wait_objects;
Result m_result;
public:
constexpr explicit EventReactor() : m_consumers(), m_waiters(), m_num_wait_objects(), m_result(ResultSuccess()) { /* ... */ }
bool AddConsumer(EventConsumer *consumer, Waiter waiter);
void RemoveConsumer(EventConsumer *consumer);
public:
void SetResult(Result r) { m_result = r; }
Result GetResult() const { return m_result; }
public:
template <typename... Args> requires (sizeof...(Args) > 0)
Result WaitFor(s32 *out_arg_waiter, Args &&... arg_waiters) {
const Waiter arg_waiter_array[] = { arg_waiters... };
return this->WaitForImpl(out_arg_waiter, arg_waiter_array, sizeof...(Args));
}
private:
Result WaitForImpl(s32 *out_arg_waiter, const Waiter *arg_waiters, s32 num_arg_waiters);
};
}
| 1,951
|
C++
|
.h
| 46
| 34.978261
| 137
| 0.645603
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,414
|
ptp_data_parser.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/ptp_data_parser.hpp
|
/*
* 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 <haze/async_usb_server.hpp>
#include <haze/common.hpp>
#include <haze/ptp.hpp>
namespace haze {
class PtpDataParser final {
private:
AsyncUsbServer *m_server;
u32 m_received_size;
u32 m_offset;
u8 *m_data;
bool m_eot;
private:
Result Flush() {
R_UNLESS(!m_eot, haze::ResultEndOfTransmission());
m_received_size = 0;
m_offset = 0;
ON_SCOPE_EXIT {
/* End of transmission occurs when receiving a bulk transfer less than the buffer size. */
/* PTP uses zero-length termination, so zero is a possible size to receive. */
m_eot = m_received_size < haze::UsbBulkPacketBufferSize;
};
R_RETURN(m_server->ReadPacket(m_data, haze::UsbBulkPacketBufferSize, std::addressof(m_received_size)));
}
public:
constexpr explicit PtpDataParser(void *data, AsyncUsbServer *server) : m_server(server), m_received_size(), m_offset(), m_data(static_cast<u8 *>(data)), m_eot() { /* ... */ }
Result Finalize() {
/* Read until the transmission completes. */
while (true) {
Result rc = this->Flush();
R_SUCCEED_IF(m_eot || haze::ResultEndOfTransmission::Includes(rc));
R_TRY(rc);
}
}
Result ReadBuffer(u8 *buffer, u32 count, u32 *out_read_count) {
*out_read_count = 0;
while (count > 0) {
/* If we cannot read more bytes now, flush. */
if (m_offset == m_received_size) {
R_TRY(this->Flush());
}
/* Calculate how many bytes we can read now. */
u32 read_size = std::min<u32>(count, m_received_size - m_offset);
/* Read this number of bytes. */
std::memcpy(buffer + *out_read_count, m_data + m_offset, read_size);
*out_read_count += read_size;
m_offset += read_size;
count -= read_size;
}
R_SUCCEED();
}
template <typename T>
Result Read(T *out_t) {
u32 read_count;
u8 bytes[sizeof(T)];
R_TRY(this->ReadBuffer(bytes, sizeof(T), std::addressof(read_count)));
std::memcpy(out_t, bytes, sizeof(T));
R_SUCCEED();
}
/* NOTE: out_string must contain room for 256 bytes. */
/* The result will be null-terminated on successful completion. */
Result ReadString(char *out_string) {
u8 len;
R_TRY(this->Read(std::addressof(len)));
/* Read characters one by one. */
for (size_t i = 0; i < len; i++) {
u16 chr;
R_TRY(this->Read(std::addressof(chr)));
*out_string++ = static_cast<char>(chr);
}
/* Write null terminator. */
*out_string++ = '\x00';
R_SUCCEED();
}
};
}
| 3,981
|
C++
|
.h
| 91
| 30.472527
| 186
| 0.519783
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,415
|
common.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/common.hpp
|
/*
* 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
#define ATMOSPHERE_OS_HORIZON
#define ATMOSPHERE_ARCH_ARM64
#define ATMOSPHERE_ARCH_ARM_V8A
#include <algorithm>
#include <cstring>
#include <bit>
#include <memory>
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include <switch.h>
#include <haze/results.hpp>
#include <haze/assert.hpp>
#include <vapours/literals.hpp>
#include <vapours/svc/svc_common.hpp>
#include <vapours/svc/svc_types_common.hpp>
namespace haze {
using namespace ::ams::literals;
using namespace ::ams;
using Result = ::ams::Result;
}
| 1,186
|
C++
|
.h
| 37
| 30.135135
| 76
| 0.75986
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,416
|
console_main_loop.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/console_main_loop.hpp
|
/*
* 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 <haze/event_reactor.hpp>
#include <haze/ptp_object_heap.hpp>
namespace haze {
class ConsoleMainLoop : public EventConsumer {
private:
static constexpr size_t FrameDelayNs = 33'333'333;
private:
EventReactor *m_reactor;
PtpObjectHeap *m_object_heap;
PadState m_pad;
Thread m_thread;
UEvent m_event;
UEvent m_cancel_event;
u32 m_last_heap_used;
u32 m_last_heap_total;
bool m_is_applet_mode;
private:
static void Run(void *arg) {
static_cast<ConsoleMainLoop *>(arg)->Run();
}
void Run() {
int idx;
while (true) {
/* Wait for up to 1 frame delay time to be cancelled. */
Waiter cancel_waiter = waiterForUEvent(std::addressof(m_cancel_event));
Result rc = waitObjects(std::addressof(idx), std::addressof(cancel_waiter), 1, FrameDelayNs);
/* Finish if we were cancelled. */
if (R_SUCCEEDED(rc)) {
break;
}
/* Otherwise, signal the console update event. */
if (svc::ResultTimedOut::Includes(rc)) {
ueventSignal(std::addressof(m_event));
}
}
}
public:
explicit ConsoleMainLoop() : m_reactor(), m_pad(), m_thread(), m_event(), m_cancel_event(), m_last_heap_used(), m_last_heap_total(), m_is_applet_mode() { /* ... */ }
Result Initialize(EventReactor *reactor, PtpObjectHeap *object_heap) {
/* Register event reactor and heap. */
m_reactor = reactor;
m_object_heap = object_heap;
/* Set cached use amounts to invalid values. */
m_last_heap_used = 0xffffffffu;
m_last_heap_total = 0xffffffffu;
/* Get whether we are launched in applet mode. */
AppletType applet_type = appletGetAppletType();
m_is_applet_mode = applet_type != AppletType_Application && applet_type != AppletType_SystemApplication;
/* Initialize events. */
ueventCreate(std::addressof(m_event), true);
ueventCreate(std::addressof(m_cancel_event), true);
/* Set up pad inputs to allow exiting the program. */
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
padInitializeAny(std::addressof(m_pad));
/* Create the delay thread with higher priority than the main thread (which runs at priority 0x2c). */
R_TRY(threadCreate(std::addressof(m_thread), ConsoleMainLoop::Run, this, nullptr, 4_KB, 0x2b, svc::IdealCoreUseProcessValue));
/* Ensure we close the thread on failure. */
ON_RESULT_FAILURE { threadClose(std::addressof(m_thread)); };
/* Connect ourselves to the event loop. */
R_UNLESS(m_reactor->AddConsumer(this, waiterForUEvent(std::addressof(m_event))), haze::ResultRegistrationFailed());
/* Start the delay thread. */
R_RETURN(threadStart(std::addressof(m_thread)));
}
void Finalize() {
/* Signal the delay thread to shut down. */
ueventSignal(std::addressof(m_cancel_event));
/* Wait for the delay thread to exit and close it. */
HAZE_R_ABORT_UNLESS(threadWaitForExit(std::addressof(m_thread)));
HAZE_R_ABORT_UNLESS(threadClose(std::addressof(m_thread)));
/* Disconnect from the event loop.*/
m_reactor->RemoveConsumer(this);
}
private:
void RedrawConsole() {
/* Get use amounts from the heap. */
u32 heap_used = m_object_heap->GetUsedSize();
u32 heap_total = m_object_heap->GetTotalSize();
u32 heap_pct = heap_total > 0 ? static_cast<u32>((heap_used * 100ul) / heap_total) : 0;
if (heap_used == m_last_heap_used && heap_total == m_last_heap_total) {
/* If usage didn't change, skip redrawing the console. */
/* This provides a substantial performance improvement in file transfer speed. */
return;
}
/* Update cached use amounts. */
m_last_heap_used = heap_used;
m_last_heap_total = heap_total;
/* Determine units to use for printing to the console. */
const char *used_unit = "B";
if (heap_used >= 1_KB) { heap_used >>= 10; used_unit = "KiB"; }
if (heap_used >= (1_MB / 1_KB)) { heap_used >>= 10; used_unit = "MiB"; }
const char *total_unit = "B";
if (heap_total >= 1_KB) { heap_total >>= 10; total_unit = "KiB"; }
if (heap_total >= (1_MB / 1_KB)) { heap_total >>= 10; total_unit = "MiB"; }
/* Draw the console UI. */
consoleClear();
printf("USB File Transfer\n\n");
printf("Connect console to computer. Press [+] to exit.\n");
printf("Heap used: %u %s / %u %s (%u%%)\n", heap_used, used_unit, heap_total, total_unit, heap_pct);
if (m_is_applet_mode) {
/* Print "Applet Mode" in red text. */
printf("\n" CONSOLE_ESC(31;1m) "Applet Mode" CONSOLE_ESC(0m) "\n");
}
consoleUpdate(nullptr);
}
protected:
void ProcessEvent() override {
/* Update the console. */
this->RedrawConsole();
/* Check buttons. */
padUpdate(std::addressof(m_pad));
/* If the plus button is held, request immediate exit. */
if (padGetButtonsDown(std::addressof(m_pad)) & HidNpadButton_Plus) {
m_reactor->SetResult(haze::ResultStopRequested());
}
/* Pump applet events, and check if exit was requested. */
if (!appletMainLoop()) {
m_reactor->SetResult(haze::ResultStopRequested());
}
/* Check if focus was lost. */
if (appletGetFocusState() == AppletFocusState_Background) {
m_reactor->SetResult(haze::ResultFocusLost());
}
}
private:
static bool SuspendAndWaitForFocus() {
/* Enable suspension with resume notification. */
appletSetFocusHandlingMode(AppletFocusHandlingMode_SuspendHomeSleepNotify);
/* Pump applet events. */
while (appletMainLoop()) {
/* Check if focus was regained. */
if (appletGetFocusState() != AppletFocusState_Background) {
return true;
}
}
/* Exit was requested. */
return false;
}
public:
static void RunApplication() {
/* Declare the object heap, to hold the database for an active session. */
PtpObjectHeap ptp_object_heap;
/* Declare the event reactor, and components which use it. */
EventReactor event_reactor;
PtpResponder ptp_responder;
ConsoleMainLoop console_main_loop;
/* Initialize the console.*/
consoleInit(nullptr);
while (true) {
/* Disable suspension. */
appletSetFocusHandlingMode(AppletFocusHandlingMode_NoSuspend);
/* Declare result from serving to use. */
Result rc;
{
/* Ensure we don't go to sleep while transferring files. */
appletSetAutoSleepDisabled(true);
/* Clear the event reactor. */
event_reactor.SetResult(ResultSuccess());
/* Configure the PTP responder and console main loop. */
ptp_responder.Initialize(std::addressof(event_reactor), std::addressof(ptp_object_heap));
console_main_loop.Initialize(std::addressof(event_reactor), std::addressof(ptp_object_heap));
/* Ensure we maintain a clean state on exit. */
ON_SCOPE_EXIT {
/* Finalize the console main loop and PTP responder. */
console_main_loop.Finalize();
ptp_responder.Finalize();
/* Restore auto sleep setting. */
appletSetAutoSleepDisabled(false);
};
/* Begin processing requests. */
rc = ptp_responder.LoopProcess();
}
/* If focus was lost, try to pump the applet main loop until we receive focus again. */
if (haze::ResultFocusLost::Includes(rc) && SuspendAndWaitForFocus()) {
continue;
}
/* Otherwise, enable suspension and finish. */
appletSetFocusHandlingMode(AppletFocusHandlingMode_SuspendHomeSleep);
break;
}
/* Finalize the console. */
consoleExit(nullptr);
}
};
}
| 10,460
|
C++
|
.h
| 200
| 35.985
| 177
| 0.523259
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,417
|
file_system_proxy.hpp
|
Atmosphere-NX_Atmosphere/troposphere/haze/include/haze/file_system_proxy.hpp
|
/*
* 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 <haze/common.hpp>
#include <haze/event_reactor.hpp>
namespace haze {
class FileSystemProxy final {
private:
EventReactor *m_reactor;
FsFileSystem *m_filesystem;
public:
constexpr explicit FileSystemProxy() : m_reactor(), m_filesystem() { /* ... */ }
void Initialize(EventReactor *reactor, FsFileSystem *fs) {
HAZE_ASSERT(fs != nullptr);
m_reactor = reactor;
m_filesystem = fs;
}
void Finalize() {
m_reactor = nullptr;
m_filesystem = nullptr;
}
private:
template <typename F, typename... Args>
Result ForwardResult(F func, Args &&... args) {
/* Perform the method call, collecting its result. */
const Result rc = func(std::forward<Args>(args)...);
/* If the event loop was stopped, return that here. */
R_TRY(m_reactor->GetResult());
/* Otherwise, return the call result. */
R_RETURN(rc);
}
public:
Result GetTotalSpace(const char *path, s64 *out) {
R_RETURN(this->ForwardResult(fsFsGetTotalSpace, m_filesystem, path, out));
}
Result GetFreeSpace(const char *path, s64 *out) {
R_RETURN(this->ForwardResult(fsFsGetFreeSpace, m_filesystem, path, out));
}
Result GetEntryType(const char *path, FsDirEntryType *out_entry_type) {
R_RETURN(this->ForwardResult(fsFsGetEntryType, m_filesystem, path, out_entry_type));
}
Result CreateFile(const char* path, s64 size, u32 option) {
R_RETURN(this->ForwardResult(fsFsCreateFile, m_filesystem, path, size, option));
}
Result DeleteFile(const char* path) {
R_RETURN(this->ForwardResult(fsFsDeleteFile, m_filesystem, path));
}
Result RenameFile(const char *old_path, const char *new_path) {
R_RETURN(this->ForwardResult(fsFsRenameFile, m_filesystem, old_path, new_path));
}
Result OpenFile(const char *path, u32 mode, FsFile *out_file) {
R_RETURN(this->ForwardResult(fsFsOpenFile, m_filesystem, path, mode, out_file));
}
Result GetFileSize(FsFile *file, s64 *out_size) {
R_RETURN(this->ForwardResult(fsFileGetSize, file, out_size));
}
Result SetFileSize(FsFile *file, s64 size) {
R_RETURN(this->ForwardResult(fsFileSetSize, file, size));
}
Result ReadFile(FsFile *file, s64 off, void *buf, u64 read_size, u32 option, u64 *out_bytes_read) {
R_RETURN(this->ForwardResult(fsFileRead, file, off, buf, read_size, option, out_bytes_read));
}
Result WriteFile(FsFile *file, s64 off, const void *buf, u64 write_size, u32 option) {
R_RETURN(this->ForwardResult(fsFileWrite, file, off, buf, write_size, option));
}
void CloseFile(FsFile *file) {
fsFileClose(file);
}
Result CreateDirectory(const char* path) {
R_RETURN(this->ForwardResult(fsFsCreateDirectory, m_filesystem, path));
}
Result DeleteDirectoryRecursively(const char* path) {
R_RETURN(this->ForwardResult(fsFsDeleteDirectoryRecursively, m_filesystem, path));
}
Result RenameDirectory(const char *old_path, const char *new_path) {
R_RETURN(this->ForwardResult(fsFsRenameDirectory, m_filesystem, old_path, new_path));
}
Result OpenDirectory(const char *path, u32 mode, FsDir *out_dir) {
R_RETURN(this->ForwardResult(fsFsOpenDirectory, m_filesystem, path, mode, out_dir));
}
Result ReadDirectory(FsDir *d, s64 *out_total_entries, size_t max_entries, FsDirectoryEntry *buf) {
R_RETURN(this->ForwardResult(fsDirRead, d, out_total_entries, max_entries, buf));
}
Result GetDirectoryEntryCount(FsDir *d, s64 *out_count) {
R_RETURN(this->ForwardResult(fsDirGetEntryCount, d, out_count));
}
void CloseDirectory(FsDir *d) {
fsDirClose(d);
}
};
}
| 5,102
|
C++
|
.h
| 104
| 37.125
| 111
| 0.595454
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,418
|
ams_bpc.h
|
Atmosphere-NX_Atmosphere/troposphere/reboot_to_payload/source/ams_bpc.h
|
/*
* 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 <switch.h>
#ifdef __cplusplus
extern "C" {
#endif
Result amsBpcInitialize();
void amsBpcExit();
Service *amsBpcGetServiceSession(void);
Result amsBpcSetRebootPayload(const void *src, size_t src_size);
#ifdef __cplusplus
}
#endif
| 891
|
C++
|
.h
| 27
| 31.37037
| 76
| 0.766551
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,419
|
service_guard.h
|
Atmosphere-NX_Atmosphere/troposphere/reboot_to_payload/source/service_guard.h
|
#pragma once
#include <switch/types.h>
#include <switch/result.h>
#include <switch/kernel/mutex.h>
#include <switch/sf/service.h>
#include <switch/services/sm.h>
typedef struct ServiceGuard {
Mutex mutex;
u32 refCount;
} ServiceGuard;
NX_INLINE bool serviceGuardBeginInit(ServiceGuard* g)
{
mutexLock(&g->mutex);
return (g->refCount++) == 0;
}
NX_INLINE Result serviceGuardEndInit(ServiceGuard* g, Result rc, void (*cleanupFunc)(void))
{
if (R_FAILED(rc)) {
cleanupFunc();
--g->refCount;
}
mutexUnlock(&g->mutex);
return rc;
}
NX_INLINE void serviceGuardExit(ServiceGuard* g, void (*cleanupFunc)(void))
{
mutexLock(&g->mutex);
if (g->refCount && (--g->refCount) == 0)
cleanupFunc();
mutexUnlock(&g->mutex);
}
#define NX_GENERATE_SERVICE_GUARD_PARAMS(name, _paramdecl, _parampass) \
\
static ServiceGuard g_##name##Guard; \
NX_INLINE Result _##name##Initialize _paramdecl; \
static void _##name##Cleanup(void); \
\
Result name##Initialize _paramdecl \
{ \
Result rc = 0; \
if (serviceGuardBeginInit(&g_##name##Guard)) \
rc = _##name##Initialize _parampass; \
return serviceGuardEndInit(&g_##name##Guard, rc, _##name##Cleanup); \
} \
\
void name##Exit(void) \
{ \
serviceGuardExit(&g_##name##Guard, _##name##Cleanup); \
}
#define NX_GENERATE_SERVICE_GUARD(name) NX_GENERATE_SERVICE_GUARD_PARAMS(name, (void), ())
| 1,408
|
C++
|
.h
| 50
| 25.22
| 91
| 0.67997
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,420
|
assert.hpp
|
Atmosphere-NX_Atmosphere/troposphere/daybreak/source/assert.hpp
|
/*
* Copyright (c) Adubbz
*
* 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 <cstdlib>
#define DBK_ABORT_UNLESS(expr) \
if (!static_cast<bool>(expr)) { \
std::abort(); \
}
| 781
|
C++
|
.h
| 21
| 34.666667
| 76
| 0.712401
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,423
|
ams_su.h
|
Atmosphere-NX_Atmosphere/troposphere/daybreak/source/ams_su.h
|
/*
* 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 <switch.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
u32 version;
bool exfat_supported;
u32 num_firmware_variations;
u32 firmware_variation_ids[16];
} AmsSuUpdateInformation;
typedef struct {
Result result;
Result exfat_result;
NcmContentMetaKey invalid_key;
NcmContentId invalid_content_id;
} AmsSuUpdateValidationInfo;
Result amssuInitialize();
void amssuExit();
Service *amssuGetServiceSession(void);
Result amssuGetUpdateInformation(AmsSuUpdateInformation *out, const char *path);
Result amssuValidateUpdate(AmsSuUpdateValidationInfo *out, const char *path);
Result amssuSetupUpdate(void *buffer, size_t size, const char *path, bool exfat);
Result amssuSetupUpdateWithVariation(void *buffer, size_t size, const char *path, bool exfat, u32 variation);
Result amssuRequestPrepareUpdate(AsyncResult *a);
Result amssuGetPrepareUpdateProgress(NsSystemUpdateProgress *out);
Result amssuHasPreparedUpdate(bool *out);
Result amssuApplyPreparedUpdate();
#ifdef __cplusplus
}
#endif
| 1,687
|
C++
|
.h
| 46
| 34.565217
| 109
| 0.790342
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,425
|
nanovg_dk.h
|
Atmosphere-NX_Atmosphere/troposphere/daybreak/nanovg/include/nanovg_dk.h
|
#pragma once
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "nanovg.h"
#include "nanovg/dk_renderer.hpp"
#ifdef __cplusplus
extern "C" {
#endif
static int dknvg__maxi(int a, int b) { return a > b ? a : b; }
static const DKNVGtextureDescriptor* dknvg__findTexture(DKNVGcontext* dk, int id) {
return dk->renderer->GetTextureDescriptor(*dk, id);
}
static int dknvg__renderCreate(void* uptr)
{
DKNVGcontext *dk = (DKNVGcontext*)uptr;
return dk->renderer->Create(*dk);
}
static int dknvg__renderCreateTexture(void* uptr, int type, int w, int h, int imageFlags, const unsigned char* data)
{
DKNVGcontext *dk = (DKNVGcontext*)uptr;
return dk->renderer->CreateTexture(*dk, type, w, h, imageFlags, data);
}
static int dknvg__renderDeleteTexture(void* uptr, int image) {
DKNVGcontext *dk = (DKNVGcontext*)uptr;
return dk->renderer->DeleteTexture(*dk, image);
}
static int dknvg__renderUpdateTexture(void* uptr, int image, int x, int y, int w, int h, const unsigned char* data) {
DKNVGcontext *dk = (DKNVGcontext*)uptr;
return dk->renderer->UpdateTexture(*dk, image, x, y, w, h, data);
}
static int dknvg__renderGetTextureSize(void* uptr, int image, int* w, int* h) {
DKNVGcontext *dk = (DKNVGcontext*)uptr;
return dk->renderer->GetTextureSize(*dk, image, w, h);
}
static void dknvg__xformToMat3x4(float* m3, float* t) {
m3[0] = t[0];
m3[1] = t[1];
m3[2] = 0.0f;
m3[3] = 0.0f;
m3[4] = t[2];
m3[5] = t[3];
m3[6] = 0.0f;
m3[7] = 0.0f;
m3[8] = t[4];
m3[9] = t[5];
m3[10] = 1.0f;
m3[11] = 0.0f;
}
static NVGcolor dknvg__premulColor(NVGcolor c) {
c.r *= c.a;
c.g *= c.a;
c.b *= c.a;
return c;
}
static int dknvg__convertPaint(DKNVGcontext* dk, DKNVGfragUniforms* frag, NVGpaint* paint,
NVGscissor* scissor, float width, float fringe, float strokeThr)
{
const DKNVGtextureDescriptor *tex = NULL;
float invxform[6];
memset(frag, 0, sizeof(*frag));
frag->innerCol = dknvg__premulColor(paint->innerColor);
frag->outerCol = dknvg__premulColor(paint->outerColor);
if (scissor->extent[0] < -0.5f || scissor->extent[1] < -0.5f) {
memset(frag->scissorMat, 0, sizeof(frag->scissorMat));
frag->scissorExt[0] = 1.0f;
frag->scissorExt[1] = 1.0f;
frag->scissorScale[0] = 1.0f;
frag->scissorScale[1] = 1.0f;
} else {
nvgTransformInverse(invxform, scissor->xform);
dknvg__xformToMat3x4(frag->scissorMat, invxform);
frag->scissorExt[0] = scissor->extent[0];
frag->scissorExt[1] = scissor->extent[1];
frag->scissorScale[0] = sqrtf(scissor->xform[0]*scissor->xform[0] + scissor->xform[2]*scissor->xform[2]) / fringe;
frag->scissorScale[1] = sqrtf(scissor->xform[1]*scissor->xform[1] + scissor->xform[3]*scissor->xform[3]) / fringe;
}
memcpy(frag->extent, paint->extent, sizeof(frag->extent));
frag->strokeMult = (width*0.5f + fringe*0.5f) / fringe;
frag->strokeThr = strokeThr;
if (paint->image != 0) {
tex = dknvg__findTexture(dk, paint->image);
if (tex == NULL) return 0;
if ((tex->flags & NVG_IMAGE_FLIPY) != 0) {
float m1[6], m2[6];
nvgTransformTranslate(m1, 0.0f, frag->extent[1] * 0.5f);
nvgTransformMultiply(m1, paint->xform);
nvgTransformScale(m2, 1.0f, -1.0f);
nvgTransformMultiply(m2, m1);
nvgTransformTranslate(m1, 0.0f, -frag->extent[1] * 0.5f);
nvgTransformMultiply(m1, m2);
nvgTransformInverse(invxform, m1);
} else {
nvgTransformInverse(invxform, paint->xform);
}
frag->type = NSVG_SHADER_FILLIMG;
if (tex->type == NVG_TEXTURE_RGBA)
frag->texType = (tex->flags & NVG_IMAGE_PREMULTIPLIED) ? 0 : 1;
else
frag->texType = 2;
// printf("frag->texType = %d\n", frag->texType);
} else {
frag->type = NSVG_SHADER_FILLGRAD;
frag->radius = paint->radius;
frag->feather = paint->feather;
nvgTransformInverse(invxform, paint->xform);
}
dknvg__xformToMat3x4(frag->paintMat, invxform);
return 1;
}
static DKNVGfragUniforms* nvg__fragUniformPtr(DKNVGcontext* dk, int i);
static void dknvg__renderViewport(void* uptr, float width, float height, float devicePixelRatio)
{
NVG_NOTUSED(devicePixelRatio);
DKNVGcontext* dk = (DKNVGcontext*)uptr;
dk->view[0] = width;
dk->view[1] = height;
}
static void dknvg__renderCancel(void* uptr) {
DKNVGcontext* dk = (DKNVGcontext*)uptr;
dk->nverts = 0;
dk->npaths = 0;
dk->ncalls = 0;
dk->nuniforms = 0;
}
static int dknvg_convertBlendFuncFactor(int factor) {
switch (factor) {
case NVG_ZERO:
return DkBlendFactor_Zero;
case NVG_ONE:
return DkBlendFactor_One;
case NVG_SRC_COLOR:
return DkBlendFactor_SrcColor;
case NVG_ONE_MINUS_SRC_COLOR:
return DkBlendFactor_InvSrcColor;
case NVG_DST_COLOR:
return DkBlendFactor_DstColor;
case NVG_ONE_MINUS_DST_COLOR:
return DkBlendFactor_InvDstColor;
case NVG_SRC_ALPHA:
return DkBlendFactor_SrcAlpha;
case NVG_ONE_MINUS_SRC_ALPHA:
return DkBlendFactor_InvSrcAlpha;
case NVG_DST_ALPHA:
return DkBlendFactor_DstAlpha;
case NVG_ONE_MINUS_DST_ALPHA:
return DkBlendFactor_InvDstAlpha;
case NVG_SRC_ALPHA_SATURATE:
return DkBlendFactor_SrcAlphaSaturate;
default:
return -1;
}
}
static DKNVGblend dknvg__blendCompositeOperation(NVGcompositeOperationState op) {
DKNVGblend blend;
blend.srcRGB = dknvg_convertBlendFuncFactor(op.srcRGB);
blend.dstRGB = dknvg_convertBlendFuncFactor(op.dstRGB);
blend.srcAlpha = dknvg_convertBlendFuncFactor(op.srcAlpha);
blend.dstAlpha = dknvg_convertBlendFuncFactor(op.dstAlpha);
if (blend.srcRGB == -1 || blend.dstRGB == -1 || blend.srcAlpha == -1 || blend.dstAlpha == -1) {
blend.srcRGB = DkBlendFactor_One;
blend.dstRGB = DkBlendFactor_InvSrcAlpha;
blend.srcAlpha = DkBlendFactor_One;
blend.dstAlpha = DkBlendFactor_InvSrcAlpha;
}
return blend;
}
static void dknvg__renderFlush(void* uptr) {
DKNVGcontext *dk = (DKNVGcontext*)uptr;
dk->renderer->Flush(*dk);
}
static int dknvg__maxVertCount(const NVGpath* paths, int npaths) {
int i, count = 0;
for (i = 0; i < npaths; i++) {
count += paths[i].nfill;
count += paths[i].nstroke;
}
return count;
}
static DKNVGcall* dknvg__allocCall(DKNVGcontext* dk)
{
DKNVGcall* ret = NULL;
if (dk->ncalls+1 > dk->ccalls) {
DKNVGcall* calls;
int ccalls = dknvg__maxi(dk->ncalls+1, 128) + dk->ccalls/2; // 1.5x Overallocate
calls = (DKNVGcall*)realloc(dk->calls, sizeof(DKNVGcall) * ccalls);
if (calls == NULL) return NULL;
dk->calls = calls;
dk->ccalls = ccalls;
}
ret = &dk->calls[dk->ncalls++];
memset(ret, 0, sizeof(DKNVGcall));
return ret;
}
static int dknvg__allocPaths(DKNVGcontext* dk, int n)
{
int ret = 0;
if (dk->npaths+n > dk->cpaths) {
DKNVGpath* paths;
int cpaths = dknvg__maxi(dk->npaths + n, 128) + dk->cpaths/2; // 1.5x Overallocate
paths = (DKNVGpath*)realloc(dk->paths, sizeof(DKNVGpath) * cpaths);
if (paths == NULL) return -1;
dk->paths = paths;
dk->cpaths = cpaths;
}
ret = dk->npaths;
dk->npaths += n;
return ret;
}
static int dknvg__allocVerts(DKNVGcontext* dk, int n)
{
int ret = 0;
if (dk->nverts+n > dk->cverts) {
NVGvertex* verts;
int cverts = dknvg__maxi(dk->nverts + n, 4096) + dk->cverts/2; // 1.5x Overallocate
verts = (NVGvertex*)realloc(dk->verts, sizeof(NVGvertex) * cverts);
if (verts == NULL) return -1;
dk->verts = verts;
dk->cverts = cverts;
}
ret = dk->nverts;
dk->nverts += n;
return ret;
}
static int dknvg__allocFragUniforms(DKNVGcontext* dk, int n)
{
int ret = 0, structSize = dk->fragSize;
if (dk->nuniforms+n > dk->cuniforms) {
unsigned char* uniforms;
int cuniforms = dknvg__maxi(dk->nuniforms+n, 128) + dk->cuniforms/2; // 1.5x Overallocate
uniforms = (unsigned char*)realloc(dk->uniforms, structSize * cuniforms);
if (uniforms == NULL) return -1;
dk->uniforms = uniforms;
dk->cuniforms = cuniforms;
}
ret = dk->nuniforms * structSize;
dk->nuniforms += n;
return ret;
}
static DKNVGfragUniforms* nvg__fragUniformPtr(DKNVGcontext* dk, int i)
{
return (DKNVGfragUniforms*)&dk->uniforms[i];
}
static void dknvg__vset(NVGvertex* vtx, float x, float y, float u, float v)
{
vtx->x = x;
vtx->y = y;
vtx->u = u;
vtx->v = v;
}
static void dknvg__renderFill(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe,
const float* bounds, const NVGpath* paths, int npaths)
{
DKNVGcontext* dk = (DKNVGcontext*)uptr;
DKNVGcall* call = dknvg__allocCall(dk);
NVGvertex* quad;
DKNVGfragUniforms* frag;
int i, maxverts, offset;
if (call == NULL) return;
call->type = DKNVG_FILL;
call->triangleCount = 4;
call->pathOffset = dknvg__allocPaths(dk, npaths);
if (call->pathOffset == -1) goto error;
call->pathCount = npaths;
call->image = paint->image;
call->blendFunc = dknvg__blendCompositeOperation(compositeOperation);
if (npaths == 1 && paths[0].convex)
{
call->type = DKNVG_CONVEXFILL;
call->triangleCount = 0; // Bounding box fill quad not needed for convex fill
}
// Allocate vertices for all the paths.
maxverts = dknvg__maxVertCount(paths, npaths) + call->triangleCount;
offset = dknvg__allocVerts(dk, maxverts);
if (offset == -1) goto error;
for (i = 0; i < npaths; i++) {
DKNVGpath* copy = &dk->paths[call->pathOffset + i];
const NVGpath* path = &paths[i];
memset(copy, 0, sizeof(DKNVGpath));
if (path->nfill > 0) {
copy->fillOffset = offset;
copy->fillCount = path->nfill;
memcpy(&dk->verts[offset], path->fill, sizeof(NVGvertex) * path->nfill);
offset += path->nfill;
}
if (path->nstroke > 0) {
copy->strokeOffset = offset;
copy->strokeCount = path->nstroke;
memcpy(&dk->verts[offset], path->stroke, sizeof(NVGvertex) * path->nstroke);
offset += path->nstroke;
}
}
// Setup uniforms for draw calls
if (call->type == DKNVG_FILL) {
// Quad
call->triangleOffset = offset;
quad = &dk->verts[call->triangleOffset];
dknvg__vset(&quad[0], bounds[2], bounds[3], 0.5f, 1.0f);
dknvg__vset(&quad[1], bounds[2], bounds[1], 0.5f, 1.0f);
dknvg__vset(&quad[2], bounds[0], bounds[3], 0.5f, 1.0f);
dknvg__vset(&quad[3], bounds[0], bounds[1], 0.5f, 1.0f);
call->uniformOffset = dknvg__allocFragUniforms(dk, 2);
if (call->uniformOffset == -1) goto error;
// Simple shader for stencil
frag = nvg__fragUniformPtr(dk, call->uniformOffset);
memset(frag, 0, sizeof(*frag));
frag->strokeThr = -1.0f;
frag->type = NSVG_SHADER_SIMPLE;
// Fill shader
dknvg__convertPaint(dk, nvg__fragUniformPtr(dk, call->uniformOffset + dk->fragSize), paint, scissor, fringe, fringe, -1.0f);
} else {
call->uniformOffset = dknvg__allocFragUniforms(dk, 1);
if (call->uniformOffset == -1) goto error;
// Fill shader
dknvg__convertPaint(dk, nvg__fragUniformPtr(dk, call->uniformOffset), paint, scissor, fringe, fringe, -1.0f);
}
return;
error:
// We get here if call alloc was ok, but something else is not.
// Roll back the last call to prevent drawing it.
if (dk->ncalls > 0) dk->ncalls--;
}
static void dknvg__renderStroke(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe,
float strokeWidth, const NVGpath* paths, int npaths)
{
DKNVGcontext* dk = (DKNVGcontext*)uptr;
DKNVGcall* call = dknvg__allocCall(dk);
int i, maxverts, offset;
if (call == NULL) {
return;
}
call->type = DKNVG_STROKE;
call->pathOffset = dknvg__allocPaths(dk, npaths);
if (call->pathOffset == -1) goto error;
call->pathCount = npaths;
call->image = paint->image;
call->blendFunc = dknvg__blendCompositeOperation(compositeOperation);
// Allocate vertices for all the paths.
maxverts = dknvg__maxVertCount(paths, npaths);
offset = dknvg__allocVerts(dk, maxverts);
if (offset == -1) goto error;
for (i = 0; i < npaths; i++) {
DKNVGpath* copy = &dk->paths[call->pathOffset + i];
const NVGpath* path = &paths[i];
memset(copy, 0, sizeof(DKNVGpath));
if (path->nstroke) {
copy->strokeOffset = offset;
copy->strokeCount = path->nstroke;
memcpy(&dk->verts[offset], path->stroke, sizeof(NVGvertex) * path->nstroke);
offset += path->nstroke;
}
}
if (dk->flags & NVG_STENCIL_STROKES) {
// Fill shader
call->uniformOffset = dknvg__allocFragUniforms(dk, 2);
if (call->uniformOffset == -1) goto error;
dknvg__convertPaint(dk, nvg__fragUniformPtr(dk, call->uniformOffset), paint, scissor, strokeWidth, fringe, -1.0f);
dknvg__convertPaint(dk, nvg__fragUniformPtr(dk, call->uniformOffset + dk->fragSize), paint, scissor, strokeWidth, fringe, 1.0f - 0.5f/255.0f);
} else {
// Fill shader
call->uniformOffset = dknvg__allocFragUniforms(dk, 1);
if (call->uniformOffset == -1) goto error;
dknvg__convertPaint(dk, nvg__fragUniformPtr(dk, call->uniformOffset), paint, scissor, strokeWidth, fringe, -1.0f);
}
return;
error:
// We get here if call alloc was ok, but something else is not.
// Roll back the last call to prevent drawing it.
if (dk->ncalls > 0) dk->ncalls--;
}
static void dknvg__renderTriangles(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor,
const NVGvertex* verts, int nverts, float fringe)
{
DKNVGcontext* dk = (DKNVGcontext*)uptr;
DKNVGcall* call = dknvg__allocCall(dk);
DKNVGfragUniforms* frag;
if (call == NULL) return;
call->type = DKNVG_TRIANGLES;
call->image = paint->image;
call->blendFunc = dknvg__blendCompositeOperation(compositeOperation);
// Allocate vertices for all the paths.
call->triangleOffset = dknvg__allocVerts(dk, nverts);
if (call->triangleOffset == -1) goto error;
call->triangleCount = nverts;
memcpy(&dk->verts[call->triangleOffset], verts, sizeof(NVGvertex) * nverts);
// Fill shader
call->uniformOffset = dknvg__allocFragUniforms(dk, 1);
if (call->uniformOffset == -1) goto error;
frag = nvg__fragUniformPtr(dk, call->uniformOffset);
dknvg__convertPaint(dk, frag, paint, scissor, 1.0f, fringe, -1.0f);
frag->type = NSVG_SHADER_IMG;
return;
error:
// We get here if call alloc was ok, but something else is not.
// Roll back the last call to prevent drawing it.
if (dk->ncalls > 0) dk->ncalls--;
}
static void dknvg__renderDelete(void* uptr) {
DKNVGcontext* dk = (DKNVGcontext*)uptr;
if (dk == NULL) return;
free(dk->paths);
free(dk->verts);
free(dk->uniforms);
free(dk->calls);
free(dk);
}
NVGcontext* nvgCreateDk(nvg::DkRenderer *renderer, int flags) {
NVGparams params;
NVGcontext* ctx = NULL;
DKNVGcontext* dk = (DKNVGcontext*)malloc(sizeof(DKNVGcontext));
if (dk == NULL) goto error;
memset(dk, 0, sizeof(DKNVGcontext));
memset(¶ms, 0, sizeof(params));
params.renderCreate = dknvg__renderCreate;
params.renderCreateTexture = dknvg__renderCreateTexture;
params.renderDeleteTexture = dknvg__renderDeleteTexture;
params.renderUpdateTexture = dknvg__renderUpdateTexture;
params.renderGetTextureSize = dknvg__renderGetTextureSize;
params.renderViewport = dknvg__renderViewport;
params.renderCancel = dknvg__renderCancel;
params.renderFlush = dknvg__renderFlush;
params.renderFill = dknvg__renderFill;
params.renderStroke = dknvg__renderStroke;
params.renderTriangles = dknvg__renderTriangles;
params.renderDelete = dknvg__renderDelete;
params.userPtr = dk;
params.edgeAntiAlias = flags & NVG_ANTIALIAS ? 1 : 0;
dk->renderer = renderer;
dk->flags = flags;
ctx = nvgCreateInternal(¶ms);
if (ctx == NULL) goto error;
return ctx;
error:
// 'dk' is freed by nvgDeleteInternal.
if (ctx != NULL) nvgDeleteInternal(ctx);
return NULL;
}
void nvgDeleteDk(NVGcontext* ctx)
{
nvgDeleteInternal(ctx);
}
#ifdef __cplusplus
}
#endif
| 17,162
|
C++
|
.h
| 446
| 32.257848
| 150
| 0.639788
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,434
|
FileLoader.h
|
Atmosphere-NX_Atmosphere/troposphere/daybreak/nanovg/include/nanovg/framework/FileLoader.h
|
/*
** Sample Framework for deko3d Applications
** FileLoader.h: Helpers for loading data from the filesystem directly into GPU memory
*/
#pragma once
#include "common.h"
#include "CMemPool.h"
CMemPool::Handle LoadFile(CMemPool& pool, const char* path, uint32_t alignment = DK_CMDMEM_ALIGNMENT);
| 298
|
C++
|
.h
| 8
| 36.125
| 102
| 0.782007
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,442
|
kern_init_loader_board_setup.hpp
|
Atmosphere-NX_Atmosphere/mesosphere/kernel_ldr/source/kern_init_loader_board_setup.hpp
|
/*
* 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 <mesosphere.hpp>
namespace ams::kern::init::loader {
#if defined(ATMOSPHERE_ARCH_ARM64)
void PerformDefaultAarch64SpecificSetup();
#endif
void PerformBoardSpecificSetup();
}
| 843
|
C++
|
.h
| 23
| 34.521739
| 76
| 0.765931
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,443
|
kern_init_loader_asm.hpp
|
Atmosphere-NX_Atmosphere/mesosphere/kernel_ldr/source/kern_init_loader_asm.hpp
|
/*
* 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 <mesosphere.hpp>
namespace ams::kern::init::loader {
struct SavedRegisterState {
u64 x[(30 - 19) + 1];
u64 sp;
u64 xzr;
};
static_assert(sizeof(SavedRegisterState) == 0x70);
int SaveRegistersToTpidrEl1(void *tpidr_el1);
void VerifyAndClearTpidrEl1(void *tpidr_el1);
}
| 973
|
C++
|
.h
| 27
| 32.740741
| 76
| 0.727176
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,444
|
kern_libc_config.arch.arm64.h
|
Atmosphere-NX_Atmosphere/mesosphere/kernel_ldr/source/libc/kern_libc_config.arch.arm64.h
|
/*
* 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
/* Definitions for libc genericity. */
#define MESOSPHERE_LIBC_MEMCPY_GENERIC 1
#define MESOSPHERE_LIBC_MEMCMP_GENERIC 1
#define MESOSPHERE_LIBC_MEMMOVE_GENERIC 1
#define MESOSPHERE_LIBC_MEMSET_GENERIC 1
#define MESOSPHERE_LIBC_STRNCPY_GENERIC 1
#define MESOSPHERE_LIBC_STRNCMP_GENERIC 1
| 940
|
C++
|
.h
| 23
| 39.217391
| 76
| 0.779476
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,445
|
kern_libc_config.h
|
Atmosphere-NX_Atmosphere/mesosphere/kernel_ldr/source/libc/kern_libc_config.h
|
/*
* 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
#if defined(ATMOSPHERE_ARCH_ARM64)
#include "kern_libc_config.arch.arm64.h"
#else
#error "Unknown architecture for libc"
#endif
| 789
|
C++
|
.h
| 21
| 35.285714
| 76
| 0.757536
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,446
|
kern_libc_config.arch.arm64.h
|
Atmosphere-NX_Atmosphere/mesosphere/kernel/source/libc/kern_libc_config.arch.arm64.h
|
/*
* 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
/* Definitions for libc genericity. */
#define MESOSPHERE_LIBC_MEMCPY_GENERIC 0
#define MESOSPHERE_LIBC_MEMCMP_GENERIC 0
#define MESOSPHERE_LIBC_MEMMOVE_GENERIC 0
#define MESOSPHERE_LIBC_MEMSET_GENERIC 0
#define MESOSPHERE_LIBC_STRNCPY_GENERIC 1
#define MESOSPHERE_LIBC_STRNCMP_GENERIC 1
| 940
|
C++
|
.h
| 23
| 39.217391
| 76
| 0.779476
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,447
|
asmdefs.h
|
Atmosphere-NX_Atmosphere/mesosphere/kernel/source/libc/arch/arm64/asmdefs.h
|
/*
* Macros for asm code.
*
* Copyright (c) 2019, Arm Limited.
* SPDX-License-Identifier: MIT
*/
#ifndef _ASMDEFS_H
#define _ASMDEFS_H
#define ENTRY_ALIGN(name, alignment) \
.global name; \
.type name,%function; \
.align alignment; \
name: \
.cfi_startproc;
#define ENTRY(name) ENTRY_ALIGN(name, 6)
#define ENTRY_ALIAS(name) \
.global name; \
.type name,%function; \
name:
#define END(name) \
.cfi_endproc; \
.size name, .-name;
#define L(l) .L ## l
#endif
| 619
|
C++
|
.h
| 24
| 23.458333
| 43
| 0.522109
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,448
|
util_common.hpp
|
Atmosphere-NX_Atmosphere/tests/TestSvc/source/util_common.hpp
|
/*
* 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 "util_test_framework.hpp"
namespace ams::test {
static constexpr s32 NumCores = 4;
static constexpr s32 DpcManagerNormalThreadPriority = 59;
static constexpr s32 DpcManagerPreemptionThreadPriority = 63;
static constexpr s32 HighestTestPriority = 32;
static constexpr s32 LowestTestPriority = svc::LowestThreadPriority;
static_assert(HighestTestPriority < LowestTestPriority);
static constexpr TimeSpan PreemptionTimeSpan = TimeSpan::FromMilliSeconds(10);
constexpr inline bool IsPreemptionPriority(s32 core, s32 priority) {
return priority == ((core == (NumCores - 1)) ? DpcManagerPreemptionThreadPriority : DpcManagerNormalThreadPriority);
}
template<typename F>
void DoWithThreadPinning(F f) {
/* Get the thread local region. */
auto * const tlr = svc::GetThreadLocalRegion();
/* Require that we're not currently pinned. */
DOCTEST_CHECK((tlr->disable_count == 0));
DOCTEST_CHECK((!tlr->interrupt_flag));
/* Request to pin ourselves. */
tlr->disable_count = 1;
/* Wait long enough that we can be confident preemption will occur, and therefore our interrupt flag will be set. */
{
constexpr auto MinimumTicksToGuaranteeInterruptFlag = ::ams::svc::Tick(PreemptionTimeSpan) + ::ams::svc::Tick(PreemptionTimeSpan) + 2;
auto GetSystemTickForPinnedThread = []() ALWAYS_INLINE_LAMBDA -> ::ams::svc::Tick {
s64 v;
__asm__ __volatile__ ("mrs %x[v], cntpct_el0" : [v]"=r"(v) :: "memory");
return ::ams::svc::Tick(v);
};
const auto start_tick = GetSystemTickForPinnedThread();
while (true) {
if (tlr->interrupt_flag) {
break;
}
if (const auto cur_tick = GetSystemTickForPinnedThread(); (cur_tick - start_tick) > MinimumTicksToGuaranteeInterruptFlag) {
break;
}
}
}
/* We're pinned. Execute the user callback. */
bool callback_succeeded = true;
{
if constexpr (requires { { f() } -> std::convertible_to<bool>; }) {
callback_succeeded = f();
} else {
f();
}
}
/* Clear our disable count. */
tlr->disable_count = 0;
/* Get our interrupt flag. */
const auto interrupt_flag_while_pinned = tlr->interrupt_flag;
/* Unpin ourselves. */
if (interrupt_flag_while_pinned) {
svc::SynchronizePreemptionState();
}
/* Get our interrupt flag. */
const auto interrupt_flag_after_unpin = tlr->interrupt_flag;
/* We have access to all SVCs again. Check that our pinning happened as expected. */
DOCTEST_CHECK(interrupt_flag_while_pinned);
DOCTEST_CHECK(!interrupt_flag_after_unpin);
/* Check that our callback succeeded. */
DOCTEST_CHECK(callback_succeeded);
}
}
| 3,727
|
C++
|
.h
| 81
| 37.395062
| 146
| 0.629997
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,449
|
util_test_framework.hpp
|
Atmosphere-NX_Atmosphere/tests/TestSvc/source/util_test_framework.hpp
|
/*
* 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 <stratosphere.hpp>
#define CATCH_CONFIG_NOSTDOUT
#define DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
#define DOCTEST_CONFIG_NO_EXCEPTIONS
#define DOCTEST_CONFIG_NO_POSIX_SIGNALS
#include "doctest.h"
| 891
|
C++
|
.h
| 23
| 37.086957
| 76
| 0.7797
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,450
|
util_check_memory.hpp
|
Atmosphere-NX_Atmosphere/tests/TestSvc/source/util_check_memory.hpp
|
/*
* 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 "util_test_framework.hpp"
namespace ams::test {
inline void TestMemory(uintptr_t address, svc::MemoryState state, svc::MemoryPermission perm, u32 attr) {
svc::MemoryInfo mem_info;
svc::PageInfo page_info;
DOCTEST_CHECK(R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), address)));
DOCTEST_CHECK(mem_info.base_address <= address);
DOCTEST_CHECK(address < (mem_info.base_address + mem_info.size));
DOCTEST_CHECK(mem_info.state == state);
DOCTEST_CHECK(mem_info.permission == perm);
DOCTEST_CHECK(mem_info.attribute == attr);
}
inline void TestMemory(uintptr_t address, size_t size, svc::MemoryState state, svc::MemoryPermission perm, u32 attr) {
svc::MemoryInfo mem_info;
svc::PageInfo page_info;
DOCTEST_CHECK(R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), address)));
DOCTEST_CHECK(mem_info.base_address <= address);
DOCTEST_CHECK(mem_info.base_address < (address + size));
DOCTEST_CHECK((address + size) <= (mem_info.base_address + mem_info.size));
DOCTEST_CHECK(mem_info.state == state);
DOCTEST_CHECK(mem_info.permission == perm);
DOCTEST_CHECK(mem_info.attribute == attr);
}
}
| 1,962
|
C++
|
.h
| 40
| 43.775
| 122
| 0.701095
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,451
|
util_scoped_heap.hpp
|
Atmosphere-NX_Atmosphere/tests/TestSvc/source/util_scoped_heap.hpp
|
/*
* 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 "util_test_framework.hpp"
namespace ams::test {
class ScopedHeap {
NON_COPYABLE(ScopedHeap);
NON_MOVEABLE(ScopedHeap);
private:
uintptr_t m_address;
size_t m_size;
public:
explicit ScopedHeap(size_t size) {
this->SetHeapSize(size);
}
~ScopedHeap() {
const auto result = svc::SetHeapSize(std::addressof(m_address), 0);
DOCTEST_CHECK(R_SUCCEEDED(result));
}
void SetHeapSize(size_t size) {
m_size = util::AlignUp(size, svc::HeapSizeAlignment);
const auto result = svc::SetHeapSize(std::addressof(m_address), m_size);
DOCTEST_CHECK(R_SUCCEEDED(result));
}
uintptr_t GetAddress() const { return m_address; }
size_t GetSize() const { return m_size; }
};
}
| 1,570
|
C++
|
.h
| 41
| 30.560976
| 88
| 0.632305
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,453
|
fusee_package2.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_package2.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
void DecryptPackage2(u8 *package2);
}
| 739
|
C++
|
.h
| 20
| 34.95
| 76
| 0.757322
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,454
|
fusee_sd_card.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_sd_card.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
Result InitializeSdCard();
Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw);
Result GetSdCardMemoryCapacity(u32 *out_num_sectors);
Result ReadSdCard(void *dst, size_t size, size_t sector_index, size_t sector_count);
Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size);
void FinalizeSdCard();
}
| 1,087
|
C++
|
.h
| 25
| 40.8
| 95
| 0.753308
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,455
|
fusee_malloc.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_malloc.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
void *AllocateMemory(size_t size);
ALWAYS_INLINE void *AllocateAligned(size_t size, size_t align) {
return reinterpret_cast<void *>(util::AlignUp(reinterpret_cast<uintptr_t>(AllocateMemory(size + align)), align));
}
template<typename T, typename... Args> requires std::constructible_from<T, Args...>
inline T *AllocateObject(Args &&... args) {
T * const obj = static_cast<T *>(AllocateAligned(sizeof(T), alignof(T)));
std::construct_at(obj, std::forward<Args>(args)...);
return obj;
}
}
| 1,244
|
C++
|
.h
| 29
| 39.275862
| 121
| 0.713813
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,456
|
fusee_overlay_manager.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_overlay_manager.hpp
|
/*
* 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 <exosphere.hpp>
#include "fs/fusee_fs_api.hpp"
namespace ams::nxboot {
enum OverlayId {
/* OverlayId_SecureInitializer = 0, */
OverlayId_MemoryTraining = 1,
};
void LoadOverlay(fs::FileHandle archive_file, OverlayId ovl);
void SaveMemoryTrainingOverlay();
void RestoreMemoryTrainingOverlay();
void RestoreSecureMonitorOverlay();
}
| 1,033
|
C++
|
.h
| 28
| 33.785714
| 76
| 0.744
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,457
|
fusee_uncompress.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_uncompress.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
void Uncompress(void *dst, size_t dst_size, const void *src, size_t src_size);
}
| 782
|
C++
|
.h
| 20
| 37.1
| 82
| 0.751316
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,458
|
fusee_registers_di.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_registers_di.hpp
|
/*
* Copyright (c) 2018 naehrwert
* Copyright (C) 2018 CTCaer
* 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 <exosphere.hpp>
#define DC_CMD_GENERAL_INCR_SYNCPT 0x00
#define DC_CMD_GENERAL_INCR_SYNCPT_CNTRL 0x01
#define SYNCPT_CNTRL_NO_STALL (1 << 8)
#define SYNCPT_CNTRL_SOFT_RESET (1 << 0)
#define DC_CMD_CONT_SYNCPT_VSYNC 0x28
#define SYNCPT_VSYNC_ENABLE (1 << 8)
#define DC_CMD_DISPLAY_COMMAND_OPTION0 0x031
#define DC_CMD_DISPLAY_COMMAND 0x32
#define DISP_CTRL_MODE_STOP (0 << 5)
#define DISP_CTRL_MODE_C_DISPLAY (1 << 5)
#define DISP_CTRL_MODE_NC_DISPLAY (2 << 5)
#define DISP_CTRL_MODE_MASK (3 << 5)
#define DC_CMD_DISPLAY_POWER_CONTROL 0x36
#define PW0_ENABLE (1 << 0)
#define PW1_ENABLE (1 << 2)
#define PW2_ENABLE (1 << 4)
#define PW3_ENABLE (1 << 6)
#define PW4_ENABLE (1 << 8)
#define PM0_ENABLE (1 << 16)
#define PM1_ENABLE (1 << 18)
#define DC_CMD_INT_STATUS 0x37
#define DC_CMD_INT_MASK 0x38
#define DC_CMD_INT_ENABLE 0x39
#define DC_CMD_STATE_ACCESS 0x40
#define READ_MUX (1 << 0)
#define WRITE_MUX (1 << 2)
#define DC_CMD_STATE_CONTROL 0x41
#define GENERAL_ACT_REQ (1 << 0)
#define WIN_A_ACT_REQ (1 << 1)
#define WIN_B_ACT_REQ (1 << 2)
#define WIN_C_ACT_REQ (1 << 3)
#define CURSOR_ACT_REQ (1 << 7)
#define GENERAL_UPDATE (1 << 8)
#define WIN_A_UPDATE (1 << 9)
#define WIN_B_UPDATE (1 << 10)
#define WIN_C_UPDATE (1 << 11)
#define CURSOR_UPDATE (1 << 15)
#define NC_HOST_TRIG (1 << 24)
#define DC_CMD_DISPLAY_WINDOW_HEADER 0x42
#define WINDOW_A_SELECT (1 << 4)
#define WINDOW_B_SELECT (1 << 5)
#define WINDOW_C_SELECT (1 << 6)
#define DC_CMD_REG_ACT_CONTROL 0x043
#define DC_COM_CRC_CONTROL 0x300
#define DC_COM_PIN_OUTPUT_ENABLE(x) (0x302 + (x))
#define DC_COM_PIN_OUTPUT_POLARITY(x) (0x306 + (x))
#define DC_COM_DSC_TOP_CTL 0x33E
#define DC_DISP_DISP_WIN_OPTIONS 0x402
#define HDMI_ENABLE (1 << 30)
#define DSI_ENABLE (1 << 29)
#define SOR1_TIMING_CYA (1 << 27)
#define SOR1_ENABLE (1 << 26)
#define SOR_ENABLE (1 << 25)
#define CURSOR_ENABLE (1 << 16)
#define DC_DISP_DISP_MEM_HIGH_PRIORITY 0x403
#define DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER 0x404
#define DC_DISP_DISP_TIMING_OPTIONS 0x405
#define DC_DISP_REF_TO_SYNC 0x406
#define DC_DISP_SYNC_WIDTH 0x407
#define DC_DISP_BACK_PORCH 0x408
#define DC_DISP_ACTIVE 0x409
#define DC_DISP_FRONT_PORCH 0x40A
#define DC_DISP_DISP_CLOCK_CONTROL 0x42E
#define PIXEL_CLK_DIVIDER_PCD1 (0 << 8)
#define PIXEL_CLK_DIVIDER_PCD1H (1 << 8)
#define PIXEL_CLK_DIVIDER_PCD2 (2 << 8)
#define PIXEL_CLK_DIVIDER_PCD3 (3 << 8)
#define PIXEL_CLK_DIVIDER_PCD4 (4 << 8)
#define PIXEL_CLK_DIVIDER_PCD6 (5 << 8)
#define PIXEL_CLK_DIVIDER_PCD8 (6 << 8)
#define PIXEL_CLK_DIVIDER_PCD9 (7 << 8)
#define PIXEL_CLK_DIVIDER_PCD12 (8 << 8)
#define PIXEL_CLK_DIVIDER_PCD16 (9 << 8)
#define PIXEL_CLK_DIVIDER_PCD18 (10 << 8)
#define PIXEL_CLK_DIVIDER_PCD24 (11 << 8)
#define PIXEL_CLK_DIVIDER_PCD13 (12 << 8)
#define SHIFT_CLK_DIVIDER(x) ((x) & 0xff)
#define DC_DISP_DISP_INTERFACE_CONTROL 0x42F
#define DISP_DATA_FORMAT_DF1P1C (0 << 0)
#define DISP_DATA_FORMAT_DF1P2C24B (1 << 0)
#define DISP_DATA_FORMAT_DF1P2C18B (2 << 0)
#define DISP_DATA_FORMAT_DF1P2C16B (3 << 0)
#define DISP_DATA_FORMAT_DF2S (4 << 0)
#define DISP_DATA_FORMAT_DF3S (5 << 0)
#define DISP_DATA_FORMAT_DFSPI (6 << 0)
#define DISP_DATA_FORMAT_DF1P3C24B (7 << 0)
#define DISP_DATA_FORMAT_DF1P3C18B (8 << 0)
#define DISP_ALIGNMENT_MSB (0 << 8)
#define DISP_ALIGNMENT_LSB (1 << 8)
#define DISP_ORDER_RED_BLUE (0 << 9)
#define DISP_ORDER_BLUE_RED (1 << 9)
#define DC_DISP_DISP_COLOR_CONTROL 0x430
#define DITHER_CONTROL_MASK (3 << 8)
#define DITHER_CONTROL_DISABLE (0 << 8)
#define DITHER_CONTROL_ORDERED (2 << 8)
#define DITHER_CONTROL_ERRDIFF (3 << 8)
#define BASE_COLOR_SIZE_MASK (0xf << 0)
#define BASE_COLOR_SIZE_666 (0 << 0)
#define BASE_COLOR_SIZE_111 (1 << 0)
#define BASE_COLOR_SIZE_222 (2 << 0)
#define BASE_COLOR_SIZE_333 (3 << 0)
#define BASE_COLOR_SIZE_444 (4 << 0)
#define BASE_COLOR_SIZE_555 (5 << 0)
#define BASE_COLOR_SIZE_565 (6 << 0)
#define BASE_COLOR_SIZE_332 (7 << 0)
#define BASE_COLOR_SIZE_888 (8 << 0)
#define DC_DISP_SHIFT_CLOCK_OPTIONS 0x431
#define SC1_H_QUALIFIER_NONE (1 << 16)
#define SC0_H_QUALIFIER_NONE (1 << 0)
#define DC_DISP_DATA_ENABLE_OPTIONS 0x432
#define DE_SELECT_ACTIVE_BLANK (0 << 0)
#define DE_SELECT_ACTIVE (1 << 0)
#define DE_SELECT_ACTIVE_IS (2 << 0)
#define DE_CONTROL_ONECLK (0 << 2)
#define DE_CONTROL_NORMAL (1 << 2)
#define DE_CONTROL_EARLY_EXT (2 << 2)
#define DE_CONTROL_EARLY (3 << 2)
#define DE_CONTROL_ACTIVE_BLANK (4 << 2)
#define DC_DISP_DC_MCCIF_FIFOCTRL 0x480
#define DC_DISP_SD_BL_PARAMETERS 0x4D7
#define DC_DISP_SD_BL_CONTROL 0x4DC
#define DC_DISP_BLEND_BACKGROUND_COLOR 0x4E4
#define DC_WIN_CSC_YOF 0x611
#define DC_WIN_CSC_KYRGB 0x612
#define DC_WIN_CSC_KUR 0x613
#define DC_WIN_CSC_KVR 0x614
#define DC_WIN_CSC_KUG 0x615
#define DC_WIN_CSC_KVG 0x616
#define DC_WIN_CSC_KUB 0x617
#define DC_WIN_CSC_KVB 0x618
#define DC_WIN_AD_WIN_OPTIONS 0xB80
#define DC_WIN_BD_WIN_OPTIONS 0xD80
#define DC_WIN_CD_WIN_OPTIONS 0xF80
// The following registers are A/B/C shadows of the 0xB80/0xD80/0xF80 registers (see DISPLAY_WINDOW_HEADER).
#define DC_WIN_WIN_OPTIONS 0x700
#define H_DIRECTION (1 << 0)
#define V_DIRECTION (1 << 2)
#define SCAN_COLUMN (1 << 4)
#define COLOR_EXPAND (1 << 6)
#define CSC_ENABLE (1 << 18)
#define WIN_ENABLE (1 << 30)
#define DC_WIN_COLOR_DEPTH 0x703
#define WIN_COLOR_DEPTH_P1 0x0
#define WIN_COLOR_DEPTH_P2 0x1
#define WIN_COLOR_DEPTH_P4 0x2
#define WIN_COLOR_DEPTH_P8 0x3
#define WIN_COLOR_DEPTH_B4G4R4A4 0x4
#define WIN_COLOR_DEPTH_B5G5R5A 0x5
#define WIN_COLOR_DEPTH_B5G6R5 0x6
#define WIN_COLOR_DEPTH_AB5G5R5 0x7
#define WIN_COLOR_DEPTH_B8G8R8A8 0xC
#define WIN_COLOR_DEPTH_R8G8B8A8 0xD
#define WIN_COLOR_DEPTH_B6x2G6x2R6x2A8 0xE
#define WIN_COLOR_DEPTH_R6x2G6x2B6x2A8 0xF
#define WIN_COLOR_DEPTH_YCbCr422 0x10
#define WIN_COLOR_DEPTH_YUV422 0x11
#define WIN_COLOR_DEPTH_YCbCr420P 0x12
#define WIN_COLOR_DEPTH_YUV420P 0x13
#define WIN_COLOR_DEPTH_YCbCr422P 0x14
#define WIN_COLOR_DEPTH_YUV422P 0x15
#define WIN_COLOR_DEPTH_YCbCr422R 0x16
#define WIN_COLOR_DEPTH_YUV422R 0x17
#define WIN_COLOR_DEPTH_YCbCr422RA 0x18
#define WIN_COLOR_DEPTH_YUV422RA 0x19
#define DC_WIN_BUFFER_CONTROL 0x702
#define DC_WIN_POSITION 0x704
#define DC_WIN_SIZE 0x705
#define H_SIZE(x) (((x) & 0x1fff) << 0)
#define V_SIZE(x) (((x) & 0x1fff) << 16)
#define DC_WIN_PRESCALED_SIZE 0x706
#define H_PRESCALED_SIZE(x) (((x) & 0x7fff) << 0)
#define V_PRESCALED_SIZE(x) (((x) & 0x1fff) << 16)
#define DC_WIN_H_INITIAL_DDA 0x707
#define DC_WIN_V_INITIAL_DDA 0x708
#define DC_WIN_DDA_INC 0x709
#define H_DDA_INC(x) (((x) & 0xffff) << 0)
#define V_DDA_INC(x) (((x) & 0xffff) << 16)
#define DC_WIN_LINE_STRIDE 0x70A
#define LINE_STRIDE(x) (x)
#define UV_LINE_STRIDE(x) (((x) & 0xffff) << 16)
#define DC_WIN_DV_CONTROL 0x70E
// The following registers are A/B/C shadows of the 0xBC0/0xDC0/0xFC0 registers (see DISPLAY_WINDOW_HEADER).
#define DC_WINBUF_START_ADDR 0x800
#define DC_WINBUF_ADDR_H_OFFSET 0x806
#define DC_WINBUF_ADDR_V_OFFSET 0x808
#define DC_WINBUF_SURFACE_KIND 0x80B
#define PITCH (0 << 0)
#define TILED (1 << 0)
#define BLOCK (2 << 0)
#define BLOCK_HEIGHT(x) (((x) & 0x7) << 4)
/*! Display serial interface registers. */
#define _DSIREG(reg) ((reg) * 4)
#define DSI_INCR_SYNCPT_CNTRL 0x1
#define DSI_RD_DATA 0x9
#define DSI_WR_DATA 0xA
#define DSI_POWER_CONTROL 0xB
#define DSI_POWER_CONTROL_ENABLE 1
#define DSI_INT_ENABLE 0xC
#define DSI_INT_STATUS 0xD
#define DSI_INT_MASK 0xE
#define DSI_HOST_CONTROL 0xF
#define DSI_HOST_CONTROL_FIFO_RESET (1 << 21)
#define DSI_HOST_CONTROL_CRC_RESET (1 << 20)
#define DSI_HOST_CONTROL_TX_TRIG_SOL (0 << 12)
#define DSI_HOST_CONTROL_TX_TRIG_FIFO (1 << 12)
#define DSI_HOST_CONTROL_TX_TRIG_HOST (2 << 12)
#define DSI_HOST_CONTROL_RAW (1 << 6)
#define DSI_HOST_CONTROL_HS (1 << 5)
#define DSI_HOST_CONTROL_FIFO_SEL (1 << 4)
#define DSI_HOST_CONTROL_IMM_BTA (1 << 3)
#define DSI_HOST_CONTROL_PKT_BTA (1 << 2)
#define DSI_HOST_CONTROL_CS (1 << 1)
#define DSI_HOST_CONTROL_ECC (1 << 0)
#define DSI_CONTROL 0x10
#define DSI_CONTROL_HS_CLK_CTRL (1 << 20)
#define DSI_CONTROL_CHANNEL(c) (((c) & 0x3) << 16)
#define DSI_CONTROL_FORMAT(f) (((f) & 0x3) << 12)
#define DSI_CONTROL_TX_TRIG(x) (((x) & 0x3) << 8)
#define DSI_CONTROL_LANES(n) (((n) & 0x3) << 4)
#define DSI_CONTROL_DCS_ENABLE (1 << 3)
#define DSI_CONTROL_SOURCE(s) (((s) & 0x1) << 2)
#define DSI_CONTROL_VIDEO_ENABLE (1 << 1)
#define DSI_CONTROL_HOST_ENABLE (1 << 0)
#define DSI_SOL_DELAY 0x11
#define DSI_MAX_THRESHOLD 0x12
#define DSI_TRIGGER 0x13
#define DSI_TRIGGER_HOST (1 << 1)
#define DSI_TRIGGER_VIDEO (1 << 0)
#define DSI_TX_CRC 0x14
#define DSI_STATUS 0x15
#define DSI_INIT_SEQ_CONTROL 0x1A
#define DSI_INIT_SEQ_DATA_0 0x1B
#define DSI_INIT_SEQ_DATA_1 0x1C
#define DSI_INIT_SEQ_DATA_2 0x1D
#define DSI_INIT_SEQ_DATA_3 0x1E
#define DSI_PKT_SEQ_0_LO 0x23
#define DSI_PKT_SEQ_0_HI 0x24
#define DSI_PKT_SEQ_1_LO 0x25
#define DSI_PKT_SEQ_1_HI 0x26
#define DSI_PKT_SEQ_2_LO 0x27
#define DSI_PKT_SEQ_2_HI 0x28
#define DSI_PKT_SEQ_3_LO 0x29
#define DSI_PKT_SEQ_3_HI 0x2A
#define DSI_PKT_SEQ_4_LO 0x2B
#define DSI_PKT_SEQ_4_HI 0x2C
#define DSI_PKT_SEQ_5_LO 0x2D
#define DSI_PKT_SEQ_5_HI 0x2E
#define DSI_DCS_CMDS 0x33
#define DSI_PKT_LEN_0_1 0x34
#define DSI_PKT_LEN_2_3 0x35
#define DSI_PKT_LEN_4_5 0x36
#define DSI_PKT_LEN_6_7 0x37
#define DSI_PHY_TIMING_0 0x3C
#define DSI_PHY_TIMING_1 0x3D
#define DSI_PHY_TIMING_2 0x3E
#define DSI_BTA_TIMING 0x3F
#define DSI_TIMEOUT_0 0x44
#define DSI_TIMEOUT_LRX(x) (((x) & 0xffff) << 16)
#define DSI_TIMEOUT_HTX(x) (((x) & 0xffff) << 0)
#define DSI_TIMEOUT_1 0x45
#define DSI_TIMEOUT_PR(x) (((x) & 0xffff) << 16)
#define DSI_TIMEOUT_TA(x) (((x) & 0xffff) << 0)
#define DSI_TO_TALLY 0x46
#define DSI_PAD_CONTROL_0 0x4B
#define DSI_PAD_CONTROL_VS1_PULLDN_CLK (1 << 24)
#define DSI_PAD_CONTROL_VS1_PULLDN(x) (((x) & 0xf) << 16)
#define DSI_PAD_CONTROL_VS1_PDIO_CLK (1 << 8)
#define DSI_PAD_CONTROL_VS1_PDIO(x) (((x) & 0xf) << 0)
#define DSI_PAD_CONTROL_CD 0x4c
#define DSI_VIDEO_MODE_CONTROL 0x4E
#define DSI_PAD_CONTROL_1 0x4F
#define DSI_PAD_CONTROL_2 0x50
#define DSI_PAD_CONTROL_3 0x51
#define DSI_PAD_PREEMP_PD_CLK(x) (((x) & 0x3) << 12)
#define DSI_PAD_PREEMP_PU_CLK(x) (((x) & 0x3) << 8)
#define DSI_PAD_PREEMP_PD(x) (((x) & 0x3) << 4)
#define DSI_PAD_PREEMP_PU(x) (((x) & 0x3) << 0)
#define DSI_PAD_CONTROL_4 0x52
#define DSI_PAD_CONTROL_5_MARIKO 0x53
#define DSI_PAD_CONTROL_6_MARIKO 0x54
#define DSI_PAD_CONTROL_7_MARIKO 0x55
#define DSI_INIT_SEQ_DATA_15 0x5F
#define DSI_INIT_SEQ_DATA_15_MARIKO 0x62
#define NV_PVIC_THI_SLCG_OVERRIDE_LOW_A 0x8C
| 11,834
|
C++
|
.h
| 303
| 37.834983
| 108
| 0.688676
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,459
|
fusee_cpu.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_cpu.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::nxboot {
void SetupCpu(uintptr_t entrypoint);
void StartCpu();
}
| 764
|
C++
|
.h
| 21
| 34.190476
| 76
| 0.754054
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,460
|
fusee_external_package.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_external_package.hpp
|
/*
* 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 <exosphere.hpp>
#include "fusee_display.hpp"
namespace ams::nxboot {
constexpr inline const size_t ExternalPackageSize = 8_MB;
constexpr inline const size_t InitialProcessStorageSizeMax = 3_MB / 8;
struct ExternalPackageContentMeta {
u32 offset;
u32 size;
u8 type;
u8 flags[3];
u32 pad;
char name[0x10];
};
static_assert(sizeof(ExternalPackageContentMeta) == 0x20);
struct ExternalPackageKipMeta {
u64 program_id;
u32 offset;
u32 size;
se::Sha256Hash hash;
};
static_assert(sizeof(ExternalPackageKipMeta) == 0x30);
struct ExternalPackageHeader {
static constexpr u32 Magic = util::FourCC<'P', 'K', '3', '1'>::Code;
static constexpr u32 LegacyMagic = util::FourCC<'F','S','S','0'>::Code;
u32 magic; /* Previously entrypoint. */
u32 metadata_offset;
u32 flags;
u32 meso_size;
u32 num_kips;
u32 reserved1[3];
u32 legacy_magic;
u32 total_size;
u32 reserved2; /* Previously crt0 offset. */
u32 content_header_offset;
u32 num_content_headers;
u32 supported_hos_version;
u32 release_version;
u32 git_revision;
ExternalPackageContentMeta content_metas[(0x400 - 0x40) / sizeof(ExternalPackageContentMeta)];
ExternalPackageKipMeta emummc_meta;
ExternalPackageKipMeta kip_metas[8];
u8 reserved3[0x800 - (0x400 + 9 * sizeof(ExternalPackageKipMeta))];
};
static_assert(sizeof(ExternalPackageHeader) == 0x800);
struct ExternalPackage {
ExternalPackageHeader header; /* 0x000000-0x000800 */
u8 warmboot[0x1800]; /* 0x000800-0x002000 */
u8 tsec_keygen[0x2000]; /* 0x002000-0x004000 */
u8 mariko_fatal[0x1C000]; /* 0x004000-0x020000 */
u8 ovl_mtc_erista[0x14000]; /* 0x020000-0x034000 */
u8 ovl_mtc_mariko[0x14000]; /* 0x034000-0x048000 */
u8 exosphere[0xE000]; /* 0x048000-0x056000 */
u8 mesosphere[0xAA000]; /* 0x056000-0x100000 */
u8 kips[3_MB]; /* 0x100000-0x400000 */
u8 splash_screen_fb[FrameBufferSize]; /* 0x400000-0x7C0000 */
u8 fusee[0x20000]; /* 0x7C0000-0x7E0000 */
u8 reboot_stub[0x1000]; /* 0x7E0000-0x7E1000 */
u8 reserved[0x1F000]; /* 0x7E1000-0x800000 */
};
static_assert(sizeof(ExternalPackage) == ExternalPackageSize);
ALWAYS_INLINE const ExternalPackage &GetExternalPackage() { return *reinterpret_cast<const ExternalPackage *>(0xC0000000); }
}
| 3,399
|
C++
|
.h
| 78
| 37.089744
| 128
| 0.636364
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,461
|
fusee_exception_handler.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_exception_handler.hpp
|
/*
* 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/>.
*/
#include <exosphere.hpp>
#pragma once
namespace ams::nxboot {
NORETURN void ExceptionHandler();
NORETURN void ExceptionHandler0();
NORETURN void ExceptionHandler1();
NORETURN void ExceptionHandler2();
NORETURN void ExceptionHandler3();
NORETURN void ExceptionHandler4();
NORETURN void ExceptionHandler5();
NORETURN void ExceptionHandler6();
NORETURN void ExceptionHandler7();
}
| 1,052
|
C++
|
.h
| 28
| 34.678571
| 76
| 0.760039
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,462
|
fusee_fatal.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_fatal.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::nxboot {
NORETURN void ShowFatalError(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
void ShowFatalError(const ams::impl::FatalErrorContext *f_ctx, const Result save_result);
void SaveAndShowFatalError();
NORETURN void WaitForReboot();
}
| 962
|
C++
|
.h
| 23
| 39.26087
| 93
| 0.749196
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,463
|
fusee_print.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_print.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::nxboot {
void InitializeConsole(u32 *frame_buffer);
void Print(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
void VPrint(const char *fmt, std::va_list vl);
}
| 876
|
C++
|
.h
| 22
| 37.5
| 76
| 0.737955
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,464
|
fusee_display.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_display.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::nxboot {
constexpr inline size_t FrameBufferHeight = 768;
constexpr inline size_t FrameBufferWidth = 1280;
constexpr inline size_t FrameBufferSize = FrameBufferHeight * FrameBufferWidth * sizeof(u32);
bool IsDisplayInitialized();
void InitializeDisplay();
void FinalizeDisplay();
u16 GetDisplayLcdVendor();
void ShowDisplay();
}
| 1,058
|
C++
|
.h
| 27
| 36.259259
| 99
| 0.755122
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,465
|
fusee_emummc.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_emummc.hpp
|
/*
* 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 <exosphere/secmon/secmon_emummc_context.hpp>
namespace ams::nxboot {
void InitializeEmummc(bool emummc_enabled, const secmon::EmummcConfiguration &emummc_cfg);
Result ReadBoot0(s64 offset, void *dst, size_t size);
Result ReadPackage2(s64 offset, void *dst, size_t size);
Result ReadSystem(s64 offset, void *dst, size_t size);
}
| 1,028
|
C++
|
.h
| 24
| 40.416667
| 94
| 0.758
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,466
|
fusee_key_derivation.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_key_derivation.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
void DeriveKeysErista();
void DeriveKeysMariko();
int PrepareMasterKey(int generation);
int PrepareDeviceMasterKey(int generation);
}
| 848
|
C++
|
.h
| 23
| 34.434783
| 76
| 0.759124
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,467
|
fusee_setup_horizon.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_setup_horizon.hpp
|
/*
* 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/>.
*/
#include <exosphere.hpp>
#pragma once
namespace ams::nxboot {
void SetupAndStartHorizon();
}
| 734
|
C++
|
.h
| 20
| 34.7
| 76
| 0.758427
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,468
|
fusee_stratosphere.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_stratosphere.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
u32 ConfigureStratosphere(const u8 *nn_package2, ams::TargetFirmware target_firmware, bool emummc_enabled, bool nogc_enabled);
void RebuildPackage2(ams::TargetFirmware target_firmware, bool emummc_enabled);
}
| 915
|
C++
|
.h
| 21
| 41.380952
| 130
| 0.768799
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,469
|
fusee_ini.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_ini.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
struct IniKeyValueEntry {
util::IntrusiveListNode list_node;
char *key;
char *value;
};
using IniKeyValueList = typename util::IntrusiveListMemberTraits<&IniKeyValueEntry::list_node>::ListType;
struct IniSection {
util::IntrusiveListNode list_node;
IniKeyValueList kv_list;
char *name;
};
using IniSectionList = typename util::IntrusiveListMemberTraits<&IniSection::list_node>::ListType;
enum ParseIniResult {
ParseIniResult_Success,
ParseIniResult_NoFile,
ParseIniResult_InvalidFormat,
};
ParseIniResult ParseIniFile(IniSectionList &out_sections, const char *ini_path);
}
| 1,383
|
C++
|
.h
| 37
| 32.891892
| 109
| 0.731143
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,470
|
fusee_secmon_sync.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_secmon_sync.hpp
|
/*
* 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/>.
*/
#include <exosphere.hpp>
#pragma once
namespace ams::nxboot {
void InitializeSecureMonitorMailbox();
void WaitSecureMonitorState(pkg1::SecureMonitorState state);
void SetBootloaderState(pkg1::BootloaderState state);
}
| 868
|
C++
|
.h
| 22
| 37.136364
| 76
| 0.76987
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,471
|
fusee_mmc.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fusee_mmc.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot {
Result InitializeMmc();
Result CheckMmcConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw);
Result GetMmcMemoryCapacity(u32 *out_num_sectors, sdmmc::MmcPartition partition);
Result ReadMmc(void *dst, size_t size, sdmmc::MmcPartition partition, size_t sector_index, size_t sector_count);
Result WriteMmc(sdmmc::MmcPartition partition, size_t sector_index, size_t sector_count, const void *src, size_t size);
}
| 1,137
|
C++
|
.h
| 24
| 44.833333
| 123
| 0.758559
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,472
|
fusee_secure_initialize.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/sein/fusee_secure_initialize.hpp
|
/*
* 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/>.
*/
#include <exosphere.hpp>
#pragma once
namespace ams::nxboot {
void SecureInitialize(bool enable_log);
}
| 745
|
C++
|
.h
| 20
| 35.25
| 76
| 0.759336
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,474
|
ff.h
|
Atmosphere-NX_Atmosphere/fusee/program/source/fatfs/ff.h
|
/*----------------------------------------------------------------------------/
/ FatFs - Generic FAT Filesystem module R0.14 /
/-----------------------------------------------------------------------------/
/
/ Copyright (C) 2019, ChaN, all right reserved.
/
/ FatFs module is an open source software. Redistribution and use of FatFs in
/ source and binary forms, with or without modification, are permitted provided
/ that the following condition is met:
/ 1. Redistributions of source code must retain the above copyright notice,
/ this condition and the following disclaimer.
/
/ This software is provided by the copyright holder and contributors "AS IS"
/ and any warranties related to this software are DISCLAIMED.
/ The copyright owner or contributors be NOT LIABLE for any damages caused
/ by use of this software.
/
/----------------------------------------------------------------------------*/
#ifndef FF_DEFINED
#define FF_DEFINED 86606 /* Revision ID */
#ifdef __cplusplus
extern "C" {
#endif
#include "ffconf.h" /* FatFs configuration options */
#if FF_DEFINED != FFCONF_DEF
#error Wrong configuration file (ffconf.h).
#endif
/* Integer types used for FatFs API */
#if defined(_WIN32) /* Main development platform */
#define FF_INTDEF 2
#include <windows.h>
typedef unsigned __int64 QWORD;
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
#define FF_INTDEF 2
#include <stdint.h>
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */
typedef uint16_t WORD; /* 16-bit unsigned integer */
typedef uint32_t DWORD; /* 32-bit unsigned integer */
typedef uint64_t QWORD; /* 64-bit unsigned integer */
typedef WORD WCHAR; /* UTF-16 character type */
#else /* Earlier than C99 */
#define FF_INTDEF 1
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */
typedef unsigned short WORD; /* 16-bit unsigned integer */
typedef unsigned long DWORD; /* 32-bit unsigned integer */
typedef WORD WCHAR; /* UTF-16 character type */
#endif
/* Definitions of volume management */
#if FF_MULTI_PARTITION /* Multiple partition configuration */
typedef struct {
BYTE pd; /* Physical drive number */
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
} PARTITION;
extern PARTITION VolToPart[]; /* Volume - Partition mapping table */
#endif
#if FF_STR_VOLUME_ID
#ifndef FF_VOLUME_STRS
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
#endif
#endif
/* Type of path name strings on FatFs API */
#ifndef _INC_TCHAR
#define _INC_TCHAR
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
typedef WCHAR TCHAR;
#define _T(x) L ## x
#define _TEXT(x) L ## x
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
typedef char TCHAR;
#define _T(x) u8 ## x
#define _TEXT(x) u8 ## x
#elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */
typedef DWORD TCHAR;
#define _T(x) U ## x
#define _TEXT(x) U ## x
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3)
#error Wrong FF_LFN_UNICODE setting
#else /* ANSI/OEM code in SBCS/DBCS */
typedef char TCHAR;
#define _T(x) x
#define _TEXT(x) x
#endif
#endif
/* Type of file size and LBA variables */
#if FF_FS_EXFAT
#if FF_INTDEF != 2
#error exFAT feature wants C99 or later
#endif
typedef QWORD FSIZE_t;
#if FF_LBA64
typedef QWORD LBA_t;
#else
typedef DWORD LBA_t;
#endif
#else
#if FF_LBA64
#error exFAT needs to be enabled when enable 64-bit LBA
#endif
typedef DWORD FSIZE_t;
typedef DWORD LBA_t;
#endif
/* Filesystem object structure (FATFS) */
typedef struct {
BYTE fs_type; /* Filesystem type (0:not mounted) */
BYTE pdrv; /* Associated physical drive */
BYTE n_fats; /* Number of FATs (1 or 2) */
BYTE wflag; /* win[] flag (b0:dirty) */
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
WORD id; /* Volume mount ID */
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
WORD csize; /* Cluster size [sectors] */
#if FF_MAX_SS != FF_MIN_SS
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
#endif
#if FF_USE_LFN
WCHAR* lfnbuf; /* LFN working buffer */
#endif
#if FF_FS_EXFAT
BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */
#endif
#if FF_FS_REENTRANT
FF_SYNC_t sobj; /* Identifier of sync object */
#endif
#if !FF_FS_READONLY
DWORD last_clst; /* Last allocated cluster */
DWORD free_clst; /* Number of free clusters */
#endif
#if FF_FS_RPATH
DWORD cdir; /* Current directory start cluster (0:root) */
#if FF_FS_EXFAT
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
#endif
#endif
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
DWORD fsize; /* Size of an FAT [sectors] */
LBA_t volbase; /* Volume base sector */
LBA_t fatbase; /* FAT base sector */
LBA_t dirbase; /* Root directory base sector/cluster */
LBA_t database; /* Data base sector */
#if FF_FS_EXFAT
LBA_t bitbase; /* Allocation bitmap base sector */
#endif
LBA_t winsect; /* Current sector appearing in the win[] */
BYTE pad[4];
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
} FATFS;
/* Object ID and allocation information (FFOBJID) */
typedef struct {
FATFS* fs; /* Pointer to the hosting volume of this object */
WORD id; /* Hosting volume mount ID */
BYTE attr; /* Object attribute */
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
#if FF_FS_EXFAT
DWORD n_cont; /* Size of first fragment - 1 (valid when stat == 3) */
DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */
#endif
#if FF_FS_LOCK
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
#endif
} FFOBJID;
/* File object structure (FIL) */
typedef struct {
FFOBJID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
BYTE flag; /* File status flags */
BYTE err; /* Abort flag (error code) */
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */
DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */
LBA_t sect; /* Sector number appearing in buf[] (0:invalid) */
#if !FF_FS_READONLY
LBA_t dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */
#endif
#if FF_USE_FASTSEEK
DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */
#endif
#if !FF_FS_TINY
BYTE buf[FF_MAX_SS]; /* File private data read/write window */
#endif
} FIL;
/* Directory object structure (DIR) */
typedef struct {
FFOBJID obj; /* Object identifier */
DWORD dptr; /* Current read/write offset */
DWORD clust; /* Current cluster */
LBA_t sect; /* Current sector (0:Read operation has terminated) */
BYTE* dir; /* Pointer to the directory item in the win[] */
BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */
#if FF_USE_LFN
DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */
#endif
#if FF_USE_FIND
const TCHAR* pat; /* Pointer to the name matching pattern */
#endif
} DIR;
/* File information structure (FILINFO) */
typedef struct {
FSIZE_t fsize; /* File size */
WORD fdate; /* Modified date */
WORD ftime; /* Modified time */
BYTE fattrib; /* File attribute */
#if FF_USE_LFN
TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
#else
TCHAR fname[12 + 1]; /* File name */
#endif
} FILINFO;
/* Format parameter structure (MKFS_PARM) */
typedef struct {
BYTE fmt; /* Format option (FM_FAT, FM_FAT32, FM_EXFAT and FM_SFD) */
BYTE n_fat; /* Number of FATs */
UINT align; /* Data area alignment (sector) */
UINT n_root; /* Number of root directory entries */
DWORD au_size; /* Cluster size (byte) */
} MKFS_PARM;
/* File function return code (FRESULT) */
typedef enum {
FR_OK = 0, /* (0) Succeeded */
FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
FR_INT_ERR, /* (2) Assertion failed */
FR_NOT_READY, /* (3) The physical drive cannot work */
FR_NO_FILE, /* (4) Could not find the file */
FR_NO_PATH, /* (5) Could not find the path */
FR_INVALID_NAME, /* (6) The path name format is invalid */
FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
FR_EXIST, /* (8) Access denied due to prohibited access */
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
FR_NOT_ENABLED, /* (12) The volume has no work area */
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
} FRESULT;
/*--------------------------------------------------------------*/
/* FatFs module application interface */
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
FRESULT f_close (FIL* fp); /* Close an open file object */
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
FRESULT f_truncate (FIL* fp); /* Truncate the file */
FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
FRESULT f_closedir (DIR* dp); /* Close an open directory */
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */
FRESULT f_chdir (const TCHAR* path); /* Change current directory */
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
FRESULT f_expand (FIL* fp, FSIZE_t fsz, BYTE opt); /* Allocate a contiguous block to the file */
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
FRESULT f_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len); /* Create a FAT volume */
FRESULT f_fdisk (BYTE pdrv, const LBA_t ptbl[], void* work); /* Divide a physical drive into some partitions */
FRESULT f_setcp (WORD cp); /* Set current code page */
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
#define f_error(fp) ((fp)->err)
#define f_tell(fp) ((fp)->fptr)
#define f_size(fp) ((fp)->obj.objsize)
#define f_rewind(fp) f_lseek((fp), 0)
#define f_rewinddir(dp) f_readdir((dp), 0)
#define f_rmdir(path) f_unlink(path)
#define f_unmount(path) f_mount(0, path, 0)
#ifndef EOF
#define EOF (-1)
#endif
/*--------------------------------------------------------------*/
/* Additional user defined functions */
/* RTC function */
#if !FF_FS_READONLY && !FF_FS_NORTC
DWORD get_fattime (void);
#endif
/* LFN support functions */
#if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
#endif
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
void* ff_memalloc (UINT msize); /* Allocate memory block */
void ff_memfree (void* mblock); /* Free memory block */
#endif
/* Sync functions */
#if FF_FS_REENTRANT
int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj); /* Create a sync object */
int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */
void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */
int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
#endif
/*--------------------------------------------------------------*/
/* Flags and offset address */
/* File access mode and open method flags (3rd argument of f_open) */
#define FA_READ 0x01
#define FA_WRITE 0x02
#define FA_OPEN_EXISTING 0x00
#define FA_CREATE_NEW 0x04
#define FA_CREATE_ALWAYS 0x08
#define FA_OPEN_ALWAYS 0x10
#define FA_OPEN_APPEND 0x30
/* Fast seek controls (2nd argument of f_lseek) */
#define CREATE_LINKMAP ((FSIZE_t)0 - 1)
/* Format options (2nd argument of f_mkfs) */
#define FM_FAT 0x01
#define FM_FAT32 0x02
#define FM_EXFAT 0x04
#define FM_ANY 0x07
#define FM_SFD 0x08
/* Filesystem type (FATFS.fs_type) */
#define FS_FAT12 1
#define FS_FAT16 2
#define FS_FAT32 3
#define FS_EXFAT 4
/* File attribute bits for directory entry (FILINFO.fattrib) */
#define AM_RDO 0x01 /* Read only */
#define AM_HID 0x02 /* Hidden */
#define AM_SYS 0x04 /* System */
#define AM_DIR 0x10 /* Directory */
#define AM_ARC 0x20 /* Archive */
#ifdef __cplusplus
}
#endif
#endif /* FF_DEFINED */
| 17,448
|
C++
|
.h
| 350
| 47.58
| 153
| 0.59597
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
9,475
|
diskio_cpp.h
|
Atmosphere-NX_Atmosphere/fusee/program/source/fatfs/diskio_cpp.h
|
/*
* 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
#ifdef __cplusplus
extern "C" {
#endif
bool diskio_read_sd_card(void *dst, size_t size, size_t sector_index, size_t sector_count);
bool diskio_write_sd_card(size_t sector_index, size_t sector_count, const void *src, size_t size);
bool diskio_read_system(void *dst, size_t size, size_t sector_index, size_t sector_count);
bool diskio_write_system(size_t sector_index, size_t sector_count, const void *src, size_t size);
#ifdef __cplusplus
}
#endif
| 1,099
|
C++
|
.h
| 26
| 40.576923
| 98
| 0.755847
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,476
|
ffconf.h
|
Atmosphere-NX_Atmosphere/fusee/program/source/fatfs/ffconf.h
|
/*---------------------------------------------------------------------------/
/ FatFs Functional Configurations
/---------------------------------------------------------------------------*/
#define FFCONF_DEF 86606 /* Revision ID */
/*---------------------------------------------------------------------------/
/ Function Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_READONLY 0
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
/ and optional writing functions as well. */
#define FF_FS_MINIMIZE 0
/* This option defines minimization level to remove some basic API functions.
/
/ 0: Basic functions are fully enabled.
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
/ are removed.
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
/ 3: f_lseek() function is removed in addition to 2. */
#define FF_USE_STRFUNC 2
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
/
/ 0: Disable string functions.
/ 1: Enable without LF-CRLF conversion.
/ 2: Enable with LF-CRLF conversion. */
#define FF_USE_FIND 0
/* This option switches filtered directory read functions, f_findfirst() and
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
#define FF_USE_MKFS 0
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
#define FF_USE_FASTSEEK 0
/* This option switches fast seek function. (0:Disable or 1:Enable) */
#define FF_USE_EXPAND 1
/* This option switches f_expand function. (0:Disable or 1:Enable) */
#define FF_USE_CHMOD 0
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
#define FF_USE_LABEL 0
/* This option switches volume label functions, f_getlabel() and f_setlabel().
/ (0:Disable or 1:Enable) */
#define FF_USE_FORWARD 0
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
/*---------------------------------------------------------------------------/
/ Locale and Namespace Configurations
/---------------------------------------------------------------------------*/
#define FF_CODE_PAGE 850
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect code page setting can cause a file open failure.
/
/ 437 - U.S.
/ 720 - Arabic
/ 737 - Greek
/ 771 - KBL
/ 775 - Baltic
/ 850 - Latin 1
/ 852 - Latin 2
/ 855 - Cyrillic
/ 857 - Turkish
/ 860 - Portuguese
/ 861 - Icelandic
/ 862 - Hebrew
/ 863 - Canadian French
/ 864 - Arabic
/ 865 - Nordic
/ 866 - Russian
/ 869 - Greek 2
/ 932 - Japanese (DBCS)
/ 936 - Simplified Chinese (DBCS)
/ 949 - Korean (DBCS)
/ 950 - Traditional Chinese (DBCS)
/ 0 - Include all code pages above and configured by f_setcp()
*/
#define FF_USE_LFN 1
#define FF_MAX_LFN 255
/* The FF_USE_LFN switches the support for LFN (long file name).
/
/ 0: Disable LFN. FF_MAX_LFN has no effect.
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
/ 2: Enable LFN with dynamic working buffer on the STACK.
/ 3: Enable LFN with dynamic working buffer on the HEAP.
/
/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
/ be in range of 12 to 255. It is recommended to be set it 255 to fully support LFN
/ specification.
/ When use stack for the working buffer, take care on stack overflow. When use heap
/ memory for the working buffer, memory management functions, ff_memalloc() and
/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */
#define FF_LFN_UNICODE 2
/* This option switches the character encoding on the API when LFN is enabled.
/
/ 0: ANSI/OEM in current CP (TCHAR = char)
/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
/ 2: Unicode in UTF-8 (TCHAR = char)
/ 3: Unicode in UTF-32 (TCHAR = DWORD)
/
/ Also behavior of string I/O functions will be affected by this option.
/ When LFN is not enabled, this option has no effect. */
#define FF_LFN_BUF 255
#define FF_SFN_BUF 12
/* This set of options defines size of file name members in the FILINFO structure
/ which is used to read out directory items. These values should be suffcient for
/ the file names to read. The maximum possible length of the read file name depends
/ on character encoding. When LFN is not enabled, these options have no effect. */
#define FF_STRF_ENCODE 3
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
/ This option selects assumption of character encoding ON THE FILE to be
/ read/written via those functions.
/
/ 0: ANSI/OEM in current CP
/ 1: Unicode in UTF-16LE
/ 2: Unicode in UTF-16BE
/ 3: Unicode in UTF-8
*/
#define FF_FS_RPATH 0
/* This option configures support for relative path.
/
/ 0: Disable relative path and remove related functions.
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
/ 2: f_getcwd() function is available in addition to 1.
*/
/*---------------------------------------------------------------------------/
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/
#define FF_VOLUMES 2
/* Number of volumes (logical drives) to be used. (1-10) */
#define FF_STR_VOLUME_ID 1
#define FF_VOLUME_STRS "sdmc","sys"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
/ not defined, a user defined volume string table needs to be defined as:
/
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
*/
#define FF_MULTI_PARTITION 0
/* This option switches support for multiple volumes on the physical drive.
/ By default (0), each logical drive number is bound to the same physical drive
/ number and only an FAT volume found on the physical drive will be mounted.
/ When this function is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */
#define FF_MIN_SS 512
#define FF_MAX_SS 512
/* This set of options configures the range of sector size to be supported. (512,
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
/ harddisk. But a larger value may be required for on-board flash memory and some
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
/ for variable sector size mode and disk_ioctl() function needs to implement
/ GET_SECTOR_SIZE command. */
#define FF_LBA64 0
/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable)
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
#define FF_MIN_GPT 0x100000000
/* Minimum number of sectors to switch GPT format to create partition in f_mkfs and
/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
#define FF_USE_TRIM 0
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
/ disk_ioctl() function. */
/*---------------------------------------------------------------------------/
/ System Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_TINY 0
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
#define FF_FS_EXFAT 1
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
#define FF_FS_NORTC 1
#define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2019
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
/
/ bit0=0: Use free cluster count in the FSINFO if available.
/ bit0=1: Do not trust free cluster count in the FSINFO.
/ bit1=0: Use last allocated cluster number in the FSINFO if available.
/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
*/
#define FF_FS_LOCK 0
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
/ is 1.
/
/ 0: Disable file lock function. To avoid volume corruption, application program
/ should avoid illegal open, remove and rename to the open objects.
/ >0: Enable file lock function. The value defines how many files/sub-directories
/ can be opened simultaneously under file lock control. Note that the file
/ lock control is independent of re-entrancy. */
/* #include <somertos.h> // O/S definitions */
#define FF_FS_REENTRANT 0
#define FF_FS_TIMEOUT 1000
#define FF_SYNC_t HANDLE
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
/ to the same volume is under control of this function.
/
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
/ function, must be added to the project. Samples are available in
/ option/syscall.c.
/
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
/*--- End of configuration options ---*/
| 11,979
|
C++
|
.h
| 232
| 50.349138
| 86
| 0.679137
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
9,477
|
fusee_mtc_timing_table_erista.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/mtc/fusee_mtc_timing_table_erista.hpp
|
/*
* 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 <exosphere.hpp>
#include "fusee_mtc_timing_table_common.hpp"
namespace ams::nxboot::erista {
#define FOREACH_BURST_REG(HANDLER) \
HANDLER(EMC, EMC_RC, emc_rc) \
HANDLER(EMC, EMC_RFC, emc_rfc) \
HANDLER(EMC, EMC_RFCPB, emc_rfcpb) \
HANDLER(EMC, EMC_REFCTRL2, emc_refctrl2) \
HANDLER(EMC, EMC_RFC_SLR, emc_rfc_slr) \
HANDLER(EMC, EMC_RAS, emc_ras) \
HANDLER(EMC, EMC_RP, emc_rp) \
HANDLER(EMC, EMC_R2W, emc_r2w) \
HANDLER(EMC, EMC_W2R, emc_w2r) \
HANDLER(EMC, EMC_R2P, emc_r2p) \
HANDLER(EMC, EMC_W2P, emc_w2p) \
HANDLER(EMC, EMC_R2R, emc_r2r) \
HANDLER(EMC, EMC_TPPD, emc_tppd) \
HANDLER(EMC, EMC_CCDMW, emc_ccdmw) \
HANDLER(EMC, EMC_RD_RCD, emc_rd_rcd) \
HANDLER(EMC, EMC_WR_RCD, emc_wr_rcd) \
HANDLER(EMC, EMC_RRD, emc_rrd) \
HANDLER(EMC, EMC_REXT, emc_rext) \
HANDLER(EMC, EMC_WEXT, emc_wext) \
HANDLER(EMC, EMC_WDV_CHK, emc_wdv_chk) \
HANDLER(EMC, EMC_WDV, emc_wdv) \
HANDLER(EMC, EMC_WSV, emc_wsv) \
HANDLER(EMC, EMC_WEV, emc_wev) \
HANDLER(EMC, EMC_WDV_MASK, emc_wdv_mask) \
HANDLER(EMC, EMC_WS_DURATION, emc_ws_duration) \
HANDLER(EMC, EMC_WE_DURATION, emc_we_duration) \
HANDLER(EMC, EMC_QUSE, emc_quse) \
HANDLER(EMC, EMC_QUSE_WIDTH, emc_quse_width) \
HANDLER(EMC, EMC_IBDLY, emc_ibdly) \
HANDLER(EMC, EMC_OBDLY, emc_obdly) \
HANDLER(EMC, EMC_EINPUT, emc_einput) \
HANDLER(EMC, EMC_MRW6, emc_mrw6) \
HANDLER(EMC, EMC_EINPUT_DURATION, emc_einput_duration) \
HANDLER(EMC, EMC_PUTERM_EXTRA, emc_puterm_extra) \
HANDLER(EMC, EMC_PUTERM_WIDTH, emc_puterm_width) \
HANDLER(EMC, EMC_QRST, emc_qrst) \
HANDLER(EMC, EMC_QSAFE, emc_qsafe) \
HANDLER(EMC, EMC_RDV, emc_rdv) \
HANDLER(EMC, EMC_RDV_MASK, emc_rdv_mask) \
HANDLER(EMC, EMC_RDV_EARLY, emc_rdv_early) \
HANDLER(EMC, EMC_RDV_EARLY_MASK, emc_rdv_early_mask) \
HANDLER(EMC, EMC_REFRESH, emc_refresh) \
HANDLER(EMC, EMC_BURST_REFRESH_NUM, emc_burst_refresh_num) \
HANDLER(EMC, EMC_PRE_REFRESH_REQ_CNT, emc_pre_refresh_req_cnt) \
HANDLER(EMC, EMC_PDEX2WR, emc_pdex2wr) \
HANDLER(EMC, EMC_PDEX2RD, emc_pdex2rd) \
HANDLER(EMC, EMC_PCHG2PDEN, emc_pchg2pden) \
HANDLER(EMC, EMC_ACT2PDEN, emc_act2pden) \
HANDLER(EMC, EMC_AR2PDEN, emc_ar2pden) \
HANDLER(EMC, EMC_RW2PDEN, emc_rw2pden) \
HANDLER(EMC, EMC_CKE2PDEN, emc_cke2pden) \
HANDLER(EMC, EMC_PDEX2CKE, emc_pdex2cke) \
HANDLER(EMC, EMC_PDEX2MRR, emc_pdex2mrr) \
HANDLER(EMC, EMC_TXSR, emc_txsr) \
HANDLER(EMC, EMC_TXSRDLL, emc_txsrdll) \
HANDLER(EMC, EMC_TCKE, emc_tcke) \
HANDLER(EMC, EMC_TCKESR, emc_tckesr) \
HANDLER(EMC, EMC_TPD, emc_tpd) \
HANDLER(EMC, EMC_TFAW, emc_tfaw) \
HANDLER(EMC, EMC_TRPAB, emc_trpab) \
HANDLER(EMC, EMC_TCLKSTABLE, emc_tclkstable) \
HANDLER(EMC, EMC_TCLKSTOP, emc_tclkstop) \
HANDLER(EMC, EMC_MRW7, emc_mrw7) \
HANDLER(EMC, EMC_TREFBW, emc_trefbw) \
HANDLER(EMC, EMC_ODT_WRITE, emc_odt_write) \
HANDLER(EMC, EMC_FBIO_CFG5, emc_fbio_cfg5) \
HANDLER(EMC, EMC_FBIO_CFG7, emc_fbio_cfg7) \
HANDLER(EMC, EMC_CFG_DIG_DLL, emc_cfg_dig_dll) \
HANDLER(EMC, EMC_CFG_DIG_DLL_PERIOD, emc_cfg_dig_dll_period) \
HANDLER(EMC, EMC_PMACRO_IB_RXRT, emc_pmacro_ib_rxrt) \
HANDLER(EMC, EMC_CFG_PIPE_1, emc_cfg_pipe_1) \
HANDLER(EMC, EMC_CFG_PIPE_2, emc_cfg_pipe_2) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_4, emc_pmacro_quse_ddll_rank0_4) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_5, emc_pmacro_quse_ddll_rank0_5) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_4, emc_pmacro_quse_ddll_rank1_4) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_5, emc_pmacro_quse_ddll_rank1_5) \
HANDLER(EMC, EMC_MRW8, emc_mrw8) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_4, emc_pmacro_ob_ddll_long_dq_rank1_4) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_5, emc_pmacro_ob_ddll_long_dq_rank1_5) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_0, emc_pmacro_ob_ddll_long_dqs_rank0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_1, emc_pmacro_ob_ddll_long_dqs_rank0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_2, emc_pmacro_ob_ddll_long_dqs_rank0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_3, emc_pmacro_ob_ddll_long_dqs_rank0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_4, emc_pmacro_ob_ddll_long_dqs_rank0_4) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_5, emc_pmacro_ob_ddll_long_dqs_rank0_5) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_0, emc_pmacro_ob_ddll_long_dqs_rank1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_1, emc_pmacro_ob_ddll_long_dqs_rank1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_2, emc_pmacro_ob_ddll_long_dqs_rank1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_3, emc_pmacro_ob_ddll_long_dqs_rank1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_4, emc_pmacro_ob_ddll_long_dqs_rank1_4) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_5, emc_pmacro_ob_ddll_long_dqs_rank1_5) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_0, emc_pmacro_ddll_long_cmd_0) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_1, emc_pmacro_ddll_long_cmd_1) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_2, emc_pmacro_ddll_long_cmd_2) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_3, emc_pmacro_ddll_long_cmd_3) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_4, emc_pmacro_ddll_long_cmd_4) \
HANDLER(EMC, EMC_PMACRO_DDLL_SHORT_CMD_0, emc_pmacro_ddll_short_cmd_0) \
HANDLER(EMC, EMC_PMACRO_DDLL_SHORT_CMD_1, emc_pmacro_ddll_short_cmd_1) \
HANDLER(EMC, EMC_PMACRO_DDLL_SHORT_CMD_2, emc_pmacro_ddll_short_cmd_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE0_3, emc_pmacro_ob_ddll_short_dq_rank0_byte0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE1_3, emc_pmacro_ob_ddll_short_dq_rank0_byte1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE2_3, emc_pmacro_ob_ddll_short_dq_rank0_byte2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE3_3, emc_pmacro_ob_ddll_short_dq_rank0_byte3_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE4_3, emc_pmacro_ob_ddll_short_dq_rank0_byte4_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE5_3, emc_pmacro_ob_ddll_short_dq_rank0_byte5_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE6_3, emc_pmacro_ob_ddll_short_dq_rank0_byte6_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE7_3, emc_pmacro_ob_ddll_short_dq_rank0_byte7_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD0_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD1_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD2_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD3_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd3_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE0_3, emc_pmacro_ob_ddll_short_dq_rank1_byte0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE1_3, emc_pmacro_ob_ddll_short_dq_rank1_byte1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE2_3, emc_pmacro_ob_ddll_short_dq_rank1_byte2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE3_3, emc_pmacro_ob_ddll_short_dq_rank1_byte3_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE4_3, emc_pmacro_ob_ddll_short_dq_rank1_byte4_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE5_3, emc_pmacro_ob_ddll_short_dq_rank1_byte5_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE6_3, emc_pmacro_ob_ddll_short_dq_rank1_byte6_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE7_3, emc_pmacro_ob_ddll_short_dq_rank1_byte7_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_3) \
HANDLER(EMC, EMC_TXDSRVTTGEN, emc_txdsrvttgen) \
HANDLER(EMC, EMC_FDPD_CTRL_DQ, emc_fdpd_ctrl_dq) \
HANDLER(EMC, EMC_FDPD_CTRL_CMD, emc_fdpd_ctrl_cmd) \
HANDLER(EMC, EMC_FBIO_SPARE, emc_fbio_spare) \
HANDLER(EMC, EMC_ZCAL_INTERVAL, emc_zcal_interval) \
HANDLER(EMC, EMC_ZCAL_WAIT_CNT, emc_zcal_wait_cnt) \
HANDLER(EMC, EMC_MRS_WAIT_CNT, emc_mrs_wait_cnt) \
HANDLER(EMC, EMC_MRS_WAIT_CNT2, emc_mrs_wait_cnt2) \
HANDLER(EMC, EMC_AUTO_CAL_CHANNEL, emc_auto_cal_channel) \
HANDLER(EMC, EMC_DLL_CFG_0, emc_dll_cfg_0) \
HANDLER(EMC, EMC_DLL_CFG_1, emc_dll_cfg_1) \
HANDLER(EMC, EMC_PMACRO_AUTOCAL_CFG_COMMON, emc_pmacro_autocal_cfg_common) \
HANDLER(EMC, EMC_PMACRO_ZCTRL, emc_pmacro_zctrl) \
HANDLER(EMC, EMC_CFG, emc_cfg) \
HANDLER(EMC, EMC_CFG_PIPE, emc_cfg_pipe) \
HANDLER(EMC, EMC_DYN_SELF_REF_CONTROL, emc_dyn_self_ref_control) \
HANDLER(EMC, EMC_QPOP, emc_qpop) \
HANDLER(EMC, EMC_DQS_BRLSHFT_0, emc_dqs_brlshft_0) \
HANDLER(EMC, EMC_DQS_BRLSHFT_1, emc_dqs_brlshft_1) \
HANDLER(EMC, EMC_CMD_BRLSHFT_2, emc_cmd_brlshft_2) \
HANDLER(EMC, EMC_CMD_BRLSHFT_3, emc_cmd_brlshft_3) \
HANDLER(EMC, EMC_PMACRO_PAD_CFG_CTRL, emc_pmacro_pad_cfg_ctrl) \
HANDLER(EMC, EMC_PMACRO_DATA_PAD_RX_CTRL, emc_pmacro_data_pad_rx_ctrl) \
HANDLER(EMC, EMC_PMACRO_CMD_PAD_RX_CTRL, emc_pmacro_cmd_pad_rx_ctrl) \
HANDLER(EMC, EMC_PMACRO_DATA_RX_TERM_MODE, emc_pmacro_data_rx_term_mode) \
HANDLER(EMC, EMC_PMACRO_CMD_RX_TERM_MODE, emc_pmacro_cmd_rx_term_mode) \
HANDLER(EMC, EMC_PMACRO_CMD_PAD_TX_CTRL, emc_pmacro_cmd_pad_tx_ctrl) \
HANDLER(EMC, EMC_PMACRO_DATA_PAD_TX_CTRL, emc_pmacro_data_pad_tx_ctrl) \
HANDLER(EMC, EMC_PMACRO_COMMON_PAD_TX_CTRL, emc_pmacro_common_pad_tx_ctrl) \
HANDLER(EMC, EMC_PMACRO_VTTGEN_CTRL_0, emc_pmacro_vttgen_ctrl_0) \
HANDLER(EMC, EMC_PMACRO_VTTGEN_CTRL_1, emc_pmacro_vttgen_ctrl_1) \
HANDLER(EMC, EMC_PMACRO_VTTGEN_CTRL_2, emc_pmacro_vttgen_ctrl_2) \
HANDLER(EMC, EMC_PMACRO_BRICK_CTRL_RFU1, emc_pmacro_brick_ctrl_rfu1) \
HANDLER(EMC, EMC_PMACRO_CMD_BRICK_CTRL_FDPD, emc_pmacro_cmd_brick_ctrl_fdpd) \
HANDLER(EMC, EMC_PMACRO_BRICK_CTRL_RFU2, emc_pmacro_brick_ctrl_rfu2) \
HANDLER(EMC, EMC_PMACRO_DATA_BRICK_CTRL_FDPD, emc_pmacro_data_brick_ctrl_fdpd) \
HANDLER(EMC, EMC_PMACRO_BG_BIAS_CTRL_0, emc_pmacro_bg_bias_ctrl_0) \
HANDLER(EMC, EMC_CFG_3, emc_cfg_3) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_0, emc_pmacro_tx_pwrd_0) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_1, emc_pmacro_tx_pwrd_1) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_2, emc_pmacro_tx_pwrd_2) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_3, emc_pmacro_tx_pwrd_3) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_4, emc_pmacro_tx_pwrd_4) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_5, emc_pmacro_tx_pwrd_5) \
HANDLER(EMC, EMC_CONFIG_SAMPLE_DELAY, emc_config_sample_delay) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_0, emc_pmacro_tx_sel_clk_src_0) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_1, emc_pmacro_tx_sel_clk_src_1) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_2, emc_pmacro_tx_sel_clk_src_2) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_3, emc_pmacro_tx_sel_clk_src_3) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_4, emc_pmacro_tx_sel_clk_src_4) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_5, emc_pmacro_tx_sel_clk_src_5) \
HANDLER(EMC, EMC_PMACRO_DDLL_BYPASS, emc_pmacro_ddll_bypass) \
HANDLER(EMC, EMC_PMACRO_DDLL_PWRD_0, emc_pmacro_ddll_pwrd_0) \
HANDLER(EMC, EMC_PMACRO_DDLL_PWRD_1, emc_pmacro_ddll_pwrd_1) \
HANDLER(EMC, EMC_PMACRO_DDLL_PWRD_2, emc_pmacro_ddll_pwrd_2) \
HANDLER(EMC, EMC_PMACRO_CMD_CTRL_0, emc_pmacro_cmd_ctrl_0) \
HANDLER(EMC, EMC_PMACRO_CMD_CTRL_1, emc_pmacro_cmd_ctrl_1) \
HANDLER(EMC, EMC_PMACRO_CMD_CTRL_2, emc_pmacro_cmd_ctrl_2) \
HANDLER(EMC, EMC_TR_TIMING_0, emc_tr_timing_0) \
HANDLER(EMC, EMC_TR_DVFS, emc_tr_dvfs) \
HANDLER(EMC, EMC_TR_CTRL_1, emc_tr_ctrl_1) \
HANDLER(EMC, EMC_TR_RDV, emc_tr_rdv) \
HANDLER(EMC, EMC_TR_QPOP, emc_tr_qpop) \
HANDLER(EMC, EMC_TR_RDV_MASK, emc_tr_rdv_mask) \
HANDLER(EMC, EMC_MRW14, emc_mrw14) \
HANDLER(EMC, EMC_TR_QSAFE, emc_tr_qsafe) \
HANDLER(EMC, EMC_TR_QRST, emc_tr_qrst) \
HANDLER(EMC, EMC_TRAINING_CTRL, emc_training_ctrl) \
HANDLER(EMC, EMC_TRAINING_SETTLE, emc_training_settle) \
HANDLER(EMC, EMC_TRAINING_VREF_SETTLE, emc_training_vref_settle) \
HANDLER(EMC, EMC_TRAINING_CA_FINE_CTRL, emc_training_ca_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_CA_CTRL_MISC, emc_training_ca_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_CA_CTRL_MISC1, emc_training_ca_ctrl_misc1) \
HANDLER(EMC, EMC_TRAINING_CA_VREF_CTRL, emc_training_ca_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_QUSE_CORS_CTRL, emc_training_quse_cors_ctrl) \
HANDLER(EMC, EMC_TRAINING_QUSE_FINE_CTRL, emc_training_quse_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_QUSE_CTRL_MISC, emc_training_quse_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_QUSE_VREF_CTRL, emc_training_quse_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_READ_FINE_CTRL, emc_training_read_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_READ_CTRL_MISC, emc_training_read_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_READ_VREF_CTRL, emc_training_read_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_WRITE_FINE_CTRL, emc_training_write_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_WRITE_CTRL_MISC, emc_training_write_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_WRITE_VREF_CTRL, emc_training_write_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_MPC, emc_training_mpc) \
HANDLER(EMC, EMC_MRW15, emc_mrw15)
#define DECLARE_STRUCT_MEMBER_HANDLER(BASE, REG, NAME) uint32_t NAME;
#define DECLARE_ARRAY_AND_STRUCT_MEMBERS(NAME, FOREACH_HANDLER) \
union { struct { FOREACH_HANDLER(DECLARE_STRUCT_MEMBER_HANDLER) } NAME; uint32_t NAME##_arr[sizeof(NAME) / sizeof(uint32_t)]; }
struct EmcDvfsTimingTable {
uint32_t rev;
char dvfs_ver[60];
uint32_t rate_khz;
uint32_t min_volt;
uint32_t gpu_min_volt;
char clock_src[32];
uint32_t clk_src_emc;
uint32_t needs_training;
uint32_t training_pattern;
uint32_t trained;
uint32_t periodic_training;
uint32_t trained_dram_clktree_c0d0u0;
uint32_t trained_dram_clktree_c0d0u1;
uint32_t trained_dram_clktree_c0d1u0;
uint32_t trained_dram_clktree_c0d1u1;
uint32_t trained_dram_clktree_c1d0u0;
uint32_t trained_dram_clktree_c1d0u1;
uint32_t trained_dram_clktree_c1d1u0;
uint32_t trained_dram_clktree_c1d1u1;
uint32_t current_dram_clktree_c0d0u0;
uint32_t current_dram_clktree_c0d0u1;
uint32_t current_dram_clktree_c0d1u0;
uint32_t current_dram_clktree_c0d1u1;
uint32_t current_dram_clktree_c1d0u0;
uint32_t current_dram_clktree_c1d0u1;
uint32_t current_dram_clktree_c1d1u0;
uint32_t current_dram_clktree_c1d1u1;
uint32_t run_clocks;
uint32_t tree_margin;
uint32_t num_burst;
uint32_t num_burst_per_ch;
uint32_t num_trim;
uint32_t num_trim_per_ch;
uint32_t num_mc_regs;
uint32_t num_up_down;
uint32_t vref_num;
uint32_t training_mod_num;
uint32_t dram_timing_num;
uint32_t ptfv_dqsosc_movavg_c0d0u0;
uint32_t ptfv_dqsosc_movavg_c0d0u1;
uint32_t ptfv_dqsosc_movavg_c0d1u0;
uint32_t ptfv_dqsosc_movavg_c0d1u1;
uint32_t ptfv_dqsosc_movavg_c1d0u0;
uint32_t ptfv_dqsosc_movavg_c1d0u1;
uint32_t ptfv_dqsosc_movavg_c1d1u0;
uint32_t ptfv_dqsosc_movavg_c1d1u1;
uint32_t ptfv_write_samples;
uint32_t ptfv_dvfs_samples;
uint32_t ptfv_movavg_weight;
uint32_t ptfv_config_ctrl;
DECLARE_ARRAY_AND_STRUCT_MEMBERS(burst_regs, FOREACH_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(burst_perch_regs, FOREACH_PER_CHANNEL_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(shadow_regs_ca_train, FOREACH_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(shadow_regs_quse_train, FOREACH_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(shadow_regs_rdwr_train, FOREACH_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(trim_regs, FOREACH_TRIM_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(trim_perch_regs, FOREACH_PER_CHANNEL_TRIM_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(vref_perch_regs, FOREACH_PER_CHANNEL_VREF_REG);
struct {
uint32_t t_rp;
uint32_t t_fc_lpddr4;
uint32_t t_rfc;
uint32_t t_pdex;
uint32_t rl;
} dram_timings;
DECLARE_ARRAY_AND_STRUCT_MEMBERS(training_mod_regs, FOREACH_PER_CHANNEL_TRAINING_MOD_REG);
uint32_t save_restore_mod_regs[12];
DECLARE_ARRAY_AND_STRUCT_MEMBERS(burst_mc_regs, FOREACH_BURST_MC_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(la_scale_regs, FOREACH_LA_SCALE_REG);
uint32_t min_mrs_wait;
uint32_t emc_mrw;
uint32_t emc_mrw2;
uint32_t emc_mrw3;
uint32_t emc_mrw4;
uint32_t emc_mrw9;
uint32_t emc_mrs;
uint32_t emc_emrs;
uint32_t emc_emrs2;
uint32_t emc_auto_cal_config;
uint32_t emc_auto_cal_config2;
uint32_t emc_auto_cal_config3;
uint32_t emc_auto_cal_config4;
uint32_t emc_auto_cal_config5;
uint32_t emc_auto_cal_config6;
uint32_t emc_auto_cal_config7;
uint32_t emc_auto_cal_config8;
uint32_t emc_cfg_2;
uint32_t emc_sel_dpd_ctrl;
uint32_t emc_fdpd_ctrl_cmd_no_ramp;
uint32_t dll_clk_src;
uint32_t clk_out_enb_x_0_clk_enb_emc_dll;
uint32_t latency;
};
#undef DECLARE_STRUCT_MEMBER_HANDLER
#undef DECLARE_ARRAY_AND_STRUCT_MEMBERS
static_assert(sizeof(EmcDvfsTimingTable) == 0x1340);
}
| 29,177
|
C++
|
.h
| 342
| 76.725146
| 135
| 0.468874
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,478
|
fusee_mtc_timing_table_common.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/mtc/fusee_mtc_timing_table_common.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::nxboot {
#define MC_BASE (0x70019000)
#define EMC_BASE (0x7001B000)
#define EMC0_BASE (0x7001E000)
#define EMC1_BASE (0x7001F000)
enum {
PLLM_OUT0 = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_PLLM_OUT0,
PLLC_OUT0 = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_PLLC_OUT0,
PLLP_OUT0 = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_PLLP_OUT0,
CLK_M = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_CLK_M,
PLLM_UD = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_PLLM_UD,
PLLMB_UD = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_PLLMB_UD,
PLLMB_OUT0 = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_PLLMB_OUT0,
PLLP_UD = CLK_RST_CONTROLLER_CLK_SOURCE_EMC_EMC_2X_CLK_SRC_PLLP_UD
};
enum {
ONE_RANK = 1,
TWO_RANK = 2,
};
enum {
DLL_OFF = 0,
DLL_ON = 1,
};
enum {
AUTO_PD = 0,
MAN_SR = 2,
};
enum {
NO_TRAINING = (0 << 0),
CA_TRAINING = (1 << 0),
CA_VREF_TRAINING = (1 << 1),
QUSE_TRAINING = (1 << 2),
QUSE_VREF_TRAINING = (1 << 3),
WRITE_TRAINING = (1 << 4),
WRITE_VREF_TRAINING = (1 << 5),
READ_TRAINING = (1 << 6),
READ_VREF_TRAINING = (1 << 7),
TRAIN_SECOND_RANK = (1 << 8),
BIT_LEVEL_TRAINING = (1 << 9),
};
enum {
DRAM_TYPE_DDR4 = EMC_FBIO_CFG5_DRAM_TYPE_DDR4,
DRAM_TYPE_LPDDR4 = EMC_FBIO_CFG5_DRAM_TYPE_LPDDR4,
DRAM_TYPE_LPDDR2 = EMC_FBIO_CFG5_DRAM_TYPE_LPDDR2,
DRAM_TYPE_DDR2 = EMC_FBIO_CFG5_DRAM_TYPE_DDR2
};
enum {
ASSEMBLY = EMC_DBG_WRITE_MUX_ASSEMBLY,
ACTIVE = EMC_DBG_WRITE_MUX_ACTIVE,
};
enum {
DVFS_SEQUENCE = 1,
WRITE_TRAINING_SEQUENCE = 2,
PERIODIC_TRAINING_SEQUENCE = 3,
DVFS_PT1 = 10,
DVFS_UPDATE = 11,
TRAINING_PT1 = 12,
TRAINING_UPDATE = 13,
PERIODIC_TRAINING_UPDATE = 14,
};
/*
* Do arithmetic in fixed point.
*/
#define MOVAVG_PRECISION_FACTOR 100
/*
* The division portion of the average operation.
*/
#define __AVERAGE_PTFV(dev) \
({ dst_timing->ptfv_dqsosc_movavg_##dev = \
dst_timing->ptfv_dqsosc_movavg_##dev / \
dst_timing->ptfv_dvfs_samples; })
/*
* The division portion of the average write operation.
*/
#define __AVERAGE_WRITE_PTFV(dev) \
({ dst_timing->ptfv_dqsosc_movavg_##dev = \
dst_timing->ptfv_dqsosc_movavg_##dev / \
dst_timing->ptfv_write_samples; })
/*
* Convert val to fixed point and add it to the temporary average.
*/
#define __INCREMENT_PTFV(dev, val) \
({ dst_timing->ptfv_dqsosc_movavg_##dev += \
((val) * MOVAVG_PRECISION_FACTOR); })
/*
* Convert a moving average back to integral form and return the value.
*/
#define __MOVAVG_AC(timing, dev) \
((timing)->ptfv_dqsosc_movavg_##dev / \
MOVAVG_PRECISION_FACTOR)
/* Weighted update. */
#define __WEIGHTED_UPDATE_PTFV(dev, nval) \
do { \
dst_timing->ptfv_dqsosc_movavg_##dev = \
((nval * MOVAVG_PRECISION_FACTOR) + \
(dst_timing->ptfv_dqsosc_movavg_##dev * \
dst_timing->ptfv_movavg_weight)) / \
(dst_timing->ptfv_movavg_weight + 1); \
} while (0)
/* Access a particular average. */
#define __MOVAVG(timing, dev) \
((timing)->ptfv_dqsosc_movavg_##dev)
#define FOREACH_PER_CHANNEL_BURST_REG(HANDLER) \
HANDLER(EMC0, EMC_MRW10, emc0_mrw10) \
HANDLER(EMC1, EMC_MRW10, emc1_mrw10) \
HANDLER(EMC0, EMC_MRW11, emc0_mrw11) \
HANDLER(EMC1, EMC_MRW11, emc1_mrw11) \
HANDLER(EMC0, EMC_MRW12, emc0_mrw12) \
HANDLER(EMC1, EMC_MRW12, emc1_mrw12) \
HANDLER(EMC0, EMC_MRW13, emc0_mrw13) \
HANDLER(EMC1, EMC_MRW13, emc1_mrw13) \
#define FOREACH_TRIM_REG(HANDLER) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK0_0, emc_pmacro_ib_ddll_long_dqs_rank0_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK0_1, emc_pmacro_ib_ddll_long_dqs_rank0_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK0_2, emc_pmacro_ib_ddll_long_dqs_rank0_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK0_3, emc_pmacro_ib_ddll_long_dqs_rank0_3) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK1_0, emc_pmacro_ib_ddll_long_dqs_rank1_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK1_1, emc_pmacro_ib_ddll_long_dqs_rank1_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK1_2, emc_pmacro_ib_ddll_long_dqs_rank1_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_LONG_DQS_RANK1_3, emc_pmacro_ib_ddll_long_dqs_rank1_3) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE0_0, emc_pmacro_ib_ddll_short_dq_rank0_byte0_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE0_1, emc_pmacro_ib_ddll_short_dq_rank0_byte0_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE0_2, emc_pmacro_ib_ddll_short_dq_rank0_byte0_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE1_0, emc_pmacro_ib_ddll_short_dq_rank0_byte1_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE1_1, emc_pmacro_ib_ddll_short_dq_rank0_byte1_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE1_2, emc_pmacro_ib_ddll_short_dq_rank0_byte1_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE2_0, emc_pmacro_ib_ddll_short_dq_rank0_byte2_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE2_1, emc_pmacro_ib_ddll_short_dq_rank0_byte2_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE2_2, emc_pmacro_ib_ddll_short_dq_rank0_byte2_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE3_0, emc_pmacro_ib_ddll_short_dq_rank0_byte3_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE3_1, emc_pmacro_ib_ddll_short_dq_rank0_byte3_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE3_2, emc_pmacro_ib_ddll_short_dq_rank0_byte3_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE4_0, emc_pmacro_ib_ddll_short_dq_rank0_byte4_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE4_1, emc_pmacro_ib_ddll_short_dq_rank0_byte4_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE4_2, emc_pmacro_ib_ddll_short_dq_rank0_byte4_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE5_0, emc_pmacro_ib_ddll_short_dq_rank0_byte5_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE5_1, emc_pmacro_ib_ddll_short_dq_rank0_byte5_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE5_2, emc_pmacro_ib_ddll_short_dq_rank0_byte5_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE6_0, emc_pmacro_ib_ddll_short_dq_rank0_byte6_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE6_1, emc_pmacro_ib_ddll_short_dq_rank0_byte6_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE6_2, emc_pmacro_ib_ddll_short_dq_rank0_byte6_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE7_0, emc_pmacro_ib_ddll_short_dq_rank0_byte7_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE7_1, emc_pmacro_ib_ddll_short_dq_rank0_byte7_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK0_BYTE7_2, emc_pmacro_ib_ddll_short_dq_rank0_byte7_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE0_0, emc_pmacro_ib_ddll_short_dq_rank1_byte0_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE0_1, emc_pmacro_ib_ddll_short_dq_rank1_byte0_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE0_2, emc_pmacro_ib_ddll_short_dq_rank1_byte0_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE1_0, emc_pmacro_ib_ddll_short_dq_rank1_byte1_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE1_1, emc_pmacro_ib_ddll_short_dq_rank1_byte1_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE1_2, emc_pmacro_ib_ddll_short_dq_rank1_byte1_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE2_0, emc_pmacro_ib_ddll_short_dq_rank1_byte2_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE2_1, emc_pmacro_ib_ddll_short_dq_rank1_byte2_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE2_2, emc_pmacro_ib_ddll_short_dq_rank1_byte2_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE3_0, emc_pmacro_ib_ddll_short_dq_rank1_byte3_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE3_1, emc_pmacro_ib_ddll_short_dq_rank1_byte3_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE3_2, emc_pmacro_ib_ddll_short_dq_rank1_byte3_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE4_0, emc_pmacro_ib_ddll_short_dq_rank1_byte4_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE4_1, emc_pmacro_ib_ddll_short_dq_rank1_byte4_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE4_2, emc_pmacro_ib_ddll_short_dq_rank1_byte4_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE5_0, emc_pmacro_ib_ddll_short_dq_rank1_byte5_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE5_1, emc_pmacro_ib_ddll_short_dq_rank1_byte5_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE5_2, emc_pmacro_ib_ddll_short_dq_rank1_byte5_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE6_0, emc_pmacro_ib_ddll_short_dq_rank1_byte6_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE6_1, emc_pmacro_ib_ddll_short_dq_rank1_byte6_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE6_2, emc_pmacro_ib_ddll_short_dq_rank1_byte6_2) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE7_0, emc_pmacro_ib_ddll_short_dq_rank1_byte7_0) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE7_1, emc_pmacro_ib_ddll_short_dq_rank1_byte7_1) \
HANDLER(EMC, EMC_PMACRO_IB_DDLL_SHORT_DQ_RANK1_BYTE7_2, emc_pmacro_ib_ddll_short_dq_rank1_byte7_2) \
HANDLER(EMC, EMC_PMACRO_IB_VREF_DQS_0, emc_pmacro_ib_vref_dqs_0) \
HANDLER(EMC, EMC_PMACRO_IB_VREF_DQS_1, emc_pmacro_ib_vref_dqs_1) \
HANDLER(EMC, EMC_PMACRO_IB_VREF_DQ_0, emc_pmacro_ib_vref_dq_0) \
HANDLER(EMC, EMC_PMACRO_IB_VREF_DQ_1, emc_pmacro_ib_vref_dq_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0, emc_pmacro_ob_ddll_long_dq_rank0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1, emc_pmacro_ob_ddll_long_dq_rank0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2, emc_pmacro_ob_ddll_long_dq_rank0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_3, emc_pmacro_ob_ddll_long_dq_rank0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_4, emc_pmacro_ob_ddll_long_dq_rank0_4) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_5, emc_pmacro_ob_ddll_long_dq_rank0_5) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_0, emc_pmacro_ob_ddll_long_dq_rank1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_1, emc_pmacro_ob_ddll_long_dq_rank1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_2, emc_pmacro_ob_ddll_long_dq_rank1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_3, emc_pmacro_ob_ddll_long_dq_rank1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE0_0, emc_pmacro_ob_ddll_short_dq_rank0_byte0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE0_1, emc_pmacro_ob_ddll_short_dq_rank0_byte0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE0_2, emc_pmacro_ob_ddll_short_dq_rank0_byte0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE1_0, emc_pmacro_ob_ddll_short_dq_rank0_byte1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE1_1, emc_pmacro_ob_ddll_short_dq_rank0_byte1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE1_2, emc_pmacro_ob_ddll_short_dq_rank0_byte1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE2_0, emc_pmacro_ob_ddll_short_dq_rank0_byte2_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE2_1, emc_pmacro_ob_ddll_short_dq_rank0_byte2_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE2_2, emc_pmacro_ob_ddll_short_dq_rank0_byte2_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE3_0, emc_pmacro_ob_ddll_short_dq_rank0_byte3_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE3_1, emc_pmacro_ob_ddll_short_dq_rank0_byte3_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE3_2, emc_pmacro_ob_ddll_short_dq_rank0_byte3_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE4_0, emc_pmacro_ob_ddll_short_dq_rank0_byte4_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE4_1, emc_pmacro_ob_ddll_short_dq_rank0_byte4_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE4_2, emc_pmacro_ob_ddll_short_dq_rank0_byte4_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE5_0, emc_pmacro_ob_ddll_short_dq_rank0_byte5_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE5_1, emc_pmacro_ob_ddll_short_dq_rank0_byte5_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE5_2, emc_pmacro_ob_ddll_short_dq_rank0_byte5_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE6_0, emc_pmacro_ob_ddll_short_dq_rank0_byte6_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE6_1, emc_pmacro_ob_ddll_short_dq_rank0_byte6_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE6_2, emc_pmacro_ob_ddll_short_dq_rank0_byte6_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE7_0, emc_pmacro_ob_ddll_short_dq_rank0_byte7_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE7_1, emc_pmacro_ob_ddll_short_dq_rank0_byte7_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE7_2, emc_pmacro_ob_ddll_short_dq_rank0_byte7_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD0_0, emc_pmacro_ob_ddll_short_dq_rank0_cmd0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD0_1, emc_pmacro_ob_ddll_short_dq_rank0_cmd0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD0_2, emc_pmacro_ob_ddll_short_dq_rank0_cmd0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD1_0, emc_pmacro_ob_ddll_short_dq_rank0_cmd1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD1_1, emc_pmacro_ob_ddll_short_dq_rank0_cmd1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD1_2, emc_pmacro_ob_ddll_short_dq_rank0_cmd1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD2_0, emc_pmacro_ob_ddll_short_dq_rank0_cmd2_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD2_1, emc_pmacro_ob_ddll_short_dq_rank0_cmd2_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD2_2, emc_pmacro_ob_ddll_short_dq_rank0_cmd2_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD3_0, emc_pmacro_ob_ddll_short_dq_rank0_cmd3_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD3_1, emc_pmacro_ob_ddll_short_dq_rank0_cmd3_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD3_2, emc_pmacro_ob_ddll_short_dq_rank0_cmd3_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE0_0, emc_pmacro_ob_ddll_short_dq_rank1_byte0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE0_1, emc_pmacro_ob_ddll_short_dq_rank1_byte0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE0_2, emc_pmacro_ob_ddll_short_dq_rank1_byte0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE1_0, emc_pmacro_ob_ddll_short_dq_rank1_byte1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE1_1, emc_pmacro_ob_ddll_short_dq_rank1_byte1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE1_2, emc_pmacro_ob_ddll_short_dq_rank1_byte1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE2_0, emc_pmacro_ob_ddll_short_dq_rank1_byte2_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE2_1, emc_pmacro_ob_ddll_short_dq_rank1_byte2_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE2_2, emc_pmacro_ob_ddll_short_dq_rank1_byte2_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE3_0, emc_pmacro_ob_ddll_short_dq_rank1_byte3_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE3_1, emc_pmacro_ob_ddll_short_dq_rank1_byte3_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE3_2, emc_pmacro_ob_ddll_short_dq_rank1_byte3_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE4_0, emc_pmacro_ob_ddll_short_dq_rank1_byte4_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE4_1, emc_pmacro_ob_ddll_short_dq_rank1_byte4_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE4_2, emc_pmacro_ob_ddll_short_dq_rank1_byte4_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE5_0, emc_pmacro_ob_ddll_short_dq_rank1_byte5_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE5_1, emc_pmacro_ob_ddll_short_dq_rank1_byte5_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE5_2, emc_pmacro_ob_ddll_short_dq_rank1_byte5_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE6_0, emc_pmacro_ob_ddll_short_dq_rank1_byte6_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE6_1, emc_pmacro_ob_ddll_short_dq_rank1_byte6_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE6_2, emc_pmacro_ob_ddll_short_dq_rank1_byte6_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE7_0, emc_pmacro_ob_ddll_short_dq_rank1_byte7_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE7_1, emc_pmacro_ob_ddll_short_dq_rank1_byte7_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE7_2, emc_pmacro_ob_ddll_short_dq_rank1_byte7_2) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_0, emc_pmacro_quse_ddll_rank0_0) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_1, emc_pmacro_quse_ddll_rank0_1) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_2, emc_pmacro_quse_ddll_rank0_2) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_3, emc_pmacro_quse_ddll_rank0_3) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_0, emc_pmacro_quse_ddll_rank1_0) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_1, emc_pmacro_quse_ddll_rank1_1) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_2, emc_pmacro_quse_ddll_rank1_2) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_3, emc_pmacro_quse_ddll_rank1_3)
#define FOREACH_PER_CHANNEL_TRIM_REG(HANDLER) \
HANDLER(EMC0, EMC_CMD_BRLSHFT_0, emc0_cmd_brlshft_0) \
HANDLER(EMC1, EMC_CMD_BRLSHFT_1, emc1_cmd_brlshft_1) \
HANDLER(EMC0, EMC_DATA_BRLSHFT_0, emc0_data_brlshft_0) \
HANDLER(EMC1, EMC_DATA_BRLSHFT_0, emc1_data_brlshft_0) \
HANDLER(EMC0, EMC_DATA_BRLSHFT_1, emc0_data_brlshft_1) \
HANDLER(EMC1, EMC_DATA_BRLSHFT_1, emc1_data_brlshft_1) \
HANDLER(EMC0, EMC_QUSE_BRLSHFT_0, emc0_quse_brlshft_0) \
HANDLER(EMC1, EMC_QUSE_BRLSHFT_1, emc1_quse_brlshft_1) \
HANDLER(EMC0, EMC_QUSE_BRLSHFT_2, emc0_quse_brlshft_2) \
HANDLER(EMC1, EMC_QUSE_BRLSHFT_3, emc1_quse_brlshft_3)
#define FOREACH_PER_CHANNEL_VREF_REG(HANDLER) \
HANDLER(EMC0, EMC_TRAINING_OPT_DQS_IB_VREF_RANK0, emc0_training_opt_dqs_ib_vref_rank0) \
HANDLER(EMC1, EMC_TRAINING_OPT_DQS_IB_VREF_RANK0, emc1_training_opt_dqs_ib_vref_rank0) \
HANDLER(EMC0, EMC_TRAINING_OPT_DQS_IB_VREF_RANK1, emc0_training_opt_dqs_ib_vref_rank1) \
HANDLER(EMC1, EMC_TRAINING_OPT_DQS_IB_VREF_RANK1, emc1_training_opt_dqs_ib_vref_rank1)
#define FOREACH_PER_CHANNEL_TRAINING_MOD_REG(HANDLER) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_IB_BYTE0, emc0_training_rw_offset_ib_byte0) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_IB_BYTE0, emc1_training_rw_offset_ib_byte0) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_IB_BYTE1, emc0_training_rw_offset_ib_byte1) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_IB_BYTE1, emc1_training_rw_offset_ib_byte1) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_IB_BYTE2, emc0_training_rw_offset_ib_byte2) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_IB_BYTE2, emc1_training_rw_offset_ib_byte2) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_IB_BYTE3, emc0_training_rw_offset_ib_byte3) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_IB_BYTE3, emc1_training_rw_offset_ib_byte3) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_IB_MISC, emc0_training_rw_offset_ib_misc) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_IB_MISC, emc1_training_rw_offset_ib_misc) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_OB_BYTE0, emc0_training_rw_offset_ob_byte0) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_OB_BYTE0, emc1_training_rw_offset_ob_byte0) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_OB_BYTE1, emc0_training_rw_offset_ob_byte1) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_OB_BYTE1, emc1_training_rw_offset_ob_byte1) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_OB_BYTE2, emc0_training_rw_offset_ob_byte2) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_OB_BYTE2, emc1_training_rw_offset_ob_byte2) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_OB_BYTE3, emc0_training_rw_offset_ob_byte3) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_OB_BYTE3, emc1_training_rw_offset_ob_byte3) \
HANDLER(EMC0, EMC_TRAINING_RW_OFFSET_OB_MISC, emc0_training_rw_offset_ob_misc) \
HANDLER(EMC1, EMC_TRAINING_RW_OFFSET_OB_MISC, emc1_training_rw_offset_ob_misc)
#define FOREACH_BURST_MC_REG(HANDLER) \
HANDLER(MC, MC_EMEM_ARB_CFG, mc_emem_arb_cfg) \
HANDLER(MC, MC_EMEM_ARB_OUTSTANDING_REQ, mc_emem_arb_outstanding_req) \
HANDLER(MC, MC_EMEM_ARB_REFPB_HP_CTRL, mc_emem_arb_refpb_hp_ctrl) \
HANDLER(MC, MC_EMEM_ARB_REFPB_BANK_CTRL, mc_emem_arb_refpb_bank_ctrl) \
HANDLER(MC, MC_EMEM_ARB_TIMING_RCD, mc_emem_arb_timing_rcd) \
HANDLER(MC, MC_EMEM_ARB_TIMING_RP, mc_emem_arb_timing_rp) \
HANDLER(MC, MC_EMEM_ARB_TIMING_RC, mc_emem_arb_timing_rc) \
HANDLER(MC, MC_EMEM_ARB_TIMING_RAS, mc_emem_arb_timing_ras) \
HANDLER(MC, MC_EMEM_ARB_TIMING_FAW, mc_emem_arb_timing_faw) \
HANDLER(MC, MC_EMEM_ARB_TIMING_RRD, mc_emem_arb_timing_rrd) \
HANDLER(MC, MC_EMEM_ARB_TIMING_RAP2PRE, mc_emem_arb_timing_rap2pre) \
HANDLER(MC, MC_EMEM_ARB_TIMING_WAP2PRE, mc_emem_arb_timing_wap2pre) \
HANDLER(MC, MC_EMEM_ARB_TIMING_R2R, mc_emem_arb_timing_r2r) \
HANDLER(MC, MC_EMEM_ARB_TIMING_W2W, mc_emem_arb_timing_w2w) \
HANDLER(MC, MC_EMEM_ARB_TIMING_R2W, mc_emem_arb_timing_r2w) \
HANDLER(MC, MC_EMEM_ARB_TIMING_CCDMW, mc_emem_arb_timing_ccdmw) \
HANDLER(MC, MC_EMEM_ARB_TIMING_W2R, mc_emem_arb_timing_w2r) \
HANDLER(MC, MC_EMEM_ARB_TIMING_RFCPB, mc_emem_arb_timing_rfcpb) \
HANDLER(MC, MC_EMEM_ARB_DA_TURNS, mc_emem_arb_da_turns) \
HANDLER(MC, MC_EMEM_ARB_DA_COVERS, mc_emem_arb_da_covers) \
HANDLER(MC, MC_EMEM_ARB_MISC0, mc_emem_arb_misc0) \
HANDLER(MC, MC_EMEM_ARB_MISC1, mc_emem_arb_misc1) \
HANDLER(MC, MC_EMEM_ARB_MISC2, mc_emem_arb_misc2) \
HANDLER(MC, MC_EMEM_ARB_RING1_THROTTLE, mc_emem_arb_ring1_throttle) \
HANDLER(MC, MC_EMEM_ARB_DHYST_CTRL, mc_emem_arb_dhyst_ctrl) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_0, mc_emem_arb_dhyst_timeout_util_0) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_1, mc_emem_arb_dhyst_timeout_util_1) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_2, mc_emem_arb_dhyst_timeout_util_2) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_3, mc_emem_arb_dhyst_timeout_util_3) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_4, mc_emem_arb_dhyst_timeout_util_4) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_5, mc_emem_arb_dhyst_timeout_util_5) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_6, mc_emem_arb_dhyst_timeout_util_6) \
HANDLER(MC, MC_EMEM_ARB_DHYST_TIMEOUT_UTIL_7, mc_emem_arb_dhyst_timeout_util_7)
#define FOREACH_LA_SCALE_REG(HANDLER) \
HANDLER(MC, MC_MLL_MPCORER_PTSA_RATE, mc_mll_mpcorer_ptsa_rate) \
HANDLER(MC, MC_FTOP_PTSA_RATE, mc_ftop_ptsa_rate) \
HANDLER(MC, MC_PTSA_GRANT_DECREMENT, mc_ptsa_grant_decrement) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_XUSB_0, mc_latency_allowance_xusb_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_XUSB_1, mc_latency_allowance_xusb_1) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_TSEC_0, mc_latency_allowance_tsec_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_SDMMCA_0, mc_latency_allowance_sdmmca_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_SDMMCAA_0, mc_latency_allowance_sdmmcaa_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_SDMMC_0, mc_latency_allowance_sdmmc_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_SDMMCAB_0, mc_latency_allowance_sdmmcab_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_PPCS_0, mc_latency_allowance_ppcs_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_PPCS_1, mc_latency_allowance_ppcs_1) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_MPCORE_0, mc_latency_allowance_mpcore_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_HC_0, mc_latency_allowance_hc_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_HC_1, mc_latency_allowance_hc_1) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_AVPC_0, mc_latency_allowance_avpc_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_GPU_0, mc_latency_allowance_gpu_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_GPU2_0, mc_latency_allowance_gpu2_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_NVENC_0, mc_latency_allowance_nvenc_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_NVDEC_0, mc_latency_allowance_nvdec_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_VIC_0, mc_latency_allowance_vic_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_VI2_0, mc_latency_allowance_vi2_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_ISP2_0, mc_latency_allowance_isp2_0) \
HANDLER(MC, MC_LATENCY_ALLOWANCE_ISP2_1, mc_latency_allowance_isp2_1)
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0_OB_DDLL_LONG_DQ_RANK0_BYTE1_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0_OB_DDLL_LONG_DQ_RANK0_BYTE1_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0_OB_DDLL_LONG_DQ_RANK0_BYTE1_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0_OB_DDLL_LONG_DQ_RANK0_BYTE0_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0_OB_DDLL_LONG_DQ_RANK0_BYTE0_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0_OB_DDLL_LONG_DQ_RANK0_BYTE0_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1_OB_DDLL_LONG_DQ_RANK0_BYTE3_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1_OB_DDLL_LONG_DQ_RANK0_BYTE3_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1_OB_DDLL_LONG_DQ_RANK0_BYTE3_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1_OB_DDLL_LONG_DQ_RANK0_BYTE2_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1_OB_DDLL_LONG_DQ_RANK0_BYTE2_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1_OB_DDLL_LONG_DQ_RANK0_BYTE2_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2_OB_DDLL_LONG_DQ_RANK0_BYTE5_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2_OB_DDLL_LONG_DQ_RANK0_BYTE5_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2_OB_DDLL_LONG_DQ_RANK0_BYTE5_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2_OB_DDLL_LONG_DQ_RANK0_BYTE4_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2_OB_DDLL_LONG_DQ_RANK0_BYTE4_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2_OB_DDLL_LONG_DQ_RANK0_BYTE4_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_3_OB_DDLL_LONG_DQ_RANK0_BYTE7_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_3_OB_DDLL_LONG_DQ_RANK0_BYTE7_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_3_OB_DDLL_LONG_DQ_RANK0_BYTE7_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_3_OB_DDLL_LONG_DQ_RANK0_BYTE6_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_3_OB_DDLL_LONG_DQ_RANK0_BYTE6_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_3_OB_DDLL_LONG_DQ_RANK0_BYTE6_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_0_OB_DDLL_LONG_DQ_RANK1_BYTE1_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_0_OB_DDLL_LONG_DQ_RANK1_BYTE1_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_0_OB_DDLL_LONG_DQ_RANK1_BYTE1_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_0_OB_DDLL_LONG_DQ_RANK1_BYTE0_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_0_OB_DDLL_LONG_DQ_RANK1_BYTE0_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_0_OB_DDLL_LONG_DQ_RANK1_BYTE0_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_1_OB_DDLL_LONG_DQ_RANK1_BYTE3_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_1_OB_DDLL_LONG_DQ_RANK1_BYTE3_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_1_OB_DDLL_LONG_DQ_RANK1_BYTE3_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_1_OB_DDLL_LONG_DQ_RANK1_BYTE2_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_1_OB_DDLL_LONG_DQ_RANK1_BYTE2_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_1_OB_DDLL_LONG_DQ_RANK1_BYTE2_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_2_OB_DDLL_LONG_DQ_RANK1_BYTE5_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_2_OB_DDLL_LONG_DQ_RANK1_BYTE5_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_2_OB_DDLL_LONG_DQ_RANK1_BYTE5_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_2_OB_DDLL_LONG_DQ_RANK1_BYTE4_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_2_OB_DDLL_LONG_DQ_RANK1_BYTE4_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_2_OB_DDLL_LONG_DQ_RANK1_BYTE4_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_3_OB_DDLL_LONG_DQ_RANK1_BYTE7_SHIFT \
16
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_3_OB_DDLL_LONG_DQ_RANK1_BYTE7_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_3_OB_DDLL_LONG_DQ_RANK1_BYTE7_SHIFT
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_3_OB_DDLL_LONG_DQ_RANK1_BYTE6_SHIFT \
0
#define EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_3_OB_DDLL_LONG_DQ_RANK1_BYTE6_MASK \
0x3ff << \
EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_3_OB_DDLL_LONG_DQ_RANK1_BYTE6_SHIFT
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE7_DATA_BRLSHFT_SHIFT 21
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE7_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE7_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE6_DATA_BRLSHFT_SHIFT 18
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE6_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE6_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE5_DATA_BRLSHFT_SHIFT 15
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE5_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE5_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE4_DATA_BRLSHFT_SHIFT 12
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE4_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE4_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE3_DATA_BRLSHFT_SHIFT 9
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE3_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE3_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE2_DATA_BRLSHFT_SHIFT 6
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE2_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE2_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE1_DATA_BRLSHFT_SHIFT 3
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE1_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE1_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE0_DATA_BRLSHFT_SHIFT 0
#define EMC_DATA_BRLSHFT_0_RANK0_BYTE0_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_0_RANK0_BYTE0_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE7_DATA_BRLSHFT_SHIFT 21
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE7_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE7_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE6_DATA_BRLSHFT_SHIFT 18
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE6_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE6_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE5_DATA_BRLSHFT_SHIFT 15
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE5_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE5_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE4_DATA_BRLSHFT_SHIFT 12
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE4_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE4_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE3_DATA_BRLSHFT_SHIFT 9
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE3_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE3_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE2_DATA_BRLSHFT_SHIFT 6
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE2_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE2_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE1_DATA_BRLSHFT_SHIFT 3
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE1_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE1_DATA_BRLSHFT_SHIFT)
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE0_DATA_BRLSHFT_SHIFT 0
#define EMC_DATA_BRLSHFT_1_RANK1_BYTE0_DATA_BRLSHFT_MASK \
(0x7 << EMC_DATA_BRLSHFT_1_RANK1_BYTE0_DATA_BRLSHFT_SHIFT)
}
| 36,597
|
C++
|
.h
| 492
| 66.398374
| 108
| 0.63472
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,479
|
fusee_mtc_timing_table_mariko.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/mtc/fusee_mtc_timing_table_mariko.hpp
|
/*
* 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 <exosphere.hpp>
#include "fusee_mtc_timing_table_common.hpp"
namespace ams::nxboot::mariko {
#define FOREACH_BURST_REG(HANDLER) \
HANDLER(EMC, EMC_RC, emc_rc) \
HANDLER(EMC, EMC_RFC, emc_rfc) \
HANDLER(EMC, EMC_RFCPB, emc_rfcpb) \
HANDLER(EMC, EMC_REFCTRL2, emc_refctrl2) \
HANDLER(EMC, EMC_RFC_SLR, emc_rfc_slr) \
HANDLER(EMC, EMC_RAS, emc_ras) \
HANDLER(EMC, EMC_RP, emc_rp) \
HANDLER(EMC, EMC_R2W, emc_r2w) \
HANDLER(EMC, EMC_W2R, emc_w2r) \
HANDLER(EMC, EMC_R2P, emc_r2p) \
HANDLER(EMC, EMC_W2P, emc_w2p) \
HANDLER(EMC, EMC_R2R, emc_r2r) \
HANDLER(EMC, EMC_TPPD, emc_tppd) \
HANDLER(EMC, EMC_TRTM, emc_trtm) \
HANDLER(EMC, EMC_TWTM, emc_twtm) \
HANDLER(EMC, EMC_TRATM, emc_tratm) \
HANDLER(EMC, EMC_TWATM, emc_twatm) \
HANDLER(EMC, EMC_TR2REF, emc_tr2ref) \
HANDLER(EMC, EMC_CCDMW, emc_ccdmw) \
HANDLER(EMC, EMC_RD_RCD, emc_rd_rcd) \
HANDLER(EMC, EMC_WR_RCD, emc_wr_rcd) \
HANDLER(EMC, EMC_RRD, emc_rrd) \
HANDLER(EMC, EMC_REXT, emc_rext) \
HANDLER(EMC, EMC_WEXT, emc_wext) \
HANDLER(EMC, EMC_WDV_CHK, emc_wdv_chk) \
HANDLER(EMC, EMC_WDV, emc_wdv) \
HANDLER(EMC, EMC_WSV, emc_wsv) \
HANDLER(EMC, EMC_WEV, emc_wev) \
HANDLER(EMC, EMC_WDV_MASK, emc_wdv_mask) \
HANDLER(EMC, EMC_WS_DURATION, emc_ws_duration) \
HANDLER(EMC, EMC_WE_DURATION, emc_we_duration) \
HANDLER(EMC, EMC_QUSE, emc_quse) \
HANDLER(EMC, EMC_QUSE_WIDTH, emc_quse_width) \
HANDLER(EMC, EMC_IBDLY, emc_ibdly) \
HANDLER(EMC, EMC_OBDLY, emc_obdly) \
HANDLER(EMC, EMC_EINPUT, emc_einput) \
HANDLER(EMC, EMC_MRW6, emc_mrw6) \
HANDLER(EMC, EMC_EINPUT_DURATION, emc_einput_duration) \
HANDLER(EMC, EMC_PUTERM_EXTRA, emc_puterm_extra) \
HANDLER(EMC, EMC_PUTERM_WIDTH, emc_puterm_width) \
HANDLER(EMC, EMC_QRST, emc_qrst) \
HANDLER(EMC, EMC_QSAFE, emc_qsafe) \
HANDLER(EMC, EMC_RDV, emc_rdv) \
HANDLER(EMC, EMC_RDV_MASK, emc_rdv_mask) \
HANDLER(EMC, EMC_RDV_EARLY, emc_rdv_early) \
HANDLER(EMC, EMC_RDV_EARLY_MASK, emc_rdv_early_mask) \
HANDLER(EMC, EMC_REFRESH, emc_refresh) \
HANDLER(EMC, EMC_BURST_REFRESH_NUM, emc_burst_refresh_num) \
HANDLER(EMC, EMC_PRE_REFRESH_REQ_CNT, emc_pre_refresh_req_cnt) \
HANDLER(EMC, EMC_PDEX2WR, emc_pdex2wr) \
HANDLER(EMC, EMC_PDEX2RD, emc_pdex2rd) \
HANDLER(EMC, EMC_PCHG2PDEN, emc_pchg2pden) \
HANDLER(EMC, EMC_ACT2PDEN, emc_act2pden) \
HANDLER(EMC, EMC_AR2PDEN, emc_ar2pden) \
HANDLER(EMC, EMC_RW2PDEN, emc_rw2pden) \
HANDLER(EMC, EMC_CKE2PDEN, emc_cke2pden) \
HANDLER(EMC, EMC_PDEX2CKE, emc_pdex2cke) \
HANDLER(EMC, EMC_PDEX2MRR, emc_pdex2mrr) \
HANDLER(EMC, EMC_TXSR, emc_txsr) \
HANDLER(EMC, EMC_TXSRDLL, emc_txsrdll) \
HANDLER(EMC, EMC_TCKE, emc_tcke) \
HANDLER(EMC, EMC_TCKESR, emc_tckesr) \
HANDLER(EMC, EMC_TPD, emc_tpd) \
HANDLER(EMC, EMC_TFAW, emc_tfaw) \
HANDLER(EMC, EMC_TRPAB, emc_trpab) \
HANDLER(EMC, EMC_TCLKSTABLE, emc_tclkstable) \
HANDLER(EMC, EMC_TCLKSTOP, emc_tclkstop) \
HANDLER(EMC, EMC_MRW7, emc_mrw7) \
HANDLER(EMC, EMC_TREFBW, emc_trefbw) \
HANDLER(EMC, EMC_ODT_WRITE, emc_odt_write) \
HANDLER(EMC, EMC_FBIO_CFG5, emc_fbio_cfg5) \
HANDLER(EMC, EMC_FBIO_CFG7, emc_fbio_cfg7) \
HANDLER(EMC, EMC_CFG_DIG_DLL, emc_cfg_dig_dll) \
HANDLER(EMC, EMC_CFG_DIG_DLL_PERIOD, emc_cfg_dig_dll_period) \
HANDLER(EMC, EMC_PMACRO_IB_RXRT, emc_pmacro_ib_rxrt) \
HANDLER(EMC, EMC_CFG_PIPE_1, emc_cfg_pipe_1) \
HANDLER(EMC, EMC_CFG_PIPE_2, emc_cfg_pipe_2) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_4, emc_pmacro_quse_ddll_rank0_4) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK0_5, emc_pmacro_quse_ddll_rank0_5) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_4, emc_pmacro_quse_ddll_rank1_4) \
HANDLER(EMC, EMC_PMACRO_QUSE_DDLL_RANK1_5, emc_pmacro_quse_ddll_rank1_5) \
HANDLER(EMC, EMC_MRW8, emc_mrw8) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_4, emc_pmacro_ob_ddll_long_dq_rank1_4) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQ_RANK1_5, emc_pmacro_ob_ddll_long_dq_rank1_5) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_0, emc_pmacro_ob_ddll_long_dqs_rank0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_1, emc_pmacro_ob_ddll_long_dqs_rank0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_2, emc_pmacro_ob_ddll_long_dqs_rank0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_3, emc_pmacro_ob_ddll_long_dqs_rank0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_4, emc_pmacro_ob_ddll_long_dqs_rank0_4) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK0_5, emc_pmacro_ob_ddll_long_dqs_rank0_5) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_0, emc_pmacro_ob_ddll_long_dqs_rank1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_1, emc_pmacro_ob_ddll_long_dqs_rank1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_2, emc_pmacro_ob_ddll_long_dqs_rank1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_3, emc_pmacro_ob_ddll_long_dqs_rank1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_4, emc_pmacro_ob_ddll_long_dqs_rank1_4) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_LONG_DQS_RANK1_5, emc_pmacro_ob_ddll_long_dqs_rank1_5) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_0, emc_pmacro_ddll_long_cmd_0) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_1, emc_pmacro_ddll_long_cmd_1) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_2, emc_pmacro_ddll_long_cmd_2) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_3, emc_pmacro_ddll_long_cmd_3) \
HANDLER(EMC, EMC_PMACRO_DDLL_LONG_CMD_4, emc_pmacro_ddll_long_cmd_4) \
HANDLER(EMC, EMC_PMACRO_DDLL_SHORT_CMD_0, emc_pmacro_ddll_short_cmd_0) \
HANDLER(EMC, EMC_PMACRO_DDLL_SHORT_CMD_1, emc_pmacro_ddll_short_cmd_1) \
HANDLER(EMC, EMC_PMACRO_DDLL_SHORT_CMD_2, emc_pmacro_ddll_short_cmd_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE0_3, emc_pmacro_ob_ddll_short_dq_rank0_byte0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE1_3, emc_pmacro_ob_ddll_short_dq_rank0_byte1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE2_3, emc_pmacro_ob_ddll_short_dq_rank0_byte2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE3_3, emc_pmacro_ob_ddll_short_dq_rank0_byte3_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE4_3, emc_pmacro_ob_ddll_short_dq_rank0_byte4_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE5_3, emc_pmacro_ob_ddll_short_dq_rank0_byte5_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE6_3, emc_pmacro_ob_ddll_short_dq_rank0_byte6_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_BYTE7_3, emc_pmacro_ob_ddll_short_dq_rank0_byte7_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD0_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD1_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD2_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK0_CMD3_3, emc_pmacro_ob_ddll_short_dq_rank0_cmd3_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE0_3, emc_pmacro_ob_ddll_short_dq_rank1_byte0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE1_3, emc_pmacro_ob_ddll_short_dq_rank1_byte1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE2_3, emc_pmacro_ob_ddll_short_dq_rank1_byte2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE3_3, emc_pmacro_ob_ddll_short_dq_rank1_byte3_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE4_3, emc_pmacro_ob_ddll_short_dq_rank1_byte4_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE5_3, emc_pmacro_ob_ddll_short_dq_rank1_byte5_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE6_3, emc_pmacro_ob_ddll_short_dq_rank1_byte6_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_BYTE7_3, emc_pmacro_ob_ddll_short_dq_rank1_byte7_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD0_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd0_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD1_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd1_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD2_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd2_3) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_0, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_0) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_1, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_1) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_2, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_2) \
HANDLER(EMC, EMC_PMACRO_OB_DDLL_SHORT_DQ_RANK1_CMD3_3, emc_pmacro_ob_ddll_short_dq_rank1_cmd3_3) \
HANDLER(EMC, EMC_TXDSRVTTGEN, emc_txdsrvttgen) \
HANDLER(EMC, EMC_FDPD_CTRL_DQ, emc_fdpd_ctrl_dq) \
HANDLER(EMC, EMC_FDPD_CTRL_CMD, emc_fdpd_ctrl_cmd) \
HANDLER(EMC, EMC_FBIO_SPARE, emc_fbio_spare) \
HANDLER(EMC, EMC_ZCAL_INTERVAL, emc_zcal_interval) \
HANDLER(EMC, EMC_ZCAL_WAIT_CNT, emc_zcal_wait_cnt) \
HANDLER(EMC, EMC_MRS_WAIT_CNT, emc_mrs_wait_cnt) \
HANDLER(EMC, EMC_MRS_WAIT_CNT2, emc_mrs_wait_cnt2) \
HANDLER(EMC, EMC_AUTO_CAL_CHANNEL, emc_auto_cal_channel) \
HANDLER(EMC, EMC_PMACRO_DLL_CFG_0, emc_pmacro_dll_cfg_0) \
HANDLER(EMC, EMC_PMACRO_DLL_CFG_1, emc_pmacro_dll_cfg_1) \
HANDLER(EMC, EMC_PMACRO_DLL_CFG_2, emc_pmacro_dll_cfg_2) \
HANDLER(EMC, EMC_PMACRO_AUTOCAL_CFG_COMMON, emc_pmacro_autocal_cfg_common) \
HANDLER(EMC, EMC_PMACRO_ZCTRL, emc_pmacro_zctrl) \
HANDLER(EMC, EMC_CFG, emc_cfg) \
HANDLER(EMC, EMC_CFG_PIPE, emc_cfg_pipe) \
HANDLER(EMC, EMC_DYN_SELF_REF_CONTROL, emc_dyn_self_ref_control) \
HANDLER(EMC, EMC_QPOP, emc_qpop) \
HANDLER(EMC, EMC_DQS_BRLSHFT_0, emc_dqs_brlshft_0) \
HANDLER(EMC, EMC_DQS_BRLSHFT_1, emc_dqs_brlshft_1) \
HANDLER(EMC, EMC_CMD_BRLSHFT_2, emc_cmd_brlshft_2) \
HANDLER(EMC, EMC_CMD_BRLSHFT_3, emc_cmd_brlshft_3) \
HANDLER(EMC, EMC_PMACRO_PAD_CFG_CTRL, emc_pmacro_pad_cfg_ctrl) \
HANDLER(EMC, EMC_PMACRO_DATA_PAD_RX_CTRL, emc_pmacro_data_pad_rx_ctrl) \
HANDLER(EMC, EMC_PMACRO_CMD_PAD_RX_CTRL, emc_pmacro_cmd_pad_rx_ctrl) \
HANDLER(EMC, EMC_PMACRO_DATA_RX_TERM_MODE, emc_pmacro_data_rx_term_mode) \
HANDLER(EMC, EMC_PMACRO_CMD_RX_TERM_MODE, emc_pmacro_cmd_rx_term_mode) \
HANDLER(EMC, EMC_PMACRO_CMD_PAD_TX_CTRL, emc_pmacro_cmd_pad_tx_ctrl) \
HANDLER(EMC, EMC_PMACRO_DATA_PAD_TX_CTRL, emc_pmacro_data_pad_tx_ctrl) \
HANDLER(EMC, EMC_PMACRO_VTTGEN_CTRL_0, emc_pmacro_vttgen_ctrl_0) \
HANDLER(EMC, EMC_PMACRO_VTTGEN_CTRL_1, emc_pmacro_vttgen_ctrl_1) \
HANDLER(EMC, EMC_PMACRO_VTTGEN_CTRL_2, emc_pmacro_vttgen_ctrl_2) \
HANDLER(EMC, EMC_PMACRO_BRICK_CTRL_RFU1, emc_pmacro_brick_ctrl_rfu1) \
HANDLER(EMC, EMC_PMACRO_CMD_BRICK_CTRL_FDPD, emc_pmacro_cmd_brick_ctrl_fdpd) \
HANDLER(EMC, EMC_PMACRO_BRICK_CTRL_RFU2, emc_pmacro_brick_ctrl_rfu2) \
HANDLER(EMC, EMC_PMACRO_DATA_BRICK_CTRL_FDPD, emc_pmacro_data_brick_ctrl_fdpd) \
HANDLER(EMC, EMC_PMACRO_BG_BIAS_CTRL_0, emc_pmacro_bg_bias_ctrl_0) \
HANDLER(EMC, EMC_CFG_3, emc_cfg_3) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_0, emc_pmacro_tx_pwrd_0) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_1, emc_pmacro_tx_pwrd_1) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_2, emc_pmacro_tx_pwrd_2) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_3, emc_pmacro_tx_pwrd_3) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_4, emc_pmacro_tx_pwrd_4) \
HANDLER(EMC, EMC_PMACRO_TX_PWRD_5, emc_pmacro_tx_pwrd_5) \
HANDLER(EMC, EMC_CONFIG_SAMPLE_DELAY, emc_config_sample_delay) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_0, emc_pmacro_tx_sel_clk_src_0) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_1, emc_pmacro_tx_sel_clk_src_1) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_2, emc_pmacro_tx_sel_clk_src_2) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_3, emc_pmacro_tx_sel_clk_src_3) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_4, emc_pmacro_tx_sel_clk_src_4) \
HANDLER(EMC, EMC_PMACRO_TX_SEL_CLK_SRC_5, emc_pmacro_tx_sel_clk_src_5) \
HANDLER(EMC, EMC_PMACRO_DDLL_BYPASS, emc_pmacro_ddll_bypass) \
HANDLER(EMC, EMC_PMACRO_DDLL_PWRD_0, emc_pmacro_ddll_pwrd_0) \
HANDLER(EMC, EMC_PMACRO_DDLL_PWRD_1, emc_pmacro_ddll_pwrd_1) \
HANDLER(EMC, EMC_PMACRO_DDLL_PWRD_2, emc_pmacro_ddll_pwrd_2) \
HANDLER(EMC, EMC_PMACRO_CMD_CTRL_0, emc_pmacro_cmd_ctrl_0) \
HANDLER(EMC, EMC_PMACRO_CMD_CTRL_1, emc_pmacro_cmd_ctrl_1) \
HANDLER(EMC, EMC_PMACRO_CMD_CTRL_2, emc_pmacro_cmd_ctrl_2) \
HANDLER(EMC, EMC_PMACRO_DATA_PI_CTRL, emc_pmacro_data_pi_ctrl) \
HANDLER(EMC, EMC_PMACRO_CMD_PI_CTRL, emc_pmacro_cmd_pi_ctrl) \
HANDLER(EMC, EMC_TR_TIMING_0, emc_tr_timing_0) \
HANDLER(EMC, EMC_TR_DVFS, emc_tr_dvfs) \
HANDLER(EMC, EMC_TR_CTRL_1, emc_tr_ctrl_1) \
HANDLER(EMC, EMC_TR_RDV, emc_tr_rdv) \
HANDLER(EMC, EMC_TR_QPOP, emc_tr_qpop) \
HANDLER(EMC, EMC_TR_RDV_MASK, emc_tr_rdv_mask) \
HANDLER(EMC, EMC_MRW14, emc_mrw14) \
HANDLER(EMC, EMC_TR_QSAFE, emc_tr_qsafe) \
HANDLER(EMC, EMC_TR_QRST, emc_tr_qrst) \
HANDLER(EMC, EMC_TRAINING_CTRL, emc_training_ctrl) \
HANDLER(EMC, EMC_TRAINING_SETTLE, emc_training_settle) \
HANDLER(EMC, EMC_TRAINING_VREF_SETTLE, emc_training_vref_settle) \
HANDLER(EMC, EMC_TRAINING_CA_FINE_CTRL, emc_training_ca_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_CA_CTRL_MISC, emc_training_ca_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_CA_CTRL_MISC1, emc_training_ca_ctrl_misc1) \
HANDLER(EMC, EMC_TRAINING_CA_VREF_CTRL, emc_training_ca_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_QUSE_CORS_CTRL, emc_training_quse_cors_ctrl) \
HANDLER(EMC, EMC_TRAINING_QUSE_FINE_CTRL, emc_training_quse_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_QUSE_CTRL_MISC, emc_training_quse_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_QUSE_VREF_CTRL, emc_training_quse_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_READ_FINE_CTRL, emc_training_read_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_READ_CTRL_MISC, emc_training_read_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_READ_VREF_CTRL, emc_training_read_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_WRITE_FINE_CTRL, emc_training_write_fine_ctrl) \
HANDLER(EMC, EMC_TRAINING_WRITE_CTRL_MISC, emc_training_write_ctrl_misc) \
HANDLER(EMC, EMC_TRAINING_WRITE_VREF_CTRL, emc_training_write_vref_ctrl) \
HANDLER(EMC, EMC_TRAINING_MPC, emc_training_mpc) \
HANDLER(EMC, EMC_MRW15, emc_mrw15)
#define DECLARE_STRUCT_MEMBER_HANDLER(BASE, REG, NAME) uint32_t NAME;
#define DECLARE_ARRAY_AND_STRUCT_MEMBERS(NAME, FOREACH_HANDLER) \
union { struct { FOREACH_HANDLER(DECLARE_STRUCT_MEMBER_HANDLER) } NAME; uint32_t NAME##_arr[sizeof(NAME) / sizeof(uint32_t)]; }
struct EmcDvfsTimingTable {
uint32_t rev;
char dvfs_ver[60];
uint32_t rate_khz;
uint32_t min_volt;
uint32_t gpu_min_volt;
char clock_src[32];
uint32_t clk_src_emc;
uint32_t pll_en_ssc;
uint32_t needs_training;
uint32_t training_pattern;
uint32_t trained;
uint32_t periodic_training;
uint32_t trained_dram_clktree_c0d0u0;
uint32_t trained_dram_clktree_c0d0u1;
uint32_t trained_dram_clktree_c0d1u0;
uint32_t trained_dram_clktree_c0d1u1;
uint32_t trained_dram_clktree_c1d0u0;
uint32_t trained_dram_clktree_c1d0u1;
uint32_t trained_dram_clktree_c1d1u0;
uint32_t trained_dram_clktree_c1d1u1;
uint32_t current_dram_clktree_c0d0u0;
uint32_t current_dram_clktree_c0d0u1;
uint32_t current_dram_clktree_c0d1u0;
uint32_t current_dram_clktree_c0d1u1;
uint32_t current_dram_clktree_c1d0u0;
uint32_t current_dram_clktree_c1d0u1;
uint32_t current_dram_clktree_c1d1u0;
uint32_t current_dram_clktree_c1d1u1;
uint32_t emc_fbio_cfg7;
uint32_t run_clocks;
uint32_t tree_margin;
uint32_t num_burst;
uint32_t num_burst_per_ch;
uint32_t num_trim;
uint32_t num_trim_per_ch;
uint32_t num_mc_regs;
uint32_t num_up_down;
uint32_t vref_num;
uint32_t training_mod_num;
uint32_t dram_timing_num;
uint32_t ptfv_dqsosc_movavg_c0d0u0;
uint32_t ptfv_dqsosc_movavg_c0d0u1;
uint32_t ptfv_dqsosc_movavg_c0d1u0;
uint32_t ptfv_dqsosc_movavg_c0d1u1;
uint32_t ptfv_dqsosc_movavg_c1d0u0;
uint32_t ptfv_dqsosc_movavg_c1d0u1;
uint32_t ptfv_dqsosc_movavg_c1d1u0;
uint32_t ptfv_dqsosc_movavg_c1d1u1;
uint32_t ptfv_write_samples;
uint32_t ptfv_dvfs_samples;
uint32_t ptfv_movavg_weight;
uint32_t ptfv_config_ctrl;
DECLARE_ARRAY_AND_STRUCT_MEMBERS(burst_regs, FOREACH_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(burst_perch_regs, FOREACH_PER_CHANNEL_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(shadow_regs_ca_train, FOREACH_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(shadow_regs_rdwr_train, FOREACH_BURST_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(trim_regs, FOREACH_TRIM_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(trim_perch_regs, FOREACH_PER_CHANNEL_TRIM_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(vref_perch_regs, FOREACH_PER_CHANNEL_VREF_REG);
struct {
uint32_t t_rp;
uint32_t t_fc_lpddr4;
uint32_t t_rfc;
uint32_t t_pdex;
uint32_t rl;
} dram_timings;
uint32_t zq_op_cc_long_zcal;
uint32_t zq_op_cc_short_zcal;
uint32_t zcal_wait_time_ps_cc_long_zcal;
uint32_t zcal_wait_time_ps_cc_short_zcal;
uint32_t tZQCAL_lpddr4;
uint32_t zqcal_before_cc_cutoff;
uint32_t opt_cc_short_zcal;
uint32_t opt_short_zcal;
uint32_t opt_do_sw_qrst;
uint32_t save_restore_clkstop_pd;
uint32_t opt_E90;
uint32_t cya_allow_ref_cc;
uint32_t ref_b4_sref_en;
uint32_t cya_issue_pc_ref;
DECLARE_ARRAY_AND_STRUCT_MEMBERS(training_mod_regs, FOREACH_PER_CHANNEL_TRAINING_MOD_REG);
uint32_t save_restore_mod_regs[12];
DECLARE_ARRAY_AND_STRUCT_MEMBERS(burst_mc_regs, FOREACH_BURST_MC_REG);
DECLARE_ARRAY_AND_STRUCT_MEMBERS(la_scale_regs, FOREACH_LA_SCALE_REG);
uint32_t unk_0;
uint32_t vtt_vdda_ctrl_0;
uint32_t src_clock_div;
uint32_t vtt_vdda_dual_channel;
uint32_t vtt_vdda_ctrl_1;
uint32_t vtt_vdda_ctrl_2;
uint32_t vtt_vdda_ctrl_3;
uint32_t vtt_vdda_ctrl_4;
uint32_t misc_cfg_0;
uint32_t misc_cfg_1;
uint32_t misc_cfg_2;
uint32_t unk_1;
uint32_t unk_2;
uint32_t pipe_clk_delay;
uint32_t clkchange_delay;
uint32_t pllm_ss_cfg;
uint32_t pllm_ss_ctrl1;
uint32_t pllm_ss_ctrl2;
uint32_t pllmb_ss_cfg;
uint32_t pllmb_ss_ctrl1;
uint32_t pllmb_ss_ctrl2;
uint32_t pllmb_divm;
uint32_t pllmb_divn;
uint32_t pllmb_divp;
uint32_t min_mrs_wait;
uint32_t ramp_wait;
uint32_t emc_mrw;
uint32_t emc_mrw2;
uint32_t emc_mrw3;
uint32_t emc_mrw4;
uint32_t emc_mrw9;
uint32_t emc_mrs;
uint32_t emc_emrs;
uint32_t emc_emrs2;
uint32_t emc_auto_cal_config;
uint32_t emc_auto_cal_config2;
uint32_t emc_auto_cal_config3;
uint32_t emc_auto_cal_config4;
uint32_t emc_auto_cal_config5;
uint32_t emc_auto_cal_config6;
uint32_t emc_auto_cal_config7;
uint32_t emc_auto_cal_config8;
uint32_t emc_cfg_2;
uint32_t emc_sel_dpd_ctrl;
uint32_t emc_fdpd_ctrl_cmd_no_ramp;
uint32_t emc_tr_ctrl_0;
uint32_t dll_clk_src;
uint32_t clk_out_enb_x_0_clk_enb_emc_dll;
uint32_t latency;
uint32_t pllm_misc1_0_pllm_clamp_ph90;
};
#undef DECLARE_STRUCT_MEMBER_HANDLER
#undef DECLARE_ARRAY_AND_STRUCT_MEMBERS
static_assert(sizeof(EmcDvfsTimingTable) == 0x10CC);
}
| 31,290
|
C++
|
.h
| 391
| 71.383632
| 135
| 0.469318
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,480
|
fusee_mtc.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/mtc/fusee_mtc.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::nxboot {
void DoMemoryTraining();
void RestoreMemoryClockRate();
}
| 767
|
C++
|
.h
| 21
| 34.285714
| 76
| 0.757412
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,481
|
fusee_sdram.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/sdram/fusee_sdram.hpp
|
/*
* 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/>.
*/
#include <exosphere.hpp>
#pragma once
namespace ams::nxboot {
void InitializeSdram();
}
| 729
|
C++
|
.h
| 20
| 34.45
| 76
| 0.756719
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,482
|
fusee_fs_api.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fs/fusee_fs_api.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::fs {
enum OpenMode {
OpenMode_Read = (1 << 0),
OpenMode_Write = (1 << 1),
OpenMode_AllowAppend = (1 << 2),
OpenMode_ReadWrite = (OpenMode_Read | OpenMode_Write),
OpenMode_All = (OpenMode_ReadWrite | OpenMode_AllowAppend),
};
struct ReadOption {
u32 _value;
static const ReadOption None;
};
inline constexpr const ReadOption ReadOption::None = {0};
inline constexpr bool operator==(const ReadOption &lhs, const ReadOption &rhs) {
return lhs._value == rhs._value;
}
inline constexpr bool operator!=(const ReadOption &lhs, const ReadOption &rhs) {
return !(lhs == rhs);
}
static_assert(util::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32));
struct WriteOption {
u32 _value;
constexpr inline bool HasFlushFlag() const {
return _value & 1;
}
static const WriteOption None;
static const WriteOption Flush;
};
inline constexpr const WriteOption WriteOption::None = {0};
inline constexpr const WriteOption WriteOption::Flush = {1};
inline constexpr bool operator==(const WriteOption &lhs, const WriteOption &rhs) {
return lhs._value == rhs._value;
}
inline constexpr bool operator!=(const WriteOption &lhs, const WriteOption &rhs) {
return !(lhs == rhs);
}
static_assert(util::is_pod<WriteOption>::value && sizeof(WriteOption) == sizeof(u32));
enum DirectoryEntryType {
DirectoryEntryType_Directory = 0,
DirectoryEntryType_File = 1,
};
struct DirectoryEntry {
u64 file_size;
u16 file_date;
u16 file_time;
u8 file_attr;
char altname[13];
char file_name[0x100];
};
constexpr ALWAYS_INLINE DirectoryEntryType GetEntryType(const DirectoryEntry &entry) {
return (entry.file_attr & 0x10) ? DirectoryEntryType_Directory : DirectoryEntryType_File;
}
struct FileHandle {
void *_handle;
};
struct DirectoryHandle {
void *_handle;
};
bool MountSdCard();
void UnmountSdCard();
Result GetEntryType(DirectoryEntryType *out_entry_type, bool *out_archive, const char *path);
Result CreateFile(const char *path, s64 size);
Result CreateDirectory(const char *path);
Result OpenFile(FileHandle *out_file, const char *path, int mode);
Result OpenDirectory(DirectoryHandle *out_dir, const char *path);
Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries);
void CloseDirectory(DirectoryHandle handle);
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option);
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size);
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option);
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size);
Result GetFileSize(s64 *out, FileHandle handle);
Result FlushFile(FileHandle handle);
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option);
Result SetFileSize(FileHandle handle, s64 size);
int GetFileOpenMode(FileHandle handle);
void CloseFile(FileHandle handle);
}
| 4,103
|
C++
|
.h
| 95
| 37.326316
| 121
| 0.693216
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,483
|
fusee_fs_storage.hpp
|
Atmosphere-NX_Atmosphere/fusee/program/source/fs/fusee_fs_storage.hpp
|
/*
* 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 <exosphere.hpp>
#include "fusee_fs_api.hpp"
namespace ams::fs {
class IStorage {
public:
virtual Result Read(s64 offset, void *buffer, size_t size) = 0;
virtual Result Write(s64 offset, const void *buffer, size_t size) = 0;
virtual Result Flush() = 0;
virtual Result SetSize(s64 size) = 0;
virtual Result GetSize(s64 *out) = 0;
public:
static inline Result CheckAccessRange(s64 offset, s64 size, s64 total_size) {
R_UNLESS(offset >= 0, fs::ResultInvalidOffset());
R_UNLESS(size >= 0, fs::ResultInvalidSize());
R_UNLESS(util::CanAddWithoutOverflow<s64>(offset, size), fs::ResultOutOfRange());
R_UNLESS(offset + size <= total_size, fs::ResultOutOfRange());
R_SUCCEED();
}
static ALWAYS_INLINE Result CheckAccessRange(s64 offset, size_t size, s64 total_size) {
R_RETURN(CheckAccessRange(offset, static_cast<s64>(size), total_size));
}
static inline Result CheckOffsetAndSize(s64 offset, s64 size) {
R_UNLESS(offset >= 0, fs::ResultInvalidOffset());
R_UNLESS(size >= 0, fs::ResultInvalidSize());
R_UNLESS(util::CanAddWithoutOverflow<s64>(offset, size), fs::ResultOutOfRange());
R_SUCCEED();
}
static ALWAYS_INLINE Result CheckOffsetAndSize(s64 offset, size_t size) {
R_RETURN(CheckOffsetAndSize(offset, static_cast<s64>(size)));
}
static inline Result CheckOffsetAndSizeWithResult(s64 offset, s64 size, Result fail_result) {
R_TRY_CATCH(CheckOffsetAndSize(offset, size)) {
R_CONVERT_ALL(fail_result);
} R_END_TRY_CATCH;
R_SUCCEED();
}
static ALWAYS_INLINE Result CheckOffsetAndSizeWithResult(s64 offset, size_t size, Result fail_result) {
R_RETURN(CheckOffsetAndSizeWithResult(offset, static_cast<s64>(size), fail_result));
}
};
class ReadOnlyStorageAdapter : public IStorage {
private:
IStorage &m_storage;
public:
ReadOnlyStorageAdapter(IStorage &s) : m_storage(s) { /* ... */ }
virtual Result Read(s64 offset, void *buffer, size_t size) override {
R_RETURN(m_storage.Read(offset, buffer, size));
}
virtual Result Flush() override {
R_RETURN(m_storage.Flush());
}
virtual Result GetSize(s64 *out) override {
R_RETURN(m_storage.GetSize(out));
}
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
R_THROW(fs::ResultUnsupportedOperation());
}
virtual Result SetSize(s64 size) override {
R_THROW(fs::ResultUnsupportedOperation());
}
};
class SubStorage : public IStorage {
private:
IStorage &m_storage;
s64 m_offset;
s64 m_size;
public:
SubStorage(IStorage &s, s64 o, s64 sz) : m_storage(s), m_offset(o), m_size(sz) { /* ... */ }
virtual Result Read(s64 offset, void *buffer, size_t size) override {
/* Succeed immediately on zero-sized operation. */
R_SUCCEED_IF(size == 0);
/* Validate arguments and read. */
R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument());
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
R_RETURN(m_storage.Read(m_offset + offset, buffer, size));
}
virtual Result Write(s64 offset, const void *buffer, size_t size) override{
/* Succeed immediately on zero-sized operation. */
R_SUCCEED_IF(size == 0);
/* Validate arguments and write. */
R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument());
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
R_RETURN(m_storage.Write(m_offset + offset, buffer, size));
}
virtual Result Flush() override {
R_RETURN(m_storage.Flush());
}
virtual Result GetSize(s64 *out) override {
*out = m_size;
R_SUCCEED();
}
virtual Result SetSize(s64 size) override {
R_THROW(fs::ResultUnsupportedSetSizeForNotResizableSubStorage());
}
};
class FileHandleStorage : public IStorage {
private:
static constexpr s64 InvalidSize = -1;
private:
FileHandle m_handle;
s64 m_size;
public:
constexpr explicit FileHandleStorage(FileHandle handle) : m_handle(handle), m_size(InvalidSize) { /* ... */ }
~FileHandleStorage() { fs::CloseFile(m_handle); }
protected:
Result UpdateSize();
public:
virtual Result Read(s64 offset, void *buffer, size_t size) override;
virtual Result Write(s64 offset, const void *buffer, size_t size) override;
virtual Result Flush() override;
virtual Result GetSize(s64 *out_size) override;
virtual Result SetSize(s64 size) override;
};
}
| 6,254
|
C++
|
.h
| 130
| 36.292308
| 121
| 0.57021
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,484
|
fusee_loader_error.hpp
|
Atmosphere-NX_Atmosphere/fusee/loader_stub/source/fusee_loader_error.hpp
|
/*
* 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/>.
*/
#include <exosphere.hpp>
#pragma once
namespace ams::nxboot::loader {
NORETURN void ErrorStop();
}
| 740
|
C++
|
.h
| 20
| 35
| 76
| 0.756267
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,485
|
fusee_loader_uncompress.hpp
|
Atmosphere-NX_Atmosphere/fusee/loader_stub/source/fusee_loader_uncompress.hpp
|
/*
* 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/>.
*/
#include <vapours.hpp>
#pragma once
namespace ams::nxboot::loader {
void Uncompress(void *dst, size_t dst_size, const void *src, size_t src_size);
}
| 790
|
C++
|
.h
| 20
| 37.5
| 82
| 0.751302
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,486
|
secmon_misc.hpp
|
Atmosphere-NX_Atmosphere/exosphere/program/source/secmon_misc.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::secmon {
void SaveBootInfo(const pkg1::SecureMonitorParameters &secmon_params);
bool IsRecoveryBoot();
u32 GetRestrictedSmcMask();
bool IsJtagEnabled();
void GetPackage2Hash(se::Sha256Hash *out);
void SetPackage2Hash(const se::Sha256Hash &hash);
u32 GetDeprecatedBootReason();
}
| 1,002
|
C++
|
.h
| 26
| 35.653846
| 76
| 0.757482
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,487
|
secmon_setup.hpp
|
Atmosphere-NX_Atmosphere/exosphere/program/source/secmon_setup.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::secmon {
constexpr inline u64 MemoryAttributeIndexNormal = 0;
constexpr inline u64 MemoryAttributeIndexDevice = 1;
constexpr inline int KernelCarveoutCount = 2;
constexpr size_t CarveoutSizeMax = 512_MB - 128_KB;
void SetupCpuMemoryControllersEnableMmu();
void SetupCpuCoreContext();
void SetupCpuSErrorDebug();
void SetupSocDmaControllers();
void SetupSocSecurity();
void SetupSocProtections();
void SetupPmcAndMcSecure();
void Setup1();
void SaveSecurityEngineAesKeySlotTestVector();
void SetKernelCarveoutRegion(int index, uintptr_t address, size_t size);
}
| 1,315
|
C++
|
.h
| 33
| 36.424242
| 76
| 0.762579
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,488
|
secmon_user_power_management.hpp
|
Atmosphere-NX_Atmosphere/exosphere/program/source/secmon_user_power_management.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::secmon {
enum UserRebootType {
UserRebootType_None = 0,
UserRebootType_ToRcm = 1,
UserRebootType_ToPayload = 2,
UserRebootType_ToFatalError = 3,
UserRebootType_ByPmic = 4,
};
void PerformUserRebootToRcm();
void PerformUserRebootToPayload();
void PerformUserRebootToFatalError();
void PerformUserRebootByPmic();
void PerformUserShutDown();
}
| 1,125
|
C++
|
.h
| 31
| 32.516129
| 76
| 0.719266
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,489
|
secmon_mariko_fatal_error.hpp
|
Atmosphere-NX_Atmosphere/exosphere/program/source/secmon_mariko_fatal_error.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::secmon {
constexpr inline int MarikoFatalErrorInterruptId = 198;
NORETURN void HandleMarikoFatalErrorInterrupt();
}
| 816
|
C++
|
.h
| 21
| 36.619048
| 76
| 0.767383
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,490
|
secmon_page_mapper.hpp
|
Atmosphere-NX_Atmosphere/exosphere/program/source/secmon_page_mapper.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::secmon {
namespace impl {
class PageMapperImpl {
private:
uintptr_t m_physical_address;
uintptr_t m_virtual_address;
public:
constexpr PageMapperImpl(uintptr_t phys) : m_physical_address(util::AlignDown(phys, 4_KB)), m_virtual_address() { /* ... */ }
void *GetPointerTo(uintptr_t phys, size_t size) const;
bool CopyToMapping(uintptr_t dst_phys, const void *src, size_t size) const;
bool CopyFromMapping(void *dst, uintptr_t src_phys, size_t size) const;
ALWAYS_INLINE bool CopyToUser(uintptr_t dst_phys, const void *src, size_t size) const { return CopyToMapping(dst_phys, src, size); }
ALWAYS_INLINE bool CopyFromUser(void *dst, uintptr_t src_phys, size_t size) const { return CopyFromMapping(dst, src_phys, size); }
template<auto F>
bool MapImpl() {
m_virtual_address = F(m_physical_address);
return m_virtual_address != 0;
}
template<auto F>
void UnmapImpl() {
F();
m_virtual_address = 0;
}
};
}
class UserPageMapper : public impl::PageMapperImpl {
public:
constexpr UserPageMapper(uintptr_t phys) : PageMapperImpl(phys) { /* ... */ }
bool Map();
};
class AtmosphereIramPageMapper : public impl::PageMapperImpl {
public:
constexpr AtmosphereIramPageMapper(uintptr_t phys) : PageMapperImpl(phys) { /* ... */ }
~AtmosphereIramPageMapper();
bool Map();
};
class AtmosphereUserPageMapper : public impl::PageMapperImpl {
public:
constexpr AtmosphereUserPageMapper(uintptr_t phys) : PageMapperImpl(phys) { /* ... */ }
~AtmosphereUserPageMapper();
bool Map();
};
}
| 2,661
|
C++
|
.h
| 60
| 34.583333
| 148
| 0.612766
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,491
|
secmon_spinlock.hpp
|
Atmosphere-NX_Atmosphere/exosphere/program/source/secmon_spinlock.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::secmon {
using SpinLockType = u32;
void AcquireSpinLock(SpinLockType &lock);
void ReleaseSpinLock(SpinLockType &lock);
}
| 825
|
C++
|
.h
| 22
| 35.136364
| 76
| 0.758448
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
9,492
|
secmon_error.hpp
|
Atmosphere-NX_Atmosphere/exosphere/program/source/secmon_error.hpp
|
/*
* 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 <exosphere.hpp>
namespace ams::secmon {
void SetError(pkg1::ErrorInfo info);
NORETURN void ErrorReboot();
}
| 775
|
C++
|
.h
| 21
| 34.761905
| 76
| 0.755319
|
Atmosphere-NX/Atmosphere
| 14,324
| 1,207
| 54
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.