board.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2009-09-22 Bernard add board.h to this bsp
  9. */
  10. // <<< Use Configuration Wizard in Context Menu >>>
  11. #ifndef __BOARD_H__
  12. #define __BOARD_H__
  13. #include <stm32f2xx.h>
  14. /* board configuration */
  15. // <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card
  16. // <i>Default: 1
  17. #define STM32_USE_SDIO 1
  18. /* whether use board external SRAM memory */
  19. // <e>Use external SRAM memory on the board
  20. // <i>Enable External SRAM memory
  21. #define STM32_EXT_SRAM 0
  22. // <o>Begin Address of External SRAM
  23. // <i>Default: 0x68000000
  24. #define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */
  25. // <o>End Address of External SRAM
  26. // <i>Default: 0x68080000
  27. #define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */
  28. // </e>
  29. // <o> Internal SRAM memory size[Kbytes] <8-128>
  30. // <i>Default: 64
  31. #define STM32_SRAM_SIZE 128
  32. #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
  33. // <o> Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3
  34. // <i>Default: 1
  35. #define STM32_CONSOLE_USART 1
  36. // <o> Ethernet Interface: <0=> Microchip ENC28J60
  37. #define STM32_ETH_IF 0
  38. void rt_hw_board_led_on(int n);
  39. void rt_hw_board_led_off(int n);
  40. void rt_hw_board_init(void);
  41. #if STM32_CONSOLE_USART == 0
  42. #define CONSOLE_DEVICE "no"
  43. #elif STM32_CONSOLE_USART == 1
  44. #define CONSOLE_DEVICE "uart1"
  45. #elif STM32_CONSOLE_USART == 2
  46. #define CONSOLE_DEVICE "uart2"
  47. #elif STM32_CONSOLE_USART == 3
  48. #define CONSOLE_DEVICE "uart3"
  49. #endif
  50. #if STM32_USE_SDIO
  51. /**
  52. * @brief SD FLASH SDIO Interface
  53. */
  54. #define SD_DETECT_PIN GPIO_Pin_0 /* PB.0 */
  55. #define SD_DETECT_GPIO_PORT GPIOB /* GPIOB */
  56. #define SD_DETECT_GPIO_CLK RCC_AHB1Periph_GPIOB
  57. #define SDIO_FIFO_ADDRESS ((uint32_t)0x40012C80)
  58. /**
  59. * @brief SDIO Intialization Frequency (400KHz max)
  60. */
  61. #define SDIO_INIT_CLK_DIV ((uint8_t)0x76)
  62. /**
  63. * @brief SDIO Data Transfer Frequency (25MHz max)
  64. */
  65. #define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x0)
  66. #define SD_SDIO_DMA DMA2
  67. #define SD_SDIO_DMA_CLK RCC_AHB1Periph_DMA2
  68. #define SD_SDIO_DMA_STREAM3 3
  69. //#define SD_SDIO_DMA_STREAM6 6
  70. #ifdef SD_SDIO_DMA_STREAM3
  71. #define SD_SDIO_DMA_STREAM DMA2_Stream3
  72. #define SD_SDIO_DMA_CHANNEL DMA_Channel_4
  73. #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF3
  74. #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF3
  75. #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF3
  76. #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF3
  77. #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF3
  78. #elif defined SD_SDIO_DMA_STREAM6
  79. #define SD_SDIO_DMA_STREAM DMA2_Stream6
  80. #define SD_SDIO_DMA_CHANNEL DMA_Channel_4
  81. #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF6
  82. #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF6
  83. #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF6
  84. #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF6
  85. #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF6
  86. #endif /* SD_SDIO_DMA_STREAM3 */
  87. void SD_LowLevel_DeInit(void);
  88. void SD_LowLevel_Init(void);
  89. void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize);
  90. void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize);
  91. #endif
  92. void rt_hw_usart_init(void);
  93. /* SD Card init function */
  94. void rt_hw_msd_init(void);
  95. /* ETH interface init function */
  96. #endif
  97. // <<< Use Configuration Wizard in Context Menu >>>