preliminaryDataProcessing.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * bfin_serial.h - Blackfin UART/Serial definitions
  3. *
  4. * Copyright 2006-2010 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __BFIN_ASM_SERIAL_H__
  9. #define __BFIN_ASM_SERIAL_H__
  10. #include <linux/serial_core.h>
  11. #include <linux/spinlock.h>
  12. #include <mach/anomaly.h>
  13. #include <mach/bfin_serial.h>
  14. #if defined(CONFIG_BFIN_UART0_CTSRTS) || \
  15. defined(CONFIG_BFIN_UART1_CTSRTS) || \
  16. defined(CONFIG_BFIN_UART2_CTSRTS) || \
  17. defined(CONFIG_BFIN_UART3_CTSRTS)
  18. # if defined(BFIN_UART_BF54X_STYLE) || defined(BFIN_UART_BF60X_STYLE)
  19. # define CONFIG_SERIAL_BFIN_HARD_CTSRTS
  20. # else
  21. # define CONFIG_SERIAL_BFIN_CTSRTS
  22. # endif
  23. #endif
  24. struct circ_buf;
  25. struct timer_list;
  26. struct work_struct;
  27. struct bfin_serial_port {
  28. struct uart_port port;
  29. unsigned int old_status;
  30. int tx_irq;
  31. int rx_irq;
  32. int status_irq;
  33. #ifndef BFIN_UART_BF54X_STYLE
  34. unsigned int lsr;
  35. #endif
  36. #ifdef CONFIG_SERIAL_BFIN_DMA
  37. int tx_done;
  38. int tx_count;
  39. struct circ_buf rx_dma_buf;
  40. struct timer_list rx_dma_timer;
  41. int rx_dma_nrows;
  42. spinlock_t rx_lock;
  43. unsigned int tx_dma_channel;
  44. unsigned int rx_dma_channel;
  45. struct work_struct tx_dma_workqueue;
  46. #elif ANOMALY_05000363
  47. unsigned int anomaly_threshold;
  48. #endif
  49. #if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \
  50. defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS)
  51. int cts_pin;
  52. int rts_pin;
  53. #endif
  54. };
  55. #ifdef BFIN_UART_BF60X_STYLE
  56. /* UART_CTL Masks */
  57. #define UCEN 0x1 /* Enable UARTx Clocks */
  58. #define LOOP_ENA 0x2 /* Loopback Mode Enable */
  59. #define UMOD_MDB 0x10 /* Enable MDB Mode */
  60. #define UMOD_IRDA 0x20 /* Enable IrDA Mode */
  61. #define UMOD_MASK 0x30 /* Uart Mode Mask */
  62. #define WLS(x) (((x-5) & 0x03) << 8) /* Word Length Select */
  63. #define WLS_MASK 0x300 /* Word length Select Mask */
  64. #define WLS_OFFSET 8 /* Word length Select Offset */
  65. #define STB 0x1000 /* Stop Bits */
  66. #define STBH 0x2000 /* Half Stop Bits */
  67. #define PEN 0x4000 /* Parity Enable */
  68. #define EPS 0x8000 /* Even Parity Select */
  69. #define STP 0x10000 /* Stick Parity */
  70. #define FPE 0x20000 /* Force Parity Error On Transmit */
  71. #define FFE 0x40000 /* Force Framing Error On Transmit */
  72. #define SB 0x80000 /* Set Break */
  73. #define LCR_MASK (SB | STP | EPS | PEN | STB | WLS_MASK)
  74. #define FCPOL 0x400000 /* Flow Control Pin Polarity */
  75. #define RPOLC 0x800000 /* IrDA RX Polarity Change */
  76. #define TPOLC 0x1000000 /* IrDA TX Polarity Change */
  77. #define MRTS 0x2000000 /* Manual Request To Send */
  78. #define XOFF 0x4000000 /* Transmitter Off */
  79. #define ARTS 0x8000000 /* Automatic Request To Send */
  80. #define ACTS 0x10000000 /* Automatic Clear To Send */
  81. #define RFIT 0x20000000 /* Receive FIFO IRQ Threshold */
  82. #define RFRT 0x40000000 /* Receive FIFO RTS Threshold */
  83. /* UART_STAT Masks */
  84. #define DR 0x01 /* Data Ready */
  85. #define OE 0x02 /* Overrun Error */
  86. #define PE 0x04 /* Parity Error */
  87. #define FE 0x08 /* Framing Error */
  88. #define BI 0x10 /* Break Interrupt */
  89. #define THRE 0x20 /* THR Empty */
  90. #define TEMT 0x80 /* TSR and UART_THR Empty */
  91. #define TFI 0x100 /* Transmission Finished Indicator */
  92. #define ASTKY 0x200 /* Address Sticky */
  93. #define ADDR 0x400 /* Address bit status */
  94. #define RO 0x800 /* Reception Ongoing */
  95. #define SCTS 0x1000 /* Sticky CTS */
  96. #define CTS 0x10000 /* Clear To Send */
  97. #define RFCS 0x20000 /* Receive FIFO Count Status */
  98. /* UART_CLOCK Masks */
  99. #define EDBO 0x80000000 /* Enable Devide by One */
  100. #else /* BFIN_UART_BF60X_STYLE */
  101. /* UART_LCR Masks */
  102. #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */
  103. #define WLS_MASK 0x03 /* Word length Select Mask */
  104. #define WLS_OFFSET 0 /* Word length Select Offset */
  105. #define STB 0x04 /* Stop Bits */
  106. #define PEN 0x08 /* Parity Enable */
  107. #define EPS 0x10 /* Even Parity Select */
  108. #define STP 0x20 /* Stick Parity */
  109. #define SB 0x40 /* Set Break */
  110. #define DLAB 0x80 /* Divisor Latch Access */
  111. #define LCR_MASK (SB | STP | EPS | PEN | STB | WLS_MASK)
  112. /* UART_LSR Masks */
  113. #define DR 0x01 /* Data Ready */
  114. #define OE 0x02 /* Overrun Error */
  115. #define PE 0x04 /* Parity Error */
  116. #define FE 0x08 /* Framing Error */
  117. #define BI 0x10 /* Break Interrupt */
  118. #define THRE 0x20 /* THR Empty */
  119. #define TEMT 0x40 /* TSR and UART_THR Empty */
  120. #define TFI 0x80 /* Transmission Finished Indicator */
  121. /* UART_MCR Masks */
  122. #define XOFF 0x01 /* Transmitter Off */
  123. #define MRTS 0x02 /* Manual Request To Send */
  124. #define RFIT 0x04 /* Receive FIFO IRQ Threshold */
  125. #define RFRT 0x08 /* Receive FIFO RTS Threshold */
  126. #define LOOP_ENA 0x10 /* Loopback Mode Enable */
  127. #define FCPOL 0x20 /* Flow Control Pin Polarity */
  128. #define ARTS 0x40 /* Automatic Request To Send */
  129. #define ACTS 0x80 /* Automatic Clear To Send */
  130. /* UART_MSR Masks */
  131. #define SCTS 0x01 /* Sticky CTS */
  132. #define CTS 0x10 /* Clear To Send */
  133. #define RFCS 0x20 /* Receive FIFO Count Status */
  134. /* UART_GCTL Masks */
  135. #define UCEN 0x01 /* Enable UARTx Clocks */
  136. #define UMOD_IRDA 0x02 /* Enable IrDA Mode */
  137. #define UMOD_MASK 0x02 /* Uart Mode Mask */
  138. #define TPOLC 0x04 /* IrDA TX Polarity Change */
  139. #define RPOLC 0x08 /* IrDA RX Polarity Change */
  140. #define FPE 0x10 /* Force Parity Error On Transmit */
  141. #define FFE 0x20 /* Force Framing Error On Transmit */
  142. #endif /* BFIN_UART_BF60X_STYLE */
  143. /* UART_IER Masks */
  144. #define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */