#ifndef __log_manager_task__
#define __log_manager_task__

//#include "main.h"
#include "Std_Types.h"
#include "log.h"
#define LOG_BUF_OFFSET	0x9E6A0000
/* define by log collector design */
#define LOG_BLK_SIZE		0x40000
#define LOG_STATUS_SIZE		0x40
#define LOG_BUFFER_SIZE		(LOG_BLK_SIZE - LOG_STATUS_SIZE)
#define LOG_S			LOGLEVEL_SILENT
#define LOG_F			LOGLEVEL_FATAL
#define LOG_E			LOGLEVEL_ERROR
#define LOG_W			LOGLEVEL_WARNING
#define LOG_I			LOGLEVEL_INFO
#define LOG_D			LOGLEVEL_DEBUG
#define LOG_V			LOGLEVEL_VERBOSE

#define LOGLEVEL_SILENT		0
#define LOGLEVEL_FATAL		1
#define LOGLEVEL_ERROR		2
#define LOGLEVEL_WARNING	3
#define LOGLEVEL_INFO		4
#define LOGLEVEL_DEBUG		5
#define LOGLEVEL_VERBOSE	6
#define MAX_BLCOK_NUM                    (50u) 
/********************************************************************************************
Structure Type Declaration Section
********************************************************************************************/
struct timeval_fix {
	uint64_t	tv_sec;		/* seconds */
	uint64_t	tv_usec;	/* microseconds */
};

struct log_buffer_block {
	struct timeval_fix	log_time; /* 1970 timestamp */
	uint64_t		log_timestamp;
	uint64_t		pos_read;
	uint64_t		pos_write;
	uint64_t		boot_ready;
	uint64_t		reserve[2]; /* manually: 0x40/8 - 4 */
	uint8_t			addr_buf[LOG_BUFFER_SIZE];
};

/**
 * @brief log to memory init.
*/
/**
@brief Check the requested storage buffer
@param void
@param void
@return void
*/
 extern Log_Cfg_t *g_pxLogCfg;
 extern uint8_t g_ucLogNum;

void vBufferSizeCheck(void);
extern void log_manager_task(void *pvParameters);
#endif