summaryrefslogtreecommitdiff
path: root/src/core/hw
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-08 19:25:03 -0400
committerGravatar bunnei2014-04-08 19:25:03 -0400
commit63e46abdb8764bc97e91bae862c8d461e61b1965 (patch)
treee73f4aa25d7b4015a265e7bbfb6004dab7561027 /src/core/hw
parentfixed some license headers that I missed (diff)
downloadyuzu-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.cpp49
-rw-r--r--src/core/hw/hw.h26
-rw-r--r--src/core/hw/hw_lcd.cpp45
-rw-r--r--src/core/hw/hw_lcd.h44
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
9namespace HW {
10
11template <typename T>
12inline void Read(T &var, const u32 addr) {
13 NOTICE_LOG(HW, "Hardware read from address %08X", addr);
14}
15
16template <typename T>
17inline 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
23template void Read<u64>(u64 &var, const u32 addr);
24template void Read<u32>(u32 &var, const u32 addr);
25template void Read<u16>(u16 &var, const u32 addr);
26template void Read<u8>(u8 &var, const u32 addr);
27
28template void Write<const u64>(u32 addr, const u64 data);
29template void Write<const u32>(u32 addr, const u32 data);
30template void Write<const u16>(u32 addr, const u16 data);
31template void Write<const u8>(u32 addr, const u8 data);
32
33/// Update hardware
34void Update() {
35 LCD::Update();
36}
37
38/// Initialize hardware
39void Init() {
40 LCD::Init();
41 NOTICE_LOG(HW, "Hardware initialized OK");
42}
43
44/// Shutdown hardware
45void 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
9namespace HW {
10
11template <typename T>
12inline void Read(T &var, const u32 addr);
13
14template <typename T>
15inline void Write(u32 addr, const T data);
16
17/// Update hardware
18void Update();
19
20/// Initialize hardware
21void Init();
22
23/// Shutdown hardware
24void 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
10namespace LCD {
11
12static const u32 kFrameTicks = 268123480 / 60; ///< 268MHz / 60 frames per second
13
14u64 g_last_ticks = 0; ///< Last CPU ticks
15
16template <typename T>
17inline void Read(T &var, const u32 addr) {
18}
19
20template <typename T>
21inline void Write(u32 addr, const T data) {
22}
23
24/// Update hardware
25void 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
35void Init() {
36 g_last_ticks = Core::g_app_core->GetTicks();
37 NOTICE_LOG(LCD, "LCD initialized OK");
38}
39
40/// Shutdown hardware
41void 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
9namespace LCD {
10
11enum {
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
28template <typename T>
29inline void Read(T &var, const u32 addr);
30
31template <typename T>
32inline void Write(u32 addr, const T data);
33
34/// Update hardware
35void Update();
36
37/// Initialize hardware
38void Init();
39
40/// Shutdown hardware
41void Shutdown();
42
43
44} // namespace