Commit e92caaf5 authored by claes's avatar claes

All io processes and thread supervises all other with halt action

parent db5dc0fa
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "pwr_class.h" #include "pwr_class.h"
#include "pwrb_c_cyclesup.h" #include "pwrb_c_cyclesup.h"
#include "co_time.h" #include "co_time.h"
#include "co_cdh.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_gdh_msg.h" #include "rt_gdh_msg.h"
#include "rt_csup_msg.h" #include "rt_csup_msg.h"
...@@ -34,6 +35,7 @@ csup_Init ( ...@@ -34,6 +35,7 @@ csup_Init (
{ {
lst_sEntry *lh; lst_sEntry *lh;
pwr_tObjid cid; pwr_tObjid cid;
pwr_tObjid pid;
csup_sObject *cp; csup_sObject *cp;
int tv_sec; int tv_sec;
pwr_tFloat32 max_delay; pwr_tFloat32 max_delay;
...@@ -47,9 +49,9 @@ csup_Init ( ...@@ -47,9 +49,9 @@ csup_Init (
lst_Init(NULL, lh, NULL); lst_Init(NULL, lh, NULL);
for ( for (
*sts = gdh_GetChild(tid, &cid); *sts = gdh_GetClassList(pwr_cClass_CycleSup, &cid);
ODD(*sts); ODD(*sts);
*sts = gdh_GetNextSibling(cid, &cid) *sts = gdh_GetNextObject(cid, &cid)
) { ) {
cp = calloc(1, sizeof(*cp)); cp = calloc(1, sizeof(*cp));
cp->aref.Objid = cid; cp->aref.Objid = cid;
...@@ -57,12 +59,14 @@ csup_Init ( ...@@ -57,12 +59,14 @@ csup_Init (
if (EVEN(*sts)) if (EVEN(*sts))
goto error; goto error;
if ( ODD(gdh_GetParent( cid, &pid)) && cdh_ObjidIsEqual( pid, tid))
cp->is_owner = 1;
lst_InsertSucc(NULL, lh, &cp->le, cp); lst_InsertSucc(NULL, lh, &cp->le, cp);
max_delay = cp->o->MaxDelay; max_delay = cp->o->MaxDelay;
cp->o->DelayLimit.tv_sec = tv_sec = (int)max_delay; cp->o->DelayLimit.tv_sec = tv_sec = (int)max_delay;
cp->o->DelayLimit.tv_nsec = (int)((max_delay - (float)tv_sec + FLT_EPSILON) * 1.0e9); cp->o->DelayLimit.tv_nsec = (int)((max_delay - (float)tv_sec + FLT_EPSILON) * 1.0e9);
printf("maxdelay: %f, tv_sec: %d, tv_nsec: %d\n", cp->o->MaxDelay, // printf("maxdelay: %f, tv_sec: %d, tv_nsec: %d\n", cp->o->MaxDelay, cp->o->DelayLimit.tv_sec, cp->o->DelayLimit.tv_nsec);
cp->o->DelayLimit.tv_sec, cp->o->DelayLimit.tv_nsec);
errh_Info("maxdelay: %f, tv_sec: %d, tv_nsec: %d", cp->o->MaxDelay, errh_Info("maxdelay: %f, tv_sec: %d, tv_nsec: %d", cp->o->MaxDelay,
cp->o->DelayLimit.tv_sec, cp->o->DelayLimit.tv_nsec); cp->o->DelayLimit.tv_sec, cp->o->DelayLimit.tv_nsec);
} }
...@@ -98,6 +102,7 @@ csup_Exec ( ...@@ -98,6 +102,7 @@ csup_Exec (
while ((cp = lst_Succ(NULL, lh, &lh)) != NULL) { while ((cp = lst_Succ(NULL, lh, &lh)) != NULL) {
pwr_sClass_CycleSup *o = cp->o; pwr_sClass_CycleSup *o = cp->o;
if ( cp->is_owner) {
if (time_Dcomp(&o->NextLimit, NULL) > 0) { if (time_Dcomp(&o->NextLimit, NULL) > 0) {
if (time_Dcomp(stop, &o->NextLimit) > 0) { if (time_Dcomp(stop, &o->NextLimit) > 0) {
if (!o->Delayed) { if (!o->Delayed) {
...@@ -114,11 +119,11 @@ csup_Exec ( ...@@ -114,11 +119,11 @@ csup_Exec (
} }
} }
if ((o->DelayLimit.tv_sec & 1<<31) != (o->DelayLimit.tv_nsec & 1<<31)) { if ((o->DelayLimit.tv_sec & 1<<31) != (o->DelayLimit.tv_nsec & 1<<31)) {
printf("DelayLimit.tv_sec: %d, DelayLimit.tv_nsec: %d\n", o->DelayLimit.tv_sec, o->DelayLimit.tv_nsec); // printf("DelayLimit.tv_sec: %d, DelayLimit.tv_nsec: %d\n", o->DelayLimit.tv_sec, o->DelayLimit.tv_nsec);
errh_Info("DelayLimit.tv_sec: %d, DelayLimit.tv_nsec: %d", o->DelayLimit.tv_sec, o->DelayLimit.tv_nsec); errh_Info("DelayLimit.tv_sec: %d, DelayLimit.tv_nsec: %d", o->DelayLimit.tv_sec, o->DelayLimit.tv_nsec);
} }
if ((next_start->tv_sec & 1<<31) != (next_start->tv_nsec & 1<<31)) { if ((next_start->tv_sec & 1<<31) != (next_start->tv_nsec & 1<<31)) {
printf("next_start->tv_sec: %d, next_start->tv_nsec: %d\n", next_start->tv_sec, next_start->tv_nsec); // printf("next_start->tv_sec: %d, next_start->tv_nsec: %d\n", next_start->tv_sec, next_start->tv_nsec);
errh_Info("next_start->tv_sec: %d, next_start->tv_nsec: %d", next_start->tv_sec, next_start->tv_nsec); errh_Info("next_start->tv_sec: %d, next_start->tv_nsec: %d", next_start->tv_sec, next_start->tv_nsec);
} }
time_Dadd(&nextLimit, next_start, &o->DelayLimit); time_Dadd(&nextLimit, next_start, &o->DelayLimit);
...@@ -131,6 +136,18 @@ csup_Exec ( ...@@ -131,6 +136,18 @@ csup_Exec (
o->CycleCount++; o->CycleCount++;
} }
else {
/* Not owner, check stall delay */
if ( o->DelayAction == 2) {
if (time_Dcomp(&o->NextLimit, NULL) > 0 &&
time_Dcomp(stop, &o->NextLimit) > 0) {
o->DelayCount++;
o->LastDelay = *now;
action = MAX(action, o->DelayAction);
}
}
}
}
return action; return action;
} }
......
...@@ -17,6 +17,7 @@ typedef struct { ...@@ -17,6 +17,7 @@ typedef struct {
pwr_sClass_CycleSup *o; pwr_sClass_CycleSup *o;
pwr_sAttrRef aref; pwr_sAttrRef aref;
pwr_tDlid dlid; pwr_tDlid dlid;
int is_owner;
} csup_sObject; } csup_sObject;
void csup_Exit(pwr_tStatus*, lst_sEntry*); void csup_Exit(pwr_tStatus*, lst_sEntry*);
......
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