summaryrefslogtreecommitdiff
path: root/src/core/hw
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-18 17:52:49 -0400
committerGravatar bunnei2014-04-18 17:52:49 -0400
commit958bca606e80110e05d7c142dda3097fddc96503 (patch)
tree576917751444b4dfdb476d040b4e075bde431b7b /src/core/hw
parentInit window size from VideoCore. Start changing the default window behavior... (diff)
parentrenamed hw_lcd module to just lcd (diff)
downloadyuzu-958bca606e80110e05d7c142dda3097fddc96503.tar.gz
yuzu-958bca606e80110e05d7c142dda3097fddc96503.tar.xz
yuzu-958bca606e80110e05d7c142dda3097fddc96503.zip
Merge branch 'hle-interface'
Diffstat (limited to 'src/core/hw')
-rw-r--r--src/core/hw/hw.cpp75
-rw-r--r--src/core/hw/lcd.cpp (renamed from src/core/hw/hw_lcd.cpp)6
-rw-r--r--src/core/hw/lcd.h (renamed from src/core/hw/hw_lcd.h)0
-rw-r--r--src/core/hw/ndma.cpp48
-rw-r--r--src/core/hw/ndma.h26
5 files changed, 143 insertions, 12 deletions
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp
index 44625e3af..16bd70125 100644
--- a/src/core/hw/hw.cpp
+++ b/src/core/hw/hw.cpp
@@ -6,18 +6,73 @@
6#include "common/log.h" 6#include "common/log.h"
7 7
8#include "core/hw/hw.h" 8#include "core/hw/hw.h"
9#include "core/hw/hw_lcd.h" 9#include "core/hw/lcd.h"
10#include "core/hw/ndma.h"
10 11
11namespace HW { 12namespace HW {
12 13
14enum {
15 ADDRESS_CONFIG = 0x10000000,
16 ADDRESS_IRQ = 0x10001000,
17 ADDRESS_NDMA = 0x10002000,
18 ADDRESS_TIMER = 0x10003000,
19 ADDRESS_CTRCARD = 0x10004000,
20 ADDRESS_CTRCARD_2 = 0x10005000,
21 ADDRESS_SDMC_NAND = 0x10006000,
22 ADDRESS_SDMC_NAND_2 = 0x10007000, // Apparently not used on retail
23 ADDRESS_PXI = 0x10008000,
24 ADDRESS_AES = 0x10009000,
25 ADDRESS_SHA = 0x1000A000,
26 ADDRESS_RSA = 0x1000B000,
27 ADDRESS_XDMA = 0x1000C000,
28 ADDRESS_SPICARD = 0x1000D800,
29 ADDRESS_CONFIG_2 = 0x10010000,
30 ADDRESS_HASH = 0x10101000,
31 ADDRESS_CSND = 0x10103000,
32 ADDRESS_DSP = 0x10140000,
33 ADDRESS_PDN = 0x10141000,
34 ADDRESS_CODEC = 0x10141000,
35 ADDRESS_SPI = 0x10142000,
36 ADDRESS_SPI_2 = 0x10143000,
37 ADDRESS_I2C = 0x10144000,
38 ADDRESS_CODEC_2 = 0x10145000,
39 ADDRESS_HID = 0x10146000,
40 ADDRESS_PAD = 0x10146000,
41 ADDRESS_PTM = 0x10146000,
42 ADDRESS_I2C_2 = 0x10148000,
43 ADDRESS_SPI_3 = 0x10160000,
44 ADDRESS_I2C_3 = 0x10161000,
45 ADDRESS_MIC = 0x10162000,
46 ADDRESS_PXI_2 = 0x10163000,
47 ADDRESS_NTRCARD = 0x10164000,
48 ADDRESS_DSP_2 = 0x10203000,
49 ADDRESS_HASH_2 = 0x10301000,
50};
51
13template <typename T> 52template <typename T>
14inline void Read(T &var, const u32 addr) { 53inline void Read(T &var, const u32 addr) {
15 NOTICE_LOG(HW, "Hardware read from address %08X", addr); 54 switch (addr & 0xFFFFF000) {
55
56 case ADDRESS_NDMA:
57 NDMA::Read(var, addr);
58 break;
59
60 default:
61 ERROR_LOG(HW, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
62 }
16} 63}
17 64
18template <typename T> 65template <typename T>
19inline void Write(u32 addr, const T data) { 66inline void Write(u32 addr, const T data) {
20 NOTICE_LOG(HW, "Hardware write to address %08X", addr); 67 switch (addr & 0xFFFFF000) {
68
69 case ADDRESS_NDMA:
70 NDMA::Write(addr, data);
71 break;
72
73 default:
74 ERROR_LOG(HW, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);
75 }
21} 76}
22 77
23// Explicitly instantiate template functions because we aren't defining this in the header: 78// Explicitly instantiate template functions because we aren't defining this in the header:
@@ -27,25 +82,27 @@ template void Read<u32>(u32 &var, const u32 addr);
27template void Read<u16>(u16 &var, const u32 addr); 82template void Read<u16>(u16 &var, const u32 addr);
28template void Read<u8>(u8 &var, const u32 addr); 83template void Read<u8>(u8 &var, const u32 addr);
29 84
30template void Write<const u64>(u32 addr, const u64 data); 85template void Write<u64>(u32 addr, const u64 data);
31template void Write<const u32>(u32 addr, const u32 data); 86template void Write<u32>(u32 addr, const u32 data);
32template void Write<const u16>(u32 addr, const u16 data); 87template void Write<u16>(u32 addr, const u16 data);
33template void Write<const u8>(u32 addr, const u8 data); 88template void Write<u8>(u32 addr, const u8 data);
34 89
35/// Update hardware 90/// Update hardware
36void Update() { 91void Update() {
37 LCD::Update(); 92 LCD::Update();
93 NDMA::Update();
38} 94}
39 95
40/// Initialize hardware 96/// Initialize hardware
41void Init() { 97void Init() {
42 LCD::Init(); 98 LCD::Init();
43 NOTICE_LOG(HW, "Hardware initialized OK"); 99 NDMA::Init();
100 NOTICE_LOG(HW, "initialized OK");
44} 101}
45 102
46/// Shutdown hardware 103/// Shutdown hardware
47void Shutdown() { 104void Shutdown() {
48 NOTICE_LOG(HW, "Hardware shutdown OK"); 105 NOTICE_LOG(HW, "shutdown OK");
49} 106}
50 107
51} \ No newline at end of file 108} \ No newline at end of file
diff --git a/src/core/hw/hw_lcd.cpp b/src/core/hw/lcd.cpp
index fd783a84a..3013673f8 100644
--- a/src/core/hw/hw_lcd.cpp
+++ b/src/core/hw/lcd.cpp
@@ -6,7 +6,7 @@
6#include "common/log.h" 6#include "common/log.h"
7 7
8#include "core/core.h" 8#include "core/core.h"
9#include "core/hw/hw_lcd.h" 9#include "core/hw/lcd.h"
10 10
11#include "video_core/video_core.h" 11#include "video_core/video_core.h"
12 12
@@ -37,12 +37,12 @@ void Update() {
37/// Initialize hardware 37/// Initialize hardware
38void Init() { 38void Init() {
39 g_last_ticks = Core::g_app_core->GetTicks(); 39 g_last_ticks = Core::g_app_core->GetTicks();
40 NOTICE_LOG(LCD, "LCD initialized OK"); 40 NOTICE_LOG(LCD, "initialized OK");
41} 41}
42 42
43/// Shutdown hardware 43/// Shutdown hardware
44void Shutdown() { 44void Shutdown() {
45 NOTICE_LOG(LCD, "LCD shutdown OK"); 45 NOTICE_LOG(LCD, "shutdown OK");
46} 46}
47 47
48} // namespace 48} // namespace
diff --git a/src/core/hw/hw_lcd.h b/src/core/hw/lcd.h
index 386ed6004..386ed6004 100644
--- a/src/core/hw/hw_lcd.h
+++ b/src/core/hw/lcd.h
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 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "common/common_types.h"
6#include "common/log.h"
7
8#include "core/hw/ndma.h"
9
10namespace NDMA {
11
12template <typename T>
13inline void Read(T &var, const u32 addr) {
14 ERROR_LOG(NDMA, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
15}
16
17template <typename T>
18inline void Write(u32 addr, const T data) {
19 ERROR_LOG(NDMA, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);
20}
21
22// Explicitly instantiate template functions because we aren't defining this in the header:
23
24template void Read<u64>(u64 &var, const u32 addr);
25template void Read<u32>(u32 &var, const u32 addr);
26template void Read<u16>(u16 &var, const u32 addr);
27template void Read<u8>(u8 &var, const u32 addr);
28
29template void Write<u64>(u32 addr, const u64 data);
30template void Write<u32>(u32 addr, const u32 data);
31template void Write<u16>(u32 addr, const u16 data);
32template void Write<u8>(u32 addr, const u8 data);
33
34/// Update hardware
35void Update() {
36}
37
38/// Initialize hardware
39void Init() {
40 NOTICE_LOG(LCD, "initialized OK");
41}
42
43/// Shutdown hardware
44void Shutdown() {
45 NOTICE_LOG(LCD, "shutdown OK");
46}
47
48} // 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 @@
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/common_types.h"
8
9namespace NDMA {
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