all repos — mgba @ 4ac4733cfd4c4524c6a56d0406ba138d173fad61

mGBA Game Boy Advance Emulator

src/gb/sio.h (view raw)

 1/* Copyright (c) 2013-2016 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 GB_SIO_H
 7#define GB_SIO_H
 8
 9#include "util/common.h"
10
11#include "core/timing.h"
12
13struct GB;
14struct GBSIO {
15	struct GB* p;
16
17	struct mTimingEvent event;
18
19	int32_t nextEvent;
20	int32_t period;
21	int remainingBits;
22
23	uint8_t pendingSB;
24};
25
26DECL_BITFIELD(GBRegisterSC, uint8_t);
27DECL_BIT(GBRegisterSC, ShiftClock, 0);
28DECL_BIT(GBRegisterSC, ClockSpeed, 1);
29DECL_BIT(GBRegisterSC, Enable, 7);
30
31void GBSIOInit(struct GBSIO* sio);
32void GBSIOReset(struct GBSIO* sio);
33void GBSIODeinit(struct GBSIO* sio);
34void GBSIOWriteSC(struct GBSIO* sio, uint8_t sc);
35
36#endif