aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/src/hw/hw.cpp
blob: 7250bc237d6cfacd6fe06d430cc3edcb248a4acd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
 * Copyright (C) 2013 Citrus Emulator
 *
 * @file    hw.cpp
 * @author  bunnei
 * @date    2014-04-04
 * @brief   Hardware interface
 *
 * @section LICENSE
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details at
 * http://www.gnu.org/copyleft/gpl.html
 *
 * Official project repository can be found at:
 * http://code.google.com/p/gekko-gc-emu/
 */

#include "log.h"
#include "hw/hw.h"

namespace HW {

template <typename T>
inline void Read(T &var, const u32 addr) {
    // TODO: Figure out the fastest order of tests for both read and write (they are probably different).
    // TODO: Make sure this represents the mirrors in a correct way.

    // Could just do a base-relative read, too.... TODO

    //if ((addr & 0x3E000000) == 0x08000000) {
    //    var = *((const T*)&g_fcram[addr & MEM_FCRAM_MASK]);

    //} else {
    //    _assert_msg_(HW, false, "unknown hardware read");
    //}
}

template <typename T>
inline void Write(u32 addr, const T data) {
    //// ExeFS:/.code is loaded here:
    //if ((addr & 0xFFF00000) == 0x00100000) {
    //    // TODO(ShizZy): This is dumb... handle correctly. From 3DBrew:
    //    // http://3dbrew.org/wiki/Memory_layout#ARM11_User-land_memory_regions
    //    // The ExeFS:/.code is loaded here, executables must be loaded to the 0x00100000 region when
    //    // the exheader "special memory" flag is clear. The 0x03F00000-byte size restriction only 
    //    // applies when this flag is clear. Executables are usually loaded to 0x14000000 when the 
    //    // exheader "special memory" flag is set, however this address can be arbitrary.
    //    *(T*)&g_fcram[addr & MEM_FCRAM_MASK] = data;

    //// Error out...
    //} else {
    //    _assert_msg_(HW, false, "unknown hardware write");
    //}
}


void Init() {
}

void Shutdown() {
}

}