se051plugntrust 2.1.0.0
|
API for configuring and manipulating SE051 Plug n Trust Click driver. More...
Topics | |
Protocol Control Byte | |
List of pcb of SE051 Plug n Trust Click driver. | |
SE051 Plug n Trust Registers List | |
List of registers of SE051 Plug n Trust Click driver. | |
SE051 Plug n Trust Registers Settings | |
Settings for registers of SE051 Plug n Trust Click driver. | |
SE051 Plug n Trust MikroBUS Map | |
MikroBUS pin mapping of SE051 Plug n Trust Click driver. | |
Functions | |
void | se051plugntrust_cfg_setup (se051plugntrust_cfg_t *cfg) |
SE051 Plug n Trust configuration object setup function. | |
err_t | se051plugntrust_init (se051plugntrust_t *ctx, se051plugntrust_cfg_t *cfg) |
SE051 Plug n Trust initialization function. | |
err_t | se051plugntrust_apdu_write (se051plugntrust_t *ctx, se051plugntrust_frame_data_t *frame_data) |
Writing frame data function. | |
err_t | se051plugntrust_apdu_read (se051plugntrust_t *ctx, se051plugntrust_frame_data_t *frame_data) |
Reading frame data function function. | |
err_t | se051plugntrust_apdu_transfer (se051plugntrust_t *ctx, se051plugntrust_frame_data_t *frame_data) |
Write-Read frame data function. | |
void | se051plugntrust_set_en_pin (se051plugntrust_t *ctx, uint8_t state) |
Set Enable pin state. | |
void | se051plugntrust_set_rst_pin (se051plugntrust_t *ctx, uint8_t state) |
Set Reset pin state. | |
void | se051plugntrust_reset (se051plugntrust_t *ctx) |
Reset function. | |
void | se051plugntrust_set_tlv_u8 (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t value) |
Add TLV data of 1 byte value in payload buffer. | |
void | se051plugntrust_set_tlv_u16 (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value) |
Add TLV data of 2 bytes value in payload buffer. | |
void | se051plugntrust_set_tlv_u16_optional (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value) |
Add TLV data of 2 bytes value in payload buffer if value is greater then 0. | |
void | se051plugntrust_set_tlv_u32 (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint32_t value) |
Add TLV data of 4 bytes value in payload buffer. | |
err_t | se051plugntrust_set_tlv_u8buf (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len) |
Add TLV data buffer in payload buffer. | |
err_t | se051plugntrust_set_tlv_u8buf_optional (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len) |
Add TLV data buffer in payload buffer if TLV data buffer length greater then 0. | |
err_t | se051plugntrust_get_tlv_u8 (uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint8_t *rsp) |
Parses TLV data from payload buffer to find data for desired tag. | |
err_t | se051plugntrust_get_tlv_u16 (uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint16_t *rsp) |
Parses TLV data from payload buffer to find data for desired tag. | |
err_t | se051plugntrust_get_tlv_u8buf (uint8_t *buf, uint32_t *buf_index, uint8_t buf_len, uint8_t tag, uint8_t *rsp, uint32_t *rsp_len) |
Parses TLV data from payload buffer to find data for desired tag. | |
uint8_t | se051plugntrust_calculate_apdu_size (se051plugntrust_apdu_t *apdu_data) |
Calculates APDU object size. | |
err_t | se051plugntrust_end_apdu_session (se051plugntrust_t *ctx) |
Sends command for ending APDU session. | |
err_t | se051plugntrust_object_id_list (se051plugntrust_t *ctx, uint32_t *id_list, uint8_t *list_len) |
Reads all Object ID's from Applet. | |
err_t | se051plugntrust_sw_reset (se051plugntrust_t *ctx, se051plugntrust_atr_t *atr_data) |
Sends request to reset device and reads ATR data. | |
err_t | se051plugntrust_select_applet (se051plugntrust_t *ctx, uint8_t ns_encode, se051plugntrust_version_info_t *ver_info) |
Selects Clicks Applet and returns info that device sends back to host. | |
err_t | se051plugntrust_select_card_manager (se051plugntrust_t *ctx, uint8_t rsp, uint8_t *cardmanager_rsp, uint8_t *cardmanager_rsp_len) |
Select card manager. | |
err_t | se051plugntrust_get_free_memory (se051plugntrust_t *ctx, uint8_t memory_type, uint16_t *free_memory) |
Reads Applet free memory. | |
err_t | se051plugntrust_get_random_numbers (se051plugntrust_t *ctx, uint8_t *random_buf, uint8_t buf_len) |
Get random data. | |
err_t | se051plugntrust_check_object_exist (se051plugntrust_t *ctx, uint32_t object_id) |
Check if object exists. | |
err_t | se051plugntrust_delete_object (se051plugntrust_t *ctx, uint32_t object_id) |
Delete object. | |
err_t | se051plugntrust_read_object (se051plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t read_len, uint8_t *data_buf, uint32_t *data_len) |
Read object data. | |
err_t | se051plugntrust_write_binary_object (se051plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t data_len, uint8_t *data_buf) |
Create/Write to binary object. | |
err_t | se051plugntrust_get_applet_info (se051plugntrust_t *ctx, se051plugntrust_version_info_t *ver_info) |
Get Version info from Applet. | |
API for configuring and manipulating SE051 Plug n Trust Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
err_t se051plugntrust_apdu_read | ( | se051plugntrust_t * | ctx, |
se051plugntrust_frame_data_t * | frame_data ) |
Reading frame data function function.
This function reads a frame_data from device.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[out] | frame_data | : Communication data. See se051plugntrust_frame_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_apdu_transfer | ( | se051plugntrust_t * | ctx, |
se051plugntrust_frame_data_t * | frame_data ) |
Write-Read frame data function.
This function writes a frame_data and then reads return data from device and stores it in frame_data.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in,out] | frame_data | : Communication data. See se051plugntrust_frame_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_apdu_write | ( | se051plugntrust_t * | ctx, |
se051plugntrust_frame_data_t * | frame_data ) |
Writing frame data function.
This function writes a frame_data to device.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | frame_data | : Communication data. See se051plugntrust_frame_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t se051plugntrust_calculate_apdu_size | ( | se051plugntrust_apdu_t * | apdu_data | ) |
Calculates APDU object size.
Goes through apdu object and returns size value of it.
[in] | apdu_data | : APDU object. See se051plugntrust_apdu_t object definition for detailed explanation. |
void se051plugntrust_cfg_setup | ( | se051plugntrust_cfg_t * | cfg | ) |
SE051 Plug n Trust configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See se051plugntrust_cfg_t object definition for detailed explanation. |
err_t se051plugntrust_check_object_exist | ( | se051plugntrust_t * | ctx, |
uint32_t | object_id ) |
Check if object exists.
Sends request to check if object with object_id exists.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | object_id | : Object ID. |
1
- Does exists, 2
- Doesn't exist, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_delete_object | ( | se051plugntrust_t * | ctx, |
uint32_t | object_id ) |
Delete object.
Sends request to delete object with object_id.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | object_id | : Object ID. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_end_apdu_session | ( | se051plugntrust_t * | ctx | ) |
Sends command for ending APDU session.
This function sends SBLOCK request for ending APDU session.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_get_applet_info | ( | se051plugntrust_t * | ctx, |
se051plugntrust_version_info_t * | ver_info ) |
Get Version info from Applet.
Sends request to read version info from Applet.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[out] | ver_info | : Version info data. See #ver_info object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_get_free_memory | ( | se051plugntrust_t * | ctx, |
uint8_t | memory_type, | ||
uint16_t * | free_memory ) |
Reads Applet free memory.
Sends request to check free memory of memory_type.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | memory_type | : Memory type to check. See #Memory type definition for memory type options. |
[out] | free_memory | : Response buffer. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_get_random_numbers | ( | se051plugntrust_t * | ctx, |
uint8_t * | random_buf, | ||
uint8_t | buf_len ) |
Get random data.
Sends request to get buff_len of random data.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[out] | random_buf | : Buffer to store random data. |
[in] | buf_len | : Length of random buffer data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_get_tlv_u16 | ( | uint8_t * | buf, |
uint32_t * | buf_index, | ||
uint8_t | tag, | ||
uint16_t * | rsp ) |
Parses TLV data from payload buffer to find data for desired tag.
Searches APDU payload response to find 2 bytes of value for desired tag.
[in] | buf | : Input buffer. |
[in,out] | buf_index | : Buffer index to search from. |
[in] | tag | : Tag of TLV data. |
[out] | rsp | : Value of TLV data. |
0
- Data found, -1
- Data missing. See #err_t definition for detailed explanation. err_t se051plugntrust_get_tlv_u8 | ( | uint8_t * | buf, |
uint32_t * | buf_index, | ||
uint8_t | tag, | ||
uint8_t * | rsp ) |
Parses TLV data from payload buffer to find data for desired tag.
Searches APDU payload response to find 1 byte of value for desired tag.
[in] | buf | : Input buffer. |
[in,out] | buf_index | : Buffer index to search from. |
[in] | tag | : Tag of TLV data. |
[out] | rsp | : Value of TLV data. |
0
- Data found, -1
- Data missing. See #err_t definition for detailed explanation. err_t se051plugntrust_get_tlv_u8buf | ( | uint8_t * | buf, |
uint32_t * | buf_index, | ||
uint8_t | buf_len, | ||
uint8_t | tag, | ||
uint8_t * | rsp, | ||
uint32_t * | rsp_len ) |
Parses TLV data from payload buffer to find data for desired tag.
Searches APDU payload response to find 4 bytes of value for desired tag.
[in] | buf | : Input buffer. |
[in,out] | buf_index | : Buffer index to search from. |
[in] | buf_len | : Input buffer length. |
[in] | tag | : Tag of TLV data. |
[out] | rsp | : Buffer of TLV data. |
[in,out] | rsp_len | : Rsp buffer length. |
0
- Data found, -1
- Error parssing data. See #err_t definition for detailed explanation. err_t se051plugntrust_init | ( | se051plugntrust_t * | ctx, |
se051plugntrust_cfg_t * | cfg ) |
SE051 Plug n Trust initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See se051plugntrust_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_object_id_list | ( | se051plugntrust_t * | ctx, |
uint32_t * | id_list, | ||
uint8_t * | list_len ) |
Reads all Object ID's from Applet.
Reads list of all objects from Applet and outputs array of objects ID's.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[out] | id_list | : Buffer of Object ID's. |
[out] | list_len | : Length of id_list. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_read_object | ( | se051plugntrust_t * | ctx, |
uint32_t | object_id, | ||
uint16_t | offset, | ||
uint16_t | read_len, | ||
uint8_t * | data_buf, | ||
uint32_t * | data_len ) |
Read object data.
Sends request to read object data of object with object_id.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | object_id | : Object ID. |
[in] | offset | : Offset read data OPTIONAL: set 0 if not needed. |
[in] | read_len | : Length to be read OPTIONAL: set 0 to read full data from object. |
[out] | data_buf | : Read data buffer. |
[out] | data_len | : Length of read data bffer. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void se051plugntrust_reset | ( | se051plugntrust_t * | ctx | ) |
Reset function.
Sets en pin to enable selected interface from ctx and then resets device by toggling rst pin.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
err_t se051plugntrust_select_applet | ( | se051plugntrust_t * | ctx, |
uint8_t | ns_encode, | ||
se051plugntrust_version_info_t * | ver_info ) |
Selects Clicks Applet and returns info that device sends back to host.
Selects Clicks Applet and returns version info that device sens back to host.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | ns_encode | : NS encode of I-Block. |
[out] | ver_info | : Version info data. See se051plugntrust_version_info_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_select_card_manager | ( | se051plugntrust_t * | ctx, |
uint8_t | rsp, | ||
uint8_t * | cardmanager_rsp, | ||
uint8_t * | cardmanager_rsp_len ) |
Select card manager.
Selects card manager and depending of rsp parameter returns data to host.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | rsp | : Request response from card manager. |
[out] | cardmanager_rsp | : Response buffer. |
[out] | cardmanager_rsp_len | : Length of response buffer. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void se051plugntrust_set_en_pin | ( | se051plugntrust_t * | ctx, |
uint8_t | state ) |
Set Enable pin state.
This function sets en pin state.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | state | : Logic state. |
void se051plugntrust_set_rst_pin | ( | se051plugntrust_t * | ctx, |
uint8_t | state ) |
Set Reset pin state.
This function sets rst pin state.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | state | : Logic state. |
void se051plugntrust_set_tlv_u16 | ( | uint8_t * | buf, |
uint8_t * | buf_len, | ||
uint8_t | tag, | ||
uint16_t | value ) |
Add TLV data of 2 bytes value in payload buffer.
Concatenates TLV data in APDU payload for writing data to device.
[out] | buf | : Output buffer. |
[out] | buf_len | : Output buffer size, incresed by adding TLV. |
[in] | tag | : Tag of TLV data. |
[in] | value | : Value of TLV data. |
void se051plugntrust_set_tlv_u16_optional | ( | uint8_t * | buf, |
uint8_t * | buf_len, | ||
uint8_t | tag, | ||
uint16_t | value ) |
Add TLV data of 2 bytes value in payload buffer if value is greater then 0.
Calls se051plugntrust_set_tlv_u16 if value parameter is greater then 0.
[out] | buf | : Output buffer. |
[out] | buf_len | : Output buffer size, incresed by adding TLV. |
[in] | tag | : Tag of TLV data. |
[in] | value | : Value of TLV data. |
void se051plugntrust_set_tlv_u32 | ( | uint8_t * | buf, |
uint8_t * | buf_len, | ||
uint8_t | tag, | ||
uint32_t | value ) |
Add TLV data of 4 bytes value in payload buffer.
Concatenates TLV data in APDU payload for writing data to device.
[out] | buf | : Output buffer. |
[out] | buf_len | : Output buffer size, incresed by adding TLV. |
[in] | tag | : Tag of TLV data. |
[in] | value | : Value of TLV data. |
void se051plugntrust_set_tlv_u8 | ( | uint8_t * | buf, |
uint8_t * | buf_len, | ||
uint8_t | tag, | ||
uint8_t | value ) |
Add TLV data of 1 byte value in payload buffer.
Concatenates TLV data in APDU payload for writing data to device.
[out] | buf | : Output buffer. |
[out] | buf_len | : Output buffer size, incresed by adding TLV. |
[in] | tag | : Tag of TLV data. |
[in] | value | : Value of TLV data. |
err_t se051plugntrust_set_tlv_u8buf | ( | uint8_t * | buf, |
uint8_t * | buf_len, | ||
uint8_t | tag, | ||
uint8_t * | cmd, | ||
uint32_t | cmd_len ) |
Add TLV data buffer in payload buffer.
Concatenates TLV data in APDU payload for writing data to device.
[out] | buf | : Output buffer. |
[out] | buf_len | : Output buffer size, incresed by adding TLV. |
[in] | tag | : Tag of TLV data. |
[in] | cmd | : TLV data buffer. |
[in] | cmd_len | : TLV data buffer length. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_set_tlv_u8buf_optional | ( | uint8_t * | buf, |
uint8_t * | buf_len, | ||
uint8_t | tag, | ||
uint8_t * | cmd, | ||
uint32_t | cmd_len ) |
Add TLV data buffer in payload buffer if TLV data buffer length greater then 0.
Calls se051plugntrust_set_tlv_u8buf if cmd_len parameter is greater then 0.
[out] | buf | : Output buffer. |
[out] | buf_len | : Output buffer size, incresed by adding TLV. |
[in] | tag | : Tag of TLV data. |
[in] | cmd | : TLV data buffer. |
[in] | cmd_len | : TLV data buffer length. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_sw_reset | ( | se051plugntrust_t * | ctx, |
se051plugntrust_atr_t * | atr_data ) |
Sends request to reset device and reads ATR data.
Sends request to reset device and parses and returns ATR data.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[out] | atr_data | : Output data after reset. See se051plugntrust_atr_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t se051plugntrust_write_binary_object | ( | se051plugntrust_t * | ctx, |
uint32_t | object_id, | ||
uint16_t | offset, | ||
uint16_t | data_len, | ||
uint8_t * | data_buf ) |
Create/Write to binary object.
If binary object with object_id exist function will write data_buf to it. If binary object doesn't exist it will be created and then data will be written.
[in] | ctx | : Click context object. See se051plugntrust_t object definition for detailed explanation. |
[in] | object_id | : Object ID. |
[in] | offset | : Offset of data to be written. |
[in] | data_len | : Length of data to be written to binary object. |
[in] | data_buf | : Buffer of data to be written to binary object. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.