diff options
| author | 2014-04-08 19:25:03 -0400 | |
|---|---|---|
| committer | 2014-04-08 19:25:03 -0400 | |
| commit | 63e46abdb8764bc97e91bae862c8d461e61b1965 (patch) | |
| tree | e73f4aa25d7b4015a265e7bbfb6004dab7561027 /src/core/hw | |
| parent | fixed some license headers that I missed (diff) | |
| download | yuzu-63e46abdb8764bc97e91bae862c8d461e61b1965.tar.gz yuzu-63e46abdb8764bc97e91bae862c8d461e61b1965.tar.xz yuzu-63e46abdb8764bc97e91bae862c8d461e61b1965.zip | |
got rid of 'src' folders in each sub-project
Diffstat (limited to 'src/core/hw')
| -rw-r--r-- | src/core/hw/hw.cpp | 49 | ||||
| -rw-r--r-- | src/core/hw/hw.h | 26 | ||||
| -rw-r--r-- | src/core/hw/hw_lcd.cpp | 45 | ||||
| -rw-r--r-- | src/core/hw/hw_lcd.h | 44 |
4 files changed, 164 insertions, 0 deletions
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp new file mode 100644 index 000000000..57be4d6a8 --- /dev/null +++ b/src/core/hw/hw.cpp | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "log.h" | ||
| 6 | #include "hw/hw.h" | ||
| 7 | #include "hw/hw_lcd.h" | ||
| 8 | |||
| 9 | namespace HW { | ||
| 10 | |||
| 11 | template <typename T> | ||
| 12 | inline void Read(T &var, const u32 addr) { | ||
| 13 | NOTICE_LOG(HW, "Hardware read from address %08X", addr); | ||
| 14 | } | ||
| 15 | |||
| 16 | template <typename T> | ||
| 17 | inline void Write(u32 addr, const T data) { | ||
| 18 | NOTICE_LOG(HW, "Hardware write to address %08X", addr); | ||
| 19 | } | ||
| 20 | |||
| 21 | // Explicitly instantiate template functions because we aren't defining this in the header: | ||
| 22 | |||
| 23 | template void Read<u64>(u64 &var, const u32 addr); | ||
| 24 | template void Read<u32>(u32 &var, const u32 addr); | ||
| 25 | template void Read<u16>(u16 &var, const u32 addr); | ||
| 26 | template void Read<u8>(u8 &var, const u32 addr); | ||
| 27 | |||
| 28 | template void Write<const u64>(u32 addr, const u64 data); | ||
| 29 | template void Write<const u32>(u32 addr, const u32 data); | ||
| 30 | template void Write<const u16>(u32 addr, const u16 data); | ||
| 31 | template void Write<const u8>(u32 addr, const u8 data); | ||
| 32 | |||
| 33 | /// Update hardware | ||
| 34 | void Update() { | ||
| 35 | LCD::Update(); | ||
| 36 | } | ||
| 37 | |||
| 38 | /// Initialize hardware | ||
| 39 | void Init() { | ||
| 40 | LCD::Init(); | ||
| 41 | NOTICE_LOG(HW, "Hardware initialized OK"); | ||
| 42 | } | ||
| 43 | |||
| 44 | /// Shutdown hardware | ||
| 45 | void Shutdown() { | ||
| 46 | NOTICE_LOG(HW, "Hardware shutdown OK"); | ||
| 47 | } | ||
| 48 | |||
| 49 | } \ No newline at end of file | ||
diff --git a/src/core/hw/hw.h b/src/core/hw/hw.h new file mode 100644 index 000000000..5b0cc8c87 --- /dev/null +++ b/src/core/hw/hw.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common_types.h" | ||
| 8 | |||
| 9 | namespace HW { | ||
| 10 | |||
| 11 | template <typename T> | ||
| 12 | inline void Read(T &var, const u32 addr); | ||
| 13 | |||
| 14 | template <typename T> | ||
| 15 | inline void Write(u32 addr, const T data); | ||
| 16 | |||
| 17 | /// Update hardware | ||
| 18 | void Update(); | ||
| 19 | |||
| 20 | /// Initialize hardware | ||
| 21 | void Init(); | ||
| 22 | |||
| 23 | /// Shutdown hardware | ||
| 24 | void Shutdown(); | ||
| 25 | |||
| 26 | } // namespace | ||
diff --git a/src/core/hw/hw_lcd.cpp b/src/core/hw/hw_lcd.cpp new file mode 100644 index 000000000..ad346c794 --- /dev/null +++ b/src/core/hw/hw_lcd.cpp | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "log.h" | ||
| 6 | #include "core.h" | ||
| 7 | #include "hw_lcd.h" | ||
| 8 | #include "video_core.h" | ||
| 9 | |||
| 10 | namespace LCD { | ||
| 11 | |||
| 12 | static const u32 kFrameTicks = 268123480 / 60; ///< 268MHz / 60 frames per second | ||
| 13 | |||
| 14 | u64 g_last_ticks = 0; ///< Last CPU ticks | ||
| 15 | |||
| 16 | template <typename T> | ||
| 17 | inline void Read(T &var, const u32 addr) { | ||
| 18 | } | ||
| 19 | |||
| 20 | template <typename T> | ||
| 21 | inline void Write(u32 addr, const T data) { | ||
| 22 | } | ||
| 23 | |||
| 24 | /// Update hardware | ||
| 25 | void Update() { | ||
| 26 | u64 current_ticks = Core::g_app_core->GetTicks(); | ||
| 27 | |||
| 28 | if ((current_ticks - g_last_ticks) >= kFrameTicks) { | ||
| 29 | g_last_ticks = current_ticks; | ||
| 30 | VideoCore::g_renderer->SwapBuffers(); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | /// Initialize hardware | ||
| 35 | void Init() { | ||
| 36 | g_last_ticks = Core::g_app_core->GetTicks(); | ||
| 37 | NOTICE_LOG(LCD, "LCD initialized OK"); | ||
| 38 | } | ||
| 39 | |||
| 40 | /// Shutdown hardware | ||
| 41 | void Shutdown() { | ||
| 42 | NOTICE_LOG(LCD, "LCD shutdown OK"); | ||
| 43 | } | ||
| 44 | |||
| 45 | } // namespace | ||
diff --git a/src/core/hw/hw_lcd.h b/src/core/hw/hw_lcd.h new file mode 100644 index 000000000..30e347ccb --- /dev/null +++ b/src/core/hw/hw_lcd.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common_types.h" | ||
| 8 | |||
| 9 | namespace LCD { | ||
| 10 | |||
| 11 | enum { | ||
| 12 | TOP_ASPECT_X = 0x5, | ||
| 13 | TOP_ASPECT_Y = 0x3, | ||
| 14 | |||
| 15 | TOP_HEIGHT = 240, | ||
| 16 | TOP_WIDTH = 400, | ||
| 17 | BOTTOM_WIDTH = 320, | ||
| 18 | |||
| 19 | FRAMEBUFFER_SEL = 0x20184E59, | ||
| 20 | TOP_LEFT_FRAME1 = 0x20184E60, | ||
| 21 | TOP_LEFT_FRAME2 = 0x201CB370, | ||
| 22 | TOP_RIGHT_FRAME1 = 0x20282160, | ||
| 23 | TOP_RIGHT_FRAME2 = 0x202C8670, | ||
| 24 | SUB_FRAME1 = 0x202118E0, | ||
| 25 | SUB_FRAME2 = 0x20249CF0, | ||
| 26 | }; | ||
| 27 | |||
| 28 | template <typename T> | ||
| 29 | inline void Read(T &var, const u32 addr); | ||
| 30 | |||
| 31 | template <typename T> | ||
| 32 | inline void Write(u32 addr, const T data); | ||
| 33 | |||
| 34 | /// Update hardware | ||
| 35 | void Update(); | ||
| 36 | |||
| 37 | /// Initialize hardware | ||
| 38 | void Init(); | ||
| 39 | |||
| 40 | /// Shutdown hardware | ||
| 41 | void Shutdown(); | ||
| 42 | |||
| 43 | |||
| 44 | } // namespace | ||