You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.1 KiB

  1. /*
  2. ChibiOS - Copyright (C) 2006..2016 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. /**
  16. * @brief PAL setup.
  17. * @details Digital I/O ports static configuration as defined in @p board.h.
  18. * This variable is used by the HAL when initializing the PAL driver.
  19. */
  20. const PALConfig pal_default_config = {
  21. #if STM32_HAS_GPIOA
  22. {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
  23. VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
  24. #endif
  25. #if STM32_HAS_GPIOB
  26. {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
  27. VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
  28. #endif
  29. #if STM32_HAS_GPIOC
  30. {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
  31. VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
  32. #endif
  33. #if STM32_HAS_GPIOD
  34. {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
  35. VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
  36. #endif
  37. #if STM32_HAS_GPIOE
  38. {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
  39. VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
  40. #endif
  41. #if STM32_HAS_GPIOF
  42. {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
  43. VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
  44. #endif
  45. #if STM32_HAS_GPIOG
  46. {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
  47. VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
  48. #endif
  49. #if STM32_HAS_GPIOH
  50. {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
  51. VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
  52. #endif
  53. #if STM32_HAS_GPIOI
  54. {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
  55. VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
  56. #endif
  57. };
  58. #endif
  59. void enter_bootloader_mode_if_requested(void);
  60. /**
  61. * @brief Early initialization code.
  62. * @details This initialization must be performed just after stack setup
  63. * and before any other initialization.
  64. */
  65. void __early_init(void) {
  66. enter_bootloader_mode_if_requested();
  67. stm32_clock_init();
  68. }
  69. #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
  70. /**
  71. * @brief MMC_SPI card detection.
  72. */
  73. bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
  74. (void)mmcp;
  75. /* TODO: Fill the implementation.*/
  76. return true;
  77. }
  78. /**
  79. * @brief MMC_SPI card write protection detection.
  80. */
  81. bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
  82. (void)mmcp;
  83. /* TODO: Fill the implementation.*/
  84. return false;
  85. }
  86. #endif
  87. /**
  88. * @brief Board-specific initialization code.
  89. * @todo Add your board-specific code, if any.
  90. */
  91. void boardInit(void) {
  92. }