2017-03-11 00:55:54 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
struct spi_dev;
|
|
|
|
|
|
|
|
struct spi_ops {
|
|
|
|
int (* set_cs_level)(struct spi_dev *dev, int level);
|
2017-06-14 14:26:11 +02:00
|
|
|
int (* tx_rx)(struct spi_dev *dev, void *rx_buf, size_t rx_len,
|
|
|
|
const void *tx_buf, size_t tx_len);
|
2017-03-11 00:55:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct spi_dev {
|
|
|
|
struct spi_ops *ops;
|
|
|
|
uint32_t dev_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct spi_dev *spi_probe(void);
|
2017-03-31 15:53:56 +02:00
|
|
|
void spi_release(struct spi_dev *dev);
|
2017-06-14 14:26:11 +02:00
|
|
|
int spi_tx_rx(struct spi_dev *dev, void *rx_buf, size_t rx_len,
|
|
|
|
const void *tx_buf, size_t tx_len);
|