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_STATUS = 0x400,
23 GBA_LOG_SIO = 0x800,
24
25 GBA_LOG_ALL = 0xF3F,
26};
27
28enum GBASIOMode {
29 SIO_NORMAL_8 = 0,
30 SIO_NORMAL_32 = 1,
31 SIO_MULTI = 2,
32 SIO_UART = 3,
33 SIO_GPIO = 8,
34 SIO_JOYBUS = 12
35};
36
37struct GBA;
38struct GBAAudio;
39struct GBASIO;
40struct GBAThread;
41struct GBAVideoRenderer;
42
43typedef void (*GBALogHandler)(struct GBAThread*, enum GBALogLevel, const char* format, va_list args);
44
45extern const int GBA_LUX_LEVELS[10];
46
47struct GBALuminanceSource {
48 void (*sample)(struct GBALuminanceSource*);
49
50 uint8_t (*readLuminance)(struct GBALuminanceSource*);
51};
52
53struct GBASIODriver {
54 struct GBASIO* p;
55
56 bool (*init)(struct GBASIODriver* driver);
57 void (*deinit)(struct GBASIODriver* driver);
58 bool (*load)(struct GBASIODriver* driver);
59 bool (*unload)(struct GBASIODriver* driver);
60 uint16_t (*writeRegister)(struct GBASIODriver* driver, uint32_t address, uint16_t value);
61 int32_t (*processEvents)(struct GBASIODriver* driver, int32_t cycles);
62};
63
64#endif