Renesas PTX1xxR IoT-Reader API Version 7.3.1
Renesas Software Stack for IoT-Reader Applications
Data Structures | Macros | Typedefs | Enumerations | Functions
Collaboration diagram for LOG:

Data Structures

struct  ptxLogItem_ParamBuffer
 Log buffer. More...
 
struct  ptxLogItem_2U32
 Log item for 2 x UInt32. More...
 
union  ptxLogItem_Param
 Log User Parameter(s) More...
 
struct  ptxLogItem
 Log item, representing a single entry. More...
 
struct  ptxLogState
 Logger Component Structure. More...
 
struct  ptxLog
 Logger Component Structure. More...
 

Macros

#define PTX_LOG_FILE_NAME_LEN   40
 
#define PTX_LOG_FILE_BUF_LEN   258
 
#define PTX_LOG_MIN_NUM_ENTRIES   3
 
#define PTX_LOG_ASSERT_LOG_ENTRIES   (PTX_LOG_MIN_NUM_ENTRIES * 2)
 

Typedefs

typedef struct ptxLogItempptxLogItem_t
 
typedef ptxStatus_t(* pptxLogCallbackFn_t) (void *LogContext, pptxLogItem_t pLogItem)
 
typedef enum ptxLogClass ptxLogClass_t
 Log entry classification.
 
typedef enum ptxLogParamType ptxLogParamType_t
 Type of parameter of log entry.
 
typedef struct ptxLogItem_ParamBuffer ptxLogItem_ParamBuffer_t
 Log buffer.
 
typedef struct ptxLogItem_2U32 ptxLogItem_2U32_t
 Log item for 2 x UInt32.
 
typedef union ptxLogItem_Param ptxLogItem_Param_t
 Log User Parameter(s)
 
typedef struct ptxLogItem ptxLogItem_t
 Log item, representing a single entry.
 
typedef struct ptxLogState ptxLogState_t
 Logger Component Structure.
 
typedef struct ptxLog ptxLog_t
 Logger Component Structure.
 

Enumerations

enum  ptxLogClass {
  ptxLogClass_Trace , ptxLogClass_Message , ptxLogClass_Warning , ptxLogClass_Error ,
  ptxLogClass_Rx , ptxLogClass_Tx , ptxLogClass_Sys_Debug , ptxLogClass_Sys_Info ,
  ptxLogClass_Sys_Warn , ptxLogClass_Sys_Error , ptxLogClass_Assert , ptxLogClass_Assert_Status ,
  ptxLogClass_Assert_NotNull , ptxLogClass_Assert_Equals , ptxLogClass_Assert_NotEqual
}
 Log entry classification. More...
 
enum  ptxLogParamType {
  ptxLogParamType_None , ptxLogParamType_P2 , ptxLogParamType_PL , ptxLogParamType_Ptr ,
  ptxLogParamType_Data , ptxLogParamType_String
}
 Type of parameter of log entry. More...
 

Functions

ptxStatus_t ptxLog_Init (ptxLog_t *logCtx, void *osAl, size_t numEntries)
 Initialize the logger and the storage.
 
ptxStatus_t ptxLog_InitRTLogging (ptxLog_t *logCtx, pptxLogCallbackFn_t LogCallbackFn, void *Handler)
 Initialize Realtime-Logging (= write every log item directly to a file).
 
ptxStatus_t ptxLog_DeInit (ptxLog_t *logCtx)
 De-Initialize the logger and free the storage.
 
void ptxLog_SP2 (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, ptxLogClass_t logClass, uint32_t logStatus, uint32_t logP1, uint32_t logP2)
 Log two parameters.
 
void ptxLog_SPL (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, ptxLogClass_t logClass, uint32_t logStatus, uint64_t logP)
 Log long parameter.
 
void ptxLog_SD (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, ptxLogClass_t logClass, uint32_t logStatus, uint8_t *logData, size_t logLen)
 Log Data.
 
void ptxLog_S (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, ptxLogClass_t logClass, uint32_t logStatus)
 Log status only.
 
void ptxLog_TraceText (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, const char *traceText)
 Trace function.
 
void ptxLog_TraceTextStatus (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, const char *traceText, uint32_t logStatus)
 Trace function, including status.
 
void ptxLog_AssertStatus (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, ptxStatus_t actualStatus, const ptxStatus_t requiredStatus)
 Assert Status.
 
void ptxLog_AssertNotNull (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, void *actualPtr)
 Assert on not NULL.
 
void ptxLog_AssertEquals (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, uint32_t actualValue, uint32_t requiredValue, const char *traceText)
 Assert on equality.
 
void ptxLog_AssertNotEqual (ptxLog_t *logCtx, const char *locationMajor, int locationMinor, uint32_t actualValue, uint32_t requiredValue, const char *traceText)
 Assert on non-equality.
 
ptxStatus_t ptxLog_GetFirst (ptxLog_t *logCtx, ptxLogItem_t **logItem)
 Get recent log item.
 
ptxStatus_t ptxLog_GetNext (ptxLog_t *logCtx, ptxLogItem_t **logItem)
 Get next log item.
 
ptxStatus_t ptxLogAssert_GetFirst (ptxLog_t *logCtx, ptxLogItem_t **logItem)
 Get recent log item.
 
ptxStatus_t ptxLogAssert_GetNext (ptxLog_t *logCtx, ptxLogItem_t **logItem)
 Get next log item.
 

Detailed Description

Macro Definition Documentation

◆ PTX_LOG_ASSERT_LOG_ENTRIES

#define PTX_LOG_ASSERT_LOG_ENTRIES   (PTX_LOG_MIN_NUM_ENTRIES * 2)

Assert log items count

◆ PTX_LOG_MIN_NUM_ENTRIES

#define PTX_LOG_MIN_NUM_ENTRIES   3

Minimum number of log entries.

Typedef Documentation

◆ pptxLogCallbackFn_t

typedef ptxStatus_t(* pptxLogCallbackFn_t) (void *LogContext, pptxLogItem_t pLogItem)

Typedef (including forward declarations)

◆ pptxLogItem_t

typedef struct ptxLogItem* pptxLogItem_t

Typedef (including forward declarations)

Enumeration Type Documentation

◆ ptxLogClass

Log entry classification.

Enumerator
ptxLogClass_Trace 

Log class: Trace, log mark [T]

ptxLogClass_Message 

Log class: Message, log mark [M]

ptxLogClass_Warning 

Log class: Warning, log mark [W]

ptxLogClass_Error 

Log class: Error, log mark [E]

ptxLogClass_Rx 

Log class: Received data, log mark [RX]

ptxLogClass_Tx 

Log class: Transmitted data, log mark [TX]

ptxLogClass_Sys_Debug 

Log class: System Debug, reserved for future use

ptxLogClass_Sys_Info 

Log class: System Info, reserved for future use

ptxLogClass_Sys_Warn 

Log class: System Warning, reserved for future use

ptxLogClass_Sys_Error 

Log class: System Error, reserved for future use

ptxLogClass_Assert 

Log class: Generic Assert

ptxLogClass_Assert_Status 

Log class: Assert Status

ptxLogClass_Assert_NotNull 

Log class: Assert Pointer Not Null

ptxLogClass_Assert_Equals 

Log class: Assert Equality

ptxLogClass_Assert_NotEqual 

Log class: Assert Non-Equality

◆ ptxLogParamType

Type of parameter of log entry.

Enumerator
ptxLogParamType_None 

Log entry parameter: None

ptxLogParamType_P2 

Log entry parameter: 2 parameters of type uint32_t

ptxLogParamType_PL 

Log entry parameter: parameter of type uint64_t

ptxLogParamType_Ptr 

Log entry parameter: pointer parameter

ptxLogParamType_Data 

Log entry parameter: data buffer

ptxLogParamType_String 

Log entry parameter: null-terminated character array

Function Documentation

◆ ptxLog_AssertEquals()

void ptxLog_AssertEquals ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
uint32_t actualValue,
uint32_t requiredValue,
const char * traceText )

Assert on equality.

In case of failure, log the point of occurrence into a separate assertion log.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]actualValueValue to check.
[in]requiredValueReference value.
[in]traceTextOptional text to be output, may be NULL.

◆ ptxLog_AssertNotEqual()

void ptxLog_AssertNotEqual ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
uint32_t actualValue,
uint32_t requiredValue,
const char * traceText )

Assert on non-equality.

In case of failure, log the point of occurrence into a separate assertion log.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]actualValueValue to check.
[in]requiredValueReference value.
[in]traceTextOptional text to be output, may be NULL.

◆ ptxLog_AssertNotNull()

void ptxLog_AssertNotNull ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
void * actualPtr )

Assert on not NULL.

In case of failure, log the point of occurrence into a separate assertion log.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]actualPtrPointer to check.

◆ ptxLog_AssertStatus()

void ptxLog_AssertStatus ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
ptxStatus_t actualStatus,
const ptxStatus_t requiredStatus )

Assert Status.

In case of failure, log the point of occurrence and status into a separate assertion log.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]actualStatusActual status code.
[in]requiredStatusRequired status code.

◆ ptxLog_DeInit()

ptxStatus_t ptxLog_DeInit ( ptxLog_t * logCtx)

De-Initialize the logger and free the storage.

Parameters
[in,out]logCtxPointer to an initialized instance of the component structure.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxLog_GetFirst()

ptxStatus_t ptxLog_GetFirst ( ptxLog_t * logCtx,
ptxLogItem_t ** logItem )

Get recent log item.

A pointer to internal storage is provided, which has two implications:

  • The logger shall not be operated while retrieving the items.
  • A copy of the item pointed at shall be made before resuming logging operation.
Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in,out]logItemPointer to a location that will receive a copy of the latest entry. If there is no such entry, NULL is provided.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxLog_GetNext()

ptxStatus_t ptxLog_GetNext ( ptxLog_t * logCtx,
ptxLogItem_t ** logItem )

Get next log item.

A pointer to internal storage is provided, which has two implications:

  • The logger shall not be operated while retrieving the items.
  • A copy of the item pointed at shall be made before resuming logging operation.
Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in,out]logItemPointer to a location that will receive a copy of the next entry. If there is no such entry, NULL is provided.
Note
Call ptxLog_GetFirst before calling this function.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxLog_Init()

ptxStatus_t ptxLog_Init ( ptxLog_t * logCtx,
void * osAl,
size_t numEntries )

Initialize the logger and the storage.

Parameters
[in,out]logCtxPointer to an existing instance of the component structure to be initialized.
[in]osAlPointer to initialized OSAL.
[in]numEntriesNumber of log entries to be generated.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxLog_InitRTLogging()

ptxStatus_t ptxLog_InitRTLogging ( ptxLog_t * logCtx,
pptxLogCallbackFn_t LogCallbackFn,
void * Handler )

Initialize Realtime-Logging (= write every log item directly to a file).

Parameters
[in,out]logCtxPointer to an existing instance of the component structure to be initialized.
[in]LogCallbackFnPointer to Callback function to perform additional tasks after logging entry was written (optional).
[in]HandlerPointer to Integration component (optional).
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxLog_S()

void ptxLog_S ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
ptxLogClass_t logClass,
uint32_t logStatus )

Log status only.

Log the point of occurrence, class, status.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]logClassClassification of the log event.
[in]logStatusStatus code.

◆ ptxLog_SD()

void ptxLog_SD ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
ptxLogClass_t logClass,
uint32_t logStatus,
uint8_t * logData,
size_t logLen )

Log Data.

Log the point of occurrence, class, status and data.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]logClassClassification of the log event.
[in]logStatusStatus code.
[in]logDataUser Data Parameter.
[in]logLenUser Data Length Parameter, in bytes.

◆ ptxLog_SP2()

void ptxLog_SP2 ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
ptxLogClass_t logClass,
uint32_t logStatus,
uint32_t logP1,
uint32_t logP2 )

Log two parameters.

Log the point of occurrence, class, status and two user-defined parameters.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]logClassClassification of the log event.
[in]logStatusStatus code.
[in]logP1User Parameter 1.
[in]logP2User Parameter 2.

◆ ptxLog_SPL()

void ptxLog_SPL ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
ptxLogClass_t logClass,
uint32_t logStatus,
uint64_t logP )

Log long parameter.

Log the point of occurrence, class, status and one long user-defined parameter.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]logClassClassification of the log event.
[in]logStatusStatus code.
[in]logPUser Parameter.

◆ ptxLog_TraceText()

void ptxLog_TraceText ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
const char * traceText )

Trace function.

Log the point of occurrence, and text.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]traceTextZero-terminated user-defined string. If NULL, no text is stored.

◆ ptxLog_TraceTextStatus()

void ptxLog_TraceTextStatus ( ptxLog_t * logCtx,
const char * locationMajor,
int locationMinor,
const char * traceText,
uint32_t logStatus )

Trace function, including status.

Log the point of occurrence, status and text.

Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in]locationMajorMajor location information as zero-terminated string (use FILE).
[in]locationMinorMinor location ID, like line number (use LINE).
[in]traceTextZero-terminated user-defined string. If NULL, no text is stored.
[in]logStatusStatus code.

◆ ptxLogAssert_GetFirst()

ptxStatus_t ptxLogAssert_GetFirst ( ptxLog_t * logCtx,
ptxLogItem_t ** logItem )

Get recent log item.

A pointer to internal storage is provided, which has two implications:

  • The logger shall not be operated while retrieving the items.
  • A copy of the item pointed at shall be made before resuming logging operation.
Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in,out]logItemPointer to a location that will receive a copy of the latest entry. If there is no such entry, NULL is provided.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxLogAssert_GetNext()

ptxStatus_t ptxLogAssert_GetNext ( ptxLog_t * logCtx,
ptxLogItem_t ** logItem )

Get next log item.

A pointer to internal storage is provided, which has two implications:

  • The logger shall not be operated while retrieving the items.
  • A copy of the item pointed at shall be made before resuming logging operation.
Parameters
[in]logCtxPointer to an initialized instance of the component structure.
[in,out]logItemPointer to a location that will receive a copy of the next entry. If there is no such entry, NULL is provided.
Note
Call ptxLog_GetFirst before calling this function.
Returns
Status of the operation. See definition of ptxStatus_t.