Commit f403dbdc authored by claes's avatar claes

No re-initialization of Profiboard and slaves when there is a restart

parent 5be188fe
/*
* Proview $Id: rt_io_m_pb_profiboard.c,v 1.9 2007-04-30 09:41:53 claes Exp $
* Proview $Id: rt_io_m_pb_profiboard.c,v 1.10 2007-05-07 12:19:44 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -582,6 +582,10 @@ static pwr_tStatus IoAgentInit (
pwr_sClass_Pb_DP_Slave *sop;
char name[196];
struct timespec rqtp = {0, 20000000}; // 20 ms
int retry;
count=0;
/* Allocate area for local data structure */
......@@ -598,6 +602,11 @@ static pwr_tStatus IoAgentInit (
/* Initialize interface */
if (ctx->Node->Restarts > 0) {
nanosleep(&rqtp, NULL);
}
errh_Info( "Initializing interface for Profibus DP Master %s", ap->Name);
sts = profi_init(hDevice, (unsigned char) op->BusNumber - 1, 0, 0);
if (sts != E_OK)
......@@ -631,6 +640,7 @@ static pwr_tStatus IoAgentInit (
if (ctx->Node->Restarts == 0) {
retry = 0;
while (!ok) {
op->Status = PB__NOTINIT;
......@@ -641,6 +651,11 @@ static pwr_tStatus IoAgentInit (
if (!sts) {
op->Status = PB__INITFAIL;
errh_Error( "ERROR config Profibus DP Master %s - %s", ap->Name, "fmb set configuration");
retry++;
if (retry < 2) {
nanosleep(&rqtp, NULL);
continue;
}
return IO__ERRINIDEVICE;
}
......@@ -711,8 +726,8 @@ static pwr_tStatus IoAgentInit (
} /* End - While !ok */
} /* End - Initialization only if not restart */
else {
/* Move to STOP mode, this will fix the DPRAM layout */
/* else {
Move to STOP mode, this will fix the DPRAM layout
sts = dp_act_param_loc(hDevice, DP_OP_MODE_STOP);
if (sts != E_OK) {
......@@ -720,7 +735,7 @@ static pwr_tStatus IoAgentInit (
errh_Error( "ERROR config Profibus DP Master %s - %s", ap->Name, "act param loc to STOPPED");
return IO__ERRINIDEVICE;
}
}
} */
}
else
op->Status = PB__DISABLED;
......
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