/* set command register This api include polling the status of the bit START_COMMAND, if 0 used as timeout value, then this function will return directly without polling the START_CMD status.  */
static status_t SDIF_SetCommandRegister(SDIF_Type *base, uint32_t cmdIndex, uint32_t argument, uint32_t timeout)
/* set command register This api include polling the status of the bit START_COMMAND, if 0 used as timeout value, then this function will return directly without polling the START_CMD status.  */
static status_t SDIF_SetCommandRegister(SDIF_Type *base, uint32_t cmdIndex, uint32_t argument, uint32_t timeout)
{
    uint32_t syncTimeout = timeout;
    base->CMDARG = argument;
    base->CMD    = cmdIndex | SDIF_CMD_START_CMD_MASK;
    while ((base->CMD & SDIF_CMD_START_CMD_MASK) == SDIF_CMD_START_CMD_MASK)
    {
        if (timeout == 0U)
        {
            break;
        }
        if (0UL == syncTimeout)
        {
            return kStatus_SDIF_SyncCmdTimeout;
        }
        --syncTimeout;
    }
    return kStatus_Success;
}