#ifndef UART_LP_TEST_DRV_H_
#define UART_LP_TEST_DRV_H_

#define TEST_UART_HEAD 	0xD7
#define TEST_UART_END 	0xEE

#define TEST_UART 	0

typedef union{
	unsigned char D8[64];
	unsigned int D32[16];
	struct{
		unsigned char Head;
		unsigned char Cmd;
		unsigned char count;
		unsigned char Len;
		union{
			unsigned char Data8[60];
			unsigned int Data32[15];
			struct{
				unsigned char loopCount;
				unsigned char busPanelCount;
				unsigned char dirPanelCount;
				unsigned char areaCount;
				char desc[32];
				unsigned char rsv[24];
			}CmdCtl;
			struct{
				unsigned char id;
				unsigned char devId;//dev for device
				unsigned char devType;
				unsigned char assignType;
				unsigned char devProperty;
				unsigned char areaId;
				unsigned short delayTime;
				unsigned int devNum;
				char desc[32];
				unsigned char rsv[16];
			}CmdLoop;
			struct{
				unsigned char id;
				unsigned char keyId;
				unsigned short rsv;
				union{
					unsigned char d8[4];
					unsigned int d32;
					struct{
						unsigned char val;
						unsigned char loopId;
						unsigned char startAddr;
						unsigned char endAddr;
					}methodAddr;
					struct{
						unsigned char val;
						unsigned char loopId;
						unsigned char devType;
						unsigned char rsv;
					}methodType;
					struct{
						unsigned char val;
						unsigned char loopId;
						unsigned char areaId;
						unsigned char rsv;
					}methodArea;
				}prm;
				unsigned int Num;
				char desc[32];
				unsigned char rsv2[16];
			}CmdBus;
			struct{
				unsigned char Id;
				unsigned char keyId;
				unsigned char outProp;
				unsigned char ctlDevType;
				unsigned char errDetFlag;
				unsigned char areaId;
				unsigned short rsv;
				unsigned int Num;
				char desc[32];
				unsigned char rsv2[16];
			}CmdDir;
			struct{
				unsigned char id;
				unsigned char rsv;
				unsigned short rsv2;
				unsigned int Num;
				char desc[32];
				unsigned char rsv3[20];
			}CmdArea;
		}Frm;
	}Cfg;
}TConfigUartData;

extern unsigned int deviceCfgCount;
extern unsigned int BusPanelKeyCfgCount;
extern unsigned int DirPanelKeyCfgCount;
extern unsigned int AreaCfgCount;

extern unsigned int test_tx_is_busy(void);
extern void set_test_tx_data(unsigned char * pdata, unsigned int len);

extern void test_rx_timeout_tick(void);
extern void test_rx_irq(void);
extern void uart_test_task(void);

extern void gbk_nor_load_to_sdram(void);

#endif
