/* Finish up a receive by completing the process of receiving data and disabling the interrupt.  */
static void smartcard_emvsim_CompleteReceiveData(EMVSIM_Type *base, smartcard_context_t *context)
/* Finish up a receive by completing the process of receiving data and disabling the interrupt.  */
static void smartcard_emvsim_CompleteReceiveData(EMVSIM_Type *base, smartcard_context_t *context)
{
    assert((NULL != context));
    base->INT_MASK |= (EMVSIM_INT_MASK_RDT_IM_MASK | EMVSIM_INT_MASK_RX_DATA_IM_MASK);
    while (((base->RX_STATUS & EMVSIM_RX_STATUS_RX_CNT_MASK) != 0u) && ((context->xSize) > 0u))
    {
        *context->xBuff = (uint8_t)(base->RX_BUF);
        ++context->xBuff;
        --context->xSize;
    }
    context->xIsBusy = false;
    if (NULL != context->transferCallback)
    {
        context->transferCallback(context, context->transferCallbackParam);
    }
}