From 5d95bb98434b8e7cd67010f6064ccdb69c1222bb Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 10 Apr 2014 22:45:40 -0400 Subject: cleaned up some logging messages --- src/core/hw/hw.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/hw') diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 44625e3af..7191d7c60 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -12,12 +12,12 @@ namespace HW { template inline void Read(T &var, const u32 addr) { - NOTICE_LOG(HW, "Hardware read from address %08X", addr); + NOTICE_LOG(HW, "read from address %08X", addr); } template inline void Write(u32 addr, const T data) { - NOTICE_LOG(HW, "Hardware write to address %08X", addr); + NOTICE_LOG(HW, "write to address %08X", addr); } // Explicitly instantiate template functions because we aren't defining this in the header: @@ -40,12 +40,12 @@ void Update() { /// Initialize hardware void Init() { LCD::Init(); - NOTICE_LOG(HW, "Hardware initialized OK"); + NOTICE_LOG(HW, "initialized OK"); } /// Shutdown hardware void Shutdown() { - NOTICE_LOG(HW, "Hardware shutdown OK"); + NOTICE_LOG(HW, "shutdown OK"); } } \ No newline at end of file -- cgit v1.2.3 From 01bedbf956a261fb339eba6901716510cc8c9ca2 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 10 Apr 2014 22:49:12 -0400 Subject: updated logging message --- src/core/hw/hw_lcd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hw') diff --git a/src/core/hw/hw_lcd.cpp b/src/core/hw/hw_lcd.cpp index fd783a84a..9fb485bac 100644 --- a/src/core/hw/hw_lcd.cpp +++ b/src/core/hw/hw_lcd.cpp @@ -37,12 +37,12 @@ void Update() { /// Initialize hardware void Init() { g_last_ticks = Core::g_app_core->GetTicks(); - NOTICE_LOG(LCD, "LCD initialized OK"); + NOTICE_LOG(LCD, "initialized OK"); } /// Shutdown hardware void Shutdown() { - NOTICE_LOG(LCD, "LCD shutdown OK"); + NOTICE_LOG(LCD, "shutdown OK"); } } // namespace -- cgit v1.2.3 From f2f63a0f0583d672342d300f3c8b099f56a13c7d Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 12 Apr 2014 23:32:04 -0400 Subject: fixed hw write declarations to not be const --- src/core/hw/hw.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/hw') diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 7191d7c60..59c348ca9 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -27,10 +27,10 @@ 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); +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() { -- cgit v1.2.3 From c3a4b4bfca154f3f27830fe747c0fd74f8459d84 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 17 Apr 2014 23:43:55 -0400 Subject: added NDMA hardware interface --- src/core/hw/hw.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++-- src/core/hw/ndma.cpp | 48 +++++++++++++++++++++++++++++++++++++++++ src/core/hw/ndma.h | 26 ++++++++++++++++++++++ 3 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 src/core/hw/ndma.cpp create mode 100644 src/core/hw/ndma.h (limited to 'src/core/hw') diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 59c348ca9..1f240f09c 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -7,17 +7,72 @@ #include "core/hw/hw.h" #include "core/hw/hw_lcd.h" +#include "core/hw/ndma.h" namespace HW { +enum { + ADDRESS_CONFIG = 0x10000000, + ADDRESS_IRQ = 0x10001000, + ADDRESS_NDMA = 0x10002000, + ADDRESS_TIMER = 0x10003000, + ADDRESS_CTRCARD = 0x10004000, + ADDRESS_CTRCARD_2 = 0x10005000, + ADDRESS_SDMC_NAND = 0x10006000, + ADDRESS_SDMC_NAND_2 = 0x10007000, // Apparently not used on retail + ADDRESS_PXI = 0x10008000, + ADDRESS_AES = 0x10009000, + ADDRESS_SHA = 0x1000A000, + ADDRESS_RSA = 0x1000B000, + ADDRESS_XDMA = 0x1000C000, + ADDRESS_SPICARD = 0x1000D800, + ADDRESS_CONFIG_2 = 0x10010000, + ADDRESS_HASH = 0x10101000, + ADDRESS_CSND = 0x10103000, + ADDRESS_DSP = 0x10140000, + ADDRESS_PDN = 0x10141000, + ADDRESS_CODEC = 0x10141000, + ADDRESS_SPI = 0x10142000, + ADDRESS_SPI_2 = 0x10143000, + ADDRESS_I2C = 0x10144000, + ADDRESS_CODEC_2 = 0x10145000, + ADDRESS_HID = 0x10146000, + ADDRESS_PAD = 0x10146000, + ADDRESS_PTM = 0x10146000, + ADDRESS_I2C_2 = 0x10148000, + ADDRESS_SPI_3 = 0x10160000, + ADDRESS_I2C_3 = 0x10161000, + ADDRESS_MIC = 0x10162000, + ADDRESS_PXI_2 = 0x10163000, + ADDRESS_NTRCARD = 0x10164000, + ADDRESS_DSP_2 = 0x10203000, + ADDRESS_HASH_2 = 0x10301000, +}; + template inline void Read(T &var, const u32 addr) { - NOTICE_LOG(HW, "read from address %08X", addr); + switch (addr & 0xFFFFF000) { + + case ADDRESS_NDMA: + NDMA::Read(var, addr); + break; + + default: + ERROR_LOG(HW, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr); + } } template inline void Write(u32 addr, const T data) { - NOTICE_LOG(HW, "write to address %08X", addr); + switch (addr & 0xFFFFF000) { + + case ADDRESS_NDMA: + NDMA::Write(addr, data); + break; + + default: + ERROR_LOG(HW, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr); + } } // Explicitly instantiate template functions because we aren't defining this in the header: @@ -35,11 +90,13 @@ template void Write(u32 addr, const u8 data); /// Update hardware void Update() { LCD::Update(); + NDMA::Update(); } /// Initialize hardware void Init() { LCD::Init(); + NDMA::Init(); NOTICE_LOG(HW, "initialized OK"); } diff --git a/src/core/hw/ndma.cpp b/src/core/hw/ndma.cpp new file mode 100644 index 000000000..52e459ebd --- /dev/null +++ b/src/core/hw/ndma.cpp @@ -0,0 +1,48 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/common_types.h" +#include "common/log.h" + +#include "core/hw/ndma.h" + +namespace NDMA { + +template +inline void Read(T &var, const u32 addr) { + ERROR_LOG(NDMA, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr); +} + +template +inline void Write(u32 addr, const T data) { + ERROR_LOG(NDMA, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr); +} + +// 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() { + NOTICE_LOG(LCD, "initialized OK"); +} + +/// Shutdown hardware +void Shutdown() { + NOTICE_LOG(LCD, "shutdown OK"); +} + +} // namespace diff --git a/src/core/hw/ndma.h b/src/core/hw/ndma.h new file mode 100644 index 000000000..d8fa3d40b --- /dev/null +++ b/src/core/hw/ndma.h @@ -0,0 +1,26 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +namespace NDMA { + +template +inline void Read(T &var, const u32 addr); + +template +inline void Write(u32 addr, const T data); + +/// Update hardware +void Update(); + +/// Initialize hardware +void Init(); + +/// Shutdown hardware +void Shutdown(); + +} // namespace -- cgit v1.2.3 From 70c2cce963264678b5ba5b6aa17c2653bf459e61 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 17 Apr 2014 23:48:23 -0400 Subject: renamed hw_lcd module to just lcd --- src/core/hw/hw.cpp | 2 +- src/core/hw/hw_lcd.cpp | 48 ------------------------------------------------ src/core/hw/hw_lcd.h | 44 -------------------------------------------- src/core/hw/lcd.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/core/hw/lcd.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 93 deletions(-) delete mode 100644 src/core/hw/hw_lcd.cpp delete mode 100644 src/core/hw/hw_lcd.h create mode 100644 src/core/hw/lcd.cpp create mode 100644 src/core/hw/lcd.h (limited to 'src/core/hw') diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 1f240f09c..16bd70125 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -6,7 +6,7 @@ #include "common/log.h" #include "core/hw/hw.h" -#include "core/hw/hw_lcd.h" +#include "core/hw/lcd.h" #include "core/hw/ndma.h" namespace HW { diff --git a/src/core/hw/hw_lcd.cpp b/src/core/hw/hw_lcd.cpp deleted file mode 100644 index 9fb485bac..000000000 --- a/src/core/hw/hw_lcd.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 -// Refer to the license.txt file included. - -#include "common/common_types.h" -#include "common/log.h" - -#include "core/core.h" -#include "core/hw/hw_lcd.h" - -#include "video_core/video_core.h" - -namespace LCD { - -static const u32 kFrameTicks = 268123480 / 60; ///< 268MHz / 60 frames per second - -u64 g_last_ticks = 0; ///< Last CPU ticks - -template -inline void Read(T &var, const u32 addr) { -} - -template -inline void Write(u32 addr, const T data) { -} - -/// Update hardware -void Update() { - u64 current_ticks = Core::g_app_core->GetTicks(); - - if ((current_ticks - g_last_ticks) >= kFrameTicks) { - g_last_ticks = current_ticks; - VideoCore::g_renderer->SwapBuffers(); - } -} - -/// Initialize hardware -void Init() { - g_last_ticks = Core::g_app_core->GetTicks(); - NOTICE_LOG(LCD, "initialized OK"); -} - -/// Shutdown hardware -void Shutdown() { - NOTICE_LOG(LCD, "shutdown OK"); -} - -} // namespace diff --git a/src/core/hw/hw_lcd.h b/src/core/hw/hw_lcd.h deleted file mode 100644 index 386ed6004..000000000 --- a/src/core/hw/hw_lcd.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 -// Refer to the license.txt file included. - -#pragma once - -#include "common/common_types.h" - -namespace LCD { - -enum { - TOP_ASPECT_X = 0x5, - TOP_ASPECT_Y = 0x3, - - TOP_HEIGHT = 240, - TOP_WIDTH = 400, - BOTTOM_WIDTH = 320, - - FRAMEBUFFER_SEL = 0x20184E59, - TOP_LEFT_FRAME1 = 0x20184E60, - TOP_LEFT_FRAME2 = 0x201CB370, - TOP_RIGHT_FRAME1 = 0x20282160, - TOP_RIGHT_FRAME2 = 0x202C8670, - SUB_FRAME1 = 0x202118E0, - SUB_FRAME2 = 0x20249CF0, -}; - -template -inline void Read(T &var, const u32 addr); - -template -inline void Write(u32 addr, const T data); - -/// Update hardware -void Update(); - -/// Initialize hardware -void Init(); - -/// Shutdown hardware -void Shutdown(); - - -} // namespace diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp new file mode 100644 index 000000000..3013673f8 --- /dev/null +++ b/src/core/hw/lcd.cpp @@ -0,0 +1,48 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/common_types.h" +#include "common/log.h" + +#include "core/core.h" +#include "core/hw/lcd.h" + +#include "video_core/video_core.h" + +namespace LCD { + +static const u32 kFrameTicks = 268123480 / 60; ///< 268MHz / 60 frames per second + +u64 g_last_ticks = 0; ///< Last CPU ticks + +template +inline void Read(T &var, const u32 addr) { +} + +template +inline void Write(u32 addr, const T data) { +} + +/// Update hardware +void Update() { + u64 current_ticks = Core::g_app_core->GetTicks(); + + if ((current_ticks - g_last_ticks) >= kFrameTicks) { + g_last_ticks = current_ticks; + VideoCore::g_renderer->SwapBuffers(); + } +} + +/// Initialize hardware +void Init() { + g_last_ticks = Core::g_app_core->GetTicks(); + NOTICE_LOG(LCD, "initialized OK"); +} + +/// Shutdown hardware +void Shutdown() { + NOTICE_LOG(LCD, "shutdown OK"); +} + +} // namespace diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h new file mode 100644 index 000000000..386ed6004 --- /dev/null +++ b/src/core/hw/lcd.h @@ -0,0 +1,44 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +namespace LCD { + +enum { + TOP_ASPECT_X = 0x5, + TOP_ASPECT_Y = 0x3, + + TOP_HEIGHT = 240, + TOP_WIDTH = 400, + BOTTOM_WIDTH = 320, + + FRAMEBUFFER_SEL = 0x20184E59, + TOP_LEFT_FRAME1 = 0x20184E60, + TOP_LEFT_FRAME2 = 0x201CB370, + TOP_RIGHT_FRAME1 = 0x20282160, + TOP_RIGHT_FRAME2 = 0x202C8670, + SUB_FRAME1 = 0x202118E0, + SUB_FRAME2 = 0x20249CF0, +}; + +template +inline void Read(T &var, const u32 addr); + +template +inline void Write(u32 addr, const T data); + +/// Update hardware +void Update(); + +/// Initialize hardware +void Init(); + +/// Shutdown hardware +void Shutdown(); + + +} // namespace -- cgit v1.2.3