board.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef _BOARD_H_
  14. #define _BOARD_H_
  15. /*
  16. * Setup for Embedded Artists LPCXpresso LPC812 board.
  17. */
  18. /*
  19. * Board identifiers.
  20. */
  21. #define BOARD_EA_LPC812
  22. #define BOARD_NAME "Embedded Artists LPCXpresso LPC812"
  23. /*
  24. * Board frequencies.
  25. */
  26. #define SYSOSCCLK 12000000
  27. /*
  28. * I/O ports initial setup, this configuration is established soon after reset
  29. * in the initialization code.
  30. * Please refer to the LPC8xx Reference Manual for details.
  31. */
  32. /* Pull-up/down */
  33. #define PIN_MODE_NOPULL (0<<3)
  34. #define PIN_MODE_PULLDOWN (1<<3)
  35. #define PIN_MODE_PULLUP (2<<3)
  36. #define PIN_MODE_REPEATER (3<<3)
  37. /* Hysteresis */
  38. #define PIN_HYS_EN (1<<5)
  39. /* Invert Input */
  40. #define PIN_INV_INPUT (1<<6)
  41. /* Reserved bits */
  42. #define PIN_RSVD (1<<7)
  43. /* I2C Mode */
  44. #define PIN_I2CMODE_STD (0<<8)
  45. #define PIN_I2CMODE_STDIO (1<<8)
  46. #define PIN_I2CMODE_FAST (2<<8)
  47. /* Open Drain */
  48. #define PIN_OPEN_DRAIN (1<<10)
  49. /* Input Filter Sample Clocks */
  50. #define PIN_SMODE_FILTER(n) ((n)<<11)
  51. /* Input Filter clock divider */
  52. #define PIN_CLKDIV_FILTER(n) ((n)<<13)
  53. /*
  54. * Pin definitions.
  55. */
  56. #define LED_RED 7
  57. #define LED_BLUE 16
  58. #define LED_GREEN 17
  59. /*
  60. * GPIO 0 initial setup.
  61. */
  62. /*#define VAL_PIO0_0 PIN_MODE_PULLUP*/
  63. /*#define VAL_PIO0_1 PIN_MODE_PULLUP*/
  64. /*#define VAL_PIO0_2 PIN_MODE_PULLUP*/
  65. /*#define VAL_PIO0_3 PIN_MODE_PULLUP*/
  66. /*#define VAL_PIO0_4 PIN_MODE_PULLUP*/
  67. /*#define VAL_PIO0_5 PIN_MODE_PULLUP*/
  68. /*#define VAL_PIO0_6 PIN_MODE_PULLUP*/
  69. #define VAL_PIO0_7 PIN_MODE_NOPULL
  70. /*#define VAL_PIO0_8 PIN_MODE_PULLUP*/
  71. /*#define VAL_PIO0_9 PIN_MODE_PULLUP*/
  72. /*#define VAL_PIO0_10 PIN_MODE_PULLUP*/
  73. /*#define VAL_PIO0_11 PIN_MODE_PULLUP*/
  74. /*#define VAL_PIO0_12 PIN_MODE_PULLUP*/
  75. /*#define VAL_PIO0_13 PIN_MODE_PULLUP*/
  76. /*#define VAL_PIO0_14 PIN_MODE_PULLUP*/
  77. /*#define VAL_PIO0_15 PIN_MODE_PULLUP*/
  78. #define VAL_PIO0_16 PIN_MODE_NOPULL
  79. #define VAL_PIO0_17 PIN_MODE_NOPULL
  80. /* UART0: TXD = P0.4, RXD = P0.0)*/
  81. #define VAL_PINASSIGN0 ((0xFFFF0000) | (0<<8) | (4))
  82. /*#define VAL_PINASSIGN1 0xFFFFFFFF*/
  83. /*#define VAL_PINASSIGN2 0xFFFFFFFF*/
  84. /*#define VAL_PINASSIGN3 0xFFFFFFFF*/
  85. /*#define VAL_PINASSIGN4 0xFFFFFFFF*/
  86. /*#define VAL_PINASSIGN5 0xFFFFFFFF*/
  87. /*#define VAL_PINASSIGN6 0xFFFFFFFF*/
  88. /*#define VAL_PINASSIGN7 0xFFFFFFFF*/
  89. /*#define VAL_PINASSIGN8 0xFFFFFFFF*/
  90. #define VAL_GPIO0DIR (PAL_PORT_BIT(LED_RED) | \
  91. PAL_PORT_BIT(LED_BLUE) | \
  92. PAL_PORT_BIT(LED_GREEN))
  93. #define VAL_GPIO0DATA (PAL_PORT_BIT(LED_RED) | \
  94. PAL_PORT_BIT(LED_BLUE) | \
  95. PAL_PORT_BIT(LED_GREEN))
  96. #if !defined(_FROM_ASM_)
  97. #ifdef __cplusplus
  98. extern "C" {
  99. #endif
  100. void boardInit(void);
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* _FROM_ASM_ */
  105. #endif /* _BOARD_H_ */