summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/soc/spi.h
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-05-13 12:45:53 +0200
committerUros Majstorovic <majstor@majstor.org>2022-05-13 12:45:53 +0200
commit412a8f99928beff605805807b0f07f6bf8d0a965 (patch)
tree366f1768ddfd32960c5d26ca3fba14e82c3b571e /fw/fe310/eos/soc/spi.h
parent9ccb4db8d59ec9dab33ee8617d462f21a8bb4fa8 (diff)
code rename
Diffstat (limited to 'fw/fe310/eos/soc/spi.h')
-rw-r--r--fw/fe310/eos/soc/spi.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/fw/fe310/eos/soc/spi.h b/fw/fe310/eos/soc/spi.h
new file mode 100644
index 0000000..a23a235
--- /dev/null
+++ b/fw/fe310/eos/soc/spi.h
@@ -0,0 +1,28 @@
+#include <stdint.h>
+#include "event.h"
+
+#define EOS_SPI_FLAG_TX 0x01
+#define EOS_SPI_FLAG_MORE 0x02
+#define EOS_SPI_FLAG_BSWAP 0x04
+
+#define EOS_SPI_EVT_SDC 1
+#define EOS_SPI_EVT_CAM 2
+
+#define EOS_SPI_MAX_EVT 2
+
+int eos_spi_init(uint8_t wakeup_cause);
+void eos_spi_start(uint16_t div, uint8_t csid, uint8_t cspin, unsigned char evt);
+void eos_spi_stop(void);
+void eos_spi_set_handler(unsigned char evt, eos_evt_handler_t handler);
+
+void _eos_spi_xchg_init(unsigned char *buffer, uint16_t len, uint8_t flags);
+void eos_spi_xchg(unsigned char *buffer, uint16_t len, uint8_t flags);
+void eos_spi_handle_xchg(void);
+
+void eos_spi_cs_set(void);
+void eos_spi_cs_clear(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_xchg24(uint32_t data, uint8_t flags);
+uint32_t eos_spi_xchg32(uint32_t data, uint8_t flags);
+void eos_spi_flush(void);