|
|
@@ -25,6 +25,8 @@
|
|
|
#include <linux/kmod.h>
|
|
|
#endif
|
|
|
|
|
|
+#define FIXED_ARGS_NUM 7
|
|
|
+
|
|
|
#define MAX_3(x,y,z) (x>y?(x>z?x:z):(y>z?y:z))
|
|
|
#define MIN_3(x,y,z) (((x>y?y:x)>z)?z:(x>y?y:x))
|
|
|
|
|
|
@@ -1665,32 +1667,39 @@ const int RMT_SET_TABLE_NUMBER = sizeof( tRmtsettable ) / sizeof(tRmtsettable[0
|
|
|
|
|
|
const TFIXEDSETTABLE tfixedsettable[]= //
|
|
|
{
|
|
|
-#ifdef defined GD_AREA_ZHONGSHAN || defined GD_AREA_ZHONGSHAN_2020
|
|
|
- {FIXED_SET_EQU, 0x8001, STR_R, "D30", "终端类型",},
|
|
|
- {FIXED_SET_SYS, 0x8002, STR_R, "Linux 2.6.29.1", "操作系统",},
|
|
|
- {FIXED_SET_MAU, 0x5077, STR_R, "", " 制造商",},
|
|
|
- {FIXED_SET_HVR, 0x5079, STR_R, "HV01.02", "硬件版本",},
|
|
|
- {FIXED_SET_SVR, 0x507A, STR_R, "", "软件版本",},
|
|
|
- {FIXED_SET_CRC, 0x8006, USHORT_R,"", "软件校验",},
|
|
|
- {FIXED_SET_COM, 0x507B, STR_R, "101-2016,104-2016", "通信规约",},
|
|
|
- {FIXED_SET_TPE, 0x5078, STR_R, "DFTU-8000", "出厂型号",},
|
|
|
- {FIXED_SET_ID, 0x5076, STR_R, "", "终端ID号",},
|
|
|
-#else
|
|
|
+#if !defined CPU_FUXI
|
|
|
{FIXED_SET_EQU, 0x8001, STR_R, "D30", "终端类型",},
|
|
|
- {FIXED_SET_SYS, 0x8002, STR_R, "Linux 2.6.29.1", "操作系统",},
|
|
|
+ {FIXED_SET_SYS, 0x8002, STR_R, "Linux 5.10.214", "操作系统",},
|
|
|
{FIXED_SET_MAU, 0x8003, STR_R, "", " 制造商",},
|
|
|
{FIXED_SET_HVR, 0x8004, STR_R, "HV01.02", "硬件版本",},
|
|
|
{FIXED_SET_SVR, 0x8005, STR_R, "", "软件版本",},
|
|
|
{FIXED_SET_CRC, 0x8006, USHORT_R,"", "软件校验",},
|
|
|
{FIXED_SET_COM, 0x8007, STR_R, "101-2016,104-2016", "通信规约",},
|
|
|
- {FIXED_SET_TPE, 0x8008, STR_R, "DFTU-8000", "出厂型号",},
|
|
|
+ {FIXED_SET_TPE, 0x8008, STR_R, "CSP-6000", "出厂型号",},
|
|
|
{FIXED_SET_ID, 0x8009, STR_R, "", "终端ID号",},
|
|
|
-#endif
|
|
|
{FIXED_SET_MAC1, 0x800A, STR_R, "", "网卡1MAC",},
|
|
|
{FIXED_SET_MAC2, 0x800B, STR_R, "", "网卡2MAC",},
|
|
|
{FIXED_SET_PTRATE, 0x800C, STR_R, "100", "PT变比",},
|
|
|
{FIXED_SET_CTRATE, 0x800D, STR_R, "120", "CT变比",},
|
|
|
- {FIXED_SET_CPT, 0x800E, STR_R, "", "编译时间",},
|
|
|
+#else
|
|
|
+ {FIXED_SET_ID, 0x8001, STR_R, "", "终端ID",},
|
|
|
+ {FIXED_SET_MAU, 0x8002, STR_R, "", "终端厂商",},
|
|
|
+ {FIXED_SET_TPE, 0x8003, STR_R, "", "终端型号",},
|
|
|
+ {FIXED_SET_HVR, 0x8004, STR_R, "HV01.00", "终端硬件版本",},
|
|
|
+ {FIXED_SET_SVR, 0x8005, STR_R, "SV01.00", "终端软件版本",},
|
|
|
+ {FIXED_SET_COM, 0x8006, UINT_R, "104", "规约参数",},
|
|
|
+ {FIXED_SET_EQU_ADDR, 0x8007, UINT_R, "1", "终端逻辑地址",},
|
|
|
+ {FIXED_SET_YC_DEAD_ZONE, 0x8008, FLOAT_R, "2", "遥测死区",},
|
|
|
+ {FIXED_SET_DI_AS_TIME, 0x8009, FLOAT_R, "20", "开入量采集防抖时间",},
|
|
|
+ {FIXED_SET_BAAC, 0x800a, FLOAT_R, "2", "蓄电池自动活化周期",},
|
|
|
+ {FIXED_SET_IP_M1, 0x800b, STR_R, "", "主站侧IP1地址",},
|
|
|
+ {FIXED_SET_IP_M2, 0x800c, STR_R, "", "主站侧IP2地址",},
|
|
|
+ {FIXED_SET_IP_M3, 0x800d, STR_R, "", "主站侧IP3地址",},
|
|
|
+ {FIXED_SET_IP_M4, 0x800e, STR_R, "", "主站侧IP4地址",},
|
|
|
+ {FIXED_SET_CRC, 0x800f, STR_R, "", "软件校验",},
|
|
|
+ {FIXED_SET_MAN, 0x8010, STR_R, "", "终端名称",},
|
|
|
+ {FIXED_SET_CPT, 0x8011, STR_R, "", "编译时间",},
|
|
|
+#endif
|
|
|
};
|
|
|
|
|
|
const int FIXEDSET_TABLE_NUMBER = sizeof( tfixedsettable ) / sizeof(tfixedsettable[0]);
|
|
|
@@ -1738,88 +1747,104 @@ const int REMOTE_NUM = (sizeof(g_three_remote_func)/sizeof(g_three_remote_func[0
|
|
|
// 得到一个固定参数的值
|
|
|
int set_get_fixed_arg(int index,char *buf,int len)
|
|
|
{
|
|
|
- RMT_FIXED_TABLE tfixedset;
|
|
|
- int i;
|
|
|
-
|
|
|
- iec_init_fixedset(&g_t104[0],&tfixedset,true); // 获取固定定值
|
|
|
-
|
|
|
- // 检查参数
|
|
|
- if(index < 0 || index >=RMT_FIXED_SET_NUM) //FIXEDSET_TABLE_NUMBER)
|
|
|
- {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- if(buf==NULL || len < 32)
|
|
|
- {
|
|
|
- return -2;
|
|
|
- }
|
|
|
+ RMT_FIXED_TABLE tfixedset;
|
|
|
+ int i;
|
|
|
|
|
|
- memset(buf,0,len);
|
|
|
+ iec_init_fixedset(&g_t104[0], &tfixedset, true); // 获取固定定值
|
|
|
|
|
|
- len--;
|
|
|
- for(i=0;i<RMT_FIXED_SET_NUM;i++)
|
|
|
- {
|
|
|
- if(index == tfixedset.set[i].type)
|
|
|
- {
|
|
|
- switch(index)
|
|
|
- {
|
|
|
- case FIXED_SET_CRC: // 软件校验。
|
|
|
- sprintf(buf,"%04x",(tfixedset.set[i].str[0]+(tfixedset.set[i].str[1]<<8)));
|
|
|
- break;
|
|
|
- case FIXED_SET_MAC1:
|
|
|
- case FIXED_SET_MAC2:
|
|
|
- sprintf(buf,"%02x-%02x-%02x-%02x-%02x-%02x",tfixedset.set[i].str[0],tfixedset.set[i].str[1],tfixedset.set[i].str[2],tfixedset.set[i].str[3],tfixedset.set[i].str[4],tfixedset.set[i].str[5]);
|
|
|
- break;
|
|
|
- default:
|
|
|
- strncpy(buf,tfixedset.set[i].str,len);
|
|
|
- break;
|
|
|
- }
|
|
|
+ // 检查参数
|
|
|
+ if (index < 0 || index >= FIXEDSET_TABLE_NUMBER) // FIXEDSET_TABLE_NUMBER)
|
|
|
+ {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (buf == NULL || len < 32)
|
|
|
+ {
|
|
|
+ return -2;
|
|
|
+ }
|
|
|
|
|
|
- return 0;
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ memset(buf, 0, len);
|
|
|
|
|
|
+ len--;
|
|
|
+#if !defined CPU_FUXI
|
|
|
+ for (i = 0; i < RMT_FIXED_SET_NUM; i++)
|
|
|
+ {
|
|
|
+ if (index == tfixedset.set[i].type)
|
|
|
+ {
|
|
|
+ switch (index)
|
|
|
+ {
|
|
|
+ case FIXED_SET_CRC: // 软件校验。
|
|
|
+ sprintf(buf, "%04x", (tfixedset.set[i].str[0] + (tfixedset.set[i].str[1] << 8)));
|
|
|
+ break;
|
|
|
|
|
|
- return -3;
|
|
|
+#if !defined CPU_FUXI
|
|
|
+ case FIXED_SET_MAC1:
|
|
|
+ case FIXED_SET_MAC2:
|
|
|
+ sprintf(buf, "%02x-%02x-%02x-%02x-%02x-%02x", tfixedset.set[i].str[0], tfixedset.set[i].str[1], tfixedset.set[i].str[2], tfixedset.set[i].str[3], tfixedset.set[i].str[4], tfixedset.set[i].str[5]);
|
|
|
+ break;
|
|
|
+#endif
|
|
|
+
|
|
|
+ default:
|
|
|
+ strncpy(buf, tfixedset.set[i].str, len);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return -3;
|
|
|
+#else
|
|
|
+ for (i = 0; i < RMT_FIXED_SET_NUM; i++)
|
|
|
+ {
|
|
|
+ if (index == tfixedset.set[i].type)
|
|
|
+ {
|
|
|
+ switch (index)
|
|
|
+ {
|
|
|
+ case FIXED_SET_CRC: // 软件校验。
|
|
|
+ sprintf(buf, "%04x", (tfixedset.set[i].str[0] + (tfixedset.set[i].str[1] << 8)));
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ strncpy(buf, tfixedset.set[i].str, len);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
// 得到固定参数字符串,维护工具接口用
|
|
|
-#define FIXED_ARGS_NUM 6
|
|
|
int set_get_fixed_args_sz(int index,char *buf,int len)
|
|
|
{
|
|
|
- int i,len_line,len_all,num;
|
|
|
- char sz[64],arg[64];
|
|
|
-
|
|
|
- len_all = 0;
|
|
|
- num = 0;
|
|
|
- for(i=index*FIXED_ARGS_NUM;i<FIXEDSET_TABLE_NUMBER&&num<FIXED_ARGS_NUM;i++,num++)
|
|
|
- {
|
|
|
- set_get_fixed_arg(tfixedsettable[i].index,arg,64);
|
|
|
- len_line = sprintf(sz,"%s[%04x]:%s\r\n",tfixedsettable[i].name,tfixedsettable[i].di,arg);;
|
|
|
-
|
|
|
- strncpy(buf+len_all,sz,len-len_all);
|
|
|
+ int i, len_line, len_all, num;
|
|
|
+ char sz[64], arg[64];
|
|
|
|
|
|
- len_all += len_line;
|
|
|
- if(len_all >= len)
|
|
|
- {
|
|
|
- buf[len- 1] =0;
|
|
|
- return len;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ len_all = 0;
|
|
|
+ num = 0;
|
|
|
+ for (i = index * FIXED_ARGS_NUM; i < FIXEDSET_TABLE_NUMBER && num < FIXED_ARGS_NUM; i++, num++)
|
|
|
+ {
|
|
|
+ set_get_fixed_arg(i, arg, 64);
|
|
|
+ len_line = sprintf(sz, "%s[%04x]:%s\r\n", tfixedsettable[i].name, tfixedsettable[i].di, arg);
|
|
|
|
|
|
- // 删除最后的回车换行
|
|
|
- if(len_all > 2)
|
|
|
- {
|
|
|
- len_all -= 2;
|
|
|
- }
|
|
|
- buf[len_all] =0;
|
|
|
- return len_all+1;
|
|
|
-}
|
|
|
+ strncpy(buf + len_all, sz, len - len_all);
|
|
|
|
|
|
+ len_all += len_line;
|
|
|
+ // dp_err_n_c("index = %ld, i = %d, len_all = %d, len_line = %d, arg: %s, sz: %s", index, i, len_all, len_line, arg, sz);
|
|
|
+ if (len_all >= len)
|
|
|
+ {
|
|
|
+ buf[len - 1] = 0;
|
|
|
+ return len;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ // 删除最后的回车换行
|
|
|
+ if (len_all > 2)
|
|
|
+ {
|
|
|
+ len_all -= 2;
|
|
|
+ }
|
|
|
+ buf[len_all] = 0;
|
|
|
+ return len_all + 1;
|
|
|
+}
|
|
|
|
|
|
/*********************eep操作通用函数:包含装置型号及CRC信息*******************/
|
|
|
|
|
|
@@ -2168,7 +2193,6 @@ void get_yx_ac(u8 index, u32 type)
|
|
|
返回值: 成功时返回1,否则,0
|
|
|
函数扇入清单:
|
|
|
***************************************************************************/
|
|
|
-extern const qs08 g_e_k[];
|
|
|
bool MakeRunSet(bool bFirst)
|
|
|
{
|
|
|
TSET *ptSet;
|