NXP Reader Library  v17.1.0.2535

This layer provides logging and debug functionality. It is different from the other layers in the way it is initialised. It stores it's data parameters internally and only once, thus there can be only one instance. More...

Collaboration diagram for Log:

Data Structures

struct  phLog_LogEntry_t
 Definition of a singe Log entry. More...
 
struct  phLog_RegisterEntry_t
 Definition of a Register Entry. More...
 
struct  phLog_DataParams_t
 Log parameter structure. More...
 

Macros

#define PH_LOG_DATATYPE_BUFFER   0x00
 Data type buffer.
 
#define PH_LOG_DATATYPE_VALUE   0x01
 Data type value.
 
#define PH_LOG_LOGTYPE_INFO   0x00
 Log Type : Info.
 
#define PH_LOG_LOGTYPE_ERROR   0x01
 Log Type : Error.
 
#define PH_LOG_LOGTYPE_WARN   0x02
 Log Type : Warn.
 
#define PH_LOG_LOGTYPE_DEBUG   0x03
 Log Type : Debug.
 
#define PH_LOG_OPTION_CATEGORY_ENTER   0x01
 Execute Option: Logging takes place at function entry.
 
#define PH_LOG_OPTION_CATEGORY_GEN   0x02
 Execute Option: Logging takes place in the middle of a function.
 
#define PH_LOG_OPTION_CATEGORY_LEAVE   0x03
 Execute Option: Logging takes place before leaving the function.
 
#define PH_LOG_ALLOCATE_PARAMNAME(pParam)   char const * pParam##_log = #pParam
 Allocate space in memory for a pString value. More...
 

Typedefs

typedef void(* pphLog_Callback_t) (void *pDataParams, uint8_t bOption, phLog_LogEntry_t *pLogEntries, uint16_t wEntryCount)
 Function definition for log callback function.
 

Functions

phStatus_t phLog_Init (pphLog_Callback_t pLogCallback, phLog_RegisterEntry_t *pRegisterEntries, uint16_t wMaxRegisterEntries)
 Initialise Logging. More...
 
phStatus_t phLog_Register (void *pDataParams, phLog_LogEntry_t *pLogEntries, uint16_t wMaxLogEntries)
 Register component for logging. More...
 
void phLog_AddString (void *pDataParams, uint8_t bLogType, char const *pString)
 Add a new log entry containing just a string. More...
 
void phLog_AddParam_Uint8 (void *pDataParams, uint8_t bLogType, char const *pName, uint8_t *pParam)
 Add a new log entry containing an uint8_t parameter. More...
 
void phLog_AddParam_Uint16 (void *pDataParams, uint8_t bLogType, char const *pName, uint16_t *pParam)
 Add a new log entry containing an uint16_t parameter. More...
 
void phLog_AddParam_Uint32 (void *pDataParams, uint8_t bLogType, char const *pName, uint32_t *pParam)
 Add a new log entry containing an uint32_t parameter. More...
 
void phLog_AddParam_Uint64 (void *pDataParams, uint8_t bLogType, char const *pName, uint64_t *pParam)
 
void phLog_AddParam_Int16 (void *pDataParams, uint8_t bLogType, char const *pName, int16_t *pParam)
 
void phLog_AddParam_Int32 (void *pDataParams, uint8_t bLogType, char const *pName, int32_t *pParam)
 
void phLog_AddParam_Int64 (void *pDataParams, uint8_t bLogType, char const *pName, int64_t *pParam)
 
void phLog_AddParam_Float64 (void *pDataParams, uint8_t bLogType, char const *pName, float64_t *pParam)
 
void phLog_AddParam_Buffer (void *pDataParams, uint8_t bLogType, char const *pName, void const *pParam, uint16_t wLength)
 Add a new log entry containing a byte-buffer of variable length. More...
 
void phLog_Execute (void *pDataParams, uint8_t bOption)
 Execute the callback function to process the log buffer. More...
 

Detailed Description

This layer provides logging and debug functionality. It is different from the other layers in the way it is initialised. It stores it's data parameters internally and only once, thus there can be only one instance.

Macro Definition Documentation

◆ PH_LOG_ALLOCATE_PARAMNAME

#define PH_LOG_ALLOCATE_PARAMNAME (   pParam)    char const * pParam##_log = #pParam

Allocate space in memory for a pString value.

See also
phLog_LogEnty_t

Function Documentation

◆ phLog_Init()

phStatus_t phLog_Init ( pphLog_Callback_t  pLogCallback,
phLog_RegisterEntry_t pRegisterEntries,
uint16_t  wMaxRegisterEntries 
)

Initialise Logging.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERInput parameter combination is invalid.
Parameters
[in]pLogCallback[In] Pointer to a log callback function.
[in]pRegisterEntries[In] An array of phLog_RegisterEntry_t memory.
[in]wMaxRegisterEntries[In] Number of log entries the phLog_RegisterEntry_t array can hold.

◆ phLog_Register()

phStatus_t phLog_Register ( void *  pDataParams,
phLog_LogEntry_t pLogEntries,
uint16_t  wMaxLogEntries 
)

Register component for logging.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_USE_CONDITIONLogging is not properly initialized.
PH_ERR_INVALID_PARAMETERwMaxLogEntries is invalid.
PH_ERR_BUFFER_OVERFLOWThe maximum Register Entry count is reached.
Parameters
[in]pDataParams[In] Component for which logging shall be performed.
[in]pLogEntries[In] An array of phLog_LogEntry_t structures.
[in]wMaxLogEntries[In] Number of log entries the phLog_LogEntry_t array can hold.

◆ phLog_AddString()

void phLog_AddString ( void *  pDataParams,
uint8_t  bLogType,
char const *  pString 
)

Add a new log entry containing just a string.

See also
phLog_LogEnty_t
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pString[In] The Null-terminated string to add.

◆ phLog_AddParam_Uint8()

void phLog_AddParam_Uint8 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
uint8_t pParam 
)

Add a new log entry containing an uint8_t parameter.

See also
phLog_LogEnty_t
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Uint16()

void phLog_AddParam_Uint16 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
uint16_t pParam 
)

Add a new log entry containing an uint16_t parameter.

See also
phLog_LogEnty_t
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Uint32()

void phLog_AddParam_Uint32 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
uint32_t pParam 
)

Add a new log entry containing an uint32_t parameter.

See also
phLog_LogEnty_t
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Uint64()

void phLog_AddParam_Uint64 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
uint64_t pParam 
)
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Int16()

void phLog_AddParam_Int16 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
int16_t pParam 
)
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Int32()

void phLog_AddParam_Int32 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
int32_t pParam 
)
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Int64()

void phLog_AddParam_Int64 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
int64_t pParam 
)
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Float64()

void phLog_AddParam_Float64 ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
float64_t pParam 
)
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.

◆ phLog_AddParam_Buffer()

void phLog_AddParam_Buffer ( void *  pDataParams,
uint8_t  bLogType,
char const *  pName,
void const *  pParam,
uint16_t  wLength 
)

Add a new log entry containing a byte-buffer of variable length.

See also
phLog_LogEnty_t
Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bLogType[In] Type of Entry (one of the PH_LOG_LOGTYPE_* values).
[in]pName[In] The Null-terminated name of the parameter.
[in]pParam[In] Pointer to the memory where the parameter resides.
[in]wLength[In] The length in bytes to the supplied buffer.

◆ phLog_Execute()

void phLog_Execute ( void *  pDataParams,
uint8_t  bOption 
)

Execute the callback function to process the log buffer.

Parameters
[in]pDataParams[In] The DataParams of the calling function.
[in]bOption[In] Option byte (one of the PH_LOG_OPTION* defines).