spi-davinci.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2011-01-13 weety first version
  9. */
  10. #ifndef __DAVINCI_SPI_H
  11. #define __DAVINCI_SPI_H
  12. typedef unsigned long u32;
  13. typedef unsigned short u16;
  14. typedef unsigned char u8;
  15. typedef unsigned int bool;
  16. #define SPI_INTERN_CS 0xFF
  17. enum {
  18. SPI_VERSION_1, /* For DM355/DM365/DM6467 */
  19. SPI_VERSION_2, /* For DA8xx */
  20. };
  21. /**
  22. * davinci_spi_config - Per-chip-select configuration for SPI slave devices
  23. *
  24. * @wdelay: amount of delay between transmissions. Measured in number of
  25. * SPI module clocks.
  26. * @odd_parity: polarity of parity flag at the end of transmit data stream.
  27. * 0 - odd parity, 1 - even parity.
  28. * @parity_enable: enable transmission of parity at end of each transmit
  29. * data stream.
  30. * @io_type: type of IO transfer. Choose between polled, interrupt and DMA.
  31. * @timer_disable: disable chip-select timers (setup and hold)
  32. * @c2tdelay: chip-select setup time. Measured in number of SPI module clocks.
  33. * @t2cdelay: chip-select hold time. Measured in number of SPI module clocks.
  34. * @t2edelay: transmit data finished to SPI ENAn pin inactive time. Measured
  35. * in number of SPI clocks.
  36. * @c2edelay: chip-select active to SPI ENAn signal active time. Measured in
  37. * number of SPI clocks.
  38. */
  39. struct davinci_spi_config {
  40. u8 wdelay;
  41. u8 odd_parity;
  42. u8 parity_enable;
  43. #define SPI_IO_TYPE_INTR 0
  44. #define SPI_IO_TYPE_POLL 1
  45. #define SPI_IO_TYPE_DMA 2
  46. u8 io_type;
  47. u8 timer_disable;
  48. u8 c2tdelay;
  49. u8 t2cdelay;
  50. u8 t2edelay;
  51. u8 c2edelay;
  52. };
  53. extern int rt_hw_spi_init(void);
  54. #endif /* __DAVINCI_SPI_H */