WE310F5  39.00.000
m2mb_dbg.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
41 #ifndef M2MB_DBG_API_H
42 #define M2MB_DBG_API_H
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
63 /*-----------------------------------------------------------------------------------------------*/
64 
69 /*-----------------------------------------------------------------------------------------------*/
70 
71 
72 /* Global declarations ==========================================================================*/
73 
74 /* Macro to be called by an application to log debug message at EMERGENCY log level */
75 #define M2MB_DBG_EMERG(...) \
76  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_EMERG, __func__, __LINE__, __VA_ARGS__)
77 
78 /* Macro to be called by an application to log debug message at ALERT log level */
79 #define M2MB_DBG_ALERT(...) \
80  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_ALERT, __func__, __LINE__, __VA_ARGS__)
81 
82 /* Macro to be called by an application to log debug message at CRITICAL log level */
83 #define M2MB_DBG_CRIT(...) \
84  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_CRIT, __func__, __LINE__, __VA_ARGS__)
85 
86 /* Macro to be called by an application to log debug message at ERROR log level */
87 #define M2MB_DBG_ERROR(...) \
88  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_ERROR, __func__, __LINE__, __VA_ARGS__)
89 
90 /* Macro to be called by an application to log debug message at WARNING log level */
91 #define M2MB_DBG_WARN(...) \
92  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_WARN, __func__, __LINE__, __VA_ARGS__)
93 
94 /* Macro to be called by an application to log debug message at NOTICE log level */
95 #define M2MB_DBG_NOTICE(...) \
96  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_NOTICE, __func__, __LINE__, __VA_ARGS__)
97 
98 /* Macro to be called by an application to log debug message at INFORMATION log level */
99 #define M2MB_DBG_INFO(...) \
100  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_INFO, __func__, __LINE__, __VA_ARGS__)
101 
102 /* Macro to be called by an application to log debug message at DEBUG log level */
103 #define M2MB_DBG_DEBUG(...) \
104  m2mb_dbg_msg_log(M2MB_DBG_LOG_SEVERITY_DEBUG, __func__, __LINE__, __VA_ARGS__)
105 
106 #define M2MB_FUNC_ENTRY \
107 {\
108  M2MB_DBG_INFO(" FUNC_ENTRY \n"); \
109 }
110 #define M2MB_FUNC_EXIT \
111 {\
112  M2MB_DBG_INFO(" FUNC_EXIT \n"); \
113 }
114 #define M2MB_FUNC_EXIT_RC(x) \
115 {\
116  M2MB_DBG_INFO(" FUNC_EXIT : Return Code : %d \n", x); \
117  return x; \
118 }
119 /* Global typedefs ==============================================================================*/
129 {
141 
164 typedef INT32 (* M2MB_DBG_CMD_CB_T )( VOID *userCtx, UINT32 len, UINT8* cmd );
165 
186 typedef VOID (*M2MB_DBG_SEND_T)( VOID *userCtx, UINT32 len, UINT8* data );
187 
205 typedef VOID (*M2MB_DBG_RECV_PROC_DONE_T)( VOID *userCtx );
206 
214 typedef struct M2MB_DBG_CFG
215 {
232 
233 /* Global functions =========================================================*/
234 /*---------------------------------------------------------------------------*/
279 /*---------------------------------------------------------------------------*/
281 
282 /*---------------------------------------------------------------------------*/
302 /*---------------------------------------------------------------------------*/
304 
305 /*---------------------------------------------------------------------------*/
326 /*---------------------------------------------------------------------------*/
328 
329 /*---------------------------------------------------------------------------*/
349 /*---------------------------------------------------------------------------*/
351 
352 /*---------------------------------------------------------------------------*/
388 /*---------------------------------------------------------------------------*/
390  char const *sourceFilePath, UINT32 lineNumber, char *format, ...);
391 
392 /*---------------------------------------------------------------------------*/
417 /*---------------------------------------------------------------------------*/
418 INT32 m2mb_dbg_consol_print( char *format, ...);
419 
420 /*---------------------------------------------------------------------------*/
444 /*---------------------------------------------------------------------------*/
446 
447 /*---------------------------------------------------------------------------*/
468 /*---------------------------------------------------------------------------*/
470 
471 /*---------------------------------------------------------------------------*/
495 /*---------------------------------------------------------------------------*/
496 void m2mb_data_tx_done_cb( UINT32 num_bytes, void* cb_data );
497 
498 /*---------------------------------------------------------------------------*/
523 /*---------------------------------------------------------------------------*/
524 void m2mb_data_rx_cb( UINT32 num_bytes, void* cb_data );
525 
529 /*-----------------------------------------------------------------------------------------------*/
530 
531 #ifdef __cplusplus
532 }
533 #endif
534 #endif
INT32 m2mb_dbg_prepare_for_deepsleep(VOID)
m2mb_dbg_prepare_for_deepsleep is called to make the dbg module ready for deepsleep.
Debug module configuration context.
Definition: m2mb_dbg.h:214
M2MB_DBG_LOG_SEVERITY_T m2mb_dbg_get_severity(VOID)
m2mb_dbg_get_severity is called to get the severity level.
unsigned char UINT8
Definition: m2mb_types.h:86
M2MB_UART_PORT_ID_E port
Definition: m2mb_dbg.h:216
INT32 m2mb_dbg_reinit(VOID)
m2mb_dbg_reinit is called after coming out of deepsleep.
M2MB_DBG_CMD_CB_T cb
Definition: m2mb_dbg.h:221
INT32 M2MB_STATUS_T
Definition: m2mb_status.h:97
UINT16 bufferSize
Definition: m2mb_dbg.h:217
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.
Definition: m2mb_dbg.h:186
unsigned short UINT16
Definition: m2mb_types.h:87
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.
Definition: m2mb_dbg.h:164
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 handl...
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.
VOID * userCtx
Definition: m2mb_dbg.h:229
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_LOG_SEVERITY
M2MB_DBG_LOG_SEVERITY defines different debug category.
Definition: m2mb_dbg.h:128
void VOID
Definition: m2mb_types.h:74
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_DBG_LOG_SEVERITY_T logLevel
Definition: m2mb_dbg.h:218
unsigned long int UINT32
Definition: m2mb_types.h:88
signed int INT32
Definition: m2mb_types.h:82
M2MB_DBG_SEND_T sendData
Definition: m2mb_dbg.h:224
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.
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.
Definition: m2mb_dbg.h:205
enum M2MB_DBG_LOG_SEVERITY M2MB_DBG_LOG_SEVERITY_T
M2MB_DBG_LOG_SEVERITY defines different debug category.
Structure to configure UART module.
Definition: m2mb_uart.h:182
VOID * cbCtx
Definition: m2mb_dbg.h:222
M2MB_DBG_RECV_PROC_DONE_T recvDone
Definition: m2mb_dbg.h:227
struct M2MB_DBG_CFG M2MB_DBG_CFG_T
Debug module configuration context.
INT32 m2mb_dbg_is_init(VOID)
m2mb_dbg_is_init is called to check if dbg module is initialized.
INT32 m2mb_dbg_consol_print(char *format,...)
m2mb_dbg_consol_print is called to print to the console.
M2MB_UART_PORT_ID_E
UART Port Identifier enumeration.
Definition: m2mb_uart.h:129
UINT8 enableCI
Definition: m2mb_dbg.h:220