32#define SC_INTERFACE_NUM 3
33#define SC_PIN_STATE_HIGH 1
34#define SC_PIN_STATE_LOW 0
35#define SC_PIN_STATE_IGNORE 0xFFFFFFFF
39#define SC_TMR_MODE_0 (0ul << SC_TMR0_MODE_Pos)
40#define SC_TMR_MODE_1 (1ul << SC_TMR0_MODE_Pos)
41#define SC_TMR_MODE_2 (2ul << SC_TMR0_MODE_Pos)
42#define SC_TMR_MODE_3 (3ul << SC_TMR0_MODE_Pos)
43#define SC_TMR_MODE_4 (4ul << SC_TMR0_MODE_Pos)
44#define SC_TMR_MODE_5 (5ul << SC_TMR0_MODE_Pos)
45#define SC_TMR_MODE_6 (6ul << SC_TMR0_MODE_Pos)
46#define SC_TMR_MODE_7 (7ul << SC_TMR0_MODE_Pos)
47#define SC_TMR_MODE_8 (8ul << SC_TMR0_MODE_Pos)
48#define SC_TMR_MODE_F (0xF << SC_TMR0_MODE_Pos)
76#define SC_ENABLE_INT(sc, u32Mask) ((sc)->IER |= (u32Mask))
96#define SC_DISABLE_INT(sc, u32Mask) ((sc)->IER &= ~(u32Mask))
105#define SC_SET_VCC_PIN(sc, u32State) \
107 uint32_t reg = (sc)->PINCSR;\
108 if(((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == 0) ||\
109 ((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)))\
110 reg &= ~SC_PINCSR_POW_EN_Msk;\
112 reg |= SC_PINCSR_POW_EN_Msk;\
114 (sc)->PINCSR = reg | SC_PINCSR_POW_EN_Msk;\
116 (sc)->PINCSR = reg & ~SC_PINCSR_POW_EN_Msk;\
127#define SC_SET_CLK_PIN(sc, u32OnOff)\
129 uint32_t reg = (sc)->PINCSR;\
130 if(((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == 0) ||\
131 ((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)))\
132 reg &= ~SC_PINCSR_POW_EN_Msk;\
134 reg |= SC_PINCSR_POW_EN_Msk;\
136 (sc)->PINCSR = reg | SC_PINCSR_CLK_KEEP_Msk;\
138 (sc)->PINCSR = reg & ~SC_PINCSR_CLK_KEEP_Msk;\
148#define SC_SET_IO_PIN(sc, u32State)\
150 uint32_t reg = (sc)->PINCSR;\
151 if(((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == 0) ||\
152 ((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)))\
153 reg &= ~SC_PINCSR_POW_EN_Msk;\
155 reg |= SC_PINCSR_POW_EN_Msk;\
157 (sc)->PINCSR = reg | SC_PINCSR_SC_DATA_O_Msk;\
159 (sc)->PINCSR = reg & ~SC_PINCSR_SC_DATA_O_Msk;\
169#define SC_SET_RST_PIN(sc, u32State)\
171 uint32_t reg = (sc)->PINCSR;\
172 if(((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == 0) ||\
173 ((reg & (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)) == (SC_PINCSR_POW_EN_Msk | SC_PINCSR_POW_INV_Msk)))\
174 reg &= ~SC_PINCSR_POW_EN_Msk;\
176 reg |= SC_PINCSR_POW_EN_Msk;\
178 (sc)->PINCSR = reg | SC_PINCSR_SC_RST_Msk;\
180 (sc)->PINCSR = reg & ~SC_PINCSR_SC_RST_Msk;\
189#define SC_READ(sc) ((char)((sc)->RBR))
198#define SC_WRITE(sc, u8Data) ((sc)->THR = (u8Data))
208#define SC_SET_STOP_BIT_LEN(sc, u32Len) ((sc)->CTL = ((sc)->CTL & ~SC_CTL_SLEN_Msk) | (u32Len == 1 ? SC_CTL_SLEN_Msk : 0))
248void SC_Open(
SC_T *sc, uint32_t u32CardDet, uint32_t u32PWR);
253void SC_StartTimer(
SC_T *sc, uint32_t u32TimerNum, uint32_t u32Mode, uint32_t u32ETUCount);
#define SC_CTL_TX_ERETRY_EN_Msk
#define SC_CTL_RX_ERETRY_EN_Msk
#define SC_CTL_TX_ERETRY_Pos
#define SC_CTL_TX_ERETRY_Msk
#define SC_CTL_RX_ERETRY_Pos
#define SC_CTL_RX_ERETRY_Msk
void SC_SetBlockGuardTime(SC_T *sc, uint32_t u32BGT)
This function block guard time (BGT) of specified smartcard module.
void SC_SetCharGuardTime(SC_T *sc, uint32_t u32CGT)
This function character guard time (CGT) of specified smartcard module.
void SC_ResetReader(SC_T *sc)
This function reset specified smartcard module to its default state for activate smartcard.
void SC_Open(SC_T *sc, uint32_t u32CardDet, uint32_t u32PWR)
This function initialized smartcard module.
void SC_StopAllTimer(SC_T *sc)
This function stop all smartcard timer of specified smartcard module.
uint32_t SC_IsCardInserted(SC_T *sc)
This function indicates specified smartcard slot status.
void SC_StopTimer(SC_T *sc, uint32_t u32TimerNum)
This function stop a smartcard timer of specified smartcard module.
void SC_StartTimer(SC_T *sc, uint32_t u32TimerNum, uint32_t u32Mode, uint32_t u32ETUCount)
This function configure and start a smartcard timer of specified smartcard module.
__STATIC_INLINE void SC_SetRxRetry(SC_T *sc, uint32_t u32Count)
Enable/Disable Rx error retry, and set Rx error retry count.
void SC_ClearFIFO(SC_T *sc)
This function reset both transmit and receive FIFO of specified smartcard module.
__STATIC_INLINE void SC_SetTxRetry(SC_T *sc, uint32_t u32Count)
Enable/Disable Tx error retry, and set Tx error retry count.
void SC_Close(SC_T *sc)
This function disable specified smartcard module.