OPTIGA™ Trust M
Host Library Documentation
optiga_example.h File Reference

This file defines APIs, types and data structures used in the OPTIGA example. More...

Include dependency graph for optiga_example.h:

Go to the source code of this file.

#define START_TIMER   (TRUE)
 
#define STOPTIMER_AND_CALCULATE   (FALSE)
 
#define OPTIGA_LIB_ENABLE_EXAMPLE_LOGGING
 
#define OPTIGA_EXAMPLE   "[optiga example] : "
 
#define OPTIGA_EXAMPLE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define START_PERFORMANCE_MEASUREMENT(time_taken)   example_performance_measurement(&time_taken, START_TIMER)
 
#define READ_PERFORMANCE_MEASUREMENT(time_taken)   example_performance_measurement(&time_taken, STOPTIMER_AND_CALCULATE)
 
#define WAIT_AND_CHECK_STATUS(return_status, optiga_lib_status)
 
#define OPTIGA_EXAMPLE_LOG_MESSAGE(msg)
 Logs the message provided from Application layer. More...
 
#define OPTIGA_EXAMPLE_LOG_HEX_DATA(array, array_len)
 Logs the byte array buffer provided from Application layer in hexadecimal format. More...
 
#define OPTIGA_EXAMPLE_LOG_STATUS(return_value)
 Logs the status info provided from Application layer. More...
 
#define OPTIGA_EXAMPLE_LOG_PERFORMANCE_VALUE(time_taken, return_value)
 
#define OPTIGA_EXAMPLE_PROTECTED_UPDATE_PERFORMANCE_VALUE(time_taken)
 
char performance_buffer_string [30]
 
void example_performance_measurement (uint32_t *time_value, uint8_t time_reset_flag)
 

Detailed Description

This file defines APIs, types and data structures used in the OPTIGA example.

Author
Infineon Technologies AG

Definition in file optiga_example.h.

Macro Definition Documentation

◆ OPTIGA_EXAMPLE

#define OPTIGA_EXAMPLE   "[optiga example] : "

Definition at line 59 of file optiga_example.h.

◆ OPTIGA_EXAMPLE_COLOR

#define OPTIGA_EXAMPLE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

Definition at line 62 of file optiga_example.h.

◆ OPTIGA_EXAMPLE_LOG_HEX_DATA

#define OPTIGA_EXAMPLE_LOG_HEX_DATA (   array,
  array_len 
)
Value:
{\
optiga_lib_print_array_hex_format(array,array_len,OPTIGA_UNPROTECTED_DATA_COLOR);\
}

Logs the byte array buffer provided from Application layer in hexadecimal format.

Logs the byte array buffer provided from Application layer in hexadecimal format

Precondition
Note
  • None
Parameters
[in]arrayValid pointer to array to be logged
[in]array_lenLength of array buffer

Definition at line 119 of file optiga_example.h.

◆ OPTIGA_EXAMPLE_LOG_MESSAGE

#define OPTIGA_EXAMPLE_LOG_MESSAGE (   msg)
Value:
{\
optiga_lib_print_message(msg,OPTIGA_EXAMPLE,OPTIGA_EXAMPLE_COLOR);\
}

Logs the message provided from Application layer.

Logs the message provided from Application layer

Precondition
Note
  • None
Parameters
[in]msgValid pointer to string to be logged

Definition at line 99 of file optiga_example.h.

◆ OPTIGA_EXAMPLE_LOG_PERFORMANCE_VALUE

#define OPTIGA_EXAMPLE_LOG_PERFORMANCE_VALUE (   time_taken,
  return_value 
)
Value:
{ \
if(OPTIGA_LIB_SUCCESS == return_value) \
{ \
sprintf(performance_buffer_string, "Example takes %d msec", (int)time_taken); \
OPTIGA_EXAMPLE_LOG_MESSAGE(performance_buffer_string); \
} \
}

Definition at line 157 of file optiga_example.h.

◆ OPTIGA_EXAMPLE_LOG_STATUS

#define OPTIGA_EXAMPLE_LOG_STATUS (   return_value)
Value:
{ \
if (OPTIGA_LIB_SUCCESS != return_value) \
{ \
optiga_lib_print_status(OPTIGA_EXAMPLE,OPTIGA_ERROR_COLOR,return_value); \
} \
else\
{ \
optiga_lib_print_status(OPTIGA_EXAMPLE,OPTIGA_EXAMPLE_COLOR,return_value); \
} \
}

Logs the status info provided from Application layer.

Logs the status info provided from Application layer

Precondition
Note
  • None
Parameters
[in]return_valueStatus information Application layer

Definition at line 138 of file optiga_example.h.

◆ OPTIGA_EXAMPLE_PROTECTED_UPDATE_PERFORMANCE_VALUE

#define OPTIGA_EXAMPLE_PROTECTED_UPDATE_PERFORMANCE_VALUE (   time_taken)
Value:
{ \
sprintf(performance_buffer_string, "Execution time %d msec", (int)time_taken); \
OPTIGA_EXAMPLE_LOG_MESSAGE(performance_buffer_string); \
}

Definition at line 166 of file optiga_example.h.

◆ OPTIGA_LIB_ENABLE_EXAMPLE_LOGGING

#define OPTIGA_LIB_ENABLE_EXAMPLE_LOGGING

Definition at line 56 of file optiga_example.h.

◆ READ_PERFORMANCE_MEASUREMENT

#define READ_PERFORMANCE_MEASUREMENT (   time_taken)    example_performance_measurement(&time_taken, STOPTIMER_AND_CALCULATE)

Definition at line 68 of file optiga_example.h.

◆ START_PERFORMANCE_MEASUREMENT

#define START_PERFORMANCE_MEASUREMENT (   time_taken)    example_performance_measurement(&time_taken, START_TIMER)

Definition at line 65 of file optiga_example.h.

◆ START_TIMER

#define START_TIMER   (TRUE)

Definition at line 51 of file optiga_example.h.

◆ STOPTIMER_AND_CALCULATE

#define STOPTIMER_AND_CALCULATE   (FALSE)

Definition at line 53 of file optiga_example.h.

◆ WAIT_AND_CHECK_STATUS

#define WAIT_AND_CHECK_STATUS (   return_status,
  optiga_lib_status 
)
Value:
if (OPTIGA_LIB_SUCCESS != return_status)\
{\
break;\
}\
while (OPTIGA_LIB_BUSY == optiga_lib_status)\
{ }\
if (OPTIGA_LIB_SUCCESS != optiga_lib_status)\
{\
return_status = optiga_lib_status;\
break;\
}\

Definition at line 71 of file optiga_example.h.

Function Documentation

◆ example_performance_measurement()

void example_performance_measurement ( uint32_t *  time_value,
uint8_t  time_reset_flag 
)

Variable Documentation

◆ performance_buffer_string

char performance_buffer_string[30]
extern
performance_buffer_string
char performance_buffer_string[30]
OPTIGA_LIB_BUSY
#define OPTIGA_LIB_BUSY
OPTIGA host library in busy state.
Definition: optiga_lib_return_codes.h:56
OPTIGA_EXAMPLE_COLOR
#define OPTIGA_EXAMPLE_COLOR
Definition: optiga_example.h:62
OPTIGA_LIB_SUCCESS
#define OPTIGA_LIB_SUCCESS
OPTIGA host library API execution is successful.
Definition: optiga_lib_return_codes.h:54
OPTIGA_UNPROTECTED_DATA_COLOR
#define OPTIGA_UNPROTECTED_DATA_COLOR
Definition: optiga_lib_logger.h:76
OPTIGA_EXAMPLE
#define OPTIGA_EXAMPLE
Definition: optiga_example.h:59
OPTIGA_ERROR_COLOR
#define OPTIGA_ERROR_COLOR
Definition: optiga_lib_logger.h:75