all repos — mgba @ 7bcda2daa9cae93ec37e3806d22cb0fe1f259588

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
11struct GB;
12struct GBSIO {
13	struct GB* p;
14
15	int32_t nextEvent;
16	int32_t period;
17	int remainingBits;
18
19	uint8_t pendingSB;
20};
21
22DECL_BITFIELD(GBRegisterSC, uint8_t);
23DECL_BIT(GBRegisterSC, ShiftClock, 0);
24DECL_BIT(GBRegisterSC, ClockSpeed, 1);
25DECL_BIT(GBRegisterSC, Enable, 7);
26
27void GBSIOInit(struct GBSIO* sio);
28void GBSIOReset(struct GBSIO* sio);
29void GBSIODeinit(struct GBSIO* sio);
30int32_t GBSIOProcessEvents(struct GBSIO* sio, int32_t cycles);
31void GBSIOWriteSC(struct GBSIO* sio, uint8_t sc);
32
33#endif