DS SPI: Add missing files
Vicki Pfau vi@endrift.com
Mon, 20 Feb 2017 13:44:19 -0800
2 files changed,
59 insertions(+),
0 deletions(-)
A
include/mgba/internal/ds/spi.h
@@ -0,0 +1,38 @@
+/* Copyright (c) 2013-2017 Jeffrey Pfau + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef DS_SPI_IO_H +#define DS_SPI_IO_H + +#include <mgba-util/common.h> + +CXX_GUARD_START + +#include <mgba/core/log.h> + +mLOG_DECLARE_CATEGORY(DS_SPI); + +DECL_BITFIELD(DSSPICNT, uint16_t); +DECL_BITS(DSSPICNT, Baud, 0, 2); +DECL_BIT(DSSPICNT, Busy, 7); +DECL_BITS(DSSPICNT, ChipSelect, 8, 2); +DECL_BIT(DSSPICNT, TransferSize, 10); +DECL_BIT(DSSPICNT, CSHold, 11); +DECL_BIT(DSSPICNT, DoIRQ, 14); +DECL_BIT(DSSPICNT, Enable, 15); + +enum { + DS_SPI_DEV_POWERMAN = 0, + DS_SPI_DEV_FIRMWARE = 1, + DS_SPI_DEV_TSC = 2 +}; + +struct DS; +DSSPICNT DSSPIWriteControl(struct DS* ds, uint16_t control); +void DSSPIWrite(struct DS* ds, uint8_t datum); + +CXX_GUARD_END + +#endif
A
src/ds/spi.c
@@ -0,0 +1,21 @@
+/* Copyright (c) 2013-2017 Jeffrey Pfau + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <mgba/internal/ds/spi.h> + +#include <mgba/internal/ds/ds.h> + +mLOG_DEFINE_CATEGORY(DS_SPI, "DS SPI"); + +DSSPICNT DSSPIWriteControl(struct DS* ds, uint16_t control) { + // TODO + mLOG(DS_SPI, STUB, "Unimplemented control write: %04X", control); + return control; +} + +void DSSPIWrite(struct DS* ds, uint8_t datum) { + mLOG(DS_SPI, STUB, "Unimplemented data write: %02X", datum); + // TODO +}