#ifndef _ospshelllxh
#define _ospshelllxh


#ifdef __cplusplus
extern "C" {
#endif

#include <termios.h>
#include <ctype.h>

#include "ospTypes.h"
#include "ospSwQueue.h"


#define UCP4008_OSP_SHELL_REG      0x16

#define SPU_SHELL_MSG_DADA_LEN(x)     (x->u16DataLen - OSP_SW_MSG_INFO_SIZE)
#define SPU_SHELL_MSG_HEAD_TO_COMM(x)     (char *)((uint64_t)x + OSP_SW_MSG_INFO_SIZE)
#define SPU_SHELL_DADA_LEN(x)         (x->u16DataLen)

typedef struct tag_Osp_Ape_Msg_Head
{
    uint32_t msg_size;      /* 消息长度（单位：字节） */
    uint8_t  msg_type;      /* 消息类型 */
    uint8_t  msg_padding[3];/* 保留字段 */

    uint8_t  src_core_id;   /* 源核ID */
    uint8_t  dst_core_id;   /* 目的核ID */
    uint8_t  src_task_id;   /* 源任务ID */
    uint8_t  dst_task_id;   /* 目的任务ID */

    uint8_t  data[0];
}Osp_Ape_Msg_Head;

typedef struct tag_Osp_Server_Head
{
	uint8_t ip[16];
	uint8_t path[128];
    uint32_t ulport;
}Osp_Server_Head;

typedef struct tag_Osp_Ape_Send_Count
{
	uint32_t ulsendcount;
    uint32_t irq_no;
    uint32_t irq_num;
    uint32_t irq_handle_count;
}Osp_Ape_Send_Count;

typedef struct tagOspCmdRtn 
{
    char cmd[64];
    OSP_FUNCPTR wrapper;
    OSP_FUNCPTR routine;
    char descption[128];
    uint32_t argnum;
}OSP_CMD_RTN;

typedef struct tagOspCmdExt 
{
    char cmd[32];
 //   char desc[32];
    uint32_t argnum;    
    uint32_t num;
}OSP_CMD_EXT;

extern int32_t osp_shell_main();
extern int32_t osp_execcmd(void);
extern int32_t osp_getcmdarg(char *cmd);
extern void osp_set_prompt();
extern int32_t osp_insert_cmd(char *name, OSP_FUNCPTR pfunc);
extern int32_t osp_insert_cmd_ext(char *name, OSP_FUNCPTR pfunc, char *desc, int32_t argnum);
int32_t osp_shell_init(void);
bool osp_is_ape_cmd(char *pCmd);
void osp_get_ape_id(uint8_t ucApeid);
void osp_ape_msg_send(char *pCmd);
void osp_show_ape_taskinfo(void);
uint32_t rev_shell_log_data(uint32_t port_id,uint32_t queue_num,uint32_t el_ind,const char* buf,uint32_t remainedLength,uint32_t* handledLength);
uint32_t osp_ape_shell_wrapper(char **arg, uint32_t len, OSP_FUNCPTR func);
void osp_ape_set_log_level(uint8_t ucLevel);
void osp_show_print_level(void);
void osp_set_print_level(uint8_t ucLevel);
void osp_cmd_register(OSP_CMD_EXT *pCmdExt);
void osp_cmd_insert_proc(osp_sw_msg_info_t *pMsg);
void osp_reget_ape_cmd(void);
int32_t osp_shell_str_wrapper(char **arg, int32_t len, OSP_FUNCPTR func);
int32_t osp_shell_wrapper(char **arg, int32_t len, OSP_FUNCPTR func);
int32_t osp_shell_mem_wrapper(char **arg, int32_t len, OSP_FUNCPTR func);
void osp_ape_shell_out(Osp_Ape_Msg_Head *pMsg);
extern int32_t osp_display_phy_mem(uint64_t phy_addr, uint32_t len);
void osp_show_queue_ul_info(void);
void osp_show_queue_dl_info(void);
uint64_t osp_shell_task(void);
int8_t osp_server_cfg(uint8_t *ip, uint32_t ulport);
void osp_server_cfg_show();
void osp_log_path_cfg(char *path);
void osp_server_get();
void osp_set_platform_log_echo(uint8_t ucIsEcho);
void osp_set_ape_log_mode(uint8_t ucIsEcho);
void osp_set_platform_log_mode(uint8_t ucIsEcho);
void osp_set_arm_log_mode(uint8_t ucIsNet);
void osp_ape_csu_stop_cfg(uint8_t ucstop, uint8_t ucadvance);
void osp_ape_csu_int_cnt();
/*void osp_get_tfu_location_info(void);
void osp_get_clock_tracking_state(void);
void osp_reset_clock_module(void);
void osp_set_clk_mode(clk_flag_e pseudo_flag);*/
void osp_show_swqueue_info();
void osp_show_info_by_coreid(osp_sw_msg_info_t *pMsg);
void osp_set_oam(uint8_t ucOam);


#ifdef __cplusplus
}
#endif

#endif   /*_ospshellh */

