include/mgba/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 GBA_INTERFACE_H
7#define GBA_INTERFACE_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/interface.h>
14
15enum GBASIOMode {
16 SIO_NORMAL_8 = 0,
17 SIO_NORMAL_32 = 1,
18 SIO_MULTI = 2,
19 SIO_UART = 3,
20 SIO_GPIO = 8,
21 SIO_JOYBUS = 12
22};
23
24enum GBASIOJOYCommand {
25 JOY_RESET = 0xFF,
26 JOY_POLL = 0x00,
27 JOY_TRANS = 0x14,
28 JOY_RECV = 0x15
29};
30
31struct GBA;
32struct GBAAudio;
33struct GBASIO;
34struct GBAVideoRenderer;
35
36extern const int GBA_LUX_LEVELS[10];
37
38enum {
39 mPERIPH_GBA_LUMINANCE = 0x1000
40};
41
42struct GBALuminanceSource {
43 void (*sample)(struct GBALuminanceSource*);
44
45 uint8_t (*readLuminance)(struct GBALuminanceSource*);
46};
47
48struct GBASIODriver {
49 struct GBASIO* p;
50
51 bool (*init)(struct GBASIODriver* driver);
52 void (*deinit)(struct GBASIODriver* driver);
53 bool (*load)(struct GBASIODriver* driver);
54 bool (*unload)(struct GBASIODriver* driver);
55 uint16_t (*writeRegister)(struct GBASIODriver* driver, uint32_t address, uint16_t value);
56};
57
58void GBASIOJOYCreate(struct GBASIODriver* sio);
59int GBASIOJOYSendCommand(struct GBASIODriver* sio, enum GBASIOJOYCommand command, uint8_t* data);
60
61
62CXX_GUARD_END
63
64#endif