1 |
/* |
2 |
* PearPC |
3 |
* io.cc |
4 |
* |
5 |
* Copyright (C) 2003 Sebastian Biallas (sb@biallas.net) |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License version 2 as |
9 |
* published by the Free Software Foundation. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
#include <cstdlib> |
22 |
#include <cstring> |
23 |
|
24 |
#include "io.h" |
25 |
#include "io/3c90x/3c90x.h" |
26 |
#include "io/graphic/gcard.h" |
27 |
#include "io/pic/pic.h" |
28 |
#include "io/pci/pci.h" |
29 |
#include "io/cuda/cuda.h" |
30 |
#include "io/nvram/nvram.h" |
31 |
|
32 |
|
33 |
/* |
34 |
* The xx_glue functions are needed for the jitc |
35 |
*/ |
36 |
extern "C" uint32 FASTCALL io_mem_read_glue(uint32 addr, int size) |
37 |
{ |
38 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
39 |
uint32 ret; |
40 |
io_mem_read(addr, ret, size); |
41 |
return ret; |
42 |
} |
43 |
|
44 |
extern "C" void FASTCALL io_mem_write_glue(uint32 addr, uint32 data, int size) |
45 |
{ |
46 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
47 |
io_mem_write(addr, data, size); |
48 |
} |
49 |
|
50 |
extern "C" uint64 FASTCALL io_mem_read64_glue(uint32 addr) |
51 |
{ |
52 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
53 |
uint64 ret; |
54 |
io_mem_read64(addr, ret); |
55 |
return ret; |
56 |
} |
57 |
|
58 |
extern "C" void FASTCALL io_mem_write64_glue(uint32 addr, uint64 data) |
59 |
{ |
60 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
61 |
io_mem_write64(addr, data); |
62 |
} |
63 |
|
64 |
extern "C" void FASTCALL io_mem_read128_glue(uint32 addr, uint128 *data) |
65 |
{ |
66 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
67 |
io_mem_read128(addr, data); |
68 |
} |
69 |
|
70 |
extern "C" void FASTCALL io_mem_read128_native_glue(uint32 addr, uint128 *data) |
71 |
{ |
72 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
73 |
io_mem_read128_native(addr, data); |
74 |
} |
75 |
|
76 |
extern "C" void FASTCALL io_mem_write128_glue(uint32 addr, uint128 *data) |
77 |
{ |
78 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
79 |
io_mem_write128(addr, data); |
80 |
} |
81 |
|
82 |
extern "C" void FASTCALL io_mem_write128_native_glue(uint32 addr, uint128 *data) |
83 |
{ |
84 |
// gCPU.pc = gCPU.current_code_base + gCPU.pc_ofs; |
85 |
io_mem_write128_native(addr, data); |
86 |
} |
87 |
|
88 |
void io_init() |
89 |
{ |
90 |
pci_init(); |
91 |
cuda_init(); |
92 |
pic_init(); |
93 |
nvram_init(); |
94 |
} |
95 |
|
96 |
void io_done() |
97 |
{ |
98 |
pci_done(); |
99 |
cuda_done(); |
100 |
pic_done(); |
101 |
nvram_done(); |
102 |
} |
103 |
|
104 |
void io_init_config() |
105 |
{ |
106 |
pci_init_config(); |
107 |
cuda_init_config(); |
108 |
pic_init_config(); |
109 |
nvram_init_config(); |
110 |
} |