Julius Werner | 4783db2 | 2018-03-27 16:28:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2018 Google LLC |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * version 2 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | #ifndef _SPI_BITBANG_H_ |
| 16 | #define _SPI_BITBANG_H_ |
| 17 | |
| 18 | #include <types.h> |
| 19 | |
| 20 | struct spi_bitbang_ops { |
| 21 | int (*get_miso)(const struct spi_bitbang_ops *ops); |
| 22 | void (*set_mosi)(const struct spi_bitbang_ops *ops, int value); |
| 23 | void (*set_clk)(const struct spi_bitbang_ops *ops, int value); |
| 24 | void (*set_cs)(const struct spi_bitbang_ops *ops, int value); |
| 25 | }; |
| 26 | |
| 27 | int spi_bitbang_claim_bus(const struct spi_bitbang_ops *ops); |
| 28 | void spi_bitbang_release_bus(const struct spi_bitbang_ops *ops); |
| 29 | int spi_bitbang_xfer(const struct spi_bitbang_ops *ops, const void *dout, |
| 30 | size_t bytes_out, void *din, size_t bytes_in); |
| 31 | |
| 32 | #endif /* _SPI_BITBANG_H_ */ |