
/**
@file shell_char.h
@brief Data type definition, macro definition and declaration processing.
*/
//#include "AppLog_Print.h"
/********************************************************************************************
Multi-Inlcude-Prevent Section
********************************************************************************************/


/********************************************************************************************
Multi-Inlcude-Prevent Section
********************************************************************************************/
#ifndef _SHELL_CHAR_H_
#define _SHELL_CHAR_H_


/********************************************************************************************
Include File Section
********************************************************************************************/

#include "printf.h"
#include "log.h"
/********************************************************************************************
Macro Definition Section
********************************************************************************************/
/*buffer config*/
#define SHELL_RECV_SIZE                 (256)
#define SHELL_MAX_ARGC                  (10)
#define SHELL_MAX_ARGV_LEN              (SHELL_BUFFER_LENGTH)  //The maximum length of the command
#define SHELL_MAX_CMD                   (5)
#define SAF_TRUE		1u
#define SAF_FALSE	0u

/*solve the compile problem by wang jian_e*/
/* ----------------------------[public typedef]-----------------------------*/
/********************************************************************************************
Structure Type Declaration Section
********************************************************************************************/
typedef struct shell_buf
{
    uint8_t DataBuf[SHELL_RECV_SIZE];
    uint16_t buf_pt;
} SHELL_BUF;

typedef struct
{
	SHELL_BUF cmdbuf[SHELL_MAX_CMD];
	uint8_t cmdnum;
	uint8_t cmdindex;
	uint8_t curcmdlength;
}ShellCmdRecord_t;
typedef struct shell_msg
{
    uint32_t argc;
    uint8_t argv[SHELL_MAX_ARGC][SHELL_MAX_ARGV_LEN];
} SHELL_MSG_GROUP;

typedef enum
{
	CTRL_INIT = 0,
	CTRL_C,
	CTRL_D,
	CTRL_Z,
} CTRL_CMD;
/********************************************************************************************
Prototype Declaration Section                                   
********************************************************************************************/
void vShellKeyDown(void);
void vShellKeyUp(void);
uint8_t ucShellCharIntProc(uint8_t c);
SHELL_MSG_GROUP * pxShellGetMsgGroup(void);
void vShellWriteRootHead(void);
void vShellWriteUserHead(void);
boolean xShellPasswdCheck(const uint8_t *passwd);
void vShellClearMsgBuf(void);
void Usart_SendStr(uint8_t *str, uint32_t size);
void Usart_StartRecv(void);
CTRL_CMD xShellCtrlGet(void);
void vShellCtrlSet(CTRL_CMD cmd);
void vShellCtrlProcess(uint8_t recv);
int32_t Shell_PrintkCritical(const uint8_t *format, ...);
int32_t RpcLogSwitch_Shell_Printk(uint8_t logLevel, const uint8_t *format, ...);
//extern void Shell_Uart_Password_Check(void);
extern volatile int32_t flgLog_D;

#define _DEBUG_SWCSEATHEAT_                 0
#define _DEBUG_SWCVFMSIC_                   0
#define _DEBUG_SWCDRIVEMODE_                0
#define _DEBUG_SWCWPC_                      0
#define _DEBUG_SWCACTIVESAFETY_             0
#define _DEBUG_SWCSEATCTRL_                 0
#define _DEBUG_SYSTEMSETTING_               0
#define _DEBUG_SWCVFC_                      0
#define _DEBUG_SWCVFHUD_                    0
#define _DEBUG_SWCCARCC_                    0

#define UART_PASSWORD_FF	0xFFFFFFFFFFFFFFFF
#define UART_PASSWORD_00	0x0000000000000000
extern uint64_t g_xUartPasswordFlash;

#define UART_WRITE_STR(str)           Shell_Printk("%s",str)
#define printk					Shell_Printk

char *my_strtok ( char *str, const char *delimiters );

#endif
