XDK API  3.6.0
Documentation
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
ErrorLogger

This file contains public interface for ErrorLogger module. More...

+ Collaboration diagram for ErrorLogger:

Files

file  BCDS_ErrorLogger.h
 

Data Structures

struct  ErrorLogger_LogEntry_S
 Struct for storing the details of Logs. More...
 
struct  ErrorLoggerConfig_S
 

Macros

#define ERRORLOGGER_SIZE   (UINT8_C(120))
 
#define MAXENTRIES   (ERRORLOGGER_SIZE/SIZEOF_LOGENTRY)
 
#define SIZEOF_LOGENTRY   (UINT8_C(12))
 

Typedefs

typedef Retcode_T(* ErrorLogger_EraseFunc_T )(ErrorLogger_StorageMedium_T storageSelect, void *value, uint32_t StartAddr, uint32_t numOfBytes)
 This function writes the data from the specified partition of the storage medium. More...
 
typedef uint32_t(* ErrorLogger_GetTime )(void)
 This function is used to provide the time stamp and unit will be based on application perspective. More...
 
typedef struct
ErrorLogger_LogEntry_S 
ErrorLogger_LogEntry_T
 
typedef Retcode_T(* ErrorLogger_ReadFunc_T )(ErrorLogger_StorageMedium_T storageSelect, void *value, uint32_t StartAddr, uint32_t numOfBytes)
 This function reads the data from the specified partition of the storage medium. More...
 
typedef enum
ErrorLogger_StorageMedium_E 
ErrorLogger_StorageMedium_T
 
typedef Retcode_T(* ErrorLogger_WriteFunc_T )(ErrorLogger_StorageMedium_T storageSelect, void *value, uint32_t StartAddr, uint32_t numOfBytes)
 This function writes the data from the specified partition of the storage medium. More...
 
typedef struct ErrorLoggerConfig_S ErrorLoggerConfig_T
 

Enumerations

enum  ErrorLogger_StorageMedium_E
 Enum for different storage medium. More...
 

Functions

struct ErrorLogger_LogEntry_S __attribute__ ((packed))
 
Retcode_T ErrorLogger_ClearAllErrorLogs (void)
 API to clear all the error in the user page. More...
 
uint8_t ErrorLogger_GetCurrentErrors (void)
 API to query numbers of errors available in the storage medium. More...
 
Retcode_T ErrorLogger_GetErrorAt (uint8_t index, ErrorLogger_LogEntry_T *LogEntry)
 API to get the error at particular index. More...
 
Retcode_T ErrorLogger_GetLastErrorLog (ErrorLogger_LogEntry_T *LogEntry)
 API to get the most recent error happened in the system. More...
 
uint16_t ErrorLogger_GetTotalErrors (void)
 API to query total number of errors occurred in the system. More...
 
Retcode_T ErrorLogger_HasError (Retcode_T Error)
 API to query if particular error has happened in the system. More...
 
Retcode_T ErrorLogger_Init (ErrorLoggerConfig_T storageAgentHandle)
 API for initialize the ErrorLogger module. More...
 
Retcode_T ErrorLogger_LogError (Retcode_T Error)
 API for logging error to the storage medium. More...
 

Variables

enum ErrorLogger_StorageMedium_E __attribute__
 

Detailed Description

This file exposes the public interface of the ErrorLogger Module. Mostly call ErrorLogger_LogError() with Retcode_T to log the error to a persistent memory such as Userpage, SD card etc. Each time the ErrorLogger_LogError() is called, error will be logged with time stamp following the ring buffer model.


Data Structure Documentation

struct ErrorLogger_LogEntry_S

Data Fields

uint32_t ErrorCode
 
uint16_t Reserved
 
uint16_t SeqNo
 
uint32_t TimeStamp
 

Field Documentation

uint32_t ErrorCode

It records the timestamp (uptime) of error occurance

uint16_t Reserved

It holds error occurance number

uint16_t SeqNo

It holds the Retcode_T which says from where the error comes

uint32_t TimeStamp
struct ErrorLoggerConfig_S

Structure contains function pointers as it members to access the storage medium easily.

Data Fields

ErrorLogger_EraseFunc_T EraseLogs
 
uint32_t length
 
uint32_t position
 
ErrorLogger_ReadFunc_T ReadLogs
 
ErrorLogger_StorageMedium_T StorageMedium
 
ErrorLogger_GetTime Time_Stamp
 
ErrorLogger_WriteFunc_T WriteLogs
 

Field Documentation

uint32_t length
uint32_t position
ErrorLogger_GetTime Time_Stamp

Macro Definition Documentation

#define ERRORLOGGER_SIZE   (UINT8_C(120))
#define MAXENTRIES   (ERRORLOGGER_SIZE/SIZEOF_LOGENTRY)
#define SIZEOF_LOGENTRY   (UINT8_C(12))

This item needs to be updated whenever the log entry structure changes!!

Typedef Documentation

typedef Retcode_T(* ErrorLogger_EraseFunc_T)(ErrorLogger_StorageMedium_T storageSelect, void *value, uint32_t StartAddr, uint32_t numOfBytes)
Note
Before calling this function ensure ErrorLogger_Init has been done. Also the caller of this function has to ensure the valid position & no of bytes to erase from the medium.
Parameters
[in]partition: Type of the storage medium to erase.
[in]valuepointer to destination value to hold the data. This pointer should have enough room to place no of bytes that is mentioned in argument numOfBytes.
[in]StartAddroffset from the start of the partition.
[in]numOfBytesNumber of bytes to erase from the storage medium.
Return values
RETCODE_OKwhen the erase was successful else an error code is returned.
typedef uint32_t(* ErrorLogger_GetTime)(void)
Returns
Current time stamp.
typedef Retcode_T(* ErrorLogger_ReadFunc_T)(ErrorLogger_StorageMedium_T storageSelect, void *value, uint32_t StartAddr, uint32_t numOfBytes)
Note
Before calling this function ensure ErrorLogger_Init has been done. Also the caller of this function has to ensure the valid position & no of bytes to read from the medium.
Parameters
[in]partitionType of the storage medium to read.
[in]valuepointer to destination value to hold the data. This pointer should have enough room to place no of bytes that is mentioned in argument numOfBytes.
[in]StartAddroffset from the start of the partition.
[in]numOfBytesNumber of bytes to read from the storage medium.
Return values
RETCODE_OKif the read was successful, else an error code is returned.
typedef Retcode_T(* ErrorLogger_WriteFunc_T)(ErrorLogger_StorageMedium_T storageSelect, void *value, uint32_t StartAddr, uint32_t numOfBytes)
Note
Before calling this function ensure ErrorLogger_Init has been done. Also the caller of this function has to ensure the valid position & no of bytes to write from the medium.
Parameters
[in]partitionType of the storage medium to write.
[in]valuepointer to destination value to hold the data. This pointer should have enough room to place no of bytes that is mentioned in argument numOfBytes.
[in]StartAddroffset from the start of the partition.
[in]numOfBytesNumber of bytes to write from the storage medium.
Return values
RETCODE_OKif the write was successful, else an error code is returned.

Enumeration Type Documentation

Enumerator
STORAGE_TYPE_SDCARD 
STORAGE_TYPE_EXT_FLASH 
STORAGE_TYPE_NVM 
STORAGE_TYPE_OTHERS 

Function Documentation

struct ErrorLogger_LogEntry_S __attribute__ ( (packed)  )

The serial port LINE CODING data structure, used to carry information about serial port baudrate, parity etc. between host and device.

Retcode_T ErrorLogger_ClearAllErrorLogs ( void  )
Return values
RETCODE_OKwhen all the errors have been erased successfully and the error logger is reinitialized successfully
Returns
errors from either the erase operation (see ErrorLoggerConfig_T.EraseLogs) or the error logger initialization (see ErrorLogger_Init)
uint8_t ErrorLogger_GetCurrentErrors ( void  )
Returns
numbers of errors in the storage medium.
Retcode_T ErrorLogger_GetErrorAt ( uint8_t  index,
ErrorLogger_LogEntry_T LogEntry 
)
Parameters
[in]index- Index of the error to be queried
[out]LogEntry- If there is an error at this index, it will be filled with that error.
Return values
RETCODE_OKwhen there is an error at this index and it is successfully read
RETCODE_OUT_OF_RESOURCESwhen the index is bigger than number of error that can be stored
RETCODE_INVALID_PARAMwhen there is no error at this index
Retcode_T ErrorLogger_GetLastErrorLog ( ErrorLogger_LogEntry_T LogEntry)

Using this API, one can get the most recent error in the system.

Note
if there is an error, LogEntry is filled with most recent error, else it is left untouched
Parameters
[out]LogEntry- pointer to be filled with last logged error
Return values
RETCODE_OKwhen the last error is read successfully
RETCODE_INVALID_PARAMwhen the LogEntry pointer is NULL
RETCODE_OUT_OF_RESOURCESwhen no error was logged yet
uint16_t ErrorLogger_GetTotalErrors ( void  )
Note
The total number of errors logged can be bigger than the maximum number of entries as the errors are logged in a cyclical manner
Returns
numbers of errors in the system.
Retcode_T ErrorLogger_HasError ( Retcode_T  Error)
Parameters
[in]Error- The Error code to be searched in the logs
Return values
RETCODE_OKwhen the queried error is present
RETCODE_FAILUREwhen the queried error is not present
Retcode_T ErrorLogger_Init ( ErrorLoggerConfig_T  storageAgentHandle)

The current configuration of error logger is that it can store up to 120 bytes where one error log entry is 12 bytes. Thus 10 logs could be stored. This can be modified based on the application requirements.

Parameters
[in]storageAgentHandle- data structure handling the information required for error logging
Return values
RETCODE_OKwhen the ErrorLogger module is successfully initialized
RETCODE_FAILUREwhen the read operation of the storage agent failed
Retcode_T ErrorLogger_LogError ( Retcode_T  Error)

This API is not thread-safe and the priority has to be handled in the application.

It logs the errors to the storage medium along with timestamp. It also counts and numbers all the errors.

Parameters
[in]Error- Error code to be logged.
Return values
RETCODE_OKwhen error is logged successfully
RETCODE_INVALID_PARAMwhen trying to log a RETCODE_OK value for error (which is not an error...)
Returns
when writing failed, the actual error code is the one returned by the #WriteLogs function (see ErrorLoggerConfig_T)

Variable Documentation


All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:52 by doxygen 1.8.8