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.

124 lines
3.4 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. /**
  60. * @brief Early initialization code.
  61. * @details This initialization must be performed just after stack setup
  62. * and before any other initialization.
  63. */
  64. void __early_init(void) {
  65. stm32_clock_init();
  66. }
  67. #if HAL_USE_SDC || defined(__DOXYGEN__)
  68. /**
  69. * @brief SDC card detection.
  70. */
  71. bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
  72. (void)sdcp;
  73. /* TODO: Fill the implementation.*/
  74. return true;
  75. }
  76. /**
  77. * @brief SDC card write protection detection.
  78. */
  79. bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
  80. (void)sdcp;
  81. /* TODO: Fill the implementation.*/
  82. return false;
  83. }
  84. #endif /* HAL_USE_SDC */
  85. #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
  86. /**
  87. * @brief MMC_SPI card detection.
  88. */
  89. bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
  90. (void)mmcp;
  91. /* TODO: Fill the implementation.*/
  92. return true;
  93. }
  94. /**
  95. * @brief MMC_SPI card write protection detection.
  96. */
  97. bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
  98. (void)mmcp;
  99. /* TODO: Fill the implementation.*/
  100. return false;
  101. }
  102. #endif
  103. /**
  104. * @brief Board-specific initialization code.
  105. * @todo Add your board-specific code, if any.
  106. */
  107. void boardInit(void) {
  108. }