board.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 STMicroelectronics STM32VL-Discovery board.
  17. */
  18. /*
  19. * Board identifier.
  20. */
  21. #define BOARD_ST_STM32VL_DISCOVERY
  22. #define BOARD_NAME "ST STM32VL-Discovery"
  23. /*
  24. * Board frequencies.
  25. */
  26. #define STM32_LSECLK 32768
  27. #define STM32_HSECLK 8000000
  28. /*
  29. * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
  30. */
  31. #define STM32F100xB
  32. /*
  33. * IO pins assignments.
  34. */
  35. #define GPIOA_BUTTON 0
  36. #define GPIOA_SPI1NSS 4
  37. #define GPIOB_SPI2NSS 12
  38. #define GPIOC_LED4 8
  39. #define GPIOC_LED3 9
  40. /*
  41. * I/O ports initial setup, this configuration is established soon after reset
  42. * in the initialization code.
  43. *
  44. * The digits have the following meaning:
  45. * 0 - Analog input.
  46. * 1 - Push Pull output 10MHz.
  47. * 2 - Push Pull output 2MHz.
  48. * 3 - Push Pull output 50MHz.
  49. * 4 - Digital input.
  50. * 5 - Open Drain output 10MHz.
  51. * 6 - Open Drain output 2MHz.
  52. * 7 - Open Drain output 50MHz.
  53. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  54. * 9 - Alternate Push Pull output 10MHz.
  55. * A - Alternate Push Pull output 2MHz.
  56. * B - Alternate Push Pull output 50MHz.
  57. * C - Reserved.
  58. * D - Alternate Open Drain output 10MHz.
  59. * E - Alternate Open Drain output 2MHz.
  60. * F - Alternate Open Drain output 50MHz.
  61. * Please refer to the STM32 Reference Manual for details.
  62. */
  63. /*
  64. * Port A setup.
  65. * Everything input with pull-up except:
  66. * PA0 - Normal input (BUTTON).
  67. * PA2 - Alternate output (USART2 TX).
  68. * PA3 - Normal input (USART2 RX).
  69. * PA4 - Push pull output (SPI1 NSS), initially high state.
  70. * PA5 - Alternate output (SPI1 SCK).
  71. * PA6 - Normal input (SPI1 MISO).
  72. * PA7 - Alternate output (SPI1 MOSI).
  73. * PA9 - Alternate output (USART1 TX).
  74. * PA10 - Normal input (USART1 RX).
  75. */
  76. #define VAL_GPIOACRL 0xB4B34B84 /* PA7...PA0 */
  77. #define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */
  78. #define VAL_GPIOAODR 0xFFFFFFFF
  79. /*
  80. * Port B setup.
  81. * Everything input with pull-up except:
  82. * PB12 - Push pull output (SPI2 NSS), initially high state.
  83. * PB13 - Alternate output (SPI2 SCK).
  84. * PB14 - Normal input (SPI2 MISO).
  85. * PB15 - Alternate output (SPI2 MOSI).
  86. */
  87. #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
  88. #define VAL_GPIOBCRH 0xB4B38888 /* PB15...PB8 */
  89. #define VAL_GPIOBODR 0xFFFFFFFF
  90. /*
  91. * Port C setup.
  92. * Everything input with pull-up except:
  93. * PC8 - Push-pull output (LED4), initially low state.
  94. * PC9 - Push-pull output (LED3), initially low state.
  95. */
  96. #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */
  97. #define VAL_GPIOCCRH 0x88888833 /* PC15...PC8 */
  98. #define VAL_GPIOCODR 0xFFFFFCFF
  99. /*
  100. * Port D setup.
  101. * Everything input with pull-up except:
  102. * PD0 - Normal input (XTAL).
  103. * PD1 - Normal input (XTAL).
  104. */
  105. #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
  106. #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
  107. #define VAL_GPIODODR 0xFFFFFFFF
  108. /*
  109. * Port E setup.
  110. * Everything input with pull-up except:
  111. */
  112. #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
  113. #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
  114. #define VAL_GPIOEODR 0xFFFFFFFF
  115. #if !defined(_FROM_ASM_)
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119. void boardInit(void);
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif /* _FROM_ASM_ */
  124. #endif /* _BOARD_H_ */