npl.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #ifndef _DEV_NPL_H_
  2. #define _DEV_NPL_H_
  3. /*
  4. * Copyright (C) 2005 by egnite Software GmbH. 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 EGNITE SOFTWARE GMBH 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 EGNITE
  23. * SOFTWARE GMBH 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. * For additional information see http://www.ethernut.de/
  33. */
  34. #include <dev/irqreg.h>
  35. /*!
  36. * \file dev/npl.h
  37. * \brief Nut Programmable Logic Header File
  38. *
  39. * \verbatim
  40. *
  41. * $Log: npl.h,v $
  42. * Revision 1.2 2006/05/25 09:38:40 haraldkipp
  43. * Use the AVR way of defining memory mapped I/O.
  44. *
  45. * Revision 1.1 2006/01/05 16:32:16 haraldkipp
  46. * First check-in.
  47. *
  48. *
  49. * \endverbatim
  50. */
  51. /*!
  52. * \addtogroup xgNpl
  53. */
  54. /*@{*/
  55. /*!
  56. * \brief CPLD register base address.
  57. *
  58. * On Ethernut 3 the CPLD is selected via NCS2 (GPIO 27), which
  59. * is configured to 0x21000000 - 0x210FFFFF in the CRT initialization
  60. * startup file.
  61. */
  62. #ifndef NPL_BASE
  63. #if defined(ETHERNUT3)
  64. #define NPL_BASE 0x21000000
  65. #else
  66. #define NPL_BASE 0xFF00
  67. #endif
  68. #endif
  69. /*! \brief RS232 command register.
  70. */
  71. #define NPL_RSCR _SFR_MEM8(NPL_BASE + 0x00)
  72. #define NPL_RSFON 0x0001 /*!< \brief Force on. */
  73. #define NPL_RSFOFF 0x0002 /*!< \brief Force off. */
  74. #define NPL_RSDTR 0x0004 /*!< \brief DTR handshake. */
  75. #define NPL_RSRTS 0x0008 /*!< \brief RTS handshake. */
  76. #define NPL_RSUS0E 0x0020 /*!< \brief USART0 select. */
  77. #define NPL_RSUS1E 0x0040 /*!< \brief USART1 select. */
  78. #define NPL_RSUS1P 0x0080 /*!< \brief USART1 primary. */
  79. /*! \brief Interrupt mask register.
  80. */
  81. #define NPL_IMR _SFR_MEM16(NPL_BASE + 0x04)
  82. /*! \brief Signal latch register.
  83. */
  84. #define NPL_SLR _SFR_MEM16(NPL_BASE + 0x0C)
  85. /*! \brief Signal clear register.
  86. */
  87. #define NPL_SCR _SFR_MEM16(NPL_BASE + 0x10)
  88. #define NPL_RSCTS 0x0001 /*!< \brief RS232 CTS interrupt. */
  89. #define NPL_RSDSR 0x0002 /*!< \brief RS232 DSR interrupt. */
  90. #define NPL_RSDCD 0x0004 /*!< \brief RS232 DCD interrupt. */
  91. #define NPL_RSRI 0x0008 /*!< \brief RS232 RI interrupt. */
  92. #define NPL_RTCALARM 0x0010 /*!< \brief RTC alarm interrupt. */
  93. #define NPL_LANWAKEUP 0x0020 /*!< \brief NIC wakeup interrupt. */
  94. #define NPL_FMBUSY 0x0040 /*!< \brief FLASH ready interrupt. */
  95. #define NPL_MMCREADY 0x0080 /*!< \brief MMC shift register ready. */
  96. #define NPL_RSINVAL 0x0100 /*!< \brief RS232 invalid interrupt. */
  97. #define NPL_NRSINVAL 0x0200 /*!< \brief RS232 valid interrupt. */
  98. #define NPL_MMCD 0x0400 /*!< \brief MMC insert interrupt. */
  99. #define NPL_NMMCD 0x0800 /*!< \brief MMC remove interrupt. */
  100. /*! \brief MMC data register.
  101. */
  102. #define NPL_MMCDR _SFR_MEM8(NPL_BASE + 0x14)
  103. /*! \brief External enable register.
  104. */
  105. #define NPL_XER _SFR_MEM8(NPL_BASE + 0x18)
  106. #define NPL_MMCS 0x0001 /*!< \brief MMC select. */
  107. #define NPL_PANCS 0x0002 /*!< \brief Panel select. */
  108. #define NPL_USRLED 0x0004 /*!< \brief User LED. */
  109. /*! \brief Version identifier register.
  110. */
  111. #define NPL_VIDR _SFR_MEM8(NPL_BASE + 0x1C)
  112. extern IRQ_HANDLER sig_RSCTS;
  113. extern IRQ_HANDLER sig_RSDSR;
  114. extern IRQ_HANDLER sig_RSDCD;
  115. extern IRQ_HANDLER sig_RSRI;
  116. extern IRQ_HANDLER sig_RTCALARM;
  117. extern IRQ_HANDLER sig_LANWAKEUP;
  118. extern IRQ_HANDLER sig_FMBUSY;
  119. extern IRQ_HANDLER sig_RSINVAL;
  120. extern IRQ_HANDLER sig_NRSINVAL;
  121. extern IRQ_HANDLER sig_MMCD;
  122. extern IRQ_HANDLER sig_NMMCD;
  123. __BEGIN_DECLS
  124. /* Function prototypes. */
  125. extern int NplRegisterIrqHandler(IRQ_HANDLER * irq, void (*handler) (void *), void *arg);
  126. extern int NplIrqEnable(IRQ_HANDLER * irq);
  127. extern int NplIrqDisable(IRQ_HANDLER * irq);
  128. __END_DECLS
  129. /* */
  130. /*@}*/
  131. #endif