board.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #if HAL_USE_PAL || defined(__DOXYGEN__)
  15. /* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/
  16. static const spc_siu_init_t spc_siu_init[] = {
  17. {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
  18. {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT},
  19. {PCR(PORT_E, PE_BUTTON1), PAL_LOW, PAL_MODE_INPUT},
  20. {PCR(PORT_E, PE_BUTTON2), PAL_LOW, PAL_MODE_INPUT},
  21. {PCR(PORT_E, PE_BUTTON3), PAL_LOW, PAL_MODE_INPUT},
  22. {PCR(PORT_E, PE_BUTTON4), PAL_LOW, PAL_MODE_INPUT},
  23. {PCR(PORT_E, PE_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
  24. {PCR(PORT_E, PE_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
  25. {PCR(PORT_E, PE_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
  26. {PCR(PORT_E, PE_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
  27. {-1, 0, 0}
  28. };
  29. /* Initialization array for the PSMI registers.*/
  30. static const uint8_t spc_padsels_init[SPC5_SIUL_NUM_PADSELS] = {
  31. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  32. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  33. };
  34. /**
  35. * @brief PAL setup.
  36. */
  37. const PALConfig pal_default_config = {
  38. PAL_MODE_UNCONNECTED, /* Default mode for all undefined pads. */
  39. spc_siu_init,
  40. spc_padsels_init
  41. };
  42. #endif
  43. /*
  44. * Early initialization code.
  45. * This initialization must be performed just after stack setup and before
  46. * any other initialization.
  47. */
  48. void __early_init(void) {
  49. spc_clock_init();
  50. }
  51. /*
  52. * Board-specific initialization code.
  53. */
  54. void boardInit(void) {
  55. }