libsle4442  0.2-5
Data Structures | Macros | Functions
sle.h File Reference

This is the API avariable to access to SLE4442. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sle_t
 The main struct which represent the status of the card. More...
 

Functions

void sle_enable_port (void)
 
void sle_disable_port (void)
 
struct sle_tsle_init (void)
 
void sle_free (struct sle_t *sle)
 
void sle_reset (uint8_t *atr)
 reset the card. More...
 
uint8_t sle_present (struct sle_t *sle)
 
void sle_dump_memory (uint8_t *mm)
 
void sle_dump_prt_memory (uint8_t *mm)
 
void sle_dump_secmem (uint8_t *mm)
 
void sle_dump_allmem (struct sle_t *sle)
 
void sle_auth (struct sle_t *sle, const uint8_t pin1, const uint8_t pin2, const uint8_t pin3)
 
void sle_write_memory (struct sle_t *sle, const uint8_t addr, const uint8_t len)
 
void sle_write_secmem (struct sle_t *sle)
 

Detailed Description

This is the API avariable to access to SLE4442.

Details.

Function Documentation

◆ sle_auth()

void sle_auth ( struct sle_t sle,
const uint8_t  pin1,
const uint8_t  pin2,
const uint8_t  pin3 
)

Perform the authentication.

See the datasheet on how to authenticate.

Parameters
slethe struct allocated for the card.
pin1byte 1 of the pin number.
pin2byte 2 of the pin number.
pin3byte 3 of the pin number.

◆ sle_disable_port()

void sle_disable_port ( void  )

Disable the port and restore all the used pins to IN.

Note
also restore internals pull-up resistors to OFF.

◆ sle_dump_allmem()

void sle_dump_allmem ( struct sle_t sle)

Dump the all memories, normal, secure and protected memory.

Parameters
slestruct with allocated space for the dump.
Warning
the space have to be already allocated.

◆ sle_dump_memory()

void sle_dump_memory ( uint8_t *  mm)

Dump the card's memory into the mm area.

Parameters
mmthe storage area where to dump the memory card.
Warning
the dump memory should be already allocated and have enought space for the card (256 Byte).

◆ sle_dump_prt_memory()

void sle_dump_prt_memory ( uint8_t *  mm)

Dump the protected memory.

Parameters
mmallocated 4 Byte space for the dump.
Warning
the space have to be already allocated.

◆ sle_dump_secmem()

void sle_dump_secmem ( uint8_t *  mm)

Dump the secure memory.

Parameters
mmallocated 4 Byte space for the dump.
Warning
the space have to be already allocated.

◆ sle_enable_port()

void sle_enable_port ( void  )

Initialize the port.

Configure the I/O port's pin as: Card present pin: IN Reset: OUT Clock: OUT IO line: IN

Note
If an internal PULL-UP resistors is required for the IN pin, the define SLE_MICRO_PULLUP macro. For example if we have connected the card's pin directly to the micro without external resistors.

◆ sle_free()

void sle_free ( struct sle_t sle)

Free the memory allocated to the structure and disable the port connected to the card's reader.

Parameters
slethe allocated structure.
Note
In theory this function should never be called, unless the software have no need for the card reader.

◆ sle_init()

struct sle_t* sle_init ( void  )

Initialize and allocate the structure and enable the port connected to the card's reader.

Returns
sle The allocated structure.

◆ sle_present()

uint8_t sle_present ( struct sle_t sle)

Check for the presence of the card.

The status of the card will be stored into the struct.

Parameters
slethe struct need to store the card's status.
Returns
Card present or not.

◆ sle_reset()

void sle_reset ( uint8_t *  atr)

reset the card.

Parameters
atrpointer to the string sent to reset the card.

◆ sle_write_memory()

void sle_write_memory ( struct sle_t sle,
const uint8_t  base,
const uint8_t  len 
)

Write a group of byte into the memory card.

Write one byte at a time from the allocated memory in the sle struct starting from base for len byte.

Parameters
slethe allocated struct.
basethe base memory to start copying from.
lenhow many byte to copy.

◆ sle_write_secmem()

void sle_write_secmem ( struct sle_t sle)

Write the secure memory.

Copy the 4 byte secure memory from the allocated struct to the card.

Parameters
slethe allocated struct.