spi-davinci.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * File : spi-davinci.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2011-01-13 weety first version
  23. */
  24. #ifndef __DAVINCI_SPI_H
  25. #define __DAVINCI_SPI_H
  26. typedef unsigned long u32;
  27. typedef unsigned short u16;
  28. typedef unsigned char u8;
  29. typedef unsigned int bool;
  30. #define SPI_INTERN_CS 0xFF
  31. enum {
  32. SPI_VERSION_1, /* For DM355/DM365/DM6467 */
  33. SPI_VERSION_2, /* For DA8xx */
  34. };
  35. /**
  36. * davinci_spi_config - Per-chip-select configuration for SPI slave devices
  37. *
  38. * @wdelay: amount of delay between transmissions. Measured in number of
  39. * SPI module clocks.
  40. * @odd_parity: polarity of parity flag at the end of transmit data stream.
  41. * 0 - odd parity, 1 - even parity.
  42. * @parity_enable: enable transmission of parity at end of each transmit
  43. * data stream.
  44. * @io_type: type of IO transfer. Choose between polled, interrupt and DMA.
  45. * @timer_disable: disable chip-select timers (setup and hold)
  46. * @c2tdelay: chip-select setup time. Measured in number of SPI module clocks.
  47. * @t2cdelay: chip-select hold time. Measured in number of SPI module clocks.
  48. * @t2edelay: transmit data finished to SPI ENAn pin inactive time. Measured
  49. * in number of SPI clocks.
  50. * @c2edelay: chip-select active to SPI ENAn signal active time. Measured in
  51. * number of SPI clocks.
  52. */
  53. struct davinci_spi_config {
  54. u8 wdelay;
  55. u8 odd_parity;
  56. u8 parity_enable;
  57. #define SPI_IO_TYPE_INTR 0
  58. #define SPI_IO_TYPE_POLL 1
  59. #define SPI_IO_TYPE_DMA 2
  60. u8 io_type;
  61. u8 timer_disable;
  62. u8 c2tdelay;
  63. u8 t2cdelay;
  64. u8 t2edelay;
  65. u8 c2edelay;
  66. };
  67. extern int rt_hw_spi_init(void);
  68. #endif /* __DAVINCI_SPI_H */