Source code for the Trusted Boot Module.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
tbm-mcu/source/platform/virtual/spi.c

45 lines
723 B

#define _GNU_SOURCE
#include <stdint.h>
#include <stdlib.h>
#include <spi.h>
static int virtual_spi_tx_rx(struct spi_dev *dev, void *rx_buf, size_t rx_len,
const void *tx_buf, size_t tx_len);
static struct spi_ops virtual_spi_ops = {
.tx_rx = virtual_spi_tx_rx,
};
static void virtual_spi_init(void)
{
/* TODO */
}
struct spi_dev *spi_probe(void)
{
struct spi_dev *dev;
if (!(dev = malloc(sizeof *dev)))
return NULL;
dev->ops = &virtual_spi_ops;
/*
dev->dev_id = SPI1;
*/
virtual_spi_init();
return dev;
}
void spi_release(struct spi_dev *dev)
{
free(dev);
}
static int virtual_spi_tx_rx(struct spi_dev *dev, void *rx_buf, size_t rx_len,
const void *tx_buf, size_t tx_len)
{
return 0;
}