board.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 the Olimex STM33-H103 proto board.
  17. */
  18. /*
  19. * Board identifier.
  20. */
  21. #define BOARD_OLIMEX_STM32_H103
  22. #define BOARD_NAME "Olimex STM32-H103"
  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 STM32F10X_MD
  32. /*
  33. * IO pins assignments.
  34. */
  35. #define GPIOA_BUTTON 0
  36. #define GPIOC_USB_DISC 11
  37. #define GPIOC_LED 12
  38. /*
  39. * I/O ports initial setup, this configuration is established soon after reset
  40. * in the initialization code.
  41. *
  42. * The digits have the following meaning:
  43. * 0 - Analog input.
  44. * 1 - Push Pull output 10MHz.
  45. * 2 - Push Pull output 2MHz.
  46. * 3 - Push Pull output 50MHz.
  47. * 4 - Digital input.
  48. * 5 - Open Drain output 10MHz.
  49. * 6 - Open Drain output 2MHz.
  50. * 7 - Open Drain output 50MHz.
  51. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  52. * 9 - Alternate Push Pull output 10MHz.
  53. * A - Alternate Push Pull output 2MHz.
  54. * B - Alternate Push Pull output 50MHz.
  55. * C - Reserved.
  56. * D - Alternate Open Drain output 10MHz.
  57. * E - Alternate Open Drain output 2MHz.
  58. * F - Alternate Open Drain output 50MHz.
  59. * Please refer to the STM32 Reference Manual for details.
  60. */
  61. /*
  62. * Port A setup.
  63. * Everything input with pull-up except:
  64. * PA0 - Normal input (BUTTON).
  65. * PA2 - Alternate output (USART2 TX).
  66. * PA3 - Normal input (USART2 RX).
  67. */
  68. #define VAL_GPIOACRL 0x88884B84 /* PA7...PA0 */
  69. #define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */
  70. #define VAL_GPIOAODR 0xFFFFFFFF
  71. /*
  72. * Port B setup.
  73. * Everything input with pull-up except:
  74. */
  75. #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
  76. #define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */
  77. #define VAL_GPIOBODR 0xFFFFFFFF
  78. /*
  79. * Port C setup.
  80. * Everything input with pull-up except:
  81. * PC6 - Normal input because there is an external resistor.
  82. * PC7 - Normal input because there is an external resistor.
  83. * PC11 - Open Drain output (USB disconnect).
  84. * PC12 - Push Pull output (LED).
  85. */
  86. #define VAL_GPIOCCRL 0x44888888 /* PC7...PC0 */
  87. #define VAL_GPIOCCRH 0x88837888 /* PC15...PC8 */
  88. #define VAL_GPIOCODR 0xFFFFFFFF
  89. /*
  90. * Port D setup.
  91. * Everything input with pull-up except:
  92. * PD0 - Normal input (XTAL).
  93. * PD1 - Normal input (XTAL).
  94. */
  95. #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
  96. #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
  97. #define VAL_GPIODODR 0xFFFFFFFF
  98. /*
  99. * Port E setup.
  100. * Everything input with pull-up except:
  101. */
  102. #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
  103. #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
  104. #define VAL_GPIOEODR 0xFFFFFFFF
  105. #if !defined(_FROM_ASM_)
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109. void boardInit(void);
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif /* _FROM_ASM_ */
  114. #endif /* _BOARD_H_ */