From 0de1300b4d6e54bcb97cd00e9b81b305124f6960 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 20 Feb 2017 13:44:19 -0800 Subject: [PATCH] DS SPI: Add missing files --- include/mgba/internal/ds/spi.h | 38 ++++++++++++++++++++++++++++++++++ src/ds/spi.c | 21 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 include/mgba/internal/ds/spi.h create mode 100644 src/ds/spi.c diff --git a/include/mgba/internal/ds/spi.h b/include/mgba/internal/ds/spi.h new file mode 100644 index 000000000..322c84fe7 --- /dev/null +++ b/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 + +CXX_GUARD_START + +#include + +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 diff --git a/src/ds/spi.c b/src/ds/spi.c new file mode 100644 index 000000000..42bece4aa --- /dev/null +++ b/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 + +#include + +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 +}