Commit 677a962d authored by claes's avatar claes

New io design

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