sci_osi.c

来自「IBM source for pallas/vulcan/vesta」· C语言 代码 · 共 955 行 · 第 1/3 页

C
955
字号
    {        if(sci_cb[sci_id].sci_parameters.T != p_sci_parameters->T)        {            k_state = os_enter_critical_section();            sci_atom_set_para_T(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_f**** Purpose:     Set the current Smart Card parameters of f.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_f(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    ULONG k_state;    /* set the f of sci */    if((p_sci_parameters->f >= SCI_MIN_F) &&       (p_sci_parameters->f <= SCI_MAX_F) &&       (p_sci_parameters->f <= (__STB_SYS_CLK / 2)))    {        if(sci_cb[sci_id].sci_parameters.f != p_sci_parameters->f)        {            k_state = os_enter_critical_section();            sci_atom_set_para_f(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_ETU**** Purpose:     Set the current Smart Card parameters of ETU.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_ETU(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    ULONG k_state;    if((p_sci_parameters->ETU >= SCI_MIN_ETU) &&       (p_sci_parameters->ETU <= SCI_MAX_ETU))    {        if(sci_cb[sci_id].sci_parameters.ETU != p_sci_parameters->ETU)        {            k_state = os_enter_critical_section();            sci_atom_set_para_ETU(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_WWT**** Purpose:     Set the current Smart Card parameters of WWT.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_WWT(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    ULONG k_state;    if((p_sci_parameters->WWT >= SCI_MIN_WWT) &&       (p_sci_parameters->WWT <= SCI_MAX_WWT))    {        if(sci_cb[sci_id].sci_parameters.WWT != p_sci_parameters->WWT)        {            k_state = os_enter_critical_section();            sci_atom_set_para_WWT(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_CWT**** Purpose:     Set the current Smart Card parameters of CWT.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_CWT(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    ULONG k_state;    if((p_sci_parameters->CWT >= SCI_MIN_CWT) &&       (p_sci_parameters->CWT <= SCI_MAX_CWT))    {        if(sci_cb[sci_id].sci_parameters.CWT != p_sci_parameters->CWT)        {            k_state = os_enter_critical_section();            sci_atom_set_para_CWT(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_BWT**** Purpose:     Set the current Smart Card parameters of BWT.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_BWT(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    ULONG k_state;    if((p_sci_parameters->BWT >= SCI_MIN_BWT) &&       (p_sci_parameters->BWT <= SCI_MAX_BWT))    {        if(sci_cb[sci_id].sci_parameters.BWT != p_sci_parameters->BWT)        {            k_state = os_enter_critical_section();            sci_atom_set_para_BWT(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_EGT**** Purpose:     Set the current Smart Card parameters of EGT.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_EGT(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    ULONG k_state;    if((p_sci_parameters->EGT >= SCI_MIN_EGT) &&       (p_sci_parameters->EGT <= SCI_MAX_EGT))    {        if(sci_cb[sci_id].sci_parameters.EGT != p_sci_parameters->EGT)        {            k_state = os_enter_critical_section();            sci_atom_set_para_EGT(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_CLK_p**** Purpose:     Set the current Smart Card parameters of clock stop polarity.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_CLK_p(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    if((p_sci_parameters->clock_stop_polarity == 0) ||       (p_sci_parameters->clock_stop_polarity == 1))    {        if(sci_cb[sci_id].sci_parameters.clock_stop_polarity !=            p_sci_parameters->clock_stop_polarity)        {            sci_cb[sci_id].sci_parameters.clock_stop_polarity =                p_sci_parameters->clock_stop_polarity;        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_check**** Purpose:     Set the current Smart Card parameters of check.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_check(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    ULONG k_state;    if((p_sci_parameters->check == 1) || (p_sci_parameters->check == 2))    {        if(sci_cb[sci_id].sci_parameters.check != p_sci_parameters->check)        {            k_state=os_enter_critical_section();            sci_atom_set_para_check(sci_id, p_sci_parameters);            os_leave_critical_section(k_state);        }    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}/******************************************************************************* Function:    sci_osi_set_para_class**** Purpose:     Set the current Smart Card parameters of class.**** Parameters:  sci_id: zero-based number to identify smart card controller**              p_sci_parameters: input pointer to Smart Card parameters**** Returns:     SCI_ERROR_OK: if successful**              SCI_ERROR_PARAMETER_OUT_OF_RANGE: if sci_id is invalid or**                  p_sci_parameters is zero.*****************************************************************************/SCI_ERROR sci_osi_set_para_class(ULONG sci_id, SCI_PARAMETERS *p_sci_parameters){    SCI_ERROR rc = SCI_ERROR_OK;    if(p_sci_parameters->U != SCI_CLASS_B)    {        /* the SCI is class A- class A and class AB cards OK */        sci_cb[sci_id].sci_parameters.U = p_sci_parameters->U;    }    else    {        rc=SCI_ERROR_PARAMETER_OUT_OF_RANGE;    }    return(rc);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?