/* param base The EMVSIM peripheral address. param context A pointer to a smart card driver context structure. retval kStatus_SMARTCARD_Success The transmit abort was successful. retval kStatus_SMARTCARD_NoTransmitInProgress No transmission is currently in progress.  */
status_t SMARTCARD_EMVSIM_AbortTransfer(EMVSIM_Type *base, smartcard_context_t *context)
/* param base The EMVSIM peripheral address. param context A pointer to a smart card driver context structure. retval kStatus_SMARTCARD_Success The transmit abort was successful. retval kStatus_SMARTCARD_NoTransmitInProgress No transmission is currently in progress.  */
status_t SMARTCARD_EMVSIM_AbortTransfer(EMVSIM_Type *base, smartcard_context_t *context)
{
    if ((NULL == context))
    {
        return kStatus_SMARTCARD_InvalidInput;
    }
    context->abortTransfer = true;
    if ((!context->xIsBusy))
    {
        return kStatus_SMARTCARD_NoTransferInProgress;
    }
    if (kSMARTCARD_Receive == context->direction)
    {
        smartcard_emvsim_CompleteReceiveData(base, context);
    }
    else if (kSMARTCARD_Transmit == context->direction)
    {
        smartcard_emvsim_CompleteSendData(base, context);
    }
    else
    {
        return kStatus_SMARTCARD_InvalidInput;
    }
    return kStatus_SMARTCARD_Success;
}