board.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include "hal.h"
  14. /**
  15. * @brief PAL setup.
  16. * @details Digital I/O ports static configuration as defined in @p board.h.
  17. * This variable is used by the HAL when initializing the PAL driver.
  18. */
  19. #if HAL_USE_PAL || defined(__DOXYGEN__)
  20. const PALConfig pal_default_config = {
  21. {VAL_GPIO0DATA, VAL_GPIO0DIR},
  22. {VAL_GPIO1DATA, VAL_GPIO1DIR}
  23. };
  24. #endif
  25. /*
  26. * Early initialization code.
  27. * This initialization must be performed just after stack setup and before
  28. * any other initialization.
  29. */
  30. void __early_init(void) {
  31. lpc_clock_init();
  32. }
  33. /*
  34. * Board-specific initialization code.
  35. */
  36. void boardInit(void) {
  37. /*
  38. * Extra, board-specific, initializations.
  39. * NOTE: PIO1_2 is associated also to the JTAG, if you need to use JTAG
  40. * you must comment that line first.
  41. */
  42. LPC_IOCON->PIO0_7 = 0x80; /* Disables pull-up on LED2 output. */
  43. LPC_IOCON->TRST_PIO0_14 = 0x81; /* Disables pull-up on LED3B output
  44. and makes it GPIO1_2. */
  45. LPC_IOCON->PIO0_21 = 0x80; /* Disables pull-up on LED3R output.*/
  46. LPC_IOCON->PIO0_22 = 0x80; /* Disables pull-up on LED3G output.*/
  47. /* SSP0 mapping.*/
  48. LPC_IOCON->PIO1_29 = 0x81; /* SCK0 without resistors. */
  49. LPC_IOCON->PIO0_8 = 0x81; /* MISO0 without resistors. */
  50. LPC_IOCON->PIO0_9 = 0x81; /* MOSI0 without resistors. */
  51. /* USART mapping.*/
  52. LPC_IOCON->PIO0_18 = 0x81; /* RDX without resistors. */
  53. LPC_IOCON->PIO0_19 = 0x81; /* TDX without resistors. */
  54. }