1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  *   Mupen64plus - device.h                                                *
3  *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
4  *   Copyright (C) 2016 Bobby Smiles                                       *
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
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                         *
18  *   Free Software Foundation, Inc.,                                       *
19  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
20  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21 
22 #ifndef M64P_MAIN_DEVICE_H
23 #define M64P_MAIN_DEVICE_H
24 
25 #include <stddef.h>
26 #include <stdint.h>
27 
28 #include "ai/ai_controller.h"
29 #include "dd/dd_controller.h"
30 #include "pi/pi_controller.h"
31 #include "r4300/r4300_core.h"
32 #include "rdp/rdp_core.h"
33 #include "ri/ri_controller.h"
34 #include "rsp/rsp_core.h"
35 #include "si/si_controller.h"
36 #include "vi/vi_controller.h"
37 
38 /* Device structure is a container for the n64 submodules
39  * FIXME: should also include memory submodule, but not possible atm
40  * because of new_dynarec.
41  */
42 struct device
43 {
44     struct r4300_core r4300;
45     struct rdp_core dp;
46     struct rsp_core sp;
47     struct ai_controller ai;
48     struct pi_controller pi;
49     struct ri_controller ri;
50     struct si_controller si;
51     struct vi_controller vi;
52     struct dd_controller dd;
53 };
54 
55 /* Setup device "static" properties.  */
56 void init_device(
57       struct device *dev,
58       unsigned int emumode,
59       unsigned int count_per_op,
60       int special_rom,
61       /* ai */
62       void * ai_user_data, void (*ai_set_audio_format)(void*,unsigned int, unsigned int), void (*ai_push_audio_samples)(void*,const void*,size_t),
63       unsigned fixed_audio_pos,
64       /* pi */
65       uint8_t *rom,
66       size_t rom_size,
67       void* flashram_user_data, void (*flashram_save)(void*), uint8_t* flashram_data,
68       void* sram_user_data, void (*sram_save)(void*), uint8_t* sram_data,
69       /* ri */
70       uint32_t* dram, size_t dram_size,
71       /* si */
72       void* eeprom_user_data, void (*eeprom_save)(void*), uint8_t* eeprom_data, size_t eeprom_size, uint16_t eeprom_id,
73       void* af_rtc_user_data, const struct tm* (*af_rtc_get_time)(void*),
74       /* sp */
75       unsigned int audio_signal,
76       /* vi */
77       unsigned int vi_clock,
78       unsigned int expected_refresh_rate,
79       /* dd */
80       uint8_t *ddrom,
81       size_t ddrom_size,
82       uint8_t *dd_disk,
83       size_t dd_disk_size
84       );
85 
86 /* Setup device such that it's state is
87  * what it should be after power on.
88  */
89 void poweron_device(struct device* dev);
90 
91 #endif
92