/* 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;
    do
    {
        status = SDIF_GetInterruptStatus(base);
        if ((status &
             (kSDIF_ResponseError | kSDIF_ResponseCRCError | kSDIF_ResponseTimeout | kSDIF_HardwareLockError)) != 0u)
        {
            SDIF_ClearInterruptStatus(base, status & (kSDIF_ResponseError | kSDIF_ResponseCRCError |
                                                      kSDIF_ResponseTimeout | kSDIF_HardwareLockError));
            return kStatus_SDIF_SendCmdFail;
        }
    } while ((status & kSDIF_CommandDone) != kSDIF_CommandDone);
    SDIF_ClearInterruptStatus(base, status & kSDIF_CommandDone);
    return SDIF_ReadCommandResponse(base, command);
}