123456789101112131415161718192021222324252627282930 |
- #ifndef __HW_SPI_H__
- #define __HW_SPI_H__
- #define HW_SPI_NUMBER 1
- #define HW_SPI_DEVICE_NUMBER 3
- #define RT_SPI_CPHA (1<<0) /* bit[0]:CPHA, clock phase */
- #define RT_SPI_CPOL (1<<1) /* bit[1]:CPOL, clock polarity */
- /**
- * At CPOL=0 the base value of the clock is zero
- * - For CPHA=0, data are captured on the clock's rising edge (low->high transition)
- * and data are propagated on a falling edge (high->low clock transition).
- * - For CPHA=1, data are captured on the clock's falling edge and data are
- * propagated on a rising edge.
- * At CPOL=1 the base value of the clock is one (inversion of CPOL=0)
- * - For CPHA=0, data are captured on clock's falling edge and data are propagated
- * on a rising edge.
- * - For CPHA=1, data are captured on clock's rising edge and data are propagated
- * on a falling edge.
- */
- #define RT_SPI_LSB (0<<2) /* bit[2]: 0-LSB */
- #define RT_SPI_MSB (1<<2) /* bit[2]: 1-MSB */
- void hw_spi_init(void);
- void hw_spi_device_take(int port);
- void hw_spi_device_release(int port);
- int hw_spi_readwrite(uint8_t port, const uint8_t *cmd, uint8_t *dst, int size);
- uint16_t hw_spi_readwrite_halfword(uint8_t port, uint16_t value);
- #endif
|