Go to the documentation of this file.
34 #ifndef SPI_ENGINE_PRIVATE_H
35 #define SPI_ENGINE_PRIVATE_H
47 #define SPI_ENGINE_REG_VERSION 0x00
48 #define SPI_ENGINE_REG_DATA_WIDTH 0x0C
49 #define SPI_ENGINE_REG_RESET 0x40
50 #define SPI_ENGINE_REG_INT_ENABLE 0x80
51 #define SPI_ENGINE_REG_INT_PENDING 0x84
52 #define SPI_ENGINE_REG_INT_SOURCE 0x88
53 #define SPI_ENGINE_REG_SYNC_ID 0xC0
54 #define SPI_ENGINE_REG_CMD_FIFO_ROOM 0xD0
55 #define SPI_ENGINE_REG_SDO_FIFO_ROOM 0xD4
56 #define SPI_ENGINE_REG_SDI_FIFO_LEVEL 0xD8
57 #define SPI_ENGINE_REG_CMD_FIFO 0xE0
58 #define SPI_ENGINE_REG_SDO_DATA_FIFO 0xE4
59 #define SPI_ENGINE_REG_SDI_DATA_FIFO 0xE8
60 #define SPI_ENGINE_REG_SDI_DATA_FIFO_PEEK 0xEC
63 #define SPI_ENGINE_REG_NUM_OF_SDI_MSK NO_OS_GENMASK(23, 16)
64 #define SPI_ENGINE_REG_DATA_WIDTH_MSK NO_OS_GENMASK(15, 0)
70 #define SPI_ENGINE_INST_TRANSFER 0x00
71 #define SPI_ENGINE_INST_ASSERT 0x01
72 #define SPI_ENGINE_INST_CONFIG 0x02
73 #define SPI_ENGINE_INST_SYNC_SLEEP 0x03
74 #define SPI_ENGINE_INST_MISC 0x03
75 #define SPI_ENGINE_CMD_REG_CLK_DIV 0x00
76 #define SPI_ENGINE_CMD_REG_CONFIG 0x01
77 #define SPI_ENGINE_CMD_DATA_TRANSFER_LEN 0x02
78 #define SPI_ENGINE_MISC_SYNC 0x00
79 #define SPI_ENGINE_MISC_SLEEP 0x01
80 #define SPI_ENGINE_SYNC_TRANSFER_BEGIN NO_OS_BIT(1)
81 #define SPI_ENGINE_SYNC_TRANSFER_END NO_OS_BIT(2)
82 #define SPI_ENGINE_INT_CMD_ALMOST_EMPTY NO_OS_BIT(0)
83 #define SPI_ENGINE_INT_SDO_ALMOST_EMPTY NO_OS_BIT(1)
84 #define SPI_ENGINE_INT_SDI_ALMOST_FULL NO_OS_BIT(2)
85 #define SPI_ENGINE_INT_SYNC NO_OS_BIT(3)
86 #define SPI_ENGINE_OFFLOAD_CTRL_ENABLE NO_OS_BIT(0)
87 #define SPI_ENGINE_OFFLOAD_STATUS_ENABLED NO_OS_BIT(0)
88 #define SPI_ENGINE_CONFIG_CPHA NO_OS_BIT(0)
89 #define SPI_ENGINE_CONFIG_CPOL NO_OS_BIT(1)
90 #define SPI_ENGINE_CONFIG_3WIRE NO_OS_BIT(2)
91 #define SPI_ENGINE_CONFIG_SDO_IDLE NO_OS_BIT(3)
92 #define SPI_ENGINE_VERSION_MAJOR(x) ((x >> 16) & 0xff)
93 #define SPI_ENGINE_VERSION_MINOR(x) ((x >> 8) & 0xff)
94 #define SPI_ENGINE_VERSION_PATCH(x) (x & 0xff)
100 #define SPI_ENGINE_INSTRUCTION_TRANSFER_W 0x01
101 #define SPI_ENGINE_INSTRUCTION_TRANSFER_R 0x02
102 #define SPI_ENGINE_INSTRUCTION_TRANSFER_RW 0x03
104 #define SPI_ENGINE_REG_OFFLOAD_CTRL(x) (0x100 + (0x20 * x))
105 #define SPI_ENGINE_REG_OFFLOAD_STATUS(x) (0x104 + (0x20 * x))
106 #define SPI_ENGINE_REG_OFFLOAD_RESET(x) (0x108 + (0x20 * x))
107 #define SPI_ENGINE_REG_OFFLOAD_CMD_MEM(x) (0x110 + (0x20 * x))
108 #define SPI_ENGINE_REG_OFFLOAD_SDO_MEM(x) (0x114 + (0x20 * x))
110 #define SPI_ENGINE_CMD(inst, arg1, arg2) \
111 (((inst & 0x03) << 12) | \
112 ((arg1 & 0x03) << 8) | arg2 )
114 #define SPI_ENGINE_CMD_TRANSFER(readwrite, n) \
115 SPI_ENGINE_CMD(SPI_ENGINE_INST_TRANSFER, \
118 #define SPI_ENGINE_CMD_ASSERT(delay, cs) \
119 SPI_ENGINE_CMD(SPI_ENGINE_INST_ASSERT, \
122 #define SPI_ENGINE_CMD_CONFIG(reg, val) \
123 SPI_ENGINE_CMD(SPI_ENGINE_INST_CONFIG, \
126 #define SPI_ENGINE_CMD_SLEEP(delay) \
127 SPI_ENGINE_CMD(SPI_ENGINE_INST_MISC, \
128 SPI_ENGINE_MISC_SLEEP, \
131 #define SPI_ENGINE_CMD_SYNC(id) \
132 SPI_ENGINE_CMD(SPI_ENGINE_INST_MISC, \
133 SPI_ENGINE_MISC_SYNC, \
152 #endif // SPI_ENGINE_PRIVATE_H
struct spi_engine_cmd_queue * cmds
Definition: spi_engine_private.h:149
Definition: spi_engine_private.h:140
struct spi_engine_cmd_queue * next
Definition: spi_engine_private.h:142
Header file of SPI Interface.
uint32_t cmd
Definition: spi_engine_private.h:141
uint32_t * tx_buf
Definition: spi_engine_private.h:146
struct spi_engine_msg spi_engine_msg
uint32_t * rx_buf
Definition: spi_engine_private.h:147
uint32_t length
Definition: spi_engine_private.h:148
struct spi_engine_cmd_queue spi_engine_cmd_queue
Header file of utility functions.
Definition: spi_engine_private.h:145