109 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			109 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/****************************************************************************
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
							 | 
						||
| 
								 | 
							
								be copied by any method or incorporated into another program without
							 | 
						||
| 
								 | 
							
								the express written consent of Aerospace C.Power. This Information or any portion
							 | 
						||
| 
								 | 
							
								thereof remains the property of Aerospace C.Power. The Information contained herein
							 | 
						||
| 
								 | 
							
								is believed to be accurate and Aerospace C.Power assumes no responsibility or
							 | 
						||
| 
								 | 
							
								liability for its use in any way and conveys no license or title under
							 | 
						||
| 
								 | 
							
								any patent or copyright and makes no representation or warranty that this
							 | 
						||
| 
								 | 
							
								Information is free from patent or copyright infringement.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								****************************************************************************/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifndef IOT_CLI_DBG_LOG_H
							 | 
						||
| 
								 | 
							
								#define IOT_CLI_DBG_LOG_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "iot_utils_api.h"
							 | 
						||
| 
								 | 
							
								#include "iot_dbglog_def.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(push)  /* save the pack status */
							 | 
						||
| 
								 | 
							
								#pragma pack(1)     /* 1 byte align */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//#define DBGLOG_MODULE_GROUP_NAME_LEN (20)
							 | 
						||
| 
								 | 
							
								#define CLI_LOG_TIMER_PERIOD         (1000 * 60 * 10)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_dbglog_mod_info
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint16_t module_id;     /* module id */
							 | 
						||
| 
								 | 
							
								    uint8_t level;          /* log level */
							 | 
						||
| 
								 | 
							
								} cli_host_dbglog_mod_info;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_set_dbglog_level
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint8_t general_level;
							 | 
						||
| 
								 | 
							
								    uint8_t group_cnt;
							 | 
						||
| 
								 | 
							
								    cli_host_dbglog_mod_info module_level[MODULE_GROUP_NUM];
							 | 
						||
| 
								 | 
							
								} cli_host_set_dbglog_level;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_set_dbglog_level_ack
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint8_t result;
							 | 
						||
| 
								 | 
							
								} cli_host_set_dbglog_level_ack;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_get_dbglog_module_level
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint8_t group_cnt;
							 | 
						||
| 
								 | 
							
								    uint8_t module_level[MODULE_GROUP_NUM];
							 | 
						||
| 
								 | 
							
								} cli_host_get_dbglog_module_level;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_dbglog_module
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint16_t module_id;     /* module id */
							 | 
						||
| 
								 | 
							
								    uint8_t level;          /* log level */
							 | 
						||
| 
								 | 
							
								    uint8_t group_name[DBGLOG_MODULE_GROUP_NAME_LEN];
							 | 
						||
| 
								 | 
							
								} cli_host_dbglog_module;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_dbglog_level
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint8_t level;
							 | 
						||
| 
								 | 
							
								    uint8_t max_level;
							 | 
						||
| 
								 | 
							
								    uint8_t group_cnt;
							 | 
						||
| 
								 | 
							
								    cli_host_dbglog_module module[MODULE_GROUP_NUM];
							 | 
						||
| 
								 | 
							
								} cli_host_dbglog_level;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_enable_dbglog
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint8_t enabled;
							 | 
						||
| 
								 | 
							
								} cli_host_enable_dbglog;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _cli_host_enable_dbglog_ack
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    uint8_t result;
							 | 
						||
| 
								 | 
							
								} cli_host_enable_dbglog_ack;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void cli_config_dbglog_level(
							 | 
						||
| 
								 | 
							
								    uint8_t *buffer, uint32_t bufferlen, uint8_t *src_mac);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void cli_get_dbglog_level(
							 | 
						||
| 
								 | 
							
								    uint8_t *buffer, uint32_t bufferlen, uint8_t *src_mac);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void cli_start_stop_dbglog_live_capture(
							 | 
						||
| 
								 | 
							
								    uint8_t *buffer, uint32_t bufferlen, uint8_t *src_mac);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void cli_send_live_log_to_plc(
							 | 
						||
| 
								 | 
							
								    uint8_t *buffer, uint32_t bufferlen);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void iot_cli_dbg_log_init();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void iot_cli_handle_timer_log();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void cli_send_dbglog(
							 | 
						||
| 
								 | 
							
								    void* buffer, uint8_t crash_log, uint32_t buffer_len);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(pop)   /* restore the pack status */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 |