diff options
author | Uros Majstorovic <majstor@majstor.org> | 2018-03-14 18:31:22 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2018-03-14 18:31:22 +0100 |
commit | 4b655364d426f8429b063d9746c754beca6f7d1f (patch) | |
tree | 73afa86876733d81cf0fc331643cb0a6cd036e5e /code/fe310/eos/spi.h | |
parent | 7e209672e005b911166f27b691acfc6c988e93fb (diff) |
fixed concerning new asm trap entry
Diffstat (limited to 'code/fe310/eos/spi.h')
-rw-r--r-- | code/fe310/eos/spi.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/code/fe310/eos/spi.h b/code/fe310/eos/spi.h index 7e281b8..55ff846 100644 --- a/code/fe310/eos/spi.h +++ b/code/fe310/eos/spi.h @@ -10,19 +10,31 @@ #define SPI_SIZE_BUF 1500 #define SPI_SIZE_CHUNK 4 -#define SPI_SIZE_BUFQ 4 +#define SPI_SIZE_BUFQ 2 #define SPI_GPIO_RTS_OFFSET PIN_8_OFFSET #define SPI_GPIO_CTS_OFFSET PIN_7_OFFSET #define SPI_IOF_MASK (((uint32_t)1 << IOF_SPI1_SCK) | ((uint32_t)1 << IOF_SPI1_MOSI) | ((uint32_t)1 << IOF_SPI1_MISO)) -typedef struct SPIBuffer { - unsigned char cmd; - unsigned char *buffer; + +#define SPI_FLAG_RDY 0x01 +#define SPI_FLAG_RST 0x02 +#define SPI_FLAG_RTS 0x04 +#define SPI_FLAG_CTS 0x08 +#define SPI_FLAG_INIT 0x10 +#define SPI_FLAG_ONEW 0x20 + +typedef struct SPIState { + uint8_t flags; uint16_t len; + uint16_t len_tx; uint16_t len_rx; uint16_t idx_tx; uint16_t idx_rx; -} SPIBuffer; + unsigned char cmd; + unsigned char *buf; + uint8_t next_cnt; + unsigned char *next_buf; +} SPIState; typedef struct SPIBufQ { uint8_t idx_r; |