/* wait the command done function and check error status  */
static status_t SDIF_WaitCommandDone(SDIF_Type *base, sdif_command_t *command)
/* wait the command done function and check error status  */
static status_t SDIF_WaitCommandDone(SDIF_Type *base, sdif_command_t *command)
{
    uint32_t status      = 0U;
    uint32_t errorStatus = (uint32_t)kSDIF_ResponseError | (uint32_t)kSDIF_ResponseTimeout |
                           (uint32_t)kSDIF_DataStartBitError | (uint32_t)kSDIF_HardwareLockError |
                           (uint32_t)kSDIF_ResponseCRCError;
    do
    {
        status = SDIF_GetInterruptStatus(base);
    } while ((status & (errorStatus | (uint32_t)kSDIF_CommandDone)) == 0UL);
    SDIF_ClearInterruptStatus(base, status & (uint32_t)kSDIF_CommandTransferStatus);
    if ((status & errorStatus) != 0UL)
    {
        return kStatus_SDIF_SendCmdFail;
    }
    else
    {
        return SDIF_ReadCommandResponse(base, command);
    }
}