all repos — mgba @ b4fa4fe77e23ed774e749608144fc0d1330b941c

mGBA Game Boy Advance Emulator

include/mgba/internal/ds/spi.h (view raw)

 1/* Copyright (c) 2013-2017 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 DS_SPI_IO_H
 7#define DS_SPI_IO_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/log.h>
14
15mLOG_DECLARE_CATEGORY(DS_SPI);
16
17DECL_BITFIELD(DSSPICNT, uint16_t);
18DECL_BITS(DSSPICNT, Baud, 0, 2);
19DECL_BIT(DSSPICNT, Busy, 7);
20DECL_BITS(DSSPICNT, ChipSelect, 8, 2);
21DECL_BIT(DSSPICNT, TransferSize, 10);
22DECL_BIT(DSSPICNT, CSHold, 11);
23DECL_BIT(DSSPICNT, DoIRQ, 14);
24DECL_BIT(DSSPICNT, Enable, 15);
25
26enum {
27	DS_SPI_DEV_POWERMAN = 0,
28	DS_SPI_DEV_FIRMWARE = 1,
29	DS_SPI_DEV_TSC = 2
30};
31
32struct DS;
33DSSPICNT DSSPIWriteControl(struct DS* ds, uint16_t control);
34void DSSPIWrite(struct DS* ds, uint8_t datum);
35
36CXX_GUARD_END
37
38#endif