|
MTK(mediatek)-驱动-交流 QQ群 14180674
spi协议数据采样和数据输出不是要隔半个时钟吗?为什么linux内核用spio模拟spi协议时,数据发送和接收没有延时函数模拟那半个时钟呢?
104 bitbang_txrx_be_cpha0(struct spi_device *spi,
105 unsigned nsecs, unsigned cpol,
106 u32 word, u8 bits)
107 {
108 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
109
110 /* clock starts at inactive polarity */
111 for (word <<= (32 - bits); likely(bits); bits--) {
112
113 /* setup MSB (to slave) on trailing edge */
114 setmosi(spi, word & (1 << 31));
115 spidelay(nsecs); /* T(setup) */
116
117 setsck(spi, !cpol);118 spidelay(nsecs);
119
120 /* sample MSB (from slave) on leading edge */
121 word <<= 1;
122 word |= getmiso(spi);
123 setsck(spi, cpol);124 }
125 return word;
126 }
MTK(mediatek)-驱动-交流 QQ群 14180674 |
|