You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
4.0 KiB
182 lines
4.0 KiB
#ifndef _APP_COMMON_H
|
|
#define _APP_COMMON_H
|
|
|
|
#include "../clib/type.h"
|
|
#include "../tpc/tpc_uart.h"
|
|
#include "../tpc/tpc_modbus.h"
|
|
#include "../tpc/tpc_ccmodbus.h"
|
|
|
|
#define D_CAR_HOSPITAL_NO 0x0000
|
|
|
|
#define APP_VERSION_HEX 0x30 //高4位主版本,低4位次版本
|
|
|
|
// #define BOARD_MAIN03_A9
|
|
// #define BOARD_MAIN04_GM35
|
|
#define BOARD_MAIN04_GM35_M42
|
|
|
|
#ifdef BOARD_MAIN03_A9
|
|
#define APP_VERSION "MA10_A9_v2.0.6"
|
|
|
|
#elif defined BOARD_MAIN04_GM35
|
|
#define APP_VERSION "MA10_GM35_v2.0.6"
|
|
|
|
#elif defined BOARD_MAIN04_GM35_M42
|
|
#define APP_VERSION "MA10_GM35_v3.0.2"
|
|
|
|
#else
|
|
#define APP_VERSION "MA10_X_v2.0.6"
|
|
#endif
|
|
|
|
#define PAPER_BOX_NUM 3
|
|
#define RELAY_NUM 8
|
|
|
|
enum RunMode
|
|
{
|
|
MODE_RUN = 0x00,
|
|
MODE_DEBUG_COMMON = 0x01,
|
|
MODE_DEBUG_IR = 0x02,
|
|
MODE_DEBUG_GM35 = 0x03,
|
|
MODE_PAPER_CALIB = 0x04,
|
|
};
|
|
|
|
enum CCMODBUS_ADDR
|
|
{
|
|
ADDR_UPPER = 0x10,
|
|
ADDR_SERVER = 0x11,
|
|
ADDR_Maintenance = 0x12,
|
|
};
|
|
|
|
enum CCMODBUS_OPER
|
|
{
|
|
OPER_RELAY = 0x95,
|
|
OPER_REPORT = 0x93,
|
|
OPER_ISP = 0x80,
|
|
|
|
OPER_CALIB_MODE = 0x50,
|
|
OPER_CALIB = 0x51,
|
|
OPER_CALIB_READ = 0x52,
|
|
OPER_PAPER_COUNT = 0x53,
|
|
OPER_SET_485_ID = 0x54,
|
|
OPER_CALIB_LEAVE = 0x5a,
|
|
|
|
OPER_GPRS_HEART = 0x00,
|
|
// OPER_GPRS_ACK = 0x95,
|
|
OPER_GPRS_REPORT = 0x97,
|
|
|
|
OPER_SET_DEBUG = 0x01,
|
|
};
|
|
|
|
enum TS_485_OPER
|
|
{
|
|
OPER_ANGLE_DAT = 0x90,
|
|
OPER_ANGLE_SET_ID = 0x91,
|
|
};
|
|
|
|
#define MASTER_ID 0x00
|
|
#define SLAVER_ID_MIN 0x01
|
|
#define SLAVER_ID_MAX 0x03
|
|
#define SLAVER_ID_N 0xee
|
|
|
|
typedef struct boardstatus
|
|
{
|
|
U8 a9Status;
|
|
U8 a9RecvDataInterval;
|
|
U8 wdtStatus;
|
|
}TS_BoardStatus;
|
|
|
|
typedef struct printer_paper_calib
|
|
{
|
|
U16 num0; //x0
|
|
U16 angle0; //y0
|
|
U16 num1; //x1
|
|
U16 angle1; //y1
|
|
}TS_PaperCalib;
|
|
|
|
/**
|
|
* Register Memory Map
|
|
*/
|
|
#define SLAVER_RFID 0x00 //RFID发送过来的数据
|
|
#define SLAVER_COM0 0x01 //COM0发送过来的数据
|
|
|
|
#define SLAVER_DW20_ID 0x11
|
|
#define SLAVER_ASGA03_ID 0x12 //称重内部倾角传感
|
|
#define SLAVER_SHOW01_ID 0x13
|
|
#define SLAVER_TCP_SERVER_ID 0x14
|
|
#define SLAVER_ASGA03_UPDOWN_ID 0x15 //升降位置倾角传感
|
|
|
|
#define MD_SLAVER_INFO_MAX 6
|
|
#define CCMD_SLAVER_INFO_MAX 4
|
|
|
|
//需要持久化的参数,不能超过72字节,否则会导致eeprom溢出
|
|
typedef struct global_param_changable
|
|
{
|
|
U16 slaverId; //从设备ID
|
|
U16 wisdom_car_no; //平车编号
|
|
U16 thrombolytic_ratio; //溶栓重量比 x 10
|
|
U16 bolus_ratio; //团注计量比 x 100
|
|
U16 hold_ratio; //维持计量比 x 100
|
|
U16 reserved1[16-5]; //保留
|
|
}GlobalNeedPersistParam;
|
|
|
|
typedef struct cc_asga_info
|
|
{
|
|
U16 xaxis;
|
|
U16 yaxis;
|
|
U16 zaxis;
|
|
}CCAsGaInfo;
|
|
|
|
typedef struct printer_maintenance_global
|
|
{
|
|
GlobalNeedPersistParam p;
|
|
|
|
S32 jing_weight;
|
|
U16 thrombolytic_val;
|
|
U16 bolus_val;
|
|
U16 hold_val;
|
|
CCAsGaInfo asga;
|
|
U8 rfid[6];
|
|
S32 weight[4];
|
|
//U16 reserved2[16 - 9];
|
|
|
|
MD_SLAVER_INFO md_slaver_info[MD_SLAVER_INFO_MAX];
|
|
CCMD_SLAVER_INFO ccmd_slaver_info[CCMD_SLAVER_INFO_MAX];
|
|
|
|
vU32 modbusstmp;
|
|
U16 authed;
|
|
U16 flowStarted;
|
|
U16 flowStartVal;
|
|
|
|
U8 ccid[21]; //保存ccid卡号空间 20+'\0'
|
|
U8 ccid_passwd[22]; //保存ccid密码空间 21+'\0'
|
|
TS_BoardStatus boardstatus;
|
|
U8 _keyled;
|
|
U16 _key;
|
|
S32 pi_weight;
|
|
S32 total_weight;
|
|
|
|
CCAsGaInfo asga_02;
|
|
U8 reset;
|
|
U8 debug;
|
|
U32 rfidval;
|
|
U16 rfidHospitalNo;
|
|
}PMGlobal;
|
|
|
|
//寄存器内存基地址
|
|
#define REG_MEM_BASE ((U16*)(&G)) //寄存器基础地址(本文件外部不应该使用该宏定义)
|
|
//变量地址转寄存器
|
|
#define MEM_2_REG(mem) (((U16*)(mem) - REG_MEM_BASE))
|
|
//寄存器转变量地址
|
|
#define REG_2_MEM(reg) (REG_MEM_BASE + (U16)((reg))) //寄存及从0地址开始
|
|
|
|
|
|
extern struct printer_maintenance_global G;
|
|
extern void L2_register_init(void);
|
|
extern void L3_protocol_handler_uart4_fun(U8 *pPara);
|
|
extern void L3_protocol_handler_uart0_fun(TS_PH3_ccmodbus *ccmodbus);
|
|
extern void L2_do_board_reset(void);
|
|
extern void L2_do_gm35_reset(void);
|
|
extern U32 rfid_key_map_out(U32 rfid);
|
|
extern U32 key_rfid_map_out(U32 key);
|
|
|
|
#endif
|
|
|
|
|