OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
optiga_lib_logger.c File Reference

This file implements the APIs for the OPTIGA library logger. More...

#include "optiga_lib_common.h"
#include "optiga_lib_logger.h"
#include "pal_logger.h"
#include "pal_os_memory.h"
Include dependency graph for optiga_lib_logger.c:
#define OPTIGA_LOGGER_NEW_LINE_CHAR   0x0D, 0x0A
 
#define OPTIGA_LOGGER_CONVERT_BYTE_TO_HEX(hex_byte, p_hex_string, index)
 
pal_logger_t logger_console
 
_STATIC_H void optiga_lib_byte_to_hex_string (const uint8_t *p_array_buffer, uint8_t *p_hex_string, uint32_t length, bool_t is_input_byte_array)
 
_STATIC_H void optiga_lib_word_to_hex_string (uint16_t value, uint8_t *p_buffer)
 
_STATIC_H void optiga_lib_print_length_of_data (uint16_t value)
 
void optiga_lib_print_string (const char_t *p_log_string)
 To log a string. More...
 
void optiga_lib_print_string_with_newline (const char_t *p_log_string)
 To log a string with a new line. More...
 
void optiga_lib_print_message (const char_t *p_log_string, const char_t *p_log_layer, const char_t *p_log_color)
 To log a string with a new line and layer information. More...
 
void optiga_lib_print_status (const char_t *p_log_layer, const char_t *p_log_color, uint16_t return_value)
 To log a return value with a new line and layer information. More...
 
void optiga_lib_print_array_hex_format (const uint8_t *p_log_string, uint16_t length, const char_t *p_log_color)
 To log the byte array in hex format. More...
 

Detailed Description

This file implements the APIs for the OPTIGA library logger.

Copyright (c) 2019 Infineon Technologies AG

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

\endcopyright

Author
Infineon Technologies AG

Macro Definition Documentation

◆ OPTIGA_LOGGER_CONVERT_BYTE_TO_HEX

#define OPTIGA_LOGGER_CONVERT_BYTE_TO_HEX (   hex_byte,
  p_hex_string,
  index 
)
Value:
{ \
uint8_t nibble; \
nibble = (hex_byte & 0xF0)>>4; \
p_hex_string [index++] = ((nibble > 0x09)) ? (nibble + 0x37) : (nibble + 0x30); \
nibble = hex_byte & 0x0F; \
p_hex_string [index++] = ((nibble > 0x09)) ? (nibble + 0x37) : (nibble + 0x30); \
}

◆ OPTIGA_LOGGER_NEW_LINE_CHAR

#define OPTIGA_LOGGER_NEW_LINE_CHAR   0x0D, 0x0A

Function Documentation

◆ optiga_lib_byte_to_hex_string()

_STATIC_H void optiga_lib_byte_to_hex_string ( const uint8_t *  p_array_buffer,
uint8_t *  p_hex_string,
uint32_t  length,
bool_t  is_input_byte_array 
)

◆ optiga_lib_print_array_hex_format()

void optiga_lib_print_array_hex_format ( const uint8_t *  p_log_string,
uint16_t  length,
const char_t p_log_color 
)

To log the byte array in hex format.

To log the byte array in hex format

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the array string
[in]lengthLength of the array buffer
[in]p_log_colorPointer to the color of array string
Here is the call graph for this function:

◆ optiga_lib_print_length_of_data()

_STATIC_H void optiga_lib_print_length_of_data ( uint16_t  value)
Here is the call graph for this function:

◆ optiga_lib_print_message()

void optiga_lib_print_message ( const char_t p_log_string,
const char_t p_log_layer,
const char_t p_log_color 
)

To log a string with a new line and layer information.

To log a string with information of the layer from which it is invoked and with a new line

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the log string
[in]p_log_layerPointer to the invoked layer information
[in]p_log_colorPointer to the color of log string
Here is the call graph for this function:

◆ optiga_lib_print_status()

void optiga_lib_print_status ( const char_t p_log_layer,
const char_t p_log_color,
uint16_t  return_value 
)

To log a return value with a new line and layer information.

To log a if the return value was successful or not along with layer information

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_layerPointer to the invoked layer information
[in]p_log_colorPointer to the color of log string
[in]return_valueReturn value from the invoked layer
Here is the call graph for this function:

◆ optiga_lib_print_string()

void optiga_lib_print_string ( const char_t input_string)

To log a string.

To log a string.

  • Precondition
  • None
Note
  • None
Parameters
[in]input_stringPointer to the log string
Here is the call graph for this function:

◆ optiga_lib_print_string_with_newline()

void optiga_lib_print_string_with_newline ( const char_t p_log_string)

To log a string with a new line.

To log a string with a new line

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the log string
Here is the call graph for this function:

◆ optiga_lib_word_to_hex_string()

_STATIC_H void optiga_lib_word_to_hex_string ( uint16_t  value,
uint8_t *  p_buffer 
)

Variable Documentation

◆ logger_console

pal_logger_t logger_console