sync_serial.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * ioctl defines for synchronous serial port driver
  3. *
  4. * Copyright (c) 2001-2003 Axis Communications AB
  5. *
  6. * Author: Mikael Starvik
  7. *
  8. */
  9. #ifndef SYNC_SERIAL_H
  10. #define SYNC_SERIAL_H
  11. #include <linux/ioctl.h>
  12. #define SSP_SPEED _IOR('S', 0, unsigned int)
  13. #define SSP_MODE _IOR('S', 1, unsigned int)
  14. #define SSP_FRAME_SYNC _IOR('S', 2, unsigned int)
  15. #define SSP_IPOLARITY _IOR('S', 3, unsigned int)
  16. #define SSP_OPOLARITY _IOR('S', 4, unsigned int)
  17. #define SSP_SPI _IOR('S', 5, unsigned int)
  18. #define SSP_INBUFCHUNK _IOR('S', 6, unsigned int)
  19. /* Values for SSP_SPEED */
  20. #define SSP150 0
  21. #define SSP300 1
  22. #define SSP600 2
  23. #define SSP1200 3
  24. #define SSP2400 4
  25. #define SSP4800 5
  26. #define SSP9600 6
  27. #define SSP19200 7
  28. #define SSP28800 8
  29. #define SSP57600 9
  30. #define SSP115200 10
  31. #define SSP230400 11
  32. #define SSP460800 12
  33. #define SSP921600 13
  34. #define SSP3125000 14
  35. #define CODEC 15
  36. #define FREQ_4MHz 0
  37. #define FREQ_2MHz 1
  38. #define FREQ_1MHz 2
  39. #define FREQ_512kHz 3
  40. #define FREQ_256kHz 4
  41. #define FREQ_128kHz 5
  42. #define FREQ_64kHz 6
  43. #define FREQ_32kHz 7
  44. /* Used by application to set CODEC divider, word rate and frame rate */
  45. #define CODEC_VAL(freq, clk_per_sync, sync_per_frame) (CODEC | (freq << 8) | (clk_per_sync << 16) | (sync_per_frame << 28))
  46. /* Used by driver to extract speed */
  47. #define GET_SPEED(x) (x & 0xff)
  48. #define GET_FREQ(x) ((x & 0xff00) >> 8)
  49. #define GET_WORD_RATE(x) (((x & 0x0fff0000) >> 16) - 1)
  50. #define GET_FRAME_RATE(x) (((x & 0xf0000000) >> 28) - 1)
  51. /* Values for SSP_MODE */
  52. #define MASTER_OUTPUT 0
  53. #define SLAVE_OUTPUT 1
  54. #define MASTER_INPUT 2
  55. #define SLAVE_INPUT 3
  56. #define MASTER_BIDIR 4
  57. #define SLAVE_BIDIR 5
  58. /* Values for SSP_FRAME_SYNC */
  59. #define NORMAL_SYNC 1
  60. #define EARLY_SYNC 2
  61. #define SECOND_WORD_SYNC 0x40000
  62. #define BIT_SYNC 4
  63. #define WORD_SYNC 8
  64. #define EXTENDED_SYNC 0x10
  65. #define SYNC_OFF 0x20
  66. #define SYNC_ON 0x40
  67. #define WORD_SIZE_8 0x80
  68. #define WORD_SIZE_12 0x100
  69. #define WORD_SIZE_16 0x200
  70. #define WORD_SIZE_24 0x400
  71. #define WORD_SIZE_32 0x800
  72. #define BIT_ORDER_LSB 0x1000
  73. #define BIT_ORDER_MSB 0x2000
  74. #define FLOW_CONTROL_ENABLE 0x4000
  75. #define FLOW_CONTROL_DISABLE 0x8000
  76. #define CLOCK_GATED 0x10000
  77. #define CLOCK_NOT_GATED 0x20000
  78. /* Values for SSP_IPOLARITY and SSP_OPOLARITY */
  79. #define CLOCK_NORMAL 1
  80. #define CLOCK_INVERT 2
  81. #define CLOCK_INEGEDGE CLOCK_NORMAL
  82. #define CLOCK_IPOSEDGE CLOCK_INVERT
  83. #define FRAME_NORMAL 4
  84. #define FRAME_INVERT 8
  85. #define STATUS_NORMAL 0x10
  86. #define STATUS_INVERT 0x20
  87. /* Values for SSP_SPI */
  88. #define SPI_MASTER 0
  89. #define SPI_SLAVE 1
  90. /* Values for SSP_INBUFCHUNK */
  91. /* plain integer with the size of DMA chunks */
  92. #endif