blob: 322d022416deb6417db9dc31b5bdcfe69304f793 [file] [log] [blame]
Nico Huberd16a9112024-01-07 00:11:44 +01001/*
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
18struct 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);
Nico Huber5fc31542024-01-07 15:58:34 +010029 /* optional functions for dual/quad i/o */
30 void (*set_sck_set_dual_io) (int sck, int io, void *data);
31 void (*set_sck_set_quad_io) (int sck, int io, void *data);
32 void (*set_idle_io) (void *data);
33 int (*set_sck_get_dual_io) (int sck, void *data);
34 int (*set_sck_get_quad_io) (int sck, void *data);
Nico Huberd16a9112024-01-07 00:11:44 +010035 /* Length of half a clock period in usecs. */
36 unsigned int half_period;
37};
38
39int register_spi_bitbang_master(const struct bitbang_spi_master *, void *data);
40
41#endif /* !__BITBANG_SPI_H__ */