From c6db1c390b748646d77f38f92529f706eaa6b6ae Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 2 Aug 2018 10:19:15 -0400 Subject: hw: Remove unused files None of these files are used in any meaningful way. They're just leftovers from citra. Also has the benefit of getting rid of an unused global variable. --- src/core/CMakeLists.txt | 4 --- src/core/core.cpp | 3 -- src/core/hw/aes/ccm.cpp | 28 --------------- src/core/hw/hw.cpp | 96 ------------------------------------------------- src/core/hw/hw.h | 50 -------------------------- src/core/hw/lcd.cpp | 67 ---------------------------------- src/core/hw/lcd.h | 86 -------------------------------------------- 7 files changed, 334 deletions(-) delete mode 100644 src/core/hw/aes/ccm.cpp delete mode 100644 src/core/hw/hw.cpp delete mode 100644 src/core/hw/hw.h delete mode 100644 src/core/hw/lcd.cpp delete mode 100644 src/core/hw/lcd.h (limited to 'src') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 3cc9160ca..c05500952 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -309,10 +309,6 @@ add_library(core STATIC hle/service/vi/vi_u.h hle/service/wlan/wlan.cpp hle/service/wlan/wlan.h - hw/hw.cpp - hw/hw.h - hw/lcd.cpp - hw/lcd.h loader/deconstructed_rom_directory.cpp loader/deconstructed_rom_directory.h loader/elf.cpp diff --git a/src/core/core.cpp b/src/core/core.cpp index b7f4b4532..dd845a78a 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -15,7 +15,6 @@ #include "core/hle/service/service.h" #include "core/hle/service/sm/controller.h" #include "core/hle/service/sm/sm.h" -#include "core/hw/hw.h" #include "core/loader/loader.h" #include "core/memory_setup.h" #include "core/settings.h" @@ -180,7 +179,6 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { telemetry_session = std::make_unique(); service_manager = std::make_shared(); - HW::Init(); Kernel::Init(system_mode); Service::Init(service_manager); GDBStub::Init(); @@ -224,7 +222,6 @@ void System::Shutdown() { GDBStub::Shutdown(); Service::Shutdown(); Kernel::Shutdown(); - HW::Shutdown(); service_manager.reset(); telemetry_session.reset(); gpu_core.reset(); diff --git a/src/core/hw/aes/ccm.cpp b/src/core/hw/aes/ccm.cpp deleted file mode 100644 index 1ee37aaa4..000000000 --- a/src/core/hw/aes/ccm.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include -#include "common/alignment.h" -#include "common/assert.h" -#include "common/logging/log.h" -#include "core/hw/aes/ccm.h" -#include "core/hw/aes/key.h" - -namespace HW { -namespace AES { - -std::vector EncryptSignCCM(const std::vector& pdata, const CCMNonce& nonce, - size_t slot_id) { - UNIMPLEMENTED(); - return {}; -} - -std::vector DecryptVerifyCCM(const std::vector& cipher, const CCMNonce& nonce, - size_t slot_id) { - UNIMPLEMENTED(); - return {}; -} - -} // namespace AES -} // namespace HW diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp deleted file mode 100644 index 2f48068c1..000000000 --- a/src/core/hw/hw.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "common/common_types.h" -#include "common/logging/log.h" -#include "core/hw/hw.h" -#include "core/hw/lcd.h" - -namespace HW { - -template -inline void Read(T& var, const u32 addr) { - switch (addr & 0xFFFFF000) { - case VADDR_GPU: - case VADDR_GPU + 0x1000: - case VADDR_GPU + 0x2000: - case VADDR_GPU + 0x3000: - case VADDR_GPU + 0x4000: - case VADDR_GPU + 0x5000: - case VADDR_GPU + 0x6000: - case VADDR_GPU + 0x7000: - case VADDR_GPU + 0x8000: - case VADDR_GPU + 0x9000: - case VADDR_GPU + 0xA000: - case VADDR_GPU + 0xB000: - case VADDR_GPU + 0xC000: - case VADDR_GPU + 0xD000: - case VADDR_GPU + 0xE000: - case VADDR_GPU + 0xF000: - break; - case VADDR_LCD: - LCD::Read(var, addr); - break; - default: - LOG_ERROR(HW_Memory, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr); - break; - } -} - -template -inline void Write(u32 addr, const T data) { - switch (addr & 0xFFFFF000) { - case VADDR_GPU: - case VADDR_GPU + 0x1000: - case VADDR_GPU + 0x2000: - case VADDR_GPU + 0x3000: - case VADDR_GPU + 0x4000: - case VADDR_GPU + 0x5000: - case VADDR_GPU + 0x6000: - case VADDR_GPU + 0x7000: - case VADDR_GPU + 0x8000: - case VADDR_GPU + 0x9000: - case VADDR_GPU + 0xA000: - case VADDR_GPU + 0xB000: - case VADDR_GPU + 0xC000: - case VADDR_GPU + 0xD000: - case VADDR_GPU + 0xE000: - case VADDR_GPU + 0xF000: - break; - case VADDR_LCD: - LCD::Write(addr, data); - break; - default: - LOG_ERROR(HW_Memory, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr); - break; - } -} - -// Explicitly instantiate template functions because we aren't defining this in the header: - -template void Read(u64& var, const u32 addr); -template void Read(u32& var, const u32 addr); -template void Read(u16& var, const u32 addr); -template void Read(u8& var, const u32 addr); - -template void Write(u32 addr, const u64 data); -template void Write(u32 addr, const u32 data); -template void Write(u32 addr, const u16 data); -template void Write(u32 addr, const u8 data); - -/// Update hardware -void Update() {} - -/// Initialize hardware -void Init() { - LCD::Init(); - LOG_DEBUG(HW, "Initialized OK"); -} - -/// Shutdown hardware -void Shutdown() { - LCD::Shutdown(); - LOG_DEBUG(HW, "Shutdown OK"); -} -} // namespace HW diff --git a/src/core/hw/hw.h b/src/core/hw/hw.h deleted file mode 100644 index 5890d2b5c..000000000 --- a/src/core/hw/hw.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include "common/common_types.h" - -namespace HW { - -/// Beginnings of IO register regions, in the user VA space. -enum : u32 { - VADDR_HASH = 0x1EC01000, - VADDR_CSND = 0x1EC03000, - VADDR_DSP = 0x1EC40000, - VADDR_PDN = 0x1EC41000, - VADDR_CODEC = 0x1EC41000, - VADDR_SPI = 0x1EC42000, - VADDR_SPI_2 = 0x1EC43000, // Only used under TWL_FIRM? - VADDR_I2C = 0x1EC44000, - VADDR_CODEC_2 = 0x1EC45000, - VADDR_HID = 0x1EC46000, - VADDR_GPIO = 0x1EC47000, - VADDR_I2C_2 = 0x1EC48000, - VADDR_SPI_3 = 0x1EC60000, - VADDR_I2C_3 = 0x1EC61000, - VADDR_MIC = 0x1EC62000, - VADDR_PXI = 0x1EC63000, - VADDR_LCD = 0x1ED02000, - VADDR_DSP_2 = 0x1ED03000, - VADDR_HASH_2 = 0x1EE01000, - VADDR_GPU = 0x1EF00000, -}; - -template -void Read(T& var, const u32 addr); - -template -void Write(u32 addr, const T data); - -/// Update hardware -void Update(); - -/// Initialize hardware -void Init(); - -/// Shutdown hardware -void Shutdown(); - -} // namespace HW diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp deleted file mode 100644 index 0b62174d5..000000000 --- a/src/core/hw/lcd.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include -#include "common/common_types.h" -#include "common/logging/log.h" -#include "core/hw/hw.h" -#include "core/hw/lcd.h" -#include "core/tracer/recorder.h" - -namespace LCD { - -Regs g_regs; - -template -inline void Read(T& var, const u32 raw_addr) { - u32 addr = raw_addr - HW::VADDR_LCD; - u32 index = addr / 4; - - // Reads other than u32 are untested, so I'd rather have them abort than silently fail - if (index >= 0x400 || !std::is_same::value) { - LOG_ERROR(HW_LCD, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr); - return; - } - - var = g_regs[index]; -} - -template -inline void Write(u32 addr, const T data) { - addr -= HW::VADDR_LCD; - u32 index = addr / 4; - - // Writes other than u32 are untested, so I'd rather have them abort than silently fail - if (index >= 0x400 || !std::is_same::value) { - LOG_ERROR(HW_LCD, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr); - return; - } - - g_regs[index] = static_cast(data); -} - -// Explicitly instantiate template functions because we aren't defining this in the header: - -template void Read(u64& var, const u32 addr); -template void Read(u32& var, const u32 addr); -template void Read(u16& var, const u32 addr); -template void Read(u8& var, const u32 addr); - -template void Write(u32 addr, const u64 data); -template void Write(u32 addr, const u32 data); -template void Write(u32 addr, const u16 data); -template void Write(u32 addr, const u8 data); - -/// Initialize hardware -void Init() { - memset(&g_regs, 0, sizeof(g_regs)); - LOG_DEBUG(HW_LCD, "Initialized OK"); -} - -/// Shutdown hardware -void Shutdown() { - LOG_DEBUG(HW_LCD, "Shutdown OK"); -} - -} // namespace LCD diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h deleted file mode 100644 index d2db9700f..000000000 --- a/src/core/hw/lcd.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2015 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include -#include -#include "common/bit_field.h" -#include "common/common_funcs.h" -#include "common/common_types.h" - -#define LCD_REG_INDEX(field_name) (offsetof(LCD::Regs, field_name) / sizeof(u32)) - -namespace LCD { - -struct Regs { - - union ColorFill { - u32 raw; - - BitField<0, 8, u32> color_r; - BitField<8, 8, u32> color_g; - BitField<16, 8, u32> color_b; - BitField<24, 1, u32> is_enabled; - }; - - INSERT_PADDING_WORDS(0x81); - ColorFill color_fill_top; - INSERT_PADDING_WORDS(0xE); - u32 backlight_top; - - INSERT_PADDING_WORDS(0x1F0); - - ColorFill color_fill_bottom; - INSERT_PADDING_WORDS(0xE); - u32 backlight_bottom; - INSERT_PADDING_WORDS(0x16F); - - static constexpr size_t NumIds() { - return sizeof(Regs) / sizeof(u32); - } - - const u32& operator[](int index) const { - const u32* content = reinterpret_cast(this); - return content[index]; - } - - u32& operator[](int index) { - u32* content = reinterpret_cast(this); - return content[index]; - } -}; -static_assert(std::is_standard_layout::value, "Structure does not use standard layout"); - -// TODO: MSVC does not support using offsetof() on non-static data members even though this -// is technically allowed since C++11. This macro should be enabled once MSVC adds -// support for that. -#ifndef _MSC_VER -#define ASSERT_REG_POSITION(field_name, position) \ - static_assert(offsetof(Regs, field_name) == position * 4, \ - "Field " #field_name " has invalid position") - -ASSERT_REG_POSITION(color_fill_top, 0x81); -ASSERT_REG_POSITION(backlight_top, 0x90); -ASSERT_REG_POSITION(color_fill_bottom, 0x281); -ASSERT_REG_POSITION(backlight_bottom, 0x290); - -#undef ASSERT_REG_POSITION -#endif // !defined(_MSC_VER) - -extern Regs g_regs; - -template -void Read(T& var, const u32 addr); - -template -void Write(u32 addr, const T data); - -/// Initialize hardware -void Init(); - -/// Shutdown hardware -void Shutdown(); - -} // namespace LCD -- cgit v1.2.3