summaryrefslogtreecommitdiff
path: root/code/fe310/eos/spi.h
diff options
context:
space:
mode:
Diffstat (limited to 'code/fe310/eos/spi.h')
-rw-r--r--code/fe310/eos/spi.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/code/fe310/eos/spi.h b/code/fe310/eos/spi.h
index 9ef3745..b230924 100644
--- a/code/fe310/eos/spi.h
+++ b/code/fe310/eos/spi.h
@@ -1,8 +1,25 @@
#include <stdint.h>
-#include "encoding.h"
-#include "platform.h"
+#define EOS_SPI_DEV_NET 0
+#define EOS_SPI_DEV_DISP 1
+#define EOS_SPI_DEV_CARD 2
+#define EOS_SPI_DEV_CAM 3
-#include "spi_def.h"
+#define EOS_SPI_MAX_DEV 3
-#define SPI_IOF_MASK (((uint32_t)1 << IOF_SPI1_SCK) | ((uint32_t)1 << IOF_SPI1_MOSI) | ((uint32_t)1 << IOF_SPI1_MISO))
+#define EOS_SPI_FLAG_TX 0x01
+#define EOS_SPI_FLAG_MORE 0x02
+
+void eos_spi_init(void);
+void eos_spi_dev_acquire(unsigned char dev);
+void eos_spi_dev_release(void);
+
+void eos_spi_xchg(unsigned char *buffer, uint16_t len, uint8_t flags);
+void eos_spi_xchg_handler(void);
+void eos_spi_xchg_wait(void);
+
+uint8_t eos_spi_xchg8(uint8_t data, uint8_t flags);
+uint16_t eos_spi_xchg16(uint16_t data, uint8_t flags);
+uint32_t eos_spi_xchg32(uint32_t data, uint8_t flags);
+
+void eos_spi_set_handler(unsigned char dev, eos_evt_fptr_t handler); \ No newline at end of file