![]() |
WE310F5
39.00.000
|
This section describes the M2MB APIs to perform various debug logging operations. More...
#define | M2MB_DBG_EMERG(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_EMERG, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_DBG_ALERT(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_ALERT, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_DBG_CRIT(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_CRIT, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_DBG_ERROR(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_ERROR, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_DBG_WARN(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_WARN, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_DBG_NOTICE(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_NOTICE, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_DBG_INFO(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_INFO, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_DBG_DEBUG(...) m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_DEBUG, __func__, __LINE__, __VA_ARGS__) |
#define | M2MB_FUNC_ENTRY |
#define | M2MB_FUNC_EXIT |
#define | M2MB_FUNC_EXIT_RC(x) |
enum | M2MB_DBG_LOG_SEVERITY { M2MB_DBG_LOG_SEVERITY_INVALID = -1, M2MB_DBG_LOG_SEVERITY_LOGING_OFF = 0, M2MB_DBG_LOG_SEVERITY_EMERG, M2MB_DBG_LOG_SEVERITY_ALERT, M2MB_DBG_LOG_SEVERITY_CRIT, M2MB_DBG_LOG_SEVERITY_ERROR, M2MB_DBG_LOG_SEVERITY_WARN, M2MB_DBG_LOG_SEVERITY_NOTICE, M2MB_DBG_LOG_SEVERITY_INFO, M2MB_DBG_LOG_SEVERITY_DEBUG } |
M2MB_DBG_LOG_SEVERITY defines different debug category. More... | |
typedef enum M2MB_DBG_LOG_SEVERITY | M2MB_DBG_LOG_SEVERITY_T |
M2MB_DBG_LOG_SEVERITY defines different debug category. More... | |
typedef INT32(* | M2MB_DBG_CMD_CB_T) (VOID *userCtx, UINT32 len, UINT8 *cmd) |
M2MB_DBG_CMD_CB_T defines the command handler to handle the received command. More... | |
typedef VOID(* | M2MB_DBG_SEND_T) (VOID *userCtx, UINT32 len, UINT8 *data) |
M2MB_DBG_SEND_T defines the debug log send API the send the logs. More... | |
typedef VOID(* | M2MB_DBG_RECV_PROC_DONE_T) (VOID *userCtx) |
M2MB_DBG_RECV_PROC_DONE_T defines the API to indicate the receive process is done. More... | |
typedef struct M2MB_DBG_CFG | M2MB_DBG_CFG_T |
Debug module configuration context. More... | |
INT32 | m2mb_dbg_init (M2MB_DBG_CFG_T *pCfg, M2MB_UART_CONFIG_T *uart_cfg) |
m2mb_dbg_init is called to initialize the debug module. More... | |
INT32 | m2mb_dbg_is_init (VOID) |
m2mb_dbg_is_init is called to check if dbg module is initialized. More... | |
INT32 | m2mb_dbg_prepare_for_deepsleep (VOID) |
m2mb_dbg_prepare_for_deepsleep is called to make the dbg module ready for deepsleep. More... | |
INT32 | m2mb_dbg_reinit (VOID) |
m2mb_dbg_reinit is called after coming out of deepsleep. More... | |
INT32 | m2mb_dbg_msg_log (M2MB_DBG_LOG_SEVERITY_T severity, char const *sourceFilePath, UINT32 lineNumber, char *format,...) |
m2mb_dbg_msg_log is called to log debug information. More... | |
INT32 | m2mb_dbg_consol_print (char *format,...) |
m2mb_dbg_consol_print is called to print to the console. More... | |
M2MB_STATUS_T | m2mb_dbg_set_severity (M2MB_DBG_LOG_SEVERITY_T severityLevel) |
m2mb_dbg_set_severity is called to set the severity level to log. More... | |
M2MB_DBG_LOG_SEVERITY_T | m2mb_dbg_get_severity (VOID) |
m2mb_dbg_get_severity is called to get the severity level. More... | |
void | m2mb_data_tx_done_cb (UINT32 num_bytes, void *cb_data) |
m2mb_data_tx_done_cb is called to inform data transfer is complete. More... | |
void | m2mb_data_rx_cb (UINT32 num_bytes, void *cb_data) |
m2mb_data_rx_cb is called to inform data received which needs to be processed for command input handlling. More... | |
This section describes the M2MB APIs to perform various debug logging operations.
Debug module uses a UART port to send the debug information. The UART port to send can be configured by the user. The UART driver takes care of sending the debug log using DMA. Logs are stored in a circular buffer, while previous logs are being sent over UART.
Debug module creates a dbg thread of low priority which is used to trigger the log sending procedure once the previous log send procedure is over. Apart from logging feature, debug module provides API to send the information immediately over console and also receives command over UART, if CLI option is enabled during initialization procedure.
#define M2MB_DBG_ALERT | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_ALERT, __func__, __LINE__, __VA_ARGS__) |
Definition at line 79 of file m2mb_dbg.h.
#define M2MB_DBG_CRIT | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_CRIT, __func__, __LINE__, __VA_ARGS__) |
Definition at line 83 of file m2mb_dbg.h.
#define M2MB_DBG_DEBUG | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_DEBUG, __func__, __LINE__, __VA_ARGS__) |
Definition at line 103 of file m2mb_dbg.h.
#define M2MB_DBG_EMERG | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_EMERG, __func__, __LINE__, __VA_ARGS__) |
Definition at line 75 of file m2mb_dbg.h.
#define M2MB_DBG_ERROR | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_ERROR, __func__, __LINE__, __VA_ARGS__) |
Definition at line 87 of file m2mb_dbg.h.
#define M2MB_DBG_INFO | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_INFO, __func__, __LINE__, __VA_ARGS__) |
Definition at line 99 of file m2mb_dbg.h.
#define M2MB_DBG_NOTICE | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_NOTICE, __func__, __LINE__, __VA_ARGS__) |
Definition at line 95 of file m2mb_dbg.h.
#define M2MB_DBG_WARN | ( | ... | ) | m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_WARN, __func__, __LINE__, __VA_ARGS__) |
Definition at line 91 of file m2mb_dbg.h.
#define M2MB_FUNC_ENTRY |
Definition at line 106 of file m2mb_dbg.h.
#define M2MB_FUNC_EXIT |
Definition at line 110 of file m2mb_dbg.h.
#define M2MB_FUNC_EXIT_RC | ( | x | ) |
Definition at line 114 of file m2mb_dbg.h.
typedef struct M2MB_DBG_CFG M2MB_DBG_CFG_T |
Debug module configuration context.
Structure to configure the module. This is used while initializing the module.
M2MB_DBG_CMD_CB_T defines the command handler to handle the received command.
User has to implenment this API to handle the received command. If user sets enableCI during initialization, then to handle the command it should implement this callback.
This API is called from debug thread context.
[in] | userCtx | user context provided in cbCtx in M2MB_DBG_CFG_T while initializing the module. |
[in] | len | Length of data receiveid. |
[in] | len | Pointer to the data |
Definition at line 164 of file m2mb_dbg.h.
typedef enum M2MB_DBG_LOG_SEVERITY M2MB_DBG_LOG_SEVERITY_T |
M2MB_DBG_LOG_SEVERITY defines different debug category.
This enum is used to select various debug log severity levels.
M2MB_DBG_RECV_PROC_DONE_T defines the API to indicate the receive process is done.
User can implenment this API to to get indication on the data received is consumed when enableCI is set to TRUE during initialization. User calls the m2mb_data_rx_cb to indicate the debug module about data received. On m2mb_data_rx_cb API call the data is stored in debug module bufer and indicate the user (may be to free-up the memroy )by calling this API.
This API is called from debug thread context.
[in] | userCtx | user context provided in userCtx in M2MB_DBG_CFG_T while initializing the module. |
Definition at line 205 of file m2mb_dbg.h.
M2MB_DBG_SEND_T defines the debug log send API the send the logs.
User has to implenment this API to consume the debug logs if it dosn't want the debug module to initialize the UART module and send the logs over UART.
This API is called from debug thread context.
[in] | userCtx | user context provided in userCtx in M2MB_DBG_CFG_T while initializing the module. |
[in] | len | Length of data receiveid. |
[in] | len | Pointer to the data |
Definition at line 186 of file m2mb_dbg.h.
M2MB_DBG_LOG_SEVERITY defines different debug category.
This enum is used to select various debug log severity levels.
Definition at line 128 of file m2mb_dbg.h.
void m2mb_data_rx_cb | ( | UINT32 | num_bytes, |
void * | cb_data | ||
) |
m2mb_data_rx_cb is called to inform data received which needs to be processed for command input handlling.
m2mb_data_rx_cb is required to be called by user once data is received. This is required if user gives his API to handle the debug log in sendData function and ahs configured the enableCI in config parameter.
[in] | num_bytes | Bytes sent. |
[in] | cb_data | buffer that is sent. |
void m2mb_data_tx_done_cb | ( | UINT32 | num_bytes, |
void * | cb_data | ||
) |
m2mb_data_tx_done_cb is called to inform data transfer is complete.
m2mb_data_tx_done_cb is required to be called by user once data transfer is complete. This is required if user gives API to handle the debug log in sendData function in config parameter.
[in] | num_bytes | Bytes sent. |
[in] | cb_data | buffer that is sent. |
INT32 m2mb_dbg_consol_print | ( | char * | format, |
... | |||
) |
m2mb_dbg_consol_print is called to print to the console.
m2mb_dbg_consol_print prints to the console. The print is unformatted unlike the debug log.
[in] | format | Format of the content to be sent over console. |
M2MB_DBG_LOG_SEVERITY_T m2mb_dbg_get_severity | ( | VOID | ) |
m2mb_dbg_get_severity is called to get the severity level.
m2mb_dbg_get_severity returns the current severity level set.
INT32 m2mb_dbg_init | ( | M2MB_DBG_CFG_T * | pCfg, |
M2MB_UART_CONFIG_T * | uart_cfg | ||
) |
m2mb_dbg_init is called to initialize the debug module.
m2mb_ntp_init initializes the NTP module.
[in] | pCfg | Debug module configuration. |
[in] | uart_cfg | UART port configuration. |
m2mb_dbg_is_init is called to check if dbg module is initialized.
m2mb_dbg_is_init checks if the dbg module is initialized.
INT32 m2mb_dbg_msg_log | ( | M2MB_DBG_LOG_SEVERITY_T | severity, |
char const * | sourceFilePath, | ||
UINT32 | lineNumber, | ||
char * | format, | ||
... | |||
) |
m2mb_dbg_msg_log is called to log debug information.
m2mb_dbg_msg_log logs the debug information. If there is no write process happening then it stores the information in a circular buffer to send it log information in first in first out basis.
[in] | severity | Severity of the message. |
[in] | sourceFilePath | Source file path of the log. |
[in] | lineNumber | Line number of the log. |
[in] | format | Format of the message. |
Example
m2mb_dbg_prepare_for_deepsleep is called to make the dbg module ready for deepsleep.
m2mb_dbg_prepare_for_deepsleep makes the dbg module ready for deepsleep.
m2mb_dbg_reinit is called after coming out of deepsleep.
m2mb_dbg_reinit reinitializes the dbg module after coming out of deepsleep.
M2MB_STATUS_T m2mb_dbg_set_severity | ( | M2MB_DBG_LOG_SEVERITY_T | severityLevel | ) |
m2mb_dbg_set_severity is called to set the severity level to log.
m2mb_dbg_set_severity sets the severity level and logs only those severity level debug prints which are lower or equal to the value set.
[in] | severityLevel | Severity level to set. |