tlc16c550.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #ifndef _DEV_TLC16C550_H_
  2. #define _DEV_TLC16C550_H_
  3. /*
  4. * Copyright (C) 2001-2003 by Cyber Integration, LLC. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY CYBER INTEGRATION, LLC AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CYBER
  23. * INTEGRATION, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. */
  33. /*
  34. * $Log: tlc16c550.h,v $
  35. * Revision 1.2 2006/05/25 09:09:57 haraldkipp
  36. * API documentation updated and corrected.
  37. *
  38. * Revision 1.1 2005/11/24 11:24:06 haraldkipp
  39. * Initial check-in.
  40. * Many thanks to William Basser for this code and also to Przemyslaw Rudy
  41. * for several enhancements.
  42. *
  43. */
  44. /*
  45. Chip connections:
  46. Ax - to avr address lines
  47. CSx - to avr/PGA (chip select)
  48. Dn - to avr data lines
  49. INTN - to vcc (for 16c554 forces activation of interrupt lines)
  50. INTx - to avr interrupt lines (can be OR-ed and share common avr interrupt line)
  51. OIR - to avr /rd
  52. OIW - to avr /wr
  53. RESET - high is active
  54. */
  55. #include <sys/device.h>
  56. #include <dev/ace.h>
  57. /*!
  58. * \file dev/tlc16c550.h
  59. * \brief ACE ACE definitions.
  60. */
  61. /*!
  62. * \addtogroup xgAceDriver
  63. */
  64. /*@{*/
  65. #define ACE_MF_RTSSENSE 0x00000001UL /*!< DCE input, low on port bit is +12V, which means ON. */
  66. #define ACE_MF_CTSCONTROL 0x00000002UL /*!< DCE output. */
  67. #define ACE_MF_DTRSENSE 0x00000004UL /*!< DCE input. */
  68. #define ACE_MF_DSRCONTROL 0x00000008UL /*!< DCE output. */
  69. #define ACE_MF_DCDCONTROL 0x00000010UL /*!< DCE output. */
  70. #define ACE_MF_RTSCONTROL 0x00000020UL /*!< DTE output. */
  71. #define ACE_MF_CTSSENSE 0x00000040UL /*!< DTE input. */
  72. #define ACE_MF_DTRCONTROL 0x00000080UL /*!< DTE output. */
  73. #define ACE_MF_DSRSENSE 0x00000100UL /*!< DTE input. */
  74. #define ACE_MF_DCDSENSE 0x00000200UL /*!< DTE input. */
  75. #define ACE_MF_SENSEMASK 0x0345 /*!< Handshake sense mask. */
  76. #define ACE_MF_CONTROLMASK 0x00BC /*!< Handshake control mask. */
  77. #define ACE_MF_XONXOFF 0x00000400UL /*!< Software handshake. */
  78. #define ACE_MF_LOCALECHO 0x00010000UL /*!< Should be used in stream, not device. */
  79. #define ACE_MF_COOKEDMODE 0x00020000UL /*!< Should be used in stream, not device. */
  80. #define ACE_MF_NOBUFFER 0x00100000UL /*!< No buffering. */
  81. #define ACE_MF_LINEBUFFER 0x00200000UL /*!< Line buffered. */
  82. #define ACE_MF_BUFFERMASK 0x00300000UL /*!< Masks buffering mode flags. */
  83. #define ACE_SF_RTSOFF 0x00000001UL /*!< Set RTS line is off. */
  84. #define ACE_SF_CTSOFF 0x00000002UL /*!< Set CTS line is off. */
  85. #define ACE_SF_DTROFF 0x00000004UL /*!< Set DTR line is off. */
  86. #define ACE_SF_DSROFF 0x00000008UL /*!< Set DSR line is off. */
  87. #define ACE_SF_DCDOFF 0x00000010UL /*!< Set DCD line is off. */
  88. #define ACE_SF_TXDISABLED 0x00000040UL /*!< Transmitter disabled. */
  89. #define ACE_SF_RXDISABLED 0x00000080UL /*!< Receiver disabled. */
  90. #define ACE_HS_DCERTSCTS 0x00000003UL /*!< RTS/CTS DCE handshake. */
  91. #define ACE_HS_DCEFULL 0x0000001FUL /*!< Full DCE handshake. */
  92. #define ACE_HS_DTERTSCTS 0x00000060UL /*!< RTS/CTS DTE handshake. */
  93. #define ACE_HS_DTEFULL 0x000003E0UL /*!< Full DTE handshake. */
  94. #define ACE_HS_XONXOFF 0x00000400UL /*!< Software handshake. */
  95. #define ACE_CLOCK 1843200 /* in MHz - common for all devices (should be ok) */
  96. /*!
  97. * ACE device control block type.
  98. */
  99. typedef struct _ACEDCB ACEDCB;
  100. /*!
  101. * \struct _ACEDCB tlc16c550.h dev/tlc16c550.h
  102. * \brief ACE device control block structure.
  103. */
  104. struct _ACEDCB {
  105. /*! \brief pointer to the next device, used if more devices share the same interrupt */
  106. NUTDEVICE *dev_next;
  107. /*! \brief Read timeout.
  108. */
  109. u_long dcb_rtimeout;
  110. /*! \brief Write timeout.
  111. */
  112. u_long dcb_wtimeout;
  113. /*! \brief Queue of threads waiting for output buffer empty.
  114. *
  115. * Threads are added to this queue when calling ACEAvrFlush().
  116. */
  117. HANDLE dcb_tx_rdy;
  118. /*! \brief Queue of threads waiting for a character in the input buffer.
  119. *
  120. * Threads are added to this queue when calling ACEAvrInput().
  121. */
  122. HANDLE dcb_rx_rdy;
  123. /*! \brief Mode flags.
  124. */
  125. u_long dcb_modeflags;
  126. /*! \brief Level of the fifo trigger, 0 if no fifo.
  127. */
  128. u_char dcb_rfifo;
  129. /*! \brief Free space in the output fifo since the last write operation.
  130. */
  131. u_char dcb_wfifo;
  132. };
  133. /*@}*/
  134. #endif