3 #ifndef _SPI_GENERIC_H_
4 #define _SPI_GENERIC_H_
10 #define SPI_FLASH_PROG_TIMEOUT_MS 200
11 #define SPI_FLASH_PAGE_ERASE_TIMEOUT_MS 500
18 #define VENDOR_ID_ADESTO 0x1f
19 #define VENDOR_ID_AMIC 0x37
20 #define VENDOR_ID_ATMEL 0x1f
21 #define VENDOR_ID_EON 0x1c
22 #define VENDOR_ID_GIGADEVICE 0xc8
23 #define VENDOR_ID_MACRONIX 0xc2
24 #define VENDOR_ID_SPANSION 0x01
25 #define VENDOR_ID_SST 0xbf
26 #define VENDOR_ID_STMICRO 0x20
27 #define VENDOR_ID_WINBOND 0xef
102 #define SPI_CTRLR_DEFAULT_MAX_XFER_SIZE (UINT32_MAX)
153 size_t bytesout,
void *din,
size_t bytesin);
157 size_t bytesout,
void *din,
size_t bytesin);
262 void *din,
size_t bytesin);
284 unsigned int buf_len);
297 unsigned char dout[2];
298 unsigned char din[2];
305 return ret < 0 ? ret : din[1];
int spi_xfer_vector(const struct spi_slave *slave, struct spi_op vectors[], size_t count)
int spi_claim_bus(const struct spi_slave *slave)
unsigned int spi_crop_chunk(const struct spi_slave *slave, unsigned int cmd_len, unsigned int buf_len)
static int spi_w8r8(const struct spi_slave *slave, unsigned char byte)
int spi_xfer(const struct spi_slave *slave, const void *dout, size_t bytesout, void *din, size_t bytesin)
const struct spi_ctrlr_buses spi_ctrlr_bus_map[]
int spi_get_config(const struct spi_slave *slave, struct spi_cfg *cfg)
@ SPI_CNTRLR_DEDUCT_CMD_LEN
@ SPI_CNTRLR_DEDUCT_OPCODE_LEN
void spi_release_bus(const struct spi_slave *slave)
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
void spi_init(void)
Init all SPI controllers with default values and enable all SPI controller.
const size_t spi_ctrlr_bus_map_count
static struct spi_slave slave
enum spi_wire_mode wire_mode
unsigned int data_bit_length
enum spi_clock_phase clk_phase
enum spi_polarity cs_polarity
enum spi_polarity clk_polarity
const struct spi_ctrlr * ctrlr
int(* xfer_dual)(const struct spi_slave *slave, const void *dout, size_t bytesout, void *din, size_t bytesin)
int(* xfer_vector)(const struct spi_slave *slave, struct spi_op vectors[], size_t count)
int(* setup)(const struct spi_slave *slave)
int(* flash_probe)(const struct spi_slave *slave, struct spi_flash *flash)
int(* flash_protect)(const struct spi_flash *flash, const struct region *region, const enum ctrlr_prot_type type)
void(* release_bus)(const struct spi_slave *slave)
int(* xfer)(const struct spi_slave *slave, const void *dout, size_t bytesout, void *din, size_t bytesin)
int(* claim_bus)(const struct spi_slave *slave)
enum spi_op_status status
const struct spi_ctrlr * ctrlr
typedef void(X86APIP X86EMU_intrFuncs)(int num)