Nico Huber | d16a911 | 2024-01-07 00:11:44 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #ifndef __BITBANG_SPI_H__ |
| 16 | #define __BITBANG_SPI_H__ 1 |
| 17 | |
| 18 | struct bitbang_spi_master { |
| 19 | /* Note that CS# is active low, so val=0 means the chip is active. */ |
| 20 | void (*set_cs) (int val, void *data); |
| 21 | void (*set_sck) (int val, void *data); |
| 22 | void (*set_mosi) (int val, void *data); |
| 23 | int (*get_miso) (void *data); |
| 24 | void (*request_bus) (void *data); |
| 25 | void (*release_bus) (void *data); |
| 26 | /* optional functions to optimize xfers */ |
| 27 | void (*set_sck_set_mosi) (int sck, int mosi, void *data); |
| 28 | int (*set_sck_get_miso) (int sck, void *data); |
| 29 | /* Length of half a clock period in usecs. */ |
| 30 | unsigned int half_period; |
| 31 | }; |
| 32 | |
| 33 | int register_spi_bitbang_master(const struct bitbang_spi_master *, void *data); |
| 34 | |
| 35 | #endif /* !__BITBANG_SPI_H__ */ |