src/gba/interface.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef INTERFACE_H
7#define INTERFACE_H
8
9#include "util/common.h"
10
11#include "core/interface.h"
12
13enum GBALogLevel {
14 GBA_LOG_FATAL = 0x01,
15 GBA_LOG_ERROR = 0x02,
16 GBA_LOG_WARN = 0x04,
17 GBA_LOG_INFO = 0x08,
18 GBA_LOG_DEBUG = 0x10,
19 GBA_LOG_STUB = 0x20,
20
21 GBA_LOG_GAME_ERROR = 0x100,
22 GBA_LOG_SWI = 0x200,
23 GBA_LOG_STATUS = 0x400,
24 GBA_LOG_SIO = 0x800,
25
26 GBA_LOG_ALL = 0xF3F,
27};
28
29enum GBASIOMode {
30 SIO_NORMAL_8 = 0,
31 SIO_NORMAL_32 = 1,
32 SIO_MULTI = 2,
33 SIO_UART = 3,
34 SIO_GPIO = 8,
35 SIO_JOYBUS = 12
36};
37
38struct GBA;
39struct GBAAudio;
40struct GBASIO;
41struct GBAThread;
42struct GBAVideoRenderer;
43
44typedef void (*GBALogHandler)(struct GBAThread*, enum GBALogLevel, const char* format, va_list args);
45
46extern const int GBA_LUX_LEVELS[10];
47
48struct GBALuminanceSource {
49 void (*sample)(struct GBALuminanceSource*);
50
51 uint8_t (*readLuminance)(struct GBALuminanceSource*);
52};
53
54struct GBASIODriver {
55 struct GBASIO* p;
56
57 bool (*init)(struct GBASIODriver* driver);
58 void (*deinit)(struct GBASIODriver* driver);
59 bool (*load)(struct GBASIODriver* driver);
60 bool (*unload)(struct GBASIODriver* driver);
61 uint16_t (*writeRegister)(struct GBASIODriver* driver, uint32_t address, uint16_t value);
62 int32_t (*processEvents)(struct GBASIODriver* driver, int32_t cycles);
63};
64
65#endif