Commit 677a962d authored by claes's avatar claes

New io design

parent 8219a622
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "rt_errh.h" #include "rt_errh.h"
#include "co_cdh.h" #include "co_cdh.h"
#include "rt_io_profiboard.h" #include "rt_io_profiboard.h"
#include "rt_pb_msg.h"
/*----------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------*\
...@@ -47,8 +48,10 @@ static pwr_tStatus IoRackInit ( ...@@ -47,8 +48,10 @@ static pwr_tStatus IoRackInit (
pwr_sClass_Pb_Ao *aop; pwr_sClass_Pb_Ao *aop;
pwr_sClass_Pb_Ii *iip; pwr_sClass_Pb_Ii *iip;
pwr_sClass_Pb_Io *iop; pwr_sClass_Pb_Io *iop;
pwr_sClass_Pb_Module *mp;
char name[196]; char name[196];
pwr_tStatus sts; pwr_tStatus sts;
pwr_tCid cid;
sts = gdh_ObjidToName(rp->Objid, (char *) &name, sizeof(name), cdh_mNName); sts = gdh_ObjidToName(rp->Objid, (char *) &name, sizeof(name), cdh_mNName);
errh_Info( "Init of Profibus DP Slave and modules %s", name); errh_Info( "Init of Profibus DP Slave and modules %s", name);
...@@ -68,7 +71,10 @@ static pwr_tStatus IoRackInit ( ...@@ -68,7 +71,10 @@ static pwr_tStatus IoRackInit (
local_card->input_area = (void *) &(op->Inputs); local_card->input_area = (void *) &(op->Inputs);
local_card->output_area = (void *) &(op->Outputs); local_card->output_area = (void *) &(op->Outputs);
switch (cardp->Class) { cid = cardp->Class;
while ( ODD( gdh_GetSuperClass( cid, &cid, cardp->Objid))) ;
switch (cid) {
case pwr_cClass_Pb_Di: case pwr_cClass_Pb_Di:
dip = (pwr_sClass_Pb_Di *) cardp->op; dip = (pwr_sClass_Pb_Di *) cardp->op;
...@@ -117,6 +123,14 @@ static pwr_tStatus IoRackInit ( ...@@ -117,6 +123,14 @@ static pwr_tStatus IoRackInit (
output_counter += iop->BytesOfOutput; output_counter += iop->BytesOfOutput;
iop->Status = PB_MODULE_STATE_OPERATE; iop->Status = PB_MODULE_STATE_OPERATE;
break; break;
case pwr_cClass_Pb_Module:
mp = (pwr_sClass_Pb_Module *) cardp->op;
// iop->OffsetOutputs = output_counter;
// iop->BytesOfOutput = iop->NumberOfChannels * iop->BytesPerChannel;
// output_counter += iop->BytesOfOutput;
mp->Status = PB__SUCCESS;
break;
} }
op->NumberModules++; op->NumberModules++;
......
This diff is collapsed.
...@@ -113,7 +113,8 @@ static pwr_tStatus IoCardInit ( ...@@ -113,7 +113,8 @@ static pwr_tStatus IoCardInit (
chanp = cp->chanlist; chanp = cp->chanlist;
for ( i = 0; i < cp->ChanListSize; i++) for ( i = 0; i < cp->ChanListSize; i++)
{ {
AiRangeToCoef( chanp); if ( chanp->sop)
AiRangeToCoef( chanp);
chanp++; chanp++;
} }
...@@ -168,7 +169,7 @@ static pwr_tStatus IoCardRead ( ...@@ -168,7 +169,7 @@ static pwr_tStatus IoCardRead (
chanp = &cp->chanlist[0]; chanp = &cp->chanlist[0];
for ( i = 0; i < cp->ChanListSize; i++) for ( i = 0; i < cp->ChanListSize; i++)
{ {
if ( !chanp->cop) if ( !chanp->cop || !chanp->sop)
{ {
chanp++; chanp++;
continue; continue;
......
...@@ -125,7 +125,8 @@ static pwr_tStatus IoCardInit ( ...@@ -125,7 +125,8 @@ static pwr_tStatus IoCardInit (
chanp = cp->chanlist; chanp = cp->chanlist;
for ( i = 0; i < cp->ChanListSize; i++) for ( i = 0; i < cp->ChanListSize; i++)
{ {
AoRangeToCoef( chanp); if ( chanp->sop)
AoRangeToCoef( chanp);
chanp++; chanp++;
} }
...@@ -186,7 +187,7 @@ static pwr_tStatus IoCardWrite ( ...@@ -186,7 +187,7 @@ static pwr_tStatus IoCardWrite (
chanp = &cp->chanlist[0]; chanp = &cp->chanlist[0];
for ( i = 0; i < cp->ChanListSize; i++) for ( i = 0; i < cp->ChanListSize; i++)
{ {
if ( !chanp->cop) if ( !chanp->cop || !chanp->sop)
{ {
chanp++; chanp++;
continue; continue;
......
...@@ -78,7 +78,7 @@ static pwr_tStatus IoCardInit ( ...@@ -78,7 +78,7 @@ static pwr_tStatus IoCardInit (
/* Configure card */ /* Configure card */
for ( i = 0; i < op->MaxNoOfCounters; i++) for ( i = 0; i < op->MaxNoOfCounters; i++)
{ {
if ( !cp->chanlist[i].cop) if ( !cp->chanlist[i].cop || !cp->chanlist[i].sop)
continue; continue;
wr_data_p = (pwr_tUInt32 *) &wr_data; wr_data_p = (pwr_tUInt32 *) &wr_data;
...@@ -182,7 +182,7 @@ static pwr_tStatus IoCardRead ( ...@@ -182,7 +182,7 @@ static pwr_tStatus IoCardRead (
for ( i = 0; i < op->MaxNoOfCounters; i++) for ( i = 0; i < op->MaxNoOfCounters; i++)
{ {
if ( !cp->chanlist[i].cop) if ( !cp->chanlist[i].cop || !cp->chanlist[i].sop)
continue; continue;
if ( op->ConvMask & (1 << i)) if ( op->ConvMask & (1 << i))
......
#define IO_MAXCHAN 32 #define IO_MAXCHAN 96
#define PB_MODULE_STATE_NOTINIT 0 #define PB_MODULE_STATE_NOTINIT 0
#define PB_MODULE_STATE_OPERATE 1 #define PB_MODULE_STATE_OPERATE 1
......
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