/** * @brief Initializes the SDIO Command according to the specified * parameters in the SDIO_CmdInitStruct and send the command. * @param SDIO_CmdInitStruct : pointer to a SDIO_CmdInitTypeDef * structure that contains the configuration information for the SDIO command. * @retval None */ void SDIO_SendCommand(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_SDIO_CMD_INDEX(SDIO_CmdInitStruct->SDIO_CmdIndex)); assert_param(IS_SDIO_RESPONSE(SDIO_CmdInitStruct->SDIO_Response)); assert_param(IS_SDIO_WAIT(SDIO_CmdInitStruct->SDIO_Wait)); assert_param(IS_SDIO_CPSM(SDIO_CmdInitStruct->SDIO_CPSM)); /*---------------------------- SDIO ARG Configuration ------------------------*/ /* Set the SDIO Argument value */ SDIO->ARG = SDIO_CmdInitStruct->SDIO_Argument; /*---------------------------- SDIO CMD Configuration ------------------------*/ /* Get the SDIO CMD value */ tmpreg = SDIO->CMD; /* Clear CMDINDEX, WAITRESP, WAITINT, WAITPEND, CPSMEN bits */ tmpreg &= CMD_CLEAR_MASK; /* Set CMDINDEX bits according to SDIO_CmdIndex value */ /* Set WAITRESP bits according to SDIO_Response value */ /* Set WAITINT and WAITPEND bits according to SDIO_Wait value */ /* Set CPSMEN bits according to SDIO_CPSM value */ tmpreg |= (uint32_t)SDIO_CmdInitStruct->SDIO_CmdIndex | SDIO_CmdInitStruct->SDIO_Response | SDIO_CmdInitStruct->SDIO_Wait | SDIO_CmdInitStruct->SDIO_CPSM; /* Write to SDIO CMD */ SDIO->CMD = tmpreg; }
/** * @brief Configure the SDIO command path according to the specified parameters in * SDIO_CmdInitTypeDef structure and send the command * @param SDIOx: Pointer to SDIO register base * @param SDIO_CmdInitStruct: pointer to a SDIO_CmdInitTypeDef structure that contains * the configuration information for the SDIO command * @retval HAL status */ HAL_StatusTypeDef SDIO_SendCommand(SDIO_TypeDef *SDIOx, SDIO_CmdInitTypeDef *SDIO_CmdInitStruct) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_SDIO_CMD_INDEX(SDIO_CmdInitStruct->CmdIndex)); assert_param(IS_SDIO_RESPONSE(SDIO_CmdInitStruct->Response)); assert_param(IS_SDIO_WAIT(SDIO_CmdInitStruct->WaitForInterrupt)); assert_param(IS_SDIO_CPSM(SDIO_CmdInitStruct->CPSM)); /* Set the SDIO Argument value */ SDIOx->ARG = SDIO_CmdInitStruct->Argument; /* SDIO CMD Configuration */ /* Get the SDIO CMD value */ tmpreg = SDIOx->CMD; /* Clear CMDINDEX, WAITRESP, WAITINT, WAITPEND, CPSMEN bits */ tmpreg &= CMD_CLEAR_MASK; /* Set SDIO command parameters */ tmpreg |= (uint32_t)(SDIO_CmdInitStruct->CmdIndex |\ SDIO_CmdInitStruct->Response |\ SDIO_CmdInitStruct->WaitForInterrupt |\ SDIO_CmdInitStruct->CPSM); /* Write to SDIO CMD register */ SDIOx->CMD = tmpreg; return HAL_OK; }
/** * @brief Configure the SDIO command path according to the specified parameters in * SDIO_CmdInitTypeDef structure and send the command * @param SDIOx: Pointer to SDIO register base * @param Command: pointer to a SDIO_CmdInitTypeDef structure that contains * the configuration information for the SDIO command * @retval HAL status */ HAL_StatusTypeDef SDIO_SendCommand(SDIO_TypeDef *SDIOx, SDIO_CmdInitTypeDef *Command) { /* Check the parameters */ assert_param(IS_SDIO_CMD_INDEX(Command->CmdIndex)); assert_param(IS_SDIO_RESPONSE(Command->Response)); assert_param(IS_SDIO_WAIT(Command->WaitForInterrupt)); assert_param(IS_SDIO_CPSM(Command->CPSM)); /* Set the SDIO Argument value */ SDIOx->ARG = Command->Argument; /* Set SDIO command parameters */ /* Write to SDIO CMD register */ MODIFY_REG(SDIOx->CMD, CMD_CLEAR_MASK, Command->CmdIndex |\ Command->Response |\ Command->WaitForInterrupt |\ Command->CPSM); return HAL_OK; }
/** * @brief Configure the SDIO command path according to the specified parameters in * SDIO_CmdInitTypeDef structure and send the command * @param SDIOx: Pointer to SDIO register base * @param SDIO_CmdInitStruct: pointer to a SDIO_CmdInitTypeDef structure that contains * the configuration information for the SDIO command * @retval HAL status */ HAL_StatusTypeDef SDIO_SendCommand(SDIO_TypeDef *SDIOx, SDIO_CmdInitTypeDef *SDIO_CmdInitStruct) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_SDIO_CMD_INDEX(SDIO_CmdInitStruct->CmdIndex)); assert_param(IS_SDIO_RESPONSE(SDIO_CmdInitStruct->Response)); assert_param(IS_SDIO_WAIT(SDIO_CmdInitStruct->WaitForInterrupt)); assert_param(IS_SDIO_CPSM(SDIO_CmdInitStruct->CPSM)); /* Set the SDIO Argument value */ SDIOx->ARG = SDIO_CmdInitStruct->Argument; /* Set SDIO command parameters */ tmpreg |= (uint32_t)(SDIO_CmdInitStruct->CmdIndex |\ SDIO_CmdInitStruct->Response |\ SDIO_CmdInitStruct->WaitForInterrupt |\ SDIO_CmdInitStruct->CPSM); /* Write to SDIO CMD register */ MODIFY_REG(SDIOx->CMD, CMD_CLEAR_MASK, tmpreg); return HAL_OK; }