sync_serial.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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