scih8devs.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2004 by Jan Dubiec. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the copyright holders nor the names of
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY JAN DUBIEC AND CONTRIBUTORS
  18. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JAN DUBIEC
  21. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  22. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  23. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. /*
  30. * $Log$
  31. * Revision 1.1 2005/07/26 18:02:40 haraldkipp
  32. * Moved from dev.
  33. *
  34. * Revision 1.2 2004/03/18 14:06:52 haraldkipp
  35. * Deprecated header file replaced
  36. *
  37. * Revision 1.1 2004/03/16 16:48:27 haraldkipp
  38. * Added Jan Dubiec's H8/300 port.
  39. *
  40. */
  41. #include <sys/file.h>
  42. #include <sys/device.h>
  43. #include <dev/scih8.h>
  44. /*!
  45. * \addtogroup xgUartDev
  46. */
  47. /*@{*/
  48. static UARTDCB dcb_sci0;
  49. static IFSTREAM ifs_sci0;
  50. static UARTDCB dcb_sci1;
  51. static IFSTREAM ifs_sci1;
  52. static UARTDCB dcb_sci2;
  53. static IFSTREAM ifs_sci2;
  54. __BEGIN_DECLS
  55. /* SCI functions prototypes which are defined in scih8.c */
  56. extern int SciH8Init(NUTDEVICE * dev);
  57. extern int SciH8IOCtl(NUTDEVICE * dev, int req, void *conf);
  58. extern int SciH8Input(NUTDEVICE * dev);
  59. extern int SciH8Output(NUTDEVICE * dev);
  60. extern int SciH8Flush(NUTDEVICE * dev);
  61. extern int SciH8GetRaw(u_char * cp);
  62. extern int SciH8PutRaw(u_char ch);
  63. extern int SciH8Read(NUTFILE * fp, void *buffer, int size);
  64. extern int SciH8Write(NUTFILE * fp, CONST void *buffer, int len);
  65. extern NUTFILE *SciH8Open(NUTDEVICE * dev, CONST char *name, int mode, int acc);
  66. extern int SciH8Close(NUTFILE * fp);
  67. __END_DECLS
  68. /*!
  69. * \brief SCI0 Device information structure.
  70. */
  71. NUTDEVICE devSci0 = {
  72. 0, /*!< Pointer to next device. */
  73. {'s', 'c', 'i', '0', 0, 0, 0, 0, 0}, /*!< Unique device name. */
  74. IFTYP_STREAM, /*!< Type of device. */
  75. 0, /*!< Base address. */
  76. 0, /*!< First interrupt number. */
  77. &ifs_sci0, /*!< Interface control block. */
  78. &dcb_sci0, /*!< Driver control block. */
  79. SciH8Init, /*!< Driver initialization routine. */
  80. SciH8IOCtl, /*!< Driver specific control function. */
  81. SciH8Read, SciH8Write,
  82. /* SciH8Write_P */
  83. SciH8Open,
  84. SciH8Close,
  85. 0,
  86. 0, /*!< Select function, optional, not yet implemented */
  87. };
  88. /*!
  89. * \brief SCI1 Device information structure.
  90. */
  91. NUTDEVICE devSci1 = {
  92. 0, /*!< Pointer to next device. */
  93. {'s', 'c', 'i', '1', 0, 0, 0, 0, 0}, /*!< Unique device name. */
  94. IFTYP_STREAM, /*!< Type of device. */
  95. 1, /*!< Base address. */
  96. 0, /*!< First interrupt number. */
  97. &ifs_sci1, /*!< Interface control block. */
  98. &dcb_sci1, /*!< Driver control block. */
  99. SciH8Init, /*!< Driver initialization routine. */
  100. SciH8IOCtl, /*!< Driver specific control function. */
  101. SciH8Read,
  102. SciH8Write,
  103. /* SciH8Write_P */
  104. SciH8Open,
  105. SciH8Close,
  106. 0,
  107. 0, /*!< Select function, optional, not yet implemented */
  108. };
  109. /*!
  110. * \brief SCI2 Device information structure.
  111. */
  112. NUTDEVICE devSci2 = {
  113. 0, /*!< Pointer to next device. */
  114. {'s', 'c', 'i', '2', 0, 0, 0, 0, 0}, /*!< Unique device name. */
  115. IFTYP_STREAM, /*!< Type of device. */
  116. 2, /*!< Base address. */
  117. 0, /*!< First interrupt number. */
  118. &ifs_sci2, /*!< Interface control block. */
  119. &dcb_sci2, /*!< Driver control block. */
  120. SciH8Init, /*!< Driver initialization routine. */
  121. SciH8IOCtl, /*!< Driver specific control function. */
  122. SciH8Read,
  123. SciH8Write,
  124. /* SciH8Write_P */
  125. SciH8Open,
  126. SciH8Close,
  127. 0,
  128. 0, /*!< Select function, optional, not yet implemented */
  129. };
  130. /*@}*/