For more details and example usage, see Debug
Data Structures | |
struct | DebugP_ShmLog |
Data structure describing log in shared memory. More... | |
Functions | |
void | _DebugP_assert (int32_t expression, const char *file, const char *function, int32_t line, const char *expressionString) |
Actual function that is called for assert's by DebugP_assert. More... | |
void | _DebugP_assertNoLog (int32_t expression) |
Actual function that is called for assert's by DebugP_assertNoLog. More... | |
void | _DebugP_logZone (uint32_t logZone, char *format,...) |
Function to log a string to the enabled console for a given zone. More... | |
uint32_t | DebugP_logZoneEnable (uint32_t logZoneMask) |
Enable log zones. More... | |
uint32_t | DebugP_logZoneDisable (uint32_t logZoneMask) |
Disable log zones. More... | |
void | DebugP_logZoneRestore (uint32_t logZoneMask) |
Restire zone mask returned from DebugP_logZoneDisable or DebugP_logZoneEnable. More... | |
void | DebugP_shmLogWriterInit (DebugP_ShmLog *shmLog, uint16_t selfCoreId) |
Initialize shared memory log writer for this core. More... | |
void | DebugP_shmLogWriterPause (void) |
Pauses shared memory log writer for this core. More... | |
void | DebugP_shmLogWriterResume (void) |
Resumes shared memory log writer for this core. More... | |
void | DebugP_shmLogWriterPutChar (char character) |
Write a character to shared memory log. More... | |
void | DebugP_uartLogWriterPutChar (char character) |
Write a character to UART terminal. More... | |
void | DebugP_shmLogReaderInit (DebugP_ShmLog *shmLog, uint16_t numCores) |
Initialize log reader to read from shared memory and log to console via DebugP_log. More... | |
void | DebugP_shmLogRead (void) |
Reads logs from shared memory. More... | |
void | DebugP_memLogWriterInit (uint16_t selfCoreId) |
Initialize log write to write to memory trace buffer. More... | |
void | DebugP_memLogWriterPause (void) |
Pauses memory trace log for this core. More... | |
void | DebugP_memLogWriterResume (void) |
Resumes memory trace log for this core. More... | |
void | DebugP_memLogWriterPutChar (char character) |
Write a character to trace buffer. More... | |
void | DebugP_uartSetDrvIndex (uint32_t uartDrvIndex) |
Set UART driver index to use for character read and write form UART. More... | |
int32_t | DebugP_scanf (char *format,...) |
Read a formatted string from the selected UART driver. More... | |
int32_t | DebugP_readLine (char *lineBuf, uint32_t bufSize) |
Read a string from the selected UART driver. More... | |
Macros | |
#define | DebugP_SHM_LOG_SIZE ((2U*1024U) - 16U) |
size of shared memory log for a CPU More... | |
#define | DebugP_MEM_LOG_SIZE ( 4*1024U ) |
size of memory log for a CPU More... | |
#define | DebugP_SHM_LOG_IS_VALID (0x12345678U) |
Flag to indicate shared memory buffer is valid. More... | |
#define | UNSIGNED_INTEGERVAL_TWO (2U) |
#define | UNSIGNED_INTEGERVAL_THREE (3U) |
#define | CARRIAGE_RETURN_ASCII (13U) |
Debug log zones | |
#define | DebugP_LOG_ZONE_ALWAYS_ON (0x0001U) |
Flag for always on zone, enabled by default and recommend to not switch off. More... | |
#define | DebugP_LOG_ZONE_ERROR (0x0002U) |
Flag for error zone. More... | |
#define | DebugP_LOG_ZONE_WARN (0x0004U) |
Flag for warning zone. More... | |
#define | DebugP_LOG_ZONE_INFO (0x0008U) |
Flag for info zone. More... | |
Compile time log and assert enable, disable | |
#define | DebugP_ASSERT_ENABLED 1 |
Pre-processor define to enable or disable DebugP assert's. More... | |
#define | DebugP_LOG_ENABLED 1 |
Pre-processor define to enable or disable DebugP log's. More... | |
Debug assert APIs | |
#define | DebugP_assert(expression) |
Function to call for assert check. More... | |
#define | DebugP_assertNoLog(expression) (_DebugP_assertNoLog(expression)) |
Function to call for assert check, no logs are printed. More... | |
Debug log APIs | |
#define | DebugP_log(format, ...) |
Function to log a string to the enabled console. More... | |
#define | DebugP_logError(format, ...) |
Function to log a string to the enabled console, for error zone. More... | |
#define | DebugP_logWarn(format, ...) |
Function to log a string to the enabled console, for warning zone. More... | |
#define | DebugP_logInfo(format, ...) |
Function to log a string to the enabled console, for info zone. More... | |
#define DebugP_LOG_ZONE_ALWAYS_ON (0x0001U) |
Flag for always on zone, enabled by default and recommend to not switch off.
#define DebugP_LOG_ZONE_ERROR (0x0002U) |
Flag for error zone.
#define DebugP_LOG_ZONE_WARN (0x0004U) |
Flag for warning zone.
#define DebugP_LOG_ZONE_INFO (0x0008U) |
Flag for info zone.
#define DebugP_SHM_LOG_SIZE ((2U*1024U) - 16U) |
size of shared memory log for a CPU
#define DebugP_MEM_LOG_SIZE ( 4*1024U ) |
size of memory log for a CPU
#define DebugP_SHM_LOG_IS_VALID (0x12345678U) |
Flag to indicate shared memory buffer is valid.
Written by the writer after it has initialized and cleared by the reader after reader has initialized
#define UNSIGNED_INTEGERVAL_TWO (2U) |
Macro defines the value of two
#define UNSIGNED_INTEGERVAL_THREE (3U) |
Macro defines the value of three
#define CARRIAGE_RETURN_ASCII (13U) |
Macro defines the ascii value of carriage return
#define DebugP_ASSERT_ENABLED 1 |
Pre-processor define to enable or disable DebugP assert's.
Set to 0 to disable assert checks and recompile all code where this file is included.
#define DebugP_LOG_ENABLED 1 |
Pre-processor define to enable or disable DebugP log's.
Set to 0 to disable logging and recompile all code where this file is included.
#define DebugP_assert | ( | expression | ) |
Function to call for assert check.
If expresion evaluates to 0 then the function disable's interrupt and loops forever. It logs the file name and line number before looping forever. User should fix their code and run again.
This API should not be called within ISR context.
expression | [in] expression to check for. |
#define DebugP_assertNoLog | ( | expression | ) | (_DebugP_assertNoLog(expression)) |
Function to call for assert check, no logs are printed.
Same as DebugP_assert except no logs are printed. This can be used in very early initialization code and in ISRs.
During very early initialization and inside ISRs asserts with log will not work.
expression | [in] expression to check for. |
#define DebugP_log | ( | format, | |
... | |||
) |
Function to log a string to the enabled console.
This API should not be called within ISR context.
format | [in] String to log |
#define DebugP_logError | ( | format, | |
... | |||
) |
Function to log a string to the enabled console, for error zone.
This API should not be called within ISR context.
format | [in] String to log |
#define DebugP_logWarn | ( | format, | |
... | |||
) |
Function to log a string to the enabled console, for warning zone.
This API should not be called within ISR context.
format | [in] String to log |
#define DebugP_logInfo | ( | format, | |
... | |||
) |
Function to log a string to the enabled console, for info zone.
This API should not be called within ISR context.
format | [in] String to log |
void _DebugP_assert | ( | int32_t | expression, |
const char * | file, | ||
const char * | function, | ||
int32_t | line, | ||
const char * | expressionString | ||
) |
Actual function that is called for assert's by DebugP_assert.
void _DebugP_assertNoLog | ( | int32_t | expression | ) |
Actual function that is called for assert's by DebugP_assertNoLog.
void _DebugP_logZone | ( | uint32_t | logZone, |
char * | format, | ||
... | |||
) |
Function to log a string to the enabled console for a given zone.
This API should not be used directly, instead DebugP_log, DebugP_logError, DebugP_logWarn, DebugP_logInfo should be used.
logZone | [in] Value from DebugP_LOG_ZONE |
format | [in] String ot log |
uint32_t DebugP_logZoneEnable | ( | uint32_t | logZoneMask | ) |
Enable log zones.
logZoneMask | [in] Mask of values from DebugP_LOG_ZONE |
uint32_t DebugP_logZoneDisable | ( | uint32_t | logZoneMask | ) |
Disable log zones.
logZoneMask | [in] Mask of values from DebugP_LOG_ZONE |
void DebugP_logZoneRestore | ( | uint32_t | logZoneMask | ) |
Restire zone mask returned from DebugP_logZoneDisable or DebugP_logZoneEnable.
logZoneMask | [in] Mask of values from DebugP_LOG_ZONE |
void DebugP_shmLogWriterInit | ( | DebugP_ShmLog * | shmLog, |
uint16_t | selfCoreId | ||
) |
Initialize shared memory log writer for this core.
shmLog | [in] Address of shared memory where the writer should write logs to |
selfCoreId | [in] ID of core on which this API is called, this is used to add a core name prefix string to each log line, see CSL_CoreID |
void DebugP_shmLogWriterPause | ( | void | ) |
Pauses shared memory log writer for this core.
void DebugP_shmLogWriterResume | ( | void | ) |
Resumes shared memory log writer for this core.
void DebugP_shmLogWriterPutChar | ( | char | character | ) |
Write a character to shared memory log.
If shared memory log buffer is full, nothing is written and character gets "dropped"
Internally, the charaxter is stored in a local line buffer and line buffer is flushed to shared memory only when a '\n' character is put.
character | [in] character to write |
void DebugP_uartLogWriterPutChar | ( | char | character | ) |
Write a character to UART terminal.
Make sure the UART to use is set via DebugP_uartSetDrvIndex(). When using SysConfig this is done when UART debug log is enabled.
character | [in] character to write |
void DebugP_shmLogReaderInit | ( | DebugP_ShmLog * | shmLog, |
uint16_t | numCores | ||
) |
Initialize log reader to read from shared memory and log to console via DebugP_log.
The parameter shmLog
is a array and is indexed using core ID as defined by CSL_CoreID
shmLog | [in] Array of addresses of shared memory where the reader should read from. |
numCores | [in] Number of entries in the shmLog array. Typically CSL_CORE_ID_MAX |
void DebugP_shmLogRead | ( | void | ) |
Reads logs from shared memory.
User needs to invoke this API periodically to get continous logs from Shared memory. Used when Shared Memory log Reader is enabled for nortos application.
void DebugP_memLogWriterInit | ( | uint16_t | selfCoreId | ) |
Initialize log write to write to memory trace buffer.
Used when IPC with Linux is enabled OR ROV based logging is enabled
selfCoreId | [in] ID of core on which this API is called, this is used to add a core name prefix string to each log line, see CSL_CoreID |
void DebugP_memLogWriterPause | ( | void | ) |
Pauses memory trace log for this core.
void DebugP_memLogWriterResume | ( | void | ) |
Resumes memory trace log for this core.
void DebugP_memLogWriterPutChar | ( | char | character | ) |
Write a character to trace buffer.
Used when IPC with Linux is enabled OR ROV based logging is enabled
Internally, the charaxter is stored in a local line buffer and line buffer is flushed to UART only when a '\n' character is put.
character | [in] character to write |
void DebugP_uartSetDrvIndex | ( | uint32_t | uartDrvIndex | ) |
Set UART driver index to use for character read and write form UART.
Make sure the UART to use is set via DebugP_uartSetDrvIndex(). When using SysConfig this is done when UART debug log is enabled.
uartDrvIndex | [in] UART driver instance index to use |
int32_t DebugP_scanf | ( | char * | format, |
... | |||
) |
Read a formatted string from the selected UART driver.
This function returns when a "new line" or "enter" is input on the console. Make sure the UART to use is set via DebugP_uartSetDrvIndex(). When using SysConfig this is done when UART debug log is enabled.
int32_t DebugP_readLine | ( | char * | lineBuf, |
uint32_t | bufSize | ||
) |
Read a string from the selected UART driver.
This function returns when a "new line" or "enter" is input on the console. Make sure the UART to use for reading is set via DebugP_uartSetDrvIndex. When using SysConfig this is done when UART debug log is enabled. A '\0' is always put at the end.
lineBuf | [in] Buffer into which the string is read |
bufSize | [in] Size of the buffer in which to read, if buffer is not enough, input is truncated. |