board.h 3.8 KB

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