#ifndef _DOWN_PANEL_H
#define _DOWN_PANEL_H
#include "LcdComm.h"
#include "equ.h"

#define	DOWN_CMD_START_DOWN		0x01
#define	DOWN_CMD_ERASE_FLASH		0x02
#define	DOWN_CMD_WRITE_DATA	  		0x03
#define	DOWN_CMD_READ_DATA	    		0x04
#define	DOWN_CMD_RUN_PROG			0x05

#define  DOWN_CMD_OK		1
#define  DOWN_CMD_ERR		0

#define DOWN_FRAME_LEN_MAX				200 
 

#define  DOWN_CMD_DOWN_PROG			0x0F 
 

struct down_program_comm
{
	u8 status;
	u8 comm;
	s8 *file_name;
	u32 num;		//程序长度
	u16 crc16;		//程序校验
	u8 *probuf;		//程序内容	
	u16 frameno;		//当前帧号
	u16 framenum;	//程序总帧数
	struct timespec update_time;

	u32 bit_prog;
	u32 bit_echo;
  	u32 us_recv;

};

 
int init_down_program(s32 index);

int is_down_program(void);
int down_program_recv_timeout(void);
int down_program_recv(u8 *buf);
int down_program_send (void);
int down_program_exit(void);
void down_program_task(void);

#endif


