summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-05 01:23:51 -0400
committerGravatar bunnei2014-04-05 01:23:51 -0400
commit9c2355ba4f37585cd0054b3f05251a814ccbc0eb (patch)
treec3dbfaf5cd323719cb2f0fc0af35f307afc0dfa1 /src/core
parentadded a tick counter (diff)
downloadyuzu-9c2355ba4f37585cd0054b3f05251a814ccbc0eb.tar.gz
yuzu-9c2355ba4f37585cd0054b3f05251a814ccbc0eb.tar.xz
yuzu-9c2355ba4f37585cd0054b3f05251a814ccbc0eb.zip
added a module for interfacing to hardware LCD
Diffstat (limited to 'src/core')
-rw-r--r--src/core/src/hw/hw_lcd.cpp65
-rw-r--r--src/core/src/hw/hw_lcd.h64
2 files changed, 129 insertions, 0 deletions
diff --git a/src/core/src/hw/hw_lcd.cpp b/src/core/src/hw/hw_lcd.cpp
new file mode 100644
index 000000000..19e3b4ab4
--- /dev/null
+++ b/src/core/src/hw/hw_lcd.cpp
@@ -0,0 +1,65 @@
1/**
2 * Copyright (C) 2013 Citrus Emulator
3 *
4 * @file hw_lcd.cpp
5 * @author bunnei
6 * @date 2014-04-05
7 * @brief Hardware LCD interface
8 *
9 * @section LICENSE
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details at
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * Official project repository can be found at:
22 * http://code.google.com/p/gekko-gc-emu/
23 */
24
25#include "log.h"
26#include "core.h"
27#include "hw_lcd.h"
28
29namespace LCD {
30
31static const u32 kFrameTicks = 268123480 / 30; // 268MHz / 30 frames per second
32
33u64 g_last_ticks = 0; ///< Last CPU ticks
34
35template <typename T>
36inline void Read(T &var, const u32 addr) {
37}
38
39template <typename T>
40inline void Write(u32 addr, const T data) {
41}
42
43/// Update hardware
44void Update() {
45 u64 current_ticks = Core::g_app_core->ticks();
46
47 if ((current_ticks - g_last_ticks) >= kFrameTicks) {
48 g_last_ticks = current_ticks;
49 NOTICE_LOG(LCD, "Update frame");
50 }
51}
52
53/// Initialize hardware
54void Init() {
55 g_last_ticks = Core::g_app_core->ticks();
56
57 NOTICE_LOG(LCD, "LCD initialized OK");
58}
59
60/// Shutdown hardware
61void Shutdown() {
62 NOTICE_LOG(LCD, "LCD shutdown OK");
63}
64
65} // namespace
diff --git a/src/core/src/hw/hw_lcd.h b/src/core/src/hw/hw_lcd.h
new file mode 100644
index 000000000..fa19b1cd4
--- /dev/null
+++ b/src/core/src/hw/hw_lcd.h
@@ -0,0 +1,64 @@
1/**
2 * Copyright (C) 2013 Citrus Emulator
3 *
4 * @file hw_lcd.h
5 * @author bunnei
6 * @date 2014-04-05
7 * @brief Hardware LCD interface
8 *
9 * @section LICENSE
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details at
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * Official project repository can be found at:
22 * http://code.google.com/p/gekko-gc-emu/
23 */
24
25#pragma once
26
27#include "common_types.h"
28
29namespace LCD {
30
31enum {
32 TOP_ASPECT_X = 0x5,
33 TOP_ASPECT_Y = 0x3,
34
35 TOP_HEIGHT = 240,
36 TOP_WIDTH = 400,
37 BOTTOM_WIDTH = 320,
38
39 FRAMEBUFFER_SEL = 0x20184E59,
40 TOP_LEFT_FRAME1 = 0x20184E60,
41 TOP_LEFT_FRAME2 = 0x201CB370,
42 TOP_RIGHT_FRAME1 = 0x20282160,
43 TOP_RIGHT_FRAME2 = 0x202C8670,
44 SUB_FRAME1 = 0x202118E0,
45 SUB_FRAME2 = 0x20249CF0,
46};
47
48template <typename T>
49inline void Read(T &var, const u32 addr);
50
51template <typename T>
52inline void Write(u32 addr, const T data);
53
54/// Update hardware
55void Update();
56
57/// Initialize hardware
58void Init();
59
60/// Shutdown hardware
61void Shutdown();
62
63
64} // namespace