1 /* 2 * Copyright 2020-2022 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef _SDMMC_CONFIG_H_ 9 #define _SDMMC_CONFIG_H_ 10 11 #ifdef SD_ENABLED 12 #include "fsl_sd.h" 13 #endif 14 #ifdef MMC_ENABLED 15 #include "fsl_mmc.h" 16 #endif 17 #ifdef SDIO_ENABLED 18 #include "fsl_sdio.h" 19 #endif 20 #include "clock_config.h" 21 #include "fsl_adapter_gpio.h" 22 #include "fsl_sdmmc_host.h" 23 #include "fsl_sdmmc_common.h" 24 25 /******************************************************************************* 26 * Definitions 27 ******************************************************************************/ 28 /* @brief host basic configuration */ 29 #define BOARD_SDMMC_SD_HOST_BASEADDR USDHC0 30 #define BOARD_SDMMC_SD_HOST_IRQ USDHC0_IRQn 31 32 #define BOARD_SDMMC_SDIO_HOST_BASEADDR USDHC0 33 #define BOARD_SDMMC_SDIO_HOST_IRQ USDHC0_IRQn 34 35 /* @brief card detect type 36 * 37 * Note: Please pay attention, DAT3 card detection cannot works during the card access, 38 * since the DAT3 will be used for data transfer, thus the functionality of card detect will be disabled. Using card 39 * detect pin for card detection is recommended. 40 */ 41 #define BOARD_SDMMC_SD_CD_TYPE kSD_DetectCardByHostCD 42 #define BOARD_SDMMC_SD_CARD_DETECT_DEBOUNCE_DELAY_MS (100U) 43 /*! @brief SD power reset */ 44 45 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_CLOCK_NAME kCLOCK_HsGpio2 46 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_RESET_SOURCE kHSGPIO2_RST_SHIFT_RSTn 47 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_BASE GPIO 48 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_PORT 2 49 #define BOARD_SDMMC_SD_POWER_RESET_GPIO_PIN 10U 50 51 /*! @brief SD IO voltage */ 52 #define BOARD_SDMMC_SD_IO_VOLTAGE_CONTROL_GPIO_BASE GPIO 53 #define BOARD_SDMMC_SD_IO_VOLTAGE_CONTROL_GPIO_PORT 4U 54 #define BOARD_SDMMC_SD_IO_VOLTAGE_CONTROL_GPIO_PIN 0U 55 56 #define BOARD_SDMMC_SD_IO_VOLTAGE_CONTROL_TYPE kSD_IOVoltageCtrlByGpio 57 58 /* @brief mmc configuration */ 59 #define BOARD_SDMMC_MMC_VCC_SUPPLY kMMC_VoltageWindows270to360 60 #define BOARD_SDMMC_MMC_VCCQ_SUPPLY kMMC_VoltageWindow170to195 61 62 #define BOARD_SDMMC_DATA_BUFFER_ALIGN_SIZE (4U) 63 64 /*!@ brief host interrupt priority*/ 65 #define BOARD_SDMMC_SD_HOST_IRQ_PRIORITY (5U) 66 #define BOARD_SDMMC_MMC_HOST_IRQ_PRIORITY (5U) 67 #define BOARD_SDMMC_SDIO_HOST_IRQ_PRIORITY (5U) 68 /*!@brief dma descriptor buffer size */ 69 #define BOARD_SDMMC_HOST_DMA_DESCRIPTOR_BUFFER_SIZE (32U) 70 71 #if defined(__cplusplus) 72 extern "C" { 73 #endif /* __cplusplus */ 74 75 /******************************************************************************* 76 * API 77 ******************************************************************************/ 78 /*! 79 * @brief BOARD SD configurations. 80 * @param card card descriptor 81 * @param cd card detect callback 82 * @param userData user data for callback 83 */ 84 #ifdef SD_ENABLED 85 void BOARD_SD_Config(void *card, sd_cd_t cd, uint32_t hostIRQPriority, void *userData); 86 #endif 87 88 /*! 89 * @brief BOARD SDIO configurations. 90 * @param card card descriptor 91 * @param cd card detect callback 92 * @param cardInt card interrupt 93 */ 94 #ifdef SDIO_ENABLED 95 void BOARD_SDIO_Config(void *card, sd_cd_t cd, uint32_t hostIRQPriority, sdio_int_t cardInt); 96 #endif 97 98 /*! 99 * @brief BOARD MMC configurations. 100 * @param card card descriptor 101 * @param cd card detect callback 102 * @param userData user data for callback 103 */ 104 #ifdef MMC_ENABLED 105 void BOARD_MMC_Config(void *card, uint32_t hostIRQPriority); 106 107 #endif 108 109 #if defined(__cplusplus) 110 } 111 #endif /* __cplusplus */ 112 113 #endif /* _BOARD_H_ */ 114