sources/common/libs/STM32Cube_F4/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_mmc.c
/**
  * @brief  Initializes the MMC according to the specified parameters in the
            MMC_HandleTypeDef and create the associated handle.
  * @param  hmmc: Pointer to the MMC handle
  * @retval HAL status
  */
@brief  Initializes the MMC according to the specified parameters in the
MMC_HandleTypeDef and create the associated handle.
@param  hmmc: Pointer to the MMC handle
@retval HAL status
@brief Initializes the MMC according to the specified parameters in the MMC_HandleTypeDef and create the associated handle . @param hmmc : Pointer to the MMC handle @retval HAL status
HAL_StatusTypeDef HAL_MMC_Init(MMC_HandleTypeDef *hmmc)
{
  if(hmmc == NULL)
  {
    return HAL_ERROR;
  }
  assert_param(IS_SDIO_ALL_INSTANCE(hmmc->Instance));
  assert_param(IS_SDIO_CLOCK_EDGE(hmmc->Init.ClockEdge));
  assert_param(IS_SDIO_CLOCK_BYPASS(hmmc->Init.ClockBypass));
  assert_param(IS_SDIO_CLOCK_POWER_SAVE(hmmc->Init.ClockPowerSave));
  assert_param(IS_SDIO_BUS_WIDE(hmmc->Init.BusWide));
  assert_param(IS_SDIO_HARDWARE_FLOW_CONTROL(hmmc->Init.HardwareFlowControl));
  assert_param(IS_SDIO_CLKDIV(hmmc->Init.ClockDiv));
  if(hmmc->State == HAL_MMC_STATE_RESET)
  {
    hmmc->Lock = HAL_UNLOCKED;
#if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
    hmmc->TxCpltCallback    = HAL_MMC_TxCpltCallback;
    hmmc->RxCpltCallback    = HAL_MMC_RxCpltCallback;
    hmmc->ErrorCallback     = HAL_MMC_ErrorCallback;
    hmmc->AbortCpltCallback = HAL_MMC_AbortCallback;
    if(hmmc->MspInitCallback == NULL)
    {
      hmmc->MspInitCallback = HAL_MMC_MspInit;
    }
    hmmc->MspInitCallback(hmmc);
#else
    HAL_MMC_MspInit(hmmc);
#endif
  }
  hmmc->State = HAL_MMC_STATE_BUSY;
  if(HAL_MMC_InitCard(hmmc) == HAL_ERROR)
  {
    return HAL_ERROR;
  }
  hmmc->ErrorCode = HAL_MMC_ERROR_NONE;
  hmmc->Context = MMC_CONTEXT_NONE;
  hmmc->State = HAL_MMC_STATE_READY;
  if (hmmc->Init.BusWide != SDIO_BUS_WIDE_1B)
  {
    if (HAL_MMC_ConfigWideBusOperation(hmmc, hmmc->Init.BusWide) != HAL_OK)
    {
      return HAL_ERROR;
    }
  }
  return HAL_OK;
}
HAL_StatusTypeDef HAL_MMC_Init ( MMC_HandleTypeDef * hmmc ) { if ( hmmc == NULL ) { return HAL_ERROR ; } assert_param ( IS_SDIO_ALL_INSTANCE ( hmmc -> Instance ) ) ; assert_param ( IS_SDIO_CLOCK_EDGE ( hmmc -> Init . ClockEdge ) ) ; assert_param ( IS_SDIO_CLOCK_BYPASS ( hmmc -> Init . ClockBypass ) ) ; assert_param ( IS_SDIO_CLOCK_POWER_SAVE ( hmmc -> Init . ClockPowerSave ) ) ; assert_param ( IS_SDIO_BUS_WIDE ( hmmc -> Init . BusWide ) ) ; assert_param ( IS_SDIO_HARDWARE_FLOW_CONTROL ( hmmc -> Init . HardwareFlowControl ) ) ; assert_param ( IS_SDIO_CLKDIV ( hmmc -> Init . ClockDiv ) ) ; if ( hmmc -> State == HAL_MMC_STATE_RESET ) { hmmc -> Lock = HAL_UNLOCKED ; #if defined ( USE_HAL_MMC_REGISTER_CALLBACKS ) && ( USE_HAL_MMC_REGISTER_CALLBACKS == 1U ) hmmc -> TxCpltCallback = HAL_MMC_TxCpltCallback ; hmmc -> RxCpltCallback = HAL_MMC_RxCpltCallback ; hmmc -> ErrorCallback = HAL_MMC_ErrorCallback ; hmmc -> AbortCpltCallback = HAL_MMC_AbortCallback ; if ( hmmc -> MspInitCallback == NULL ) { hmmc -> MspInitCallback = HAL_MMC_MspInit ; } hmmc -> MspInitCallback ( hmmc ) ; #else HAL_MMC_MspInit ( hmmc ) ; #endif } hmmc -> State = HAL_MMC_STATE_BUSY ; if ( HAL_MMC_InitCard ( hmmc ) == HAL_ERROR ) { return HAL_ERROR ; } hmmc -> ErrorCode = HAL_MMC_ERROR_NONE ; hmmc -> Context = MMC_CONTEXT_NONE ; hmmc -> State = HAL_MMC_STATE_READY ; if ( hmmc -> Init . BusWide != SDIO_BUS_WIDE_1B ) { if ( HAL_MMC_ConfigWideBusOperation ( hmmc , hmmc -> Init . BusWide ) != HAL_OK ) { return HAL_ERROR ; } } return HAL_OK ; }
@brief  Initializes the MMC according to the specified parameters in the
MMC_HandleTypeDef and create the associated handle.
@brief Initializes the MMC according to the specified parameters in the MMC_HandleTypeDef and create the associated handle .
/* Check the MMC handle allocation */ /* Check the parameters */ /* Allocate lock resource and initialize it */ /* Reset Callback pointers in HAL_MMC_STATE_RESET only */ /* Init the low level hardware */ /* Init the low level hardware : GPIO, CLOCK, CORTEX...etc */ /* Initialize the Card parameters */ /* Initialize the error code */ /* Initialize the MMC operation */ /* Initialize the MMC state */ /* Configure bus width */