46static uint32_t SCUART_GetClock(
SC_T *sc)
54 else if(u32ClkSrc == 1)
56 else if(u32ClkSrc == 2)
93 uint32_t u32Clk = SCUART_GetClock(sc), u32Div;
96 u32Div = (u32Clk + (u32baudrate >> 1) - 1) / u32baudrate - 1;
102 return(u32Clk / (u32Div + 1));
117 for(u32Count = 0; u32Count < u32ReadBytes; u32Count++)
155 uint32_t u32Clk = SCUART_GetClock(sc), u32Div;
164 u32Div = (u32Clk + (u32Baudrate >> 1) - 1)/ u32Baudrate - 1;
171 return(u32Clk / (u32Div + 1));
203 for(u32Count = 0; u32Count != u32WriteBytes; u32Count++)
206 if(i32TimeoutCnt-- <= 0)
209 sc->
THR = pu8TxBuf[u32Count];
Nano102/112 peripheral access layer header file. This file contains all the peripheral register's def...
#define SC_UACTL_UA_MODE_EN_Msk
#define SC_CTL_SC_CEN_Msk
#define SYS_IRCTRIMCTL_TRIM_SEL_Msk
#define SC_ETUCR_ETU_RDIV_Msk
uint32_t CLK_GetHCLKFreq(void)
This function get HCLK frequency. The frequency unit is Hz.
uint32_t CLK_GetPLLClockFreq(void)
This function get PLL frequency. The frequency unit is Hz.
#define CLK_CLKSEL2_SC_S_Msk
#define CLK_CLKDIV0_SC0_N_Pos
#define CLK_CLKDIV0_SC0_N_Msk
#define CLK_CLKSEL2_SC_S_Pos
#define CLK_CLKDIV1_SC1_N_Msk
#define CLK
Pointer to CLK register structure.
#define SC0
Pointer to SC0 register structure.
#define SYS
Pointer to SYS register structure.
#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)
The function is used to read Rx data from RX FIFO.
#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)
This function is to write data into transmit FIFO to send data out.
#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)
This function use to enable smartcard module UART mode and set baudrate.
void SCUART_Close(SC_T *sc)
The function is used to disable smartcard interface UART mode.
#define SYS_IRCTRIMCTL_TRIM_16M