}
  }
  return IO__SUCCESS;
}

#else
static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
{
  return IO__RELEASEBUILD;
}
static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
{
  return IO__RELEASEBUILD;
}
static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
{
  return IO__RELEASEBUILD;
}
static pwr_tStatus IoAgentWrite(io_tCtx ctx, io_sAgent* ap)
{
  return IO__RELEASEBUILD;
}
#endif

/*  Every method should be registred here. */

pwr_dExport pwr_BindIoMethods(Hilscher_cifX_PnController)
    = { pwr_BindIoMethod(IoAgentInit), pwr_BindIoMethod(IoAgentClose),
        pwr_BindIoMethod(IoAgentRead), pwr_BindIoMethod(IoAgentWrite),
        pwr_NullMethod };
Ejemplo n.º 2
0
                    break;
                case pwr_cClass_ChanAit:
                    io_ConvertAit( (pwr_sClass_ChanAit *) cop, (pwr_tInt16) data,
                                   &actvalue);
                    break;
                }

                /* Filter */
                sts = io_AiFilter( (void *) op, &actvalue, local->FilterData[i]);

                *(pwr_tFloat32 *) chanp->vbp = actvalue;
                local->ScanCount[i] = cop->ScanInterval + 1;
            }
            local->ScanCount[i]--;
        }
        chanp++;
    }
    return 1;
}


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Ai_7436) = {
    pwr_BindIoMethod(IoCardInit),
    pwr_BindIoMethod(IoCardRead),
    pwr_NullMethod
};
Ejemplo n.º 3
0
	rb.Address = local->Address[i];
	sts = read( local->Qbus_fp, &rb, sizeof(rb));
      }
      else {
	/* Ethernet I/O, Get data from current address */
	data = bfbeth_get_data(r_local, (pwr_tUInt16) local->Address[i], &sts);
	/* Yes, we want to read this address the next time aswell */
	bfbeth_set_read_req(r_local, (pwr_tUInt16) local->Address[i]);
	sts = 1;      
      }
        
    }
    break;
  default: ;
  }
  return 1;
}


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Ssab_Do) = {
  pwr_BindIoMethod(IoCardInit),
  pwr_BindIoMethod(IoCardClose),
  pwr_BindIoMethod(IoCardWrite),
  pwr_BindIoMethod(IoCardSwap),
  pwr_NullMethod
};
Ejemplo n.º 4
0

/*----------------------------------------------------------------------------*\
  
\*----------------------------------------------------------------------------*/

static pwr_tStatus IoAgentClose (
  io_tCtx	ctx,
  io_sAgent	*ap
) 
{
  io_sRack	*rp;

  errh_Info( "Closing agent RTP DIOC %s", ap->Name );

  io_dioc_terminated();

  return 1;
}


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(RTP_DIOC) = {
  pwr_BindIoMethod(IoAgentInit),
  pwr_BindIoMethod(IoAgentClose),
  pwr_NullMethod
};
Ejemplo n.º 5
0
                               io_sCard *cp)
{
    return IO__SUCCESS;
}

static pwr_tStatus IoCardClose( io_tCtx ctx,
                                io_sAgent *ap,
                                io_sRack *rp,
                                io_sCard *cp)
{
    return IO__SUCCESS;
}

#else
static pwr_tStatus IoCardInit( io_tCtx ctx, io_sAgent *ap, io_sRack *rp, io_sCard *cp) {
    return IO__RELEASEBUILD;
}
static pwr_tStatus IoCardClose( io_tCtx ctx, io_sAgent *ap, io_sRack *rp, io_sCard *cp) {
    return IO__RELEASEBUILD;
}
#endif

/*  Every method should be registred here. */

pwr_dExport pwr_BindIoMethods(Hilscher_cifX_Module) = {
    pwr_BindIoMethod(IoCardInit),
    pwr_BindIoMethod(IoCardClose),
    pwr_NullMethod
};

Ejemplo n.º 6
0
{
  int sts;
  fd_set fds;
  struct timeval tv;
  struct bfb_buf rbuf;
  int size;

  sts = 1;
  while (sts > 0) {
    FD_ZERO(&fds);
    FD_SET(socket, &fds);
    tv.tv_sec = 0;
    tv.tv_usec = 0;
    sts = select(32, &fds, NULL, NULL, &tv);
    if (sts > 0)
      size = recv(socket, &rbuf, sizeof(rbuf), 0);
  }
}

/*----------------------------------------------------------------------------*\

\*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Ssab_RemoteRack) = { pwr_BindIoMethod(IoRackInit),
  pwr_BindIoMethod(IoRackSwap), pwr_BindIoMethod(IoRackClose),
  pwr_BindIoMethod(IoRackRead), pwr_BindIoMethod(IoRackWrite), pwr_NullMethod };
Ejemplo n.º 7
0
) 
{
  return IO__SUCCESS;
}


/*----------------------------------------------------------------------------*\
  
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackClose (
  io_tCtx	ctx,
  io_sAgent	*ap,
  io_sRack	*rp
) 
{
  return IO__SUCCESS;
}


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Modbus_RTU_Slave) = {
  pwr_BindIoMethod(IoRackInit),
  pwr_BindIoMethod(IoRackRead),
  pwr_BindIoMethod(IoRackWrite),
  pwr_BindIoMethod(IoRackClose),
  pwr_NullMethod
};
Ejemplo n.º 8
0
          break;
        case pwr_cClass_ChanDo:
          fprintf(fp, "%u", ((pwr_sClass_ChanDo*)cp->chanlist[i].cop)->Number);
          fflush(fp);
          break;
        default:;
        }
      }
    }
  }
  fclose(fp);

  errh_Info("Init of GPIO '%s'", rp->Name);
  op->Status = IO__SUCCESS;

  return IO__SUCCESS;
}

static pwr_tStatus IoRackClose(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
  pwr_sClass_GPIO* op = (pwr_sClass_GPIO*)rp->op;

  op->Status = 0;
  return IO__SUCCESS;
}

/*  Every method should be registred here. */

pwr_dExport pwr_BindIoMethods(GPIO) = { pwr_BindIoMethod(IoRackInit),
  pwr_BindIoMethod(IoRackClose), pwr_NullMethod };
    }
    else {
      sp->Super.ErrorCount++;
    }

    if (sp->Super.ErrorCount > sp->Super.ErrorSoftLimit && sp->Super.StallAction >= pwr_ePbStallAction_ResetInputs) {
      memset(&sp->Super.Inputs, 0, sp->Super.BytesOfInput);
    }

    if (sp->Super.ErrorCount > sp->Super.ErrorHardLimit && sp->Super.StallAction >= pwr_ePbStallAction_EmergencyBreak) {
      ctx->Node->EmergBreakTrue = 1;
    }
  }
  else {
    sp->Super.ErrorCount = 0;
    sp->Super.Status = PB__DISABLED;
  }
  
  return IO__SUCCESS;
}


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Siemens_DiagRepeater) = {
  pwr_BindIoMethod(IoRackRead),
  pwr_NullMethod
};
Ejemplo n.º 10
0
  /* Init the RTP-bus */

  if ( !init_done)
  {
    init_done = 1;
    if ( ! rtp_init())
    {
      errh_Error( "IO init error, Unable to start RTP IO");
      return KER$_NO_SUCH_DEVICE;
    }
  }

  return 1;

}

/*----------------------------------------------------------------------------*\
  
\*----------------------------------------------------------------------------*/


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Rack_RTP) = {
  pwr_BindIoMethod(IoRackInit),
  pwr_NullMethod
};
Ejemplo n.º 11
0
    rp = rp->next;
  }

  return IO__SUCCESS;
}

/*----------------------------------------------------------------------------*\
   Write method for the Pb_Profiboard agent
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoAgentWrite(io_tCtx ctx, io_sAgent* ap)
{
  return IO__SUCCESS;
}

/*----------------------------------------------------------------------------*\

\*----------------------------------------------------------------------------*/
static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
{
  return IO__SUCCESS;
}

/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Modbus_Master) = { pwr_BindIoMethod(IoAgentInit),
  pwr_BindIoMethod(IoAgentRead), pwr_BindIoMethod(IoAgentWrite),
  pwr_BindIoMethod(IoAgentClose), pwr_NullMethod };
Ejemplo n.º 12
0
      local->Qbus_fp = ((io_sRackLocal*)(rp->Local))->Qbus_fp;
      local->FirstScan = 1;
    }

    for (i = 0; i < 2; i++) {
      if (r_local->Qbus_fp != 0 && r_local->s == 0) {
        /* Write to local Q-bus */
        rb.Address = local->Address[i];
        sts = read(local->Qbus_fp, &rb, sizeof(rb));
      } else {
        /* Ethernet I/O, Get data from current address */
        data = bfbeth_get_data(r_local, (pwr_tUInt16)local->Address[i], &sts);
        /* Yes, we want to read this address the next time aswell */
        bfbeth_set_read_req(r_local, (pwr_tUInt16)local->Address[i]);
        sts = 1;
      }
    }
    break;
  default:;
  }
  return 1;
}

/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Ssab_Do) = { pwr_BindIoMethod(IoCardInit),
  pwr_BindIoMethod(IoCardClose), pwr_BindIoMethod(IoCardWrite),
  pwr_BindIoMethod(IoCardSwap), pwr_NullMethod };
Ejemplo n.º 13
0
  errh_Info( "Init of IO agent %s", ap->Name );

  return 1;
}

static pwr_tStatus IoAgentSwap (
  io_tCtx	ctx,
  io_sAgent	*ap
) 
{

  return 1;
}


/*----------------------------------------------------------------------------*\
  
\*----------------------------------------------------------------------------*/


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Node) = {
  pwr_BindIoMethod(IoAgentInit),
  pwr_BindIoMethod(IoAgentSwap),
  pwr_NullMethod
};
Ejemplo n.º 14
0
      else
        local->OldValue[i] = value;
    }
    chanp++;
  }
  if ( local->WriteFirst)
    local->WriteFirst--;
  return IO__SUCCESS;
}


/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Ao_7455_20) = {
  pwr_BindIoMethod(IoCardInit),
  pwr_BindIoMethod(IoCardWrite),
  pwr_NullMethod
};
pwr_dExport pwr_BindIoMethods(Ao_7455_30) = {
  pwr_BindIoMethod(IoCardInit),
  pwr_BindIoMethod(IoCardWrite),
  pwr_NullMethod
};
pwr_dExport pwr_BindIoMethods(Pd_7435_26) = {
  pwr_BindIoMethod(IoCardInit),
  pwr_BindIoMethod(IoCardWrite),
  pwr_NullMethod
};
Ejemplo n.º 15
0
  errh_Info( "Init of USBIO rack '%s'", rp->Name);

  return IO__SUCCESS;
}

static pwr_tStatus IoRackClose( io_tCtx ctx,
			        io_sAgent *ap,
			        io_sRack *rp)
{
  io_sLocalUSB *local = rp->Local;
  pwr_sClass_MotionControl_USB *op = (pwr_sClass_MotionControl_USB *)rp->op;
  int i;

  for ( i = 0; i < (int)sizeof(local->USB_Handle); i++) {
    if ( local->USB_Handle[i])
      USBIO_Close( &local->USB_Handle[i]);
    else
      break;
  }
  op->Status = 0;
  return IO__SUCCESS;
}

/*  Every method should be registred here. */

pwr_dExport pwr_BindIoMethods(MotionControl_USB) = {
  pwr_BindIoMethod(IoRackInit),
  pwr_BindIoMethod(IoRackClose),
  pwr_NullMethod
};
Ejemplo n.º 16
0
  if (op->Status == PB__NORMAL) {
    io_bus_card_write(ctx, cp, local->output_area, slave->ByteOrdering,
        slave->FloatRepresentation);
  }
  //  printf("Method Pb_Module-IoCardWrite\n");
  return IO__SUCCESS;
}

/*----------------------------------------------------------------------------*\
   Close method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardClose(
    io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
  io_sPnCardLocal* local;
  local = (io_sPnCardLocal*)cp->Local;

  free((char*)local);

  printf("Method Pb_Module-IoCardClose\n");
  return IO__SUCCESS;
}

/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(PnModule) = { pwr_BindIoMethod(IoCardInit),
  pwr_BindIoMethod(IoCardRead), pwr_BindIoMethod(IoCardWrite),
  pwr_BindIoMethod(IoCardClose), pwr_NullMethod };
static pwr_tStatus IoCardClose (
  io_tCtx	ctx,
  io_sAgent	*ap,
  io_sRack	*rp,
  io_sCard	*cp
) 
{
  io_sCardLocal *local;
  local = cp->Local;

  free ((char *) local);
  
  printf("Method Pb_Module-IoCardClose\n");
  return IO__SUCCESS;
}



/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Pb_FDL_DataTransfer) = {
  pwr_BindIoMethod(IoCardInit),
  pwr_BindIoMethod(IoCardRead),
  pwr_BindIoMethod(IoCardWrite),
  pwr_BindIoMethod(IoCardClose),
  pwr_NullMethod
};

Ejemplo n.º 18
0
  pwr_sClass_Modbus_RTU_ServerModule* op;
  pwr_sClass_Modbus_RTU_Server* server;

  op = (pwr_sClass_Modbus_RTU_ServerModule*)cp->op;
  local = (io_sServerModuleLocal*)cp->Local;
  server = (pwr_sClass_Modbus_RTU_Server*)rp->op;
  local_server = (io_sServerLocal*)rp->Local;

  if (server->DisableServer || !local)
    return IO__SUCCESS;

  if (server->Status == MB__NORMAL) {
    thread_MutexLock(&local_server->mutex);

    io_bus_card_write(ctx, cp, local->output_area,
        pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);

    thread_MutexUnlock(&local_server->mutex);
  }
  //  printf("Method Modbus_Module-IoCardWrite\n");
  return IO__SUCCESS;
}

/*----------------------------------------------------------------------------*\
  Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/

pwr_dExport pwr_BindIoMethods(Modbus_RTU_ServerModule)
    = { pwr_BindIoMethod(IoCardInit), pwr_BindIoMethod(IoCardRead),
        pwr_BindIoMethod(IoCardWrite), pwr_NullMethod };