lpc177x_8x_gpio.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef _LPC177X_8X_GPIO_H_
  2. #define _LPC177X_8X_GPIO_H_
  3. /*
  4. * Copyright (C) 2012 by Ole Reinhardt (ole.reinhardt@embedded-it.de)
  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. * \verbatim
  38. * $Id:$
  39. * \endverbatim
  40. */
  41. #define IOCON_FUNC_POS 0
  42. #define IOCON_FUNC_BITMASK 0x00000007
  43. #define IOCON_MODE_POS 3
  44. #define IOCON_MODE_BITMASK 0x00000018
  45. #define IOCON_HYSTERESIS_POS 5
  46. #define IOCON_HYSTERESIS_BITMASK 0x00000020
  47. #define IOCON_INVERT_POS 6
  48. #define IOCON_INVERT_BITMASK 0x00000040
  49. #define IOCON_ADMODE_POS 7
  50. #define IOCON_ADMODE_BITMASK 0x00000080
  51. #define IOCON_GLITCH_FILTER_POS 8
  52. #define IOCON_GLITCH_FILTER_BITMASK 0x00000100
  53. #define IOCON_I2C_MODE_POS 8
  54. #define IOCON_I2C_MODE_BITMASK 0x00000300
  55. #define IOCON_SLEW_POS 9
  56. #define IOCON_SLEW_BITMASK 0x00000200
  57. #define IOCON_ODMODE_POS 10
  58. #define IOCON_ODMODE_BITMASK 0x00000400
  59. #define IOCON_DACEN_POS 16
  60. #define IOCON_DACEN_BITMASK 0x00010000
  61. #define IOCON_MODE_PLAIN (0 << 3)
  62. #define IOCON_MODE_PULLDOWN (1 << 3)
  63. #define IOCON_MODE_PULLUP (2 << 3)
  64. #define IOCON_MODE_REPEATER (3 << 3)
  65. #define IOCON_HYSTERESIS (1 << 5)
  66. #define IOCON_INVERTED (1 << 6)
  67. #define IOCON_ADMODE (1 << 7)
  68. #define IOCON_GLITCH_FILTER (1 << 8)
  69. #define IOCON_SLEW (1 << 9)
  70. #define IOCON_I2CMODE_FAST (0 << 8)
  71. #define IOCON_I2CMODE_OPENDRAIN (1 << 8)
  72. #define IOCON_I2CMODE_FASTPLUS (2 << 8)
  73. #define IOCON_I2CMODE_HIGHOPENDRAIN (3 << 8)
  74. #define IOCON_ODMODE (1 << 10)
  75. #define IOCON_DACEN (1 << 16)
  76. #endif /* _LPC177X_8X_GPIO_H_ */