summaryrefslogtreecommitdiff
path: root/src/include/spi_bitbang.h
blob: 4dd560eb33660ef5d665ef32146c657b91766a3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* This file is part of the coreboot project. */
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _SPI_BITBANG_H_
#define _SPI_BITBANG_H_

#include <types.h>

struct spi_bitbang_ops {
	int (*get_miso)(const struct spi_bitbang_ops *ops);
	void (*set_mosi)(const struct spi_bitbang_ops *ops, int value);
	void (*set_clk)(const struct spi_bitbang_ops *ops, int value);
	void (*set_cs)(const struct spi_bitbang_ops *ops, int value);
};

int spi_bitbang_claim_bus(const struct spi_bitbang_ops *ops);
void spi_bitbang_release_bus(const struct spi_bitbang_ops *ops);
int spi_bitbang_xfer(const struct spi_bitbang_ops *ops, const void *dout,
		     size_t bytes_out, void *din, size_t bytes_in);

#endif /* _SPI_BITBANG_H_ */