npl.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef _NPL_H_
  2. #define _NPL_H_
  3. /*
  4. * Copyright (C) 2005 by egnite Software GmbH
  5. *
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the copyright holders nor the names of
  18. * contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  31. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * For additional information see http://www.ethernut.de/
  35. */
  36. /*!
  37. * \brief CPLD register base address.
  38. *
  39. * On Ethernut 3 the CPLD is selected via NCS2 (GPIO 27), which
  40. * is configured to 0x21000000 - 0x210FFFFF in the CRT initialization
  41. * startup file.
  42. */
  43. #ifndef NPL_BASE
  44. #define NPL_BASE 0x21000000
  45. #endif
  46. /*! \brief RS232 command register.
  47. */
  48. #define NPL_RSCR (NPL_BASE + 0x00)
  49. #define NPL_RSFON 0x0001 /*!< \brief Force on. */
  50. #define NPL_RSFOFF 0x0002 /*!< \brief Force off. */
  51. #define NPL_RSDTR 0x0004 /*!< \brief DTR handshake. */
  52. #define NPL_RSRTS 0x0008 /*!< \brief RTS handshake. */
  53. #define NPL_RSUS0E 0x0020 /*!< \brief USART0 select. */
  54. #define NPL_RSUS1E 0x0040 /*!< \brief USART1 select. */
  55. #define NPL_RSUS1P 0x0080 /*!< \brief USART1 primary. */
  56. /*! \brief Interrupt mask register.
  57. */
  58. #define NPL_IMR (NPL_BASE + 0x04)
  59. /*! \brief Signal latch register.
  60. */
  61. #define NPL_SLR (NPL_BASE + 0x0C)
  62. /*! \brief Signal clear register.
  63. */
  64. #define NPL_SCR (NPL_BASE + 0x10)
  65. #define NPL_RSCTS 0x0001 /*!< \brief RS232 CTS interrupt. */
  66. #define NPL_RSDSR 0x0002 /*!< \brief RS232 DSR interrupt. */
  67. #define NPL_RSDCD 0x0004 /*!< \brief RS232 DCD interrupt. */
  68. #define NPL_RSRI 0x0008 /*!< \brief RS232 RI interrupt. */
  69. #define NPL_RTCALARM 0x0010 /*!< \brief RTC alarm interrupt. */
  70. #define NPL_LANWAKEUP 0x0020 /*!< \brief NIC wakeup interrupt. */
  71. #define NPL_FMBUSY 0x0040 /*!< \brief FLASH ready interrupt. */
  72. #define NPL_MMCREADY 0x0080 /*!< \brief MMC shift register ready. */
  73. #define NPL_RSINVAL 0x0100 /*!< \brief RS232 invalid interrupt. */
  74. #define NPL_NRSINVAL 0x0200 /*!< \brief RS232 valid interrupt. */
  75. #define NPL_MMCD 0x0400 /*!< \brief MMC insert interrupt. */
  76. #define NPL_NMMCD 0x0800 /*!< \brief MMC remove interrupt. */
  77. /*! \brief MMC data register.
  78. */
  79. #define NPL_MMCDR (NPL_BASE + 0x14)
  80. /*! \brief External enable register.
  81. */
  82. #define NPL_XER (NPL_BASE + 0x18)
  83. #define NPL_MMCS 0x0001 /*!< \brief MMC select. */
  84. #define NPL_PANCS 0x0002 /*!< \brief Panel select. */
  85. #define NPL_USRLED 0x0004 /*!< \brief User LED. */
  86. #define NPL_NPCS0 0x0008 /*!< \brief DataFlash CS. */
  87. /*! \brief Version identifier register.
  88. */
  89. #define NPL_VIDR (NPL_BASE + 0x1C)
  90. #define outb(_reg, _val) (*((volatile unsigned char *)(_reg)) = (_val))
  91. #define inb(_reg) (*((volatile unsigned char *)(_reg)))
  92. #endif