M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
Macros | Functions
Collaboration diagram for SC Exported Functions:

Macros

#define SC_ENABLE_INT(sc, u32Mask)
 Enable smartcard interrupt. More...
 
#define SC_DISABLE_INT(sc, u32Mask)
 Disable smartcard interrupt. More...
 
#define SC_SET_VCC_PIN(sc, u32State)
 This macro set VCC pin state of smartcard interface. More...
 
#define SC_SET_CLK_PIN(sc, u32OnOff)
 Set CLK output status. More...
 
#define SC_SET_IO_PIN(sc, u32State)
 Set I/O pin state. More...
 
#define SC_SET_RST_PIN(sc, u32State)
 Set RST pin state. More...
 
#define SC_READ(sc)
 Read one byte from smartcard module receive FIFO. More...
 
#define SC_WRITE(sc, u8Data)
 Write one byte to smartcard module transmit FIFO. More...
 
#define SC_SET_STOP_BIT_LEN(sc, u32Len)
 This macro set smartcard stop bit length. More...
 

Functions

__STATIC_INLINE void SC_SetTxRetry (SC_T *sc, uint32_t u32Count)
 Enable/Disable Tx error retry, and set Tx error retry count. More...
 
__STATIC_INLINE void SC_SetRxRetry (SC_T *sc, uint32_t u32Count)
 Enable/Disable Rx error retry, and set Rx error retry count. More...
 
uint32_t SC_IsCardInserted (SC_T *sc)
 This function indicates specified smartcard slot status. More...
 
void SC_ClearFIFO (SC_T *sc)
 Reset the Tx/Rx FIFO. More...
 
void SC_Close (SC_T *sc)
 This function disable specified smartcard module. More...
 
void SC_Open (SC_T *sc, uint32_t u32CD, uint32_t u32PWR)
 This function initialized smartcard module. More...
 
void SC_ResetReader (SC_T *sc)
 This function reset specified smartcard module to its default state for activate smartcard. More...
 
void SC_SetBlockGuardTime (SC_T *sc, uint32_t u32BGT)
 Set Block Guard Time. More...
 
void SC_SetCharGuardTime (SC_T *sc, uint32_t u32CGT)
 Set character guard time. More...
 
void SC_StopAllTimer (SC_T *sc)
 Stop all Timer counting. More...
 
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. More...
 
void SC_StopTimer (SC_T *sc, uint32_t u32TimerNum)
 Stop Timer counting. More...
 

Detailed Description

Macro Definition Documentation

◆ SC_DISABLE_INT

#define SC_DISABLE_INT (   sc,
  u32Mask 
)

Disable smartcard interrupt.

Parameters
[in]scThe pointer of smartcard module.
[in]u32MaskInterrupt mask to be disabled. A combination of
Returns
None

The macro is used to disable Auto-convention error interrupt, Receiver buffer time-out interrupt, Initial end interrupt, Card detect interrupt, Block guard time interrupt, Timer2 interrupt, Timer1 interrupt, Timer0 interrupt, Transfer error interrupt, Transmit buffer empty interrupt or Receive data reach trigger level interrupt.

Definition at line 98 of file sc.h.

◆ SC_ENABLE_INT

#define SC_ENABLE_INT (   sc,
  u32Mask 
)

Enable smartcard interrupt.

Parameters
[in]scThe pointer of smartcard module.
[in]u32MaskInterrupt mask to be enabled. A combination of
Returns
None

The macro is used to enable Auto-convention error interrupt, Receiver buffer time-out interrupt, Initial end interrupt, Card detect interrupt, Block guard time interrupt, Timer2 interrupt, Timer1 interrupt, Timer0 interrupt, Transfer error interrupt, Transmit buffer empty interrupt or Receive data reach trigger level interrupt.

Definition at line 75 of file sc.h.

◆ SC_READ

#define SC_READ (   sc)

Read one byte from smartcard module receive FIFO.

Parameters
[in]scThe pointer of smartcard module.
Returns
One byte read from receive FIFO.

By reading DAT register, the SC will return an 8-bit received data.

Definition at line 184 of file sc.h.

◆ SC_SET_CLK_PIN

#define SC_SET_CLK_PIN (   sc,
  u32OnOff 
)

Set CLK output status.

Parameters
[in]scThe pointer of smartcard module.
[in]u32OnOffClock on or off for selected smartcard module, valid values are: SC_CLK_ON :Smartcard clock on. SC_CLK_OFF :Smartcard clock off.
Returns
None

User can set CLKKEEP (SC_PINCTL[6]) to decide SC_CLK pin always keeps free running or not.

Definition at line 130 of file sc.h.

◆ SC_SET_IO_PIN

#define SC_SET_IO_PIN (   sc,
  u32State 
)

Set I/O pin state.

Parameters
[in]scThe pointer of smartcard module.
[in]u32StatePin state of I/O pin, valid parameters are: SC_PIN_STATE_HIGH :Smartcard pin status high. SC_PIN_STATE_LOW :Smartcard pin status low.
Returns
None

User can set SCDOUT(SC_PINCTL[9]) to decide SCDOUT pin to high or low.

Definition at line 149 of file sc.h.

◆ SC_SET_RST_PIN

#define SC_SET_RST_PIN (   sc,
  u32State 
)

Set RST pin state.

Parameters
[in]scThe pointer of smartcard module.
[in]u32StatePin state of RST pin, valid parameters are: SC_PIN_STATE_HIGH :Smartcard pin status high. SC_PIN_STATE_LOW :Smartcard pin status low.
Returns
None

User can set SCRST(SC_PINCTL[1]) to decide SCRST pin to high or low.

Definition at line 168 of file sc.h.

◆ SC_SET_STOP_BIT_LEN

#define SC_SET_STOP_BIT_LEN (   sc,
  u32Len 
)

This macro set smartcard stop bit length.

Parameters
[in]scThe pointer of smartcard module.
[in]u32LenStop bit length, ether 1 or 2.
Returns
None

Stop bit length must be 1 for T = 1 protocol and 2 for T = 0 protocol.

Definition at line 204 of file sc.h.

◆ SC_SET_VCC_PIN

#define SC_SET_VCC_PIN (   sc,
  u32State 
)

This macro set VCC pin state of smartcard interface.

Parameters
[in]scThe pointer of smartcard module.
[in]u32StatePin state of VCC pin, valid parameters are: SC_PIN_STATE_HIGH :Smartcard pin status high. SC_PIN_STATE_LOW :Smartcard pin status low.
Returns
None

User can set PWREN (SC_PINCTL[0]) and PWRINV (SC_PINCTL[11])to decide SC_PWR pin is in high or low level.

Definition at line 110 of file sc.h.

◆ SC_WRITE

#define SC_WRITE (   sc,
  u8Data 
)

Write one byte to smartcard module transmit FIFO.

Parameters
[in]scThe pointer of smartcard module.
[in]u8DataData to write to transmit FIFO.
Returns
None

By writing data to DAT register, the SC will send out an 8-bit data.

Definition at line 194 of file sc.h.

Function Documentation

◆ SC_ClearFIFO()

void SC_ClearFIFO ( SC_T sc)

Reset the Tx/Rx FIFO.

Parameters
[in]scThe pointer of smartcard module.
Returns
None

This function reset both transmit and receive FIFO of specified smartcard module.

Definition at line 56 of file sc.c.

◆ SC_Close()

void SC_Close ( SC_T sc)

This function disable specified smartcard module.

Parameters
[in]scThe pointer of smartcard module.
Returns
None

SC will force all transition to IDLE state.

Definition at line 67 of file sc.c.

◆ SC_IsCardInserted()

uint32_t SC_IsCardInserted ( SC_T sc)

This function indicates specified smartcard slot status.

Parameters
[in]scThe pointer of smartcard module.
Return values
TRUECard insert.
FALSECard remove.

This function is used to check if specified smart card slot is presented.

Definition at line 36 of file sc.c.

◆ SC_Open()

void SC_Open ( SC_T sc,
uint32_t  u32CD,
uint32_t  u32PWR 
)

This function initialized smartcard module.

Parameters
[in]scThe pointer of smartcard module.
[in]u32CDCard detect polarity, select the CD pin state which indicates card absent. Could be: -SC_PIN_STATE_HIGH. -SC_PIN_STATE_LOW. -SC_PIN_STATE_IGNORE, no card detect pin, always assumes card present.
[in]u32PWRPower off polarity, select the PWR pin state which could set smartcard VCC to high level. Could be: -SC_PIN_STATE_HIGH. -SC_PIN_STATE_LOW.
Returns
None

Initialization process configures smartcard and enables engine clock.

Definition at line 88 of file sc.c.

◆ SC_ResetReader()

void SC_ResetReader ( SC_T sc)

This function reset specified smartcard module to its default state for activate smartcard.

Parameters
[in]scThe pointer of smartcard module.
Returns
None

Reset the Tx/Rx FIFO & clock & initial default parameter.

Definition at line 130 of file sc.c.

◆ SC_SetBlockGuardTime()

void SC_SetBlockGuardTime ( SC_T sc,
uint32_t  u32BGT 
)

Set Block Guard Time.

Parameters
[in]scThe pointer of smartcard module.
[in]u32BGTBlock guard time using ETU as unit, valid range are between 1 ~ 32.
Returns
None

This function block guard time (BGT) of specified smartcard module.

Definition at line 180 of file sc.c.

◆ SC_SetCharGuardTime()

void SC_SetCharGuardTime ( SC_T sc,
uint32_t  u32CGT 
)

Set character guard time.

Parameters
[in]scThe pointer of smartcard module.
[in]u32CGTCharacter guard time using ETU as unit, valid range are between 11 ~ 267.
Returns
None

This function character guard time (CGT) of specified smartcard module.

Note
Before using this API, user should set the correct stop bit length first.

Definition at line 193 of file sc.c.

◆ SC_SetRxRetry()

__STATIC_INLINE void SC_SetRxRetry ( SC_T sc,
uint32_t  u32Count 
)

Enable/Disable Rx error retry, and set Rx error retry count.

Parameters
[in]scThe pointer of smartcard module.
[in]u32CountThe number of times of Rx error retry count, between 0~8. 0 means disable Rx error retry.
Returns
None

This macro enable/disable receiver retry function when parity error has occurred, and set error retry count.

Definition at line 233 of file sc.h.

◆ SC_SetTxRetry()

__STATIC_INLINE void SC_SetTxRetry ( SC_T sc,
uint32_t  u32Count 
)

Enable/Disable Tx error retry, and set Tx error retry count.

Parameters
[in]scThe pointer of smartcard module.
[in]u32CountThe number of times of Tx error retry count, between 0~8. 0 means disable Tx error retry.
Returns
None

This macro enable/disable transmitter retry function when parity error has occurred, and set error retry count.

Definition at line 213 of file sc.h.

◆ SC_StartTimer()

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.

Parameters
[in]scThe pointer of smartcard module.
[in]u32TimerNumTimer(s) to start. Valid values are 0, 1, 2.
[in]u32ModeTimer operating mode, valid values are:
[in]u32ETUCountTimer timeout duration, ETU based. For timer 0, valid range are between 1~0x1000000ETUs. For timer 1 and timer 2, valid range are between 1 ~ 0x100 ETUs.
Returns
None

Enable Timer starting, counter will count when condition match.

Note
This function start the timer within smartcard module, not timer module.
Depend on the timer operating mode, timer may not start counting immediately.

Definition at line 233 of file sc.c.

◆ SC_StopAllTimer()

void SC_StopAllTimer ( SC_T sc)

Stop all Timer counting.

Parameters
[in]scThe pointer of smartcard module.
Returns
None

This function stop all smartcard timer of specified smartcard module.

Note
This function stop the timers within smartcard module, not timer module.

Definition at line 206 of file sc.c.

◆ SC_StopTimer()

void SC_StopTimer ( SC_T sc,
uint32_t  u32TimerNum 
)

Stop Timer counting.

Parameters
[in]scThe pointer of smartcard module.
[in]u32TimerNumTimer(s) to stop. Valid values are 0, 1, 2.
Returns
None

This function stop a smartcard timer of specified smartcard module.

Note
This function stop the timer within smartcard module, not timer module.

Definition at line 262 of file sc.c.