📄 scib_lib.c
字号:
}
/*F**************************************************************************
* NAME: scib_hw_cardclk_off
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* reset the bit CLK in SCCON
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_cardclk_off(void)
{
Scib_hw_clear_SCRS();
SCCON &= (~MSK_SCCON_CLK);
}
/*F**************************************************************************
* NAME: scib_hw_vcard_ok
*----------------------------------------------------------------------------
* PARAMS: none
* return: TRUE/FALSE if VCARD is OK/NOK
*----------------------------------------------------------------------------
* PURPOSE:
* Check if power of card is within the voltage range
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Uchar scib_hw_vcard_ok(void)
{
Scib_hw_clear_SCRS();
if (MSK_SCISR_VCARDOK == (SCISR & MSK_SCISR_VCARDOK))
return(TRUE); /* VCARD is OK */
else
return(FALSE); /* VCARD out of range*/
}
/*F**************************************************************************
* NAME: scib_hw_card_there
*----------------------------------------------------------------------------
* PARAMS: none
* return: TRUE/FALSE if card is present/away
*----------------------------------------------------------------------------
* PURPOSE:
* Check for card presence detected in the connector
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Uchar scib_hw_card_there(void)
{
Scib_hw_clear_SCRS();
/* test of Bit 6 of SCISR */
if ((SCISR & MSK_SCISR_CARDIN) == MSK_SCISR_CARDIN)
{
return(TRUE); /*card in*/
}
else
{
/*if one measurement ko, reinit of counter*/
return(FALSE);
}
}
/*F**************************************************************************
* NAME: scib_hw_cardio_on
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* set the CARDIO bit
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_cardio_on(void)
{
Scib_hw_clear_SCRS();
SCCON |= MSK_SCCON_CARDIO; /* Card I/O is put ON */
}
/*F**************************************************************************
* NAME: scib_hw_en_wait_time_count
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable the waiting time counter
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_en_wait_time_count()
{
Scib_hw_set_SCRS();
SCICR |= MSK_SCICR_WTEN;
}
/*F**************************************************************************
* NAME: scib_hw_dis_wait_time_count
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* disable the waiting time counter
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_dis_wait_time_count()
{
Scib_hw_set_SCRS();
SCICR &= (~MSK_SCICR_WTEN);
}
/*F**************************************************************************
* NAME: scib_hw_en_wait_time_inter
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable the waiting time interrupt
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_en_wait_time_inter(void)
{
/*enable IT*/
EA=1;
IEN1 |= MSK_IEN1_ESCI;
Scib_hw_set_SCRS();
SCIER |= MSK_SCIER_ESCWT; /* Enables waiting time counter interrupt */
}
/*F**************************************************************************
* NAME: scib_hw_en_receiver_inter
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable the receive interrupt
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_en_receiver_inter(void)
{
/*enable IT*/
EA=1;
IEN1 |= MSK_IEN1_ESCI;
Scib_hw_set_SCRS();
SCIER |= MSK_SCIER_ESCRI; /* Enables Smart Card UART Receive interrupt*/
}
/*F**************************************************************************
* NAME: scib_hw_en_inter
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable the SCI interruption
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_en_inter(void)
{
/*global IT enable*/
EA=1;
/*SCI IT enable*/
IEN1 |= MSK_IEN1_ESCI;
/*receive IT enable*/
Scib_hw_clear_SCRS();
SCIIR |= (~MSK_SCIIR_SCRI);
/*transmit IT enable*/
Scib_hw_clear_SCRS();
SCIIR |= (~MSK_SCIIR_SCTI);
}
/*F**************************************************************************
* NAME: scib_hw_disable_car_rep
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* disable caracter repetition if error parity
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_disable_car_rep()
{
Scib_hw_set_SCRS();
SCICR &= ~ MSK_SCICR_CREP;
}
/*F**************************************************************************
* NAME: scib_hw_enable_car_rep
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable caracter repetition if error parity
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_enable_car_rep()
{
Scib_hw_set_SCRS();
SCICR |= MSK_SCICR_CREP;
}
/*F**************************************************************************
* NAME: scib_hw_enable_it_power
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable it error card current status and voltage
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_enable_it_power()
{
Scib_hw_set_SCRS();
SCIER |= (MSK_SCIER_ICARDER | MSK_SCIER_EVCARDER );
}
/*F**************************************************************************
* NAME: scib_hw_disable_it_power
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable it error card current status and voltage
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_disable_it_power()
{
Scib_hw_set_SCRS();
SCIER &= ~(MSK_SCIER_ICARDER | MSK_SCIER_EVCARDER );
}
/*F**************************************************************************
* NAME: scib_hw_enable_parity_error
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable it error parity
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void scib_hw_enable_parity_error()
{
Scib_hw_set_SCRS();
SCIER |= MSK_SCIER_ESCPI;
}
/*F**************************************************************************
* NAME: scib_hw_enable_parity_error
*----------------------------------------------------------------------------
* PARAMS: none
* return: none
*----------------------------------------------------------------------------
* PURPOSE:
* enable it error parity
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -