board.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. /*
  14. Concepts and parts of this file have been contributed by Rocco Marco
  15. Guglielmi.
  16. */
  17. #ifndef _BOARD_H_
  18. #define _BOARD_H_
  19. /*
  20. * Setup for the ST7580 Evaluation kit board.
  21. */
  22. /*
  23. * Board identifier.
  24. */
  25. #define BOARD_ST_EVALKIT_ST7580_1
  26. #define BOARD_NAME "STMicroelectronics EVALKITST7580_1"
  27. /*
  28. * Board frequencies.
  29. */
  30. #define STM32_LSECLK 0
  31. #define STM32_HSECLK 8000000
  32. /*
  33. * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
  34. */
  35. #define STM32F103xB
  36. /*
  37. * IO pins assignments.
  38. */
  39. #define GPIOA_CL_ADC 0
  40. #define GPIOA_PLC_T_REQ 1
  41. #define GPIOA_PLC_TXD 2
  42. #define GPIOA_PLC_RXD 3
  43. #define GPIOA_SD_NSS 4
  44. #define GPIOA_SD_SCLK 5
  45. #define GPIOA_SD_MISO 6
  46. #define GPIOA_SD_MOSI 7
  47. #define GPIOA_8MHZ_MCO 8
  48. #define GPIOA_UART1_TXD 9
  49. #define GPIOA_UART1_RXD 10
  50. #define GPIOA_USBDM 11
  51. #define GPIOA_USBDP 12
  52. #define GPIOA_JTMS 13
  53. #define GPIOA_JTCK 14
  54. #define GPIOA_JTDI 15
  55. #define GPIOB_SD_CD 0
  56. #define GPIOB_PA_ADC 1
  57. #define GPIOB_BOOT1 2
  58. #define GPIOB_J_TDO 3
  59. #define GPIOB_J_TRSTN 4
  60. #define GPIOB_LED_RED 5
  61. #define GPIOB_LED_YELLOW 6
  62. #define GPIOB_LED_GREEN 7
  63. #define GPIOB_I2C1_SCL 8
  64. #define GPIOB_I2C1_SDA 9
  65. #define GPIOB_SW4 10
  66. #define GPIOB_SW3 11
  67. #define GPIOB_DIP_SW4 12
  68. #define GPIOB_DIP_SW3 13
  69. #define GPIOB_DIP_SW2 14
  70. #define GPIOB_DIP_SW1 15
  71. #define GPIOC_PC0 0
  72. #define GPIOC_PC1 1
  73. #define GPIOC_PC2 2
  74. #define GPIOC_PC3 3
  75. #define GPIOC_PC4 4
  76. #define GPIOC_PC5 5
  77. #define GPIOC_PC6 6
  78. #define GPIOC_PC7 7
  79. #define GPIOC_PC8 8
  80. #define GPIOC_PC9 9
  81. #define GPIOC_PC10 10
  82. #define GPIOC_PC11 11
  83. #define GPIOC_PC12 12
  84. #define GPIOC_PL_RX_ON 13
  85. #define GPIOC_PL_TX_ON 14
  86. #define GPIOC_PLC_RESETN 15
  87. #define GPIOD_OSC_IN 0
  88. #define GPIOD_OSC_OUT 1
  89. /*
  90. * I/O ports initial setup, this configuration is established soon after reset
  91. * in the initialization code.
  92. *
  93. * The digits have the following meaning:
  94. * 0 - Analog input.
  95. * 1 - Push Pull output 10MHz.
  96. * 2 - Push Pull output 2MHz.
  97. * 3 - Push Pull output 50MHz.
  98. * 4 - Digital input.
  99. * 5 - Open Drain output 10MHz.
  100. * 6 - Open Drain output 2MHz.
  101. * 7 - Open Drain output 50MHz.
  102. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  103. * 9 - Alternate Push Pull output 10MHz.
  104. * A - Alternate Push Pull output 2MHz.
  105. * B - Alternate Push Pull output 50MHz.
  106. * C - Reserved.
  107. * D - Alternate Open Drain output 10MHz.
  108. * E - Alternate Open Drain output 2MHz.
  109. * F - Alternate Open Drain output 50MHz.
  110. * Please refer to the STM32 Reference Manual for details.
  111. */
  112. /*
  113. * Port A setup.
  114. * PA0 - Analog input (GPIOA_CL_ADC)
  115. * PA1 - Push Pull output (GPIOA_PLC_T_REQ).
  116. * PA2 - Alternate output (GPIOA_PLC_TXD).
  117. * PA3 - Pull-up input (GPIOA_PLC_RXD).
  118. * PA4 - Push Pull output (GPIOA_SD_NSS).
  119. * PA5 - Alternate output (GPIOA_SD_SCLK).
  120. * PA6 - Alternate output (GPIOA_SD_MISO).
  121. * PA7 - Alternate output (GPIOA_SD_MOSI).
  122. * PA8 - Alternate output (GPIOA_8MHZ_MCO).
  123. * PA9 - Alternate output (GPIOA_UART1_TXD).
  124. * PA10 - Normal input (GPIOA_UART1_RXD).
  125. * PA11 - Alternate output (GPIOA_USBDM).
  126. * PA12 - Alternate output (GPIOA_USBDP).
  127. * PA13 - Pull-up input (GPIOA_JTMS).
  128. * PA14 - Pull-down input (GPIOA_JTCK).
  129. * PA15 - Pull-up input (GPIOA_JTDI).
  130. */
  131. #define VAL_GPIOACRL 0xBBB38B30 /* PA7...PA0 */
  132. #define VAL_GPIOACRH 0x888BB4BB /* PA15...PA8 */
  133. #define VAL_GPIOAODR 0xFFFFBFFF
  134. /*
  135. * Port B setup.
  136. * PB0 - Pull-up input (GPIOB_SD_CD)
  137. * PB1 - Analog input (GPIOB_PA_ADC).
  138. * PB2 - Normal input (GPIOB_BOOT1).
  139. * PB3 - Pull-up input (GPIOB_J_TDO).
  140. * PB4 - Pull-up input (GPIOB_J_TRSTN).
  141. * PB5 - Push Pull output (GPIOB_LED_RED).
  142. * PB6 - Push Pull output (GPIOB_LED_YELLOW).
  143. * PB7 - Push Pull output (GPIOB_LED_GREEN).
  144. * PB8 - Alternate output (GPIOB_I2C1_SCL).
  145. * PB9 - Alternate output (GPIOB_I2C1_SDA).
  146. * PB10 - Normal input (GPIOB_SW4).
  147. * PB11 - Normal input (GPIOB_SW3).
  148. * PB12 - Normal input (GPIOB_DIP_SW4).
  149. * PB13 - Normal input (GPIOB_DIP_SW3).
  150. * PB14 - Normal input (GPIOB_DIP_SW2).
  151. * PB15 - Normal input (GPIOB_DIP_SW1).
  152. */
  153. #define VAL_GPIOBCRL 0x33388408 /* PB7...PB0 */
  154. #define VAL_GPIOBCRH 0x444444BB /* PB15...PB8 */
  155. #define VAL_GPIOBODR 0xFFFFFFFF
  156. /*
  157. * Port C setup.
  158. * Everything input with pull-up except:
  159. * PC13 - Normal input (GPIOC_PL_RX_ON).
  160. * PC14 - Normal input (GPIOC_PL_TX_ON).
  161. * PC15 - Push Pull output (GPIOC_PLC_RESETN).
  162. */
  163. #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */
  164. #define VAL_GPIOCCRH 0x34488888 /* PC15...PC8 */
  165. #define VAL_GPIOCODR 0xFFFFFFFF
  166. /*
  167. * Port D setup.
  168. * Everything input with pull-up except:
  169. * PD0 - Normal input (GPIOD_OSC_IN).
  170. * PD1 - Normal input (GPIOD_OSC_OUT).
  171. */
  172. #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
  173. #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
  174. #define VAL_GPIODODR 0xFFFFFFFF
  175. /*
  176. * Port E setup.
  177. * Everything input with pull-up except:
  178. */
  179. #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
  180. #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
  181. #define VAL_GPIOEODR 0xFFFFFFFF
  182. /*
  183. * USB bus activation macro, required by the USB driver.
  184. */
  185. #define usb_lld_connect_bus(usbp)
  186. /*
  187. * USB bus de-activation macro, required by the USB driver.
  188. */
  189. #define usb_lld_disconnect_bus(usbp)
  190. #if !defined(_FROM_ASM_)
  191. #ifdef __cplusplus
  192. extern "C" {
  193. #endif
  194. void boardInit(void);
  195. #ifdef __cplusplus
  196. }
  197. #endif
  198. #endif /* _FROM_ASM_ */
  199. #endif /* _BOARD_H_ */