mxser.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #ifndef _MXSER_H
  2. #define _MXSER_H
  3. /*
  4. * Semi-public control interfaces
  5. */
  6. /*
  7. * MOXA ioctls
  8. */
  9. #define MOXA 0x400
  10. #define MOXA_GETDATACOUNT (MOXA + 23)
  11. #define MOXA_DIAGNOSE (MOXA + 50)
  12. #define MOXA_CHKPORTENABLE (MOXA + 60)
  13. #define MOXA_HighSpeedOn (MOXA + 61)
  14. #define MOXA_GET_MAJOR (MOXA + 63)
  15. #define MOXA_GETMSTATUS (MOXA + 65)
  16. #define MOXA_SET_OP_MODE (MOXA + 66)
  17. #define MOXA_GET_OP_MODE (MOXA + 67)
  18. #define RS232_MODE 0
  19. #define RS485_2WIRE_MODE 1
  20. #define RS422_MODE 2
  21. #define RS485_4WIRE_MODE 3
  22. #define OP_MODE_MASK 3
  23. #define MOXA_SDS_RSTICOUNTER (MOXA + 69)
  24. #define MOXA_ASPP_OQUEUE (MOXA + 70)
  25. #define MOXA_ASPP_MON (MOXA + 73)
  26. #define MOXA_ASPP_LSTATUS (MOXA + 74)
  27. #define MOXA_ASPP_MON_EXT (MOXA + 75)
  28. #define MOXA_SET_BAUD_METHOD (MOXA + 76)
  29. /* --------------------------------------------------- */
  30. #define NPPI_NOTIFY_PARITY 0x01
  31. #define NPPI_NOTIFY_FRAMING 0x02
  32. #define NPPI_NOTIFY_HW_OVERRUN 0x04
  33. #define NPPI_NOTIFY_SW_OVERRUN 0x08
  34. #define NPPI_NOTIFY_BREAK 0x10
  35. #define NPPI_NOTIFY_CTSHOLD 0x01 /* Tx hold by CTS low */
  36. #define NPPI_NOTIFY_DSRHOLD 0x02 /* Tx hold by DSR low */
  37. #define NPPI_NOTIFY_XOFFHOLD 0x08 /* Tx hold by Xoff received */
  38. #define NPPI_NOTIFY_XOFFXENT 0x10 /* Xoff Sent */
  39. /* follow just for Moxa Must chip define. */
  40. /* */
  41. /* when LCR register (offset 0x03) write following value, */
  42. /* the Must chip will enter enchance mode. And write value */
  43. /* on EFR (offset 0x02) bit 6,7 to change bank. */
  44. #define MOXA_MUST_ENTER_ENCHANCE 0xBF
  45. /* when enhance mode enable, access on general bank register */
  46. #define MOXA_MUST_GDL_REGISTER 0x07
  47. #define MOXA_MUST_GDL_MASK 0x7F
  48. #define MOXA_MUST_GDL_HAS_BAD_DATA 0x80
  49. #define MOXA_MUST_LSR_RERR 0x80 /* error in receive FIFO */
  50. /* enchance register bank select and enchance mode setting register */
  51. /* when LCR register equal to 0xBF */
  52. #define MOXA_MUST_EFR_REGISTER 0x02
  53. /* enchance mode enable */
  54. #define MOXA_MUST_EFR_EFRB_ENABLE 0x10
  55. /* enchance reister bank set 0, 1, 2 */
  56. #define MOXA_MUST_EFR_BANK0 0x00
  57. #define MOXA_MUST_EFR_BANK1 0x40
  58. #define MOXA_MUST_EFR_BANK2 0x80
  59. #define MOXA_MUST_EFR_BANK3 0xC0
  60. #define MOXA_MUST_EFR_BANK_MASK 0xC0
  61. /* set XON1 value register, when LCR=0xBF and change to bank0 */
  62. #define MOXA_MUST_XON1_REGISTER 0x04
  63. /* set XON2 value register, when LCR=0xBF and change to bank0 */
  64. #define MOXA_MUST_XON2_REGISTER 0x05
  65. /* set XOFF1 value register, when LCR=0xBF and change to bank0 */
  66. #define MOXA_MUST_XOFF1_REGISTER 0x06
  67. /* set XOFF2 value register, when LCR=0xBF and change to bank0 */
  68. #define MOXA_MUST_XOFF2_REGISTER 0x07
  69. #define MOXA_MUST_RBRTL_REGISTER 0x04
  70. #define MOXA_MUST_RBRTH_REGISTER 0x05
  71. #define MOXA_MUST_RBRTI_REGISTER 0x06
  72. #define MOXA_MUST_THRTL_REGISTER 0x07
  73. #define MOXA_MUST_ENUM_REGISTER 0x04
  74. #define MOXA_MUST_HWID_REGISTER 0x05
  75. #define MOXA_MUST_ECR_REGISTER 0x06
  76. #define MOXA_MUST_CSR_REGISTER 0x07
  77. /* good data mode enable */
  78. #define MOXA_MUST_FCR_GDA_MODE_ENABLE 0x20
  79. /* only good data put into RxFIFO */
  80. #define MOXA_MUST_FCR_GDA_ONLY_ENABLE 0x10
  81. /* enable CTS interrupt */
  82. #define MOXA_MUST_IER_ECTSI 0x80
  83. /* enable RTS interrupt */
  84. #define MOXA_MUST_IER_ERTSI 0x40
  85. /* enable Xon/Xoff interrupt */
  86. #define MOXA_MUST_IER_XINT 0x20
  87. /* enable GDA interrupt */
  88. #define MOXA_MUST_IER_EGDAI 0x10
  89. #define MOXA_MUST_RECV_ISR (UART_IER_RDI | MOXA_MUST_IER_EGDAI)
  90. /* GDA interrupt pending */
  91. #define MOXA_MUST_IIR_GDA 0x1C
  92. #define MOXA_MUST_IIR_RDA 0x04
  93. #define MOXA_MUST_IIR_RTO 0x0C
  94. #define MOXA_MUST_IIR_LSR 0x06
  95. /* received Xon/Xoff or specical interrupt pending */
  96. #define MOXA_MUST_IIR_XSC 0x10
  97. /* RTS/CTS change state interrupt pending */
  98. #define MOXA_MUST_IIR_RTSCTS 0x20
  99. #define MOXA_MUST_IIR_MASK 0x3E
  100. #define MOXA_MUST_MCR_XON_FLAG 0x40
  101. #define MOXA_MUST_MCR_XON_ANY 0x80
  102. #define MOXA_MUST_MCR_TX_XON 0x08
  103. /* software flow control on chip mask value */
  104. #define MOXA_MUST_EFR_SF_MASK 0x0F
  105. /* send Xon1/Xoff1 */
  106. #define MOXA_MUST_EFR_SF_TX1 0x08
  107. /* send Xon2/Xoff2 */
  108. #define MOXA_MUST_EFR_SF_TX2 0x04
  109. /* send Xon1,Xon2/Xoff1,Xoff2 */
  110. #define MOXA_MUST_EFR_SF_TX12 0x0C
  111. /* don't send Xon/Xoff */
  112. #define MOXA_MUST_EFR_SF_TX_NO 0x00
  113. /* Tx software flow control mask */
  114. #define MOXA_MUST_EFR_SF_TX_MASK 0x0C
  115. /* don't receive Xon/Xoff */
  116. #define MOXA_MUST_EFR_SF_RX_NO 0x00
  117. /* receive Xon1/Xoff1 */
  118. #define MOXA_MUST_EFR_SF_RX1 0x02
  119. /* receive Xon2/Xoff2 */
  120. #define MOXA_MUST_EFR_SF_RX2 0x01
  121. /* receive Xon1,Xon2/Xoff1,Xoff2 */
  122. #define MOXA_MUST_EFR_SF_RX12 0x03
  123. /* Rx software flow control mask */
  124. #define MOXA_MUST_EFR_SF_RX_MASK 0x03
  125. #endif