1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 /** 10 * @addtogroup MMC 11 * @{ 12 * 13 * @brief Declares standard APIs of basic embedded multi media card (MMC) capabilities. 14 * 15 * You can use this module to access the MMC and enable the driver to operate an MMC-compliant device. 16 * @since 1.0 17 */ 18 19 /** 20 * @file mmc_if.h 21 * 22 * @brief Declares the standard MMC APIs. 23 * 24 * @since 1.0 25 */ 26 27 #ifndef MMC_IF_H 28 #define MMC_IF_H 29 30 #include "platform_if.h" 31 32 #ifdef __cplusplus 33 #if __cplusplus 34 extern "C" { 35 #endif 36 #endif /* __cplusplus */ 37 38 /** 39 * @brief Enumerates MMC I/O commands. 40 * 41 * @since 1.0 42 */ 43 enum MmcIoCmd { 44 MMC_CMD_DEV_PRESENT, 45 MMC_CMD_MAX, 46 EMMC_CMD_GET_CID, 47 EMMC_CMD_MAX, 48 SDIO_CMD_MAX, 49 }; 50 51 /** 52 * @brief Opens an MMC controller with a specified number. 53 * 54 * Before using the MMC interface, you can obtain the device handle of the MMC controller 55 * by calling {@link MmcOpen}. This function is used in pair with {@link MmcClose}. 56 * 57 * @param number Indicates the mmc bus number. 58 * 59 * @return Returns the device handle {@link DevHandle} of the MMC controller if the operation is successful; 60 * returns <b>NULL</b> otherwise. 61 * 62 * @since 1.0 63 */ 64 DevHandle MmcOpen(int16_t number); 65 66 /** 67 * @brief Closes an MMC controller. 68 * 69 * After the MMC interface is used, you can close the MMC controller by calling {@link MmcClose}. 70 * This function is used in pair with {@link MmcOpen}. 71 * 72 * @param handle Indicates device handle of the MMC controller. 73 * 74 * @return Returns <b>0</b> if the operation is successful; returns a negative value if the operation fails. 75 * 76 * @since 1.0 77 */ 78 void MmcClose(DevHandle handle); 79 80 /** 81 * @brief Check if a controller has a device present. 82 * 83 * This function is used to check if a controller has a device plugged. 84 * 85 * @param handle Indicates the device handle of the MMC controller. 86 * 87 * @return Returns <b>true</b> if there is a device present; otherwise <b>false</b>. 88 * 89 * @since 1.0 90 */ 91 bool MmcDevPresent(DevHandle handle); 92 93 #ifdef __cplusplus 94 #if __cplusplus 95 } 96 #endif 97 #endif /* __cplusplus */ 98 99 #endif /* MMC_IF_H */ 100