Commit b3de8c9c authored by Claes Sjofors's avatar Claes Sjofors

Redundance communication 2

parent 849344c7
......@@ -29,10 +29,10 @@
100 20
135 20
101 20
102 126
103 324
104 2.3299
136 2.3299
102 182
103 260
104 2.51111
136 2.51111
105 100
106 2
107 1
......@@ -40,11 +40,11 @@
109 1
110 45.5
111 0.499999
116 12
117 36
118 130
119 113
120 1
116 20
117 31
118 112
119 108
120 0
121 Claes context
122 0
126 0.5
......@@ -7667,6 +7667,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -8228,6 +8230,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -9011,8 +9015,8 @@ pwr_exe:
3100 100
3101 0
3102 35
3103 478
3110 482
3103 358
3110 362
3111 1
3106
3107
......@@ -9619,6 +9623,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActSpeed
......@@ -10818,6 +10824,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.RefSpeed
......@@ -10992,6 +11000,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActSpeed
......@@ -11166,6 +11176,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.RefSpeed
......@@ -11914,6 +11926,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -12125,8 +12139,8 @@ pwr_exe:
3100 100
3101 0
3102 35
3103 358
3110 362
3103 418
3110 422
3111 1
3106
3107
......@@ -12428,6 +12442,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -12699,6 +12715,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -12709,6 +12727,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -12846,6 +12865,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -12856,6 +12877,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -12993,6 +13015,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActTorque
......@@ -13275,6 +13299,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActCurrent
......@@ -13752,6 +13778,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -13762,6 +13790,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -13899,6 +13928,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -13909,6 +13940,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -14114,6 +14146,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -14124,6 +14158,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -14261,6 +14296,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -14271,6 +14308,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -14808,6 +14846,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 4
......@@ -14818,6 +14858,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......
......@@ -31,8 +31,8 @@
101 20
102 137
103 317
104 2.13409
136 2.13409
104 2.46725
136 2.46725
105 100
106 2
107 1
......@@ -40,11 +40,11 @@
109 1
110 45.5
111 0.499999
116 12
117 32
118 120
119 102
120 0
116 14
117 38
118 104
119 113
120 1
121 Claes context
122 0
126 0.5
......@@ -7667,6 +7667,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -8228,6 +8230,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -9011,8 +9015,8 @@ pwr_exe:
3100 100
3101 0
3102 35
3103 418
3110 422
3103 358
3110 362
3111 1
3106
3107
......@@ -9485,6 +9489,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActSpeed
......@@ -10684,6 +10690,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.RefSpeed
......@@ -10858,6 +10866,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActSpeed
......@@ -11032,6 +11042,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.RefSpeed
......@@ -11780,6 +11792,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -12125,8 +12139,8 @@ pwr_exe:
3100 100
3101 0
3102 35
3103 358
3110 362
3103 418
3110 422
3111 1
3106
3107
......@@ -12428,6 +12442,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
99
99
......@@ -12699,6 +12715,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -12709,6 +12727,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -12846,6 +12865,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -12856,6 +12877,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -12993,6 +13015,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActTorque
......@@ -13275,6 +13299,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
50
5000 $object.ActCurrent
......@@ -13752,6 +13778,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -13762,6 +13790,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -13899,6 +13928,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -13909,6 +13940,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -14114,6 +14146,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -14124,6 +14158,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -14261,6 +14296,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 0
......@@ -14271,6 +14308,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......@@ -14808,6 +14846,8 @@ pwr_exe:
1202 1
1203 1
1204 0
1205
1206 0
99
13
1302 4
......@@ -14818,6 +14858,7 @@ pwr_exe:
1307
1308
1309 0
1310 0
99
99
99
......
......@@ -29,21 +29,21 @@
100 20
135 20
101 20
102 68
103 -190
104 3.09165
136 3.09165
102 40
103 -141
104 3.31378
136 3.31378
105 100
106 3
107 -29
107 -23
108 31.5
109 1
110 27.05
111 0.5
116 7
116 3
117 0
118 120
119 93
118 124
119 100
120 0
121 Claes context
122 0
......@@ -6504,8 +6504,8 @@ pwr_exe:
2
19
1904 O327
1900 23.4499
1901 18.8028
1900 23.544
1901 18.8969
1902 6.50425
1903 4.45956
1908 0
......@@ -6549,7 +6549,7 @@ pwr_exe:
28
2800 1.11803
2801 0
2802 -2.59444
2802 -2.5003
2803 0
2804 2.12851
2805 -6.6289
......@@ -10245,8 +10245,8 @@ pwr_exe:
3105
19
1904 O308
1900 21.9989
1901 20.4414
1900 22.0258
1901 20.4683
1902 22.0116
1903 6.55984
1908 0
......@@ -10290,7 +10290,7 @@ pwr_exe:
28
2800 3.11513
2801 0
2802 -54.4775
2802 -54.4506
2803 0
2804 3.09036
2805 -15.2272
......@@ -11252,8 +11252,8 @@ pwr_exe:
99
20
2004 O328
2000 21.15
2001 21.15
2000 21.2441
2001 21.2441
2002 6.46824
2003 5.14067
2009 442
......@@ -11277,7 +11277,7 @@ pwr_exe:
28
2800 1
2801 0
2802 -0.115673
2802 -0.0215356
2803 0
2804 3.6
2805 -18.6572
......@@ -11310,8 +11310,8 @@ pwr_exe:
3105
19
1904 O351
1900 22.4121
1901 19.9014
1900 22.5062
1901 19.9955
1902 6.13255
1903 5.50214
1908 370
......@@ -11355,7 +11355,7 @@ pwr_exe:
28
2800 0
2801 -0.361252
2802 23.9294
2802 24.0235
2803 0.504327
2804 -0
2805 -0.92803
......@@ -11379,8 +11379,8 @@ pwr_exe:
99
20
2004 O352
2000 19.15
2001 19.15
2000 19.2441
2001 19.2441
2002 5.75
2003 5.75
2009 0
......@@ -11404,7 +11404,7 @@ pwr_exe:
28
2800 1
2801 0
2802 -0.1
2802 -0.0058626
2803 0
2804 1
2805 -1.5
......@@ -11413,8 +11413,8 @@ pwr_exe:
99
20
2004 O353
2000 19.65
2001 19.15
2000 19.7441
2001 19.2441
2002 5.75
2003 5.75
2009 442
......@@ -11438,7 +11438,7 @@ pwr_exe:
28
2800 1
2801 0
2802 -0.1
2802 -0.0058626
2803 0
2804 1
2805 -1.5
......@@ -11447,8 +11447,8 @@ pwr_exe:
99
20
2004 O354
2000 23.15
2001 22.65
2000 23.2441
2001 22.7441
2002 5.75
2003 5.75
2009 442
......@@ -11472,7 +11472,7 @@ pwr_exe:
28
2800 1
2801 0
2802 -0.1
2802 -0.0058626
2803 0
2804 1
2805 -1.5
......@@ -11481,8 +11481,8 @@ pwr_exe:
99
20
2004 O355
2000 22.9
2001 22.9
2000 22.9941
2001 22.9941
2002 6
2003 5.5
2009 442
......@@ -11506,7 +11506,7 @@ pwr_exe:
28
2800 1
2801 0
2802 -0.1
2802 -0.0058626
2803 0
2804 1
2805 -1.5
......@@ -11515,8 +11515,8 @@ pwr_exe:
99
30
3004 O356
3000 21.7883
3001 20.4883
3000 21.8825
3001 20.5825
3002 5.17208
3003 4.47208
3008 442
......@@ -11540,7 +11540,7 @@ pwr_exe:
28
2800 1
2801 0
2802 1.09473
2802 1.18887
2803 0
2804 1
2805 -0.867717
......
This diff is collapsed.
......@@ -490,6 +490,8 @@ id (
errh_Info("Received '%s' from nid %s",
cMsg[get->type.s], cdh_NodeIdToString(NULL, mp->hdr.nid, 0, 0));
}
printf("Id Received '%s' from nid %s\n",
cMsg[get->type.s], cdh_NodeIdToString(NULL, mp->hdr.nid, 0, 0));
if (get->sender.nid == gdbroot->my_qid.nid && mp->hdr.nid == gdbroot->db->nid) {
errh_Error("New node using nid %s, conflicts with local node, '%s' ignored",
......@@ -934,6 +936,8 @@ sendId (
errh_Info("Sending 'id' to %s (%s)",
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0));
}
printf("Sending 'id' to %s (%s)\n",
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0));
if ( np->handler.nid)
tgt = np->handler;
......
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2016 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef rt_qmon_h
#define rt_qmon_h
/* rt_qmon.h -- QCom monitor */
#define qmon_cMsgClassAction 205
typedef enum {
qmon_eMsgTypeAction_NodeActive,
qmon_eMsgTypeAction_NodePassive
} qmon_eMsgTypeAction;
#endif
......@@ -64,6 +64,7 @@
#include "rt_net.h"
#include "rt_qcom.h"
#include "rt_qcom_msg.h"
#include "rt_qmon.h"
#include "rt_gdh.h"
#include "rt_lst.h"
#include "rt_que.h"
......@@ -361,6 +362,7 @@ static pwr_tStatus redu_node_init();
static redu_sNode* get_node( pwr_tNodeId nid);
static void state_change_request( sLink *lp, sIseg *sp, pwr_eRedundancyState state);
static sEseg* request_state_change( sLink *lp, pwr_eRedundancyState state);
static void send_state_change();
int
......@@ -441,7 +443,7 @@ main (int argc, char *argv[])
}
l.head.nid = l.nid;
l.head.birth = qdb->my_node->birth = time_Clock(NULL, NULL);
l.head.birth = qdb->my_node->link[0].birth = time_Clock(NULL, NULL);
ini_link_info(&l.link_info);
do {
......@@ -508,7 +510,7 @@ static pwr_tStatus redu_node_init( )
int local_found = 0;
sprintf( fname, pwr_cNameReduNode, "$pwrp_load/", qdb->my_node->name, qdb->g->bus);
sprintf( fname, pwr_cNameRedcom, "$pwrp_load/", qdb->my_node->link[0].name, qdb->g->bus);
dcli_translate_filename( fname, fname);
fp = fopen( fname, "r");
if ( !fp)
......@@ -529,13 +531,14 @@ static pwr_tStatus redu_node_init( )
errors++;
}
if ( strcmp( name, qdb->my_node->name) == 0) {
if ( strcmp( name, qdb->my_node->link[0].name) == 0) {
local_found = 1;
l.port = atoi(s_port);
if ( l.port == 0)
l.port = redu_cPort;
redu_segment_size = atoi(s_seg_size);
l.nodep->RedundancyState = atoi(s_state);
qdb->my_node->redundancy_state = l.nodep->RedundancyState;
l.min_resend_time = atoi(s_min_resend_time);
l.max_resend_time = atoi(s_max_resend_time);
l.export_buf_quota = atoi(s_export_buf_quota);
......@@ -1245,11 +1248,11 @@ ini_link_info (
{
qdb_sNode *my_np = qdb->my_node;
strcpy(lp->name, my_np->name);
strcpy(lp->name, my_np->link[0].name);
lp->version = ntohl(my_np->version);
lp->nid = ntohl(l.nid);
lp->birth = ntohl(my_np->birth);
lp->birth = ntohl(my_np->link[0].birth);
lp->bus = ntohl(qdb->g->bus);
lp->os = ntohl(my_np->os);
lp->hw = ntohl(my_np->hw);
......@@ -1540,7 +1543,7 @@ link_purge (
alloc_cnt += sp->size;
i++;
}
printf( "link_purge: %d cnt %d (%d)\n", i, lp->np->link.export_alloc_cnt, alloc_cnt);
printf( "redcom link_purge: %d cnt %d (%d)\n", i, lp->np->link.export_alloc_cnt, alloc_cnt);
lp->np->link.export_alloc_cnt = alloc_cnt;
lp->np->link.export_purge_cnt++;
l.config->Link[lp->idx].ExportPurged = lp->np->link.export_purge_cnt;
......@@ -2212,6 +2215,8 @@ state_change_request (
case pwr_eRedundancyState_Passive:
case pwr_eRedundancyState_Off:
l.nodep->RedundancyState = state;
qdb->my_node->redundancy_state = l.nodep->RedundancyState;
break;
}
}
......@@ -2264,6 +2269,8 @@ cyclic_thread ()
request_state_change( lp, pwr_eRedundancyState_Passive);
l.config->SetActive = 0;
l.nodep->RedundancyState = pwr_eRedundancyState_Active;
qdb->my_node->redundancy_state = l.nodep->RedundancyState;
send_state_change();
}
if ( l.config->SetPassive) {
......@@ -2271,6 +2278,8 @@ cyclic_thread ()
request_state_change( lp, pwr_eRedundancyState_Active);
l.config->SetPassive = 0;
l.nodep->RedundancyState = pwr_eRedundancyState_Passive;
qdb->my_node->redundancy_state = l.nodep->RedundancyState;
send_state_change();
}
if ( l.config->SetOff) {
......@@ -2278,8 +2287,32 @@ cyclic_thread ()
request_state_change( lp, pwr_eRedundancyState_Off);
l.config->SetOff = 0;
l.nodep->RedundancyState = pwr_eRedundancyState_Off;
qdb->my_node->redundancy_state = l.nodep->RedundancyState;
}
nanosleep( &ts, NULL);
}
return NULL;
}
void send_state_change()
{
pwr_tStatus sts;
qcom_sPut put;
qcom_sQid qmon_qid = {qcom_cImonAction, 0};
memset( &put, 0, sizeof(put));
put.type.b = (qcom_eBtype) qmon_cMsgClassAction;
switch ( l.nodep->RedundancyState) {
case pwr_eRedundancyState_Active:
put.type.s = (qcom_eStype) qmon_eMsgTypeAction_NodeActive;
break;
case pwr_eRedundancyState_Passive:
put.type.s = (qcom_eStype) qmon_eMsgTypeAction_NodePassive;
break;
}
put.size = 4;
put.data = qcom_Alloc( &sts, put.size);
qcom_Put( &sts, &qmon_qid, &put);
}
......@@ -942,6 +942,11 @@ int rt_report::parse( char *line)
{
char line_array[5][80];
int num;
char aline[200];
char rline[200];
replace_value( rline, sizeof(rline), line);
dcli_trim( aline, rline);
num = dcli_parse( line, " ", "",
(char *) line_array, sizeof( line_array)/sizeof( line_array[0]),
......@@ -985,6 +990,10 @@ int rt_report::parse( char *line)
else
return 0;
}
else if ( strncmp( aline, "system(", 7) == 0 && aline[strlen(aline)-1] == ')') {
aline[strlen(aline)-1] = 0;
system( &aline[7]);
}
else
return 0;
......
......@@ -636,7 +636,7 @@ typedef enum {
} pwr_eSafetyLevel;
/*_*
@aref activepassiveenum ActivePassiveEnum
@aref redundancystateenum RedundancyStateEnum
*/
typedef pwr_tEnum pwr_tRedundancyStateEnum;
......
......@@ -69,7 +69,7 @@
# define pwr_cNameBaseWttHelp "$pwr_lang/wtt_help.dat"
# define pwr_cNameProjectXttHelp "$pwrp_load/xtt_help.dat"
# define pwr_cNamePlcXttHelp "$pwrp_load/xtthelp_%s_plc.dat"
# define pwr_cNameReduNode "%sld_redunode_%s_%04d.dat"
# define pwr_cNameRedcom "%sld_redcom_%s_%04d.dat"
#elif defined OS_VMS || defined OS_ELN
......
......@@ -169,7 +169,7 @@ Parameter RTTSYS_NODE_NAME
Text/Dualpar "!"
Privileges NO
Outputflags
Characters 6
Characters 10
Decimals 0
MaxLimit 0.000000
MinLimit 0.000000
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -137,6 +137,7 @@ cvols_Notify (
put.reply = qcom_cNQid;
put.data = (char *)&nmp->msg;
put.size = nmp->size;
put.allocate = 1;
nmp->msg.hdr.hdr.xdr = 0;
nmp->msg.hdr.hdr.msn = 0;
nmp->msg.hdr.hdr.nid = gdbroot->my_node->nid;
......
......@@ -855,6 +855,7 @@ log_message (errh_sLog *lp, char severity, const char *msg, va_list ap)
if (lp != NULL && lp->send) {
lp->put.data = string;
lp->put.size = strlen(string) + 1;
lp->put.allocate = 1;
qcom_Put(NULL, &lp->logQ, &lp->put);
}
}
......
......@@ -215,6 +215,7 @@ struct io_sCtx {
pwr_sClass_IOHandler *IOHandler; /* Pointer to IO Handler object */
float ScanTime; /* Scantime supplied by caller */
io_tSupCtx SupCtx; /* Context for supervise object lists */
int read_reset; /* Reset pending read buffers */
};
/*----------------------------------------------------------------------------*\
......
......@@ -68,6 +68,7 @@ mh_NetSendMessage(
if ((msg.data = (char*)qcom_Alloc(&sts, size)) == NULL)
return sts;
msg.allocate = 0;
msg.type.b = mh_cMsgClass;
msg.type.s = subtype;
msg.reply = hp->qid;
......
......@@ -220,6 +220,7 @@ sendMessage (
put.reply.qix = 0;
put.reply.nid = 0;
put.size = sizeof(*head);
put.allocate = 1;
qcom_Put(&sts, target, &put);
......
......@@ -415,6 +415,7 @@ Error (
put.reply = qcom_cNQid;
put.data = (char *)&err;
put.size = sizeof(err);
put.allocate = 1;
qcom_Put(&sts, &tgt, &put);
......@@ -494,6 +495,7 @@ Put (
put.type.s = subtype;
put.msg_id = id;
put.size = size;
put.allocate = 0;
put.data = qcom_Alloc(&lsts, size);
if (put.data == NULL)
......
......@@ -192,6 +192,7 @@ struct plc_sThread {
unsigned int sim_idx;
unsigned int sim_halted;
unsigned int sim_singlestep;
pwr_tRedundancyStateEnum redu_state_old;
redu_tCtx redu;
};
......
......@@ -478,18 +478,6 @@ scan (
tp->ActualScanTime = MIN_SCANTIME;
}
if (pp->IOHandler->IOReadWriteFlag) {
sts = io_read(tp->plc_io_ctx);
if (EVEN(sts)) {
pp->IOHandler->IOReadWriteFlag = FALSE;
errh_Error("IO read, %m", sts);
errh_SetStatus( PLC__IOREAD);
}
}
if ( pp->Node->EmergBreakTrue && !tp->emergency_break_old)
io_swap(tp->plc_io_ctx, io_eEvent_EmergencyBreak);
tp->emergency_break_old = pp->Node->EmergBreakTrue;
if ( tp->redu && tp->pp->Node->RedundancyState == pwr_eRedundancyState_Passive) {
time_GetTimeMonotonic(&tp->before_scan);
time_GetTime(&tp->before_scan_abs);
......@@ -511,11 +499,32 @@ scan (
tp->one_before_scan = tp->before_scan;
tp->ActualScanTime = tp->f_scan_time;
tp->redu_state_old = tp->pp->Node->RedundancyState;
return;
}
if ( tp->pp->Node->RedundancyState != pwr_eRedundancyState_Passive) {
if (pp->IOHandler->IOReadWriteFlag) {
if ( tp->redu_state_old == pwr_eRedundancyState_Passive)
tp->plc_io_ctx->read_reset = 1;
sts = io_read(tp->plc_io_ctx);
if ( tp->redu_state_old == pwr_eRedundancyState_Passive)
tp->plc_io_ctx->read_reset = 0;
if (EVEN(sts)) {
pp->IOHandler->IOReadWriteFlag = FALSE;
errh_Error("IO read, %m", sts);
errh_SetStatus( PLC__IOREAD);
}
tp->redu_state_old = tp->pp->Node->RedundancyState;
}
if ( pp->Node->EmergBreakTrue && !tp->emergency_break_old)
io_swap(tp->plc_io_ctx, io_eEvent_EmergencyBreak);
tp->emergency_break_old = pp->Node->EmergBreakTrue;
thread_MutexLock(&pp->io_copy_mutex);
memcpy(tp->copy.ai_a.p, pp->base.ai_a.p, tp->copy.ai_a.size);
......
......@@ -98,6 +98,7 @@ extern "C"
#define qcom_cIhdClient (1<<31 | 105)
#define qcom_cInacp (1<<31 | 106)
#define qcom_cIini (1<<31 | 107)
#define qcom_cImonAction (1<<31 | 108)
/** @defgroup QCOM_DS Qcom Data Structures
* @ingroup QCOM
......
......@@ -432,6 +432,8 @@ qdb_Alloc (
bp = pool_Alloc(sts, &qdb->pool, sizeof(*bp) + size);
if (bp == NULL) return NULL;
// printf( "qdb_Alloc %u %ld %u\n", bp, pool_Reference(sts,&qdb->pool,bp),size);
bp->c.type = btype;
switch (btype) {
......@@ -584,6 +586,8 @@ qdb_Free (
qdb_AssumeLocked;
// printf( "qdb_Free %u %ld\n", bp, pool_Reference(sts,&qdb->pool,bp));
switch (bp->c.type) {
case qdb_eBuffer_base:
if (pool_QisLinked(sts, &qdb->pool, &bp->c.ll))
......@@ -767,11 +771,12 @@ qdb_CreateDb (
np->sa.sin_addr.s_addr = htonl(INADDR_ANY);
np->sa.sin_port = htons(55000 + qdb->g->bus);
time_GetTime(&time);
np->birth = time.tv_sec;
np->link[0].birth = time.tv_sec;
qdb->no_node = qdb_AddNode(sts, 0, qdb_mAdd_failIfAdded);
if (qdb->no_node == NULL) errh_Bugcheck(*sts, "creating the unknown node");
strcpy(qdb->no_node->name, "*** I am the unknown node ***");
strcpy(qdb->no_node->nidstr, "*** 0.0.0.0 ***");
strcpy(qdb->no_node->link[0].name, "******");
qdb->g->up = TRUE;
qdb->g->tmo_export = 10000;
......@@ -1473,16 +1478,16 @@ qdb_NodeInfo (
pwr_Status(status, QDB__SUCCESS);
node->flags.b.initiated = np->flags.b.initiated;
node->flags.b.connected = np->flags.b.connected;
node->flags.b.active = np->flags.b.active;
node->flags.b.initiated = np->link[np->clx].qflags.b.initiated;
node->flags.b.connected = np->link[np->clx].qflags.b.connected;
node->flags.b.active = np->link[np->clx].qflags.b.active;
node->nid = np->nid;
strncpy(node->name, np->name, sizeof(np->name));
strncpy(node->name, np->link[np->clx].name, sizeof(node->name));
node->os = np->os;
node->hw = np->hw;
node->bo = np->bo;
node->ft = np->ft;
node->connection = np->connection;
node->connection = np->link[np->clx].connection;
}
void
......@@ -1524,8 +1529,8 @@ qdb_Que (
np = hash_Search(sts, &qdb->nid_ht, &q.pwr.nid);
if (np == NULL) pwr_Return(NULL, sts, QCOM__NOLINK);
if (!np->flags.b.connected) pwr_Return(NULL, sts, QCOM__NOLINK);
if (!np->flags.b.active && !qdb->flags.b.ignoreStall) pwr_Return(NULL, sts, QCOM__LINKDOWN);
if (!np->link[np->clx].qflags.b.connected) pwr_Return(NULL, sts, QCOM__NOLINK);
if (!np->link[np->clx].qflags.b.active && !qdb->flags.b.ignoreStall) pwr_Return(NULL, sts, QCOM__LINKDOWN);
/* the que may exist on the remote node, lets export it */
qp = qdb->exportque;
......
This diff is collapsed.
This diff is collapsed.
......@@ -115,6 +115,9 @@ typedef struct {
pwr_tUInt32 export_buf_quota;
pwr_tFloat32 ack_delay;
pwr_tUInt32 seg_size;
unsigned int is_secondary;
char secondary_name[80];
struct in_addr secondary_naddr;
} qini_sNode;
int qini_ParseFile (FILE*, tree_sTable*, int*, int*, int*);
......
......@@ -283,7 +283,7 @@ pwr_tStatus redu_create_message( redu_tCtx ctx, void **msg)
time_Adiff( &dtime, &end_time, &start_time);
time_DToFloat( &ctx->msg_time, &dtime);
if ( ctx->packetp) {
ctx->packetp->PacketCount++;
ctx->packetp->TransmitCnt++;
ctx->packetp->PackTime = ctx->msg_time;
}
*msg = buf;
......@@ -310,8 +310,8 @@ pwr_tStatus redu_unpack_message( redu_tCtx ctx, void *msg)
time_Adiff( &dtime, &end_time, &start_time);
time_DToFloat( &ctx->msg_time, &dtime);
if ( ctx->packetp) {
ctx->packetp->PacketCount++;
ctx->packetp->PackTime = ctx->msg_time;
ctx->packetp->ReceiveCnt++;
ctx->packetp->UnpackTime = ctx->msg_time;
}
return 1;
}
......@@ -337,6 +337,7 @@ pwr_tStatus redu_send_table( redu_tCtx ctx, void **table_msg)
}
ctx->packetp->TablePacketSize = size;
ctx->packetp->Attributes = ctx->attr_cnt;
*table_msg = msg;
return 1;
}
......@@ -519,7 +520,7 @@ pwr_tStatus redu_get_initial_state( char *nodename, int busid, int *state)
char *s;
sprintf( fname, pwr_cNameReduNode, "$pwrp_load/", nodename, busid);
sprintf( fname, pwr_cNameRedcom, "$pwrp_load/", nodename, busid);
dcli_translate_filename( fname, fname);
fp = fopen( fname, "r");
if ( !fp)
......
......@@ -831,7 +831,7 @@ int rtt_cli( rtt_t_comtbl *command_table,
if ( hitnr > 1)
{
/* Command not unic */
/* Command not unique */
return RTT__COM_AMBIG;
}
else if ( hitnr < 1)
......@@ -899,7 +899,7 @@ int rtt_cli( rtt_t_comtbl *command_table,
}
else if ( hitnr > 1)
{
/* qualifier not unic */
/* qualifier not unique */
return RTT__QUAL_AMBIG;
}
/* Place back the / and = within quotes */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment