43static uint32_t SCUART_GetClock(
SC_T *sc)
45 uint32_t u32ClkSrc, u32Num, u32Clk;
57 else if(u32ClkSrc == 1)
59 else if(u32ClkSrc == 2)
88 uint32_t u32Clk = SCUART_GetClock(sc), u32Div;
91 u32Div = (u32Clk + (u32baudrate >> 1) - 1) / u32baudrate - 1;
97 return(u32Clk / (u32Div+1));
113 for(u32Count = 0; u32Count < u32ReadBytes; u32Count++)
147 uint32_t u32Clk = SCUART_GetClock(sc), u32Div;
156 u32Div = (u32Clk + (u32Baudrate >> 1) - 1) / u32Baudrate - 1;
163 return(u32Clk / (u32Div+1));
195 for(u32Count = 0; u32Count != u32WriteBytes; u32Count++)
198 sc->
DAT = pu8TxBuf[u32Count];
#define SC_ETUCTL_ETURDIV_Msk
#define SC_UARTCTL_UARTEN_Msk
NuMicro peripheral access layer header file.
__STATIC_INLINE uint32_t CLK_GetPLLClockFreq(void)
Get PLL clock frequency.
#define CLK_CLKSEL3_SC0SEL_Msk
#define CLK_CLKDIV1_SC0DIV_Msk
#define CLK_CLKSEL0_PCLK0SEL_Msk
#define SCUART_CHAR_LEN_8
#define SCUART_PARITY_NONE
void SCUART_SetTimeoutCnt(SC_T *sc, uint32_t u32TOC)
This function use to set receive timeout count.
#define SCUART_GET_TX_FULL(sc)
Get TX FIFO full flag status from register.
uint32_t SCUART_Read(SC_T *sc, uint8_t *pu8RxBuf, uint32_t u32ReadBytes)
Read data from smartcard UART interface.
#define SCUART_GET_RX_EMPTY(sc)
Get RX FIFO empty flag status from register.
void SCUART_Write(SC_T *sc, uint8_t *pu8TxBuf, uint32_t u32WriteBytes)
Write data to smartcard UART interface.
#define SCUART_READ(sc)
Read Rx data register.
uint32_t SCUART_SetLineConfig(SC_T *sc, uint32_t u32Baudrate, uint32_t u32DataWidth, uint32_t u32Parity, uint32_t u32StopBits)
This function use to config smartcard UART mode line setting.
uint32_t SCUART_Open(SC_T *sc, uint32_t u32baudrate)
Enable smartcard uart interface.
void SCUART_Close(SC_T *sc)
Disable smartcard uart interface.
void SystemCoreClockUpdate(void)
Updates the SystemCoreClock with current core Clock retrieved from cpu registers.