board.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. * 2017-5-30 Bernard the first version
  9. */
  10. #ifndef BOARD_H__
  11. #define BOARD_H__
  12. #include <stdint.h>
  13. extern unsigned char __bss_start__;
  14. extern unsigned char __bss_end__;
  15. #define RT_HW_HEAP_BEGIN (void*)&__bss_end__
  16. #define RT_HW_HEAP_END (void*)(0x20000000 + 0x00030000 - 0x1800)
  17. #define BOARD_USDHC0_BASEADDR USDHC0
  18. #define BOARD_USDHC_CD_PORT_BASE PORTC
  19. #define BOARD_USDHC_CD_GPIO_BASE GPIOC
  20. #define BOARD_USDHC_CD_GPIO_PIN 27
  21. #define BOARD_USDHC_CD_PORT_IRQ PORTC_IRQn
  22. #define BOARD_USDHC_CD_PORT_IRQ_HANDLER PORTC_IRQHandler
  23. #define BOARD_USDHC_CD_GPIO_INIT() \
  24. { \
  25. gpio_pin_config_t sw_config = {kGPIO_DigitalInput, 0}; \
  26. GPIO_PinInit(BOARD_USDHC_CD_GPIO_BASE, BOARD_USDHC_CD_GPIO_PIN, &sw_config); \
  27. PORT_SetPinInterruptConfig(BOARD_USDHC_CD_PORT_BASE, BOARD_USDHC_CD_GPIO_PIN, kPORT_InterruptRisingEdge); \
  28. }
  29. #define BOARD_USDHC_CD_STATUS() (GPIO_ReadPinInput(BOARD_USDHC_CD_GPIO_BASE, BOARD_USDHC_CD_GPIO_PIN))
  30. #define BOARD_USDHC_CD_INTERRUPT_STATUS() (GPIO_GetPinsInterruptFlags(BOARD_USDHC_CD_GPIO_BASE))
  31. #define BOARD_USDHC_CD_CLEAR_INTERRUPT(flag) (GPIO_ClearPinsInterruptFlags(BOARD_USDHC_CD_GPIO_BASE, flag))
  32. #define BOARD_USDHC_CARD_INSERT_CD_LEVEL (1U)
  33. #define BOARD_USDHC0_CLK_FREQ (CLOCK_GetIpFreq(kCLOCK_Sdhc0))
  34. #define BOARD_SD_HOST_BASEADDR BOARD_USDHC0_BASEADDR
  35. #define BOARD_SD_HOST_CLK_FREQ BOARD_USDHC0_CLK_FREQ
  36. #define BOARD_SD_HOST_IRQ USDHC0_IRQn
  37. #define BOARD_SD_SUPPORT_180V (0U)
  38. #define BOARD_MMC_HOST_BASEADDR BOARD_USDHC0_BASEADDR
  39. #define BOARD_MMC_HOST_CLK_FREQ BOARD_USDHC0_CLK_FREQ
  40. #define BOARD_MMC_HOST_IRQ USDHC0_IRQn
  41. #define BOARD_MMC_VCCQ_SUPPLY kMMC_VoltageWindows270to360
  42. #define BOARD_MMC_VCC_SUPPLY kMMC_VoltageWindows270to360
  43. #define BOARD_MMC_PIN_CONFIG(speed, strength)
  44. /* this define not implement, due to EVK board have no power reset circuit */
  45. #define BOARD_SD_POWER_RESET_GPIO ()
  46. #define BOARD_SD_POWER_RESET_GPIO_PIN ()
  47. #define BOARD_USDHC_SDCARD_POWER_CONTROL_INIT()
  48. #define BOARD_USDHC_SDCARD_POWER_CONTROL(state)
  49. #define BOARD_SD_PIN_CONFIG(speed, strength)
  50. #define BOARD_USDHC_MMCCARD_POWER_CONTROL(enable)
  51. #define BOARD_USDHC_MMCCARD_POWER_CONTROL_INIT()
  52. void rt_hw_board_init(void);
  53. #endif