Down.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef _DOWN_H
  2. #define _DOWN_H
  3. #include "equ.h"
  4. #define SPI_BOOT_ADDR 0x300000 // SPI flash中boot程序的起始地址
  5. #define DOWN_COMMNO 0
  6. #define DOWN_COMMBAUD 57600
  7. #define ErsFSH 0xc0//擦除flash
  8. #define WrtDt 0xc1//write date
  9. #define RdDt 0xc2 //read date
  10. #define NAKCODE 0xc3
  11. #define RunPrg 0xc4 //run program
  12. #define ReadInf 0xd0
  13. #define StartDOWN 0xd1
  14. #define WAVEINF 0xd4 // 录波信息
  15. #define EupInf 0x00 //设备信息
  16. #define SUMERR 0xe3
  17. #define CMDINVALID 0xe0
  18. #define NAKLTH 0x04
  19. #define OK 0x00
  20. #define UNOK 0x01//未执行/操作被拒绝
  21. #define OPFail 0x03//操作失败
  22. #define VIRLCD_E0 0xE0
  23. #define VIRLCD_E1 0xE1
  24. #define VIRLCD_E2 0xE2
  25. #define VIRLCD_F0 0xF0
  26. #define VIRLCD_F1 0xF1
  27. #define VIRLCD_C3 0xC3
  28. #define UART_FRAME_LEN 256
  29. //extern BYTE g_arrLcdByte[] ;//虚拟LCD液晶屏内容.128*64可打印16*4=64个字节,最多需要64*3的空间存放。显示1byte占3单元,每个单元包含{x地址与反显,y地址,byte字符}
  30. typedef struct DOWN_PARA
  31. {
  32. WORD wMode; // 下载方式;串口、以太网、CAN等。
  33. WORD wBaud; // 波特率
  34. BYTE byNo; // 串口编号
  35. BYTE byParity;
  36. BYTE byIP[12]; // IP Gate Mask
  37. char resver[14];
  38. }DOWN_PARA;
  39. struct program_head
  40. {
  41. u16 can_bus;
  42. };
  43. struct program_comm
  44. {
  45. u8 status;
  46. u8 comm;
  47. struct program_head head[EQU_SLOT_NUM_MAX];
  48. u8 slot; //板卡
  49. s8 *file_name;
  50. u32 num; //程序长度
  51. u16 crc16; //程序校验
  52. u8 *probuf; //程序内容
  53. u16 frameno; //当前帧号
  54. u16 framenum; //程序总帧数
  55. struct timespec update_time;
  56. u32 bit_prog;
  57. u32 bit_echo;
  58. u32 us_recv;
  59. };
  60. //虚拟LCD液晶屏内容.128*64可打印16*4=64个字节,最多需要64*3的空间存放。显示1byte占3单元,每个单元包含{x地址与反显,y地址,byte字符}
  61. void DebugRecv(BYTE cRcvData) ;
  62. void DebugTask(void);
  63. void GetDownPara(DOWN_PARA *pt);
  64. void print_mem_net(char *addr,unsigned char *pd,int lenth);
  65. int init_file_program(u8 slot, s32 index);
  66. extern int prog_recv_timeout(void);
  67. extern int prog_recv(u8 *buf);
  68. extern int prog_send (void);
  69. int down_exit(void);
  70. #ifdef METERING_ENERGY
  71. u8 is_prog_down(void);
  72. #endif
  73. #endif