Commit af1e6379 authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master' of pwrcvs:/data1/git/pwr

parents 4e0c38b9 fb9829ef
......@@ -61,4 +61,5 @@
130415 rk profibus Removed re-request for diagnostics
131107 rk profibus Fixed problem with profibus diagnostic messages handling
131113 cs profibus Profibus gsd file for ABB ACS880 added
140825 rk profibus Added support for Profibus FDL.
......@@ -45,8 +45,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
......@@ -54,6 +52,7 @@
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_pb_locals.h"
/*----------------------------------------------------------------------------*\
Convert ai from rawvalue to actualvalue.
......
......@@ -43,8 +43,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
......@@ -53,6 +51,8 @@
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_pb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Pb module Ao
......
......@@ -43,8 +43,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
......@@ -53,6 +51,8 @@
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_pb_locals.h"
#define IO_CONVMASK_ALL 0xFFFF
/*----------------------------------------------------------------------------*\
......
......@@ -43,8 +43,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
......@@ -53,6 +51,8 @@
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_pb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Pb module Do
......
......@@ -42,8 +42,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "co_cdh.h"
#include "pwr_baseclasses.h"
......@@ -57,6 +55,8 @@
#include "rt_io_profiboard.h"
#include "rt_pb_msg.h"
#include "rt_io_pb_locals.h"
/* Check if channel should be fetched from diagnostic area,
i.e. channel name starts with "Diag_" */
......@@ -98,6 +98,13 @@ static pwr_tStatus IoRackInit (
pwr_sClass_ChanAo *chan_ao;
pwr_sClass_ChanIo *chan_io;
io_sRackLocal *local;
local= calloc(1, sizeof(*local));
rp->Local = local;
local->dp = 1;
sts = gdh_ObjidToName(rp->Objid, (char *) &name, sizeof(name), cdh_mNName);
errh_Info( "Init of Profibus DP Slave and Modules %s", name);
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_pb_msg.h"
#include "rt_io_pb_locals.h"
#include "keywords.h"
#pragma pack(1)
#include "pb_type.h"
#include "pb_conf.h"
#include "pb_if.h"
#include "pb_err.h"
#include "pb_fmb.h"
#include "pb_dp.h"
#include "pb_fdl.h"
#pragma pack(0)
static unsigned char req_res_buffer[512];
static short fdlif_sda_sdn_sdr_req(io_sAgentLocal *local_agent,
pwr_sClass_Pb_FDL_SAP *sap,
pwr_sClass_Pb_FDL_DataTransfer *op,
io_sFDLCardLocal *local)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
this function is used to activate a SAP
possible return values:
- == E_OK -> no error
- != E_OK -> error
-----------------------------------------------------------------------------*/
{
// LOCAL_VARIABLES
short result; /* !!! local result variable !!! */
// FUNCTION_BODY
T_FDLIF_SDN_SDA_SRD_REQ *req = (T_FDLIF_SDN_SDA_SRD_REQ*) req_res_buffer;
unsigned char *data_ptr;
T_PROFI_SERVICE_DESCR sdb;
/* --- set data block parameters ------------------------------------------- */
data_ptr = (USIGN8*) (req+1);
req->ssap = sap->SAP_Nr;
req->dsap = op->DestSAP;
req->rem_add = sap->SlaveAddress;
req->priority = HIGH;
memcpy(data_ptr, local->output_area, local->output_area_size);
req->length = local->output_area_size;
/* --- set parameter block parameters -------------------------------------- */
sdb.comm_ref = 0;
sdb.layer = FDLIF;
switch (op->Type) {
case pwr_ePbFDLDataTransferTypeEnum_FDLIF_SDA: {
sdb.service = FDLIF_SDA;
break;
}
case pwr_ePbFDLDataTransferTypeEnum_FDLIF_SDN: {
sdb.service = FDLIF_SDN;
break;
}
case pwr_ePbFDLDataTransferTypeEnum_FDLIF_SRD: {
sdb.service = FDLIF_SRD;
break;
}
default:
sdb.service = FDLIF_SDN;
break;
}
sdb.primitive = REQ;
sdb.invoke_id = local->invoke_id = local_agent->invoke_id;
local_agent->invoke_id = (local_agent->invoke_id + 1) % 128;
result = profi_snd_req_res((T_PROFI_DEVICE_HANDLE *) local_agent, &sdb, (void *) req, PB_FALSE);
return ((pwr_tBoolean) (result == E_OK));
}
static short fdlif_reply_update_mult_req(io_sAgentLocal *local_agent,
pwr_sClass_Pb_FDL_SAP *sap,
pwr_sClass_Pb_FDL_DataTransfer *op,
io_sFDLCardLocal *local)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
this function is used to activate a SAP
possible return values:
- == E_OK -> no error
- != E_OK -> error
-----------------------------------------------------------------------------*/
{
// LOCAL_VARIABLES
INT16 result; /* !!! local result variable !!! */
// FUNCTION_BODY
T_FDLIF_RUP_REQ *req = (T_FDLIF_RUP_REQ*) req_res_buffer;
USIGN8 *data_ptr;
T_PROFI_SERVICE_DESCR sdb;
/* --- set data block parameters ------------------------------------------- */
data_ptr = (USIGN8*) (req+1);
req->sap_nr = sap->SAP_Nr;
req->priority = HIGH;
memcpy(data_ptr, local->output_area, local->output_area_size);
req->length = local->output_area_size;
/* --- set parameter block parameters -------------------------------------- */
sdb.comm_ref = 0;
sdb.layer = FDLIF;
sdb.service = FDLIF_REPLY_UPDATE_MULTIPLE;
sdb.primitive = REQ;
sdb.invoke_id = local->invoke_id = local_agent->invoke_id;
local_agent->invoke_id = (local_agent->invoke_id + 1) % 128;
result = profi_snd_req_res((T_PROFI_DEVICE_HANDLE *) local_agent, &sdb, (void *) req, PB_FALSE);
return ((pwr_tBoolean) (result == E_OK));
}
/*----------------------------------------------------------------------------*\
Init method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sFDLCardLocal *local;
pwr_sClass_Pb_FDL_DataTransfer *op = (pwr_sClass_Pb_FDL_DataTransfer *)cp->op;
unsigned int input_area_offset = 0;
unsigned int input_area_chansize = 0;
unsigned int output_area_offset = 0;
unsigned int output_area_chansize = 0;
local = (io_sFDLCardLocal *) calloc( 1, sizeof(io_sFDLCardLocal));
cp->Local = local;
/* Initialize remote address structure */
local->byte_ordering = ((pwr_sClass_Pb_FDL_SAP *) rp->op)->ByteOrdering;
io_bus_card_init( ctx, cp, &input_area_offset, &input_area_chansize,
&output_area_offset, &output_area_chansize, local->byte_ordering,
io_eAlignment_Packed);
local->input_area_size = input_area_offset + input_area_chansize;
local->output_area_size = output_area_offset + output_area_chansize;
if ( local->input_area_size > 0)
local->input_area = calloc( 1, local->input_area_size);
if ( local->output_area_size > 0)
local->output_area = calloc( 1, local->output_area_size);
errh_Info( "Init of Profibus FDL Data transfer '%s'", cp->Name);
op->Status = PB__NORMAL;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Pb FDL Data transfer module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sFDLCardLocal *local = (io_sFDLCardLocal *) cp->Local;
io_bus_card_read(ctx, rp, cp, local->input_area, 0, local->byte_ordering,
local->float_representation);
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Pb FDL Data transfer module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sAgentLocal *local_agent = (io_sAgentLocal *)ap->Local;
pwr_sClass_Pb_FDL_DataTransfer *op = (pwr_sClass_Pb_FDL_DataTransfer *) cp->op;
pwr_sClass_Pb_FDL_SAP *sap = (pwr_sClass_Pb_FDL_SAP * ) rp->op;
io_sFDLCardLocal *local = (io_sFDLCardLocal *) cp->Local;
op->Status = sap->Status;
if (op->Status == PB__NORMAL) {
io_bus_card_write(ctx, cp, local->output_area, local->byte_ordering,
local->float_representation);
if (op->SendReq) {
pthread_mutex_lock(&local_agent->mutex);
if (sap->Responder) {
fdlif_reply_update_mult_req(local_agent, sap, op, local);
}
else {
fdlif_sda_sdn_sdr_req(local_agent, sap, op, local);
}
op->SendReq = 0;
pthread_mutex_unlock(&local_agent->mutex);
}
}
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_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
};
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_pb_fdl_sap.c -- io methods for a profibus FDL SAP */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include "pwr.h"
#include "co_cdh.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_gdh.h"
#include "rt_io_base.h"
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "co_cdh.h"
#include "rt_io_profiboard.h"
#include "rt_pb_msg.h"
#include "rt_io_pb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Pb FDL SAP
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
io_sRackLocal *local;
char name[196];
pwr_tStatus sts;
sts = gdh_ObjidToName(rp->Objid, (char *) &name, sizeof(name), cdh_mNName);
errh_Info( "Init of Profibus FDL SAP %s", name);
local= calloc(1, sizeof(*local));
rp->Local = local;
local->fdl = 1;
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(Pb_FDL_SAP) = {
pwr_BindIoMethod(IoRackInit),
pwr_BindIoMethod(IoRackClose),
pwr_NullMethod
};
......@@ -74,8 +74,6 @@ The code refers to some documents provided by Hilscher, the documents are:
#include "rcs_user.h"
#include "dpm_user.h"
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "co_cdh.h"
#include "pwr_baseclasses.h"
......@@ -87,6 +85,8 @@ The code refers to some documents provided by Hilscher, the documents are:
#include "rt_io_agent_init.h"
#include "rt_pb_msg.h"
#include "rt_io_pb_locals.h"
typedef struct {
/* Board number. */
unsigned short dev_number;
......@@ -101,7 +101,7 @@ typedef struct {
/* Watchdog counter, used by DevTriggerWatchDog() as explained on page
58 of CIFLinux_en.pdf. */
unsigned short watchdog;
} io_sAgentLocal;
} io_sAgentLocalHilscher;
/* Prototypes for functions exported to Proview. */
static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent *ap);
......@@ -141,7 +141,7 @@ boards known_boards[] = {
/* Initializes Profibus DP interface on the CIF board referred to by local.
DRV_NO_ERROR is returned upon success. */
static short
dpm_init_master(io_sAgentLocal *local, pwr_sClass_Pb_Hilscher *op,
dpm_init_master(io_sAgentLocalHilscher *local, pwr_sClass_Pb_Hilscher *op,
io_sAgent *ap)
{
short rv;
......@@ -193,7 +193,7 @@ dpm_init_master(io_sAgentLocal *local, pwr_sClass_Pb_Hilscher *op,
/* Opens and initializes the board referred to by local. Upon success
* DRV_NO_ERROR will be returned. */
static short
dpm_init(io_sAgentLocal *local, io_sAgent *ap)
dpm_init(io_sAgentLocalHilscher *local, io_sAgent *ap)
{
short rv;
......@@ -215,7 +215,7 @@ dpm_init(io_sAgentLocal *local, io_sAgent *ap)
/* Closes the board referred to by local. Upon success DRV_NO_ERROR will
be returned. */
static short
dpm_exit(io_sAgentLocal *local, io_sAgent *ap)
dpm_exit(io_sAgentLocalHilscher *local, io_sAgent *ap)
{
short rv;
short rv_ret = DRV_NO_ERROR;
......@@ -414,9 +414,9 @@ dpm_set_add_tab(pwr_sClass_Pb_DP_Slave *op, io_sAgent *ap, io_sRack *rp,
slaves/modules have occupied so far. */
unsigned short *input_size;
unsigned short *output_size;
input_size = (unsigned short *) &((io_sAgentLocal *) ap->Local)->input_size;
input_size = (unsigned short *) &((io_sAgentLocalHilscher *) ap->Local)->input_size;
output_size =
(unsigned short *) &((io_sAgentLocal *) ap->Local)->output_size;
(unsigned short *) &((io_sAgentLocalHilscher *) ap->Local)->output_size;
/* This lets Proview find the IO-area for this module (in this case it is
actually handled at the agent level, thus in this file). The offsets
......@@ -606,7 +606,7 @@ or 127 to set master bus parameters. The bus parameters are read from
the buffer prmdata and shall be of length prmlen. DRV_NO_ERROR is returned
if successful. */
static short
dpm_ddlm_download(io_sAgentLocal *local, unsigned char address,
dpm_ddlm_download(io_sAgentLocalHilscher *local, unsigned char address,
unsigned int prmlen, void *prmdata, io_sAgent *ap)
{
short rv;
......@@ -673,7 +673,7 @@ dpm_ddlm_download(io_sAgentLocal *local, unsigned char address,
/* Configures the master bus parameters of the board referred to by
local, the struct containing the parameters should be passed in op. */
static short
dpm_download_master_prm(io_sAgentLocal *local, pwr_sClass_Pb_Hilscher *op,
dpm_download_master_prm(io_sAgentLocalHilscher *local, pwr_sClass_Pb_Hilscher *op,
io_sAgent *ap)
{
DPM_BUS_DP prm;
......@@ -719,7 +719,7 @@ is passed in local. op holds the slave to configure, the corresponding
agent pointer and rack pointer must be passed in ap and rp respectively.
DRV_NO_ERROR will be returned upon success. */
static short
dpm_download_slave_prm(io_sAgentLocal *local, pwr_sClass_Pb_DP_Slave *op,
dpm_download_slave_prm(io_sAgentLocalHilscher *local, pwr_sClass_Pb_DP_Slave *op,
io_sAgent *ap, io_sRack *rp)
{
unsigned char buf[DPM_MAX_LEN_DATA_UNIT];
......@@ -815,7 +815,7 @@ board referred to by local. The function will return DRV_NO_ERROR if
the request was sent without error, however, it tells us nothing
about whether any diagnostics data was sent back. */
static short
dpm_req_slave_diag(io_sAgentLocal *local, unsigned char address, io_sAgent *ap)
dpm_req_slave_diag(io_sAgentLocalHilscher *local, unsigned char address, io_sAgent *ap)
{
short rv;
RCS_MESSAGETELEGRAM_10 msg;
......@@ -858,7 +858,7 @@ to gather diagnostics data asynchronously. The desired agent's local
struct is passed via local and the associated rack list (Profibus slaves) is
passed in slave_list. */
static void
dpm_update_slave_diag(io_sAgentLocal *local, io_sRack *slave_list,
dpm_update_slave_diag(io_sAgentLocalHilscher *local, io_sRack *slave_list,
io_sAgent *ap)
{
short rv;
......@@ -1000,7 +1000,7 @@ dpm_print_diag(io_sAgent *ap, DPM_DIAGNOSTICS *diag)
If the board was found in the database, the function returns DRV_NO_ERROR
and the startsegment will be written to what db_startsegment points to. */
static short
dpm_check_board_type(io_sAgentLocal *local, io_sAgent *ap,
dpm_check_board_type(io_sAgentLocalHilscher *local, io_sAgent *ap,
unsigned char *db_startsegment)
{
short rv;
......@@ -1064,7 +1064,7 @@ dpm_check_board_type(io_sAgentLocal *local, io_sAgent *ap,
/* Deletes the "PROFIBUS" protocol settings database from the card referred
to by local, this procedure is described on page 32 -- 33 in dpm_pie.pdf. */
static short
dpm_delete_flash_prmdb(io_sAgentLocal *local, io_sAgent *ap)
dpm_delete_flash_prmdb(io_sAgentLocalHilscher *local, io_sAgent *ap)
{
unsigned char db_startsegment;
int s = 3;
......@@ -1151,7 +1151,7 @@ dpm_delete_flash_prmdb(io_sAgentLocal *local, io_sAgent *ap)
/* Wrapper for dpm_init_master(), takes care of checking for (and optionally
removing) the sycon database if present. */
static short
dpm_init_master_check_sycon_db(io_sAgentLocal *local,
dpm_init_master_check_sycon_db(io_sAgentLocalHilscher *local,
pwr_sClass_Pb_Hilscher *op, io_sAgent *ap)
{
short rv;
......@@ -1201,7 +1201,7 @@ IoAgentInit(io_tCtx ctx, io_sAgent *ap)
{
pwr_sClass_Pb_Hilscher *op;
pwr_tStatus status;
io_sAgentLocal *local;
io_sAgentLocalHilscher *local;
char ok;
pwr_tObjid slave_objid;
......@@ -1215,7 +1215,7 @@ IoAgentInit(io_tCtx ctx, io_sAgent *ap)
int retry;
/* Allocates area for local data structure */
ap->Local = calloc(1, sizeof(io_sAgentLocal));
ap->Local = calloc(1, sizeof(io_sAgentLocalHilscher));
if (!ap->Local) {
errh_Error("ERROR config Profibus DP Master %s - %s",
ap->Name, "calloc");
......@@ -1223,7 +1223,7 @@ IoAgentInit(io_tCtx ctx, io_sAgent *ap)
}
/* Handles for easy access to local variables. */
local = (io_sAgentLocal *) ap->Local;
local = (io_sAgentLocalHilscher *) ap->Local;
op = (pwr_sClass_Pb_Hilscher *) ap->op;
op->Status = PB__NOTINIT;
......@@ -1342,7 +1342,7 @@ IoAgentRead(io_tCtx ctx, io_sAgent *ap)
{
pwr_sClass_Pb_Hilscher *mp;
pwr_sClass_Pb_DP_Slave *sp;
io_sAgentLocal *local;
io_sAgentLocalHilscher *local;
io_sRack *slave_list;
pwr_sClass_Pb_Hilscher *op;
......@@ -1352,7 +1352,7 @@ IoAgentRead(io_tCtx ctx, io_sAgent *ap)
DPM_DIAGNOSTICS diag;
/* Handle for local data structure. */
local = (io_sAgentLocal *) ap->Local;
local = (io_sAgentLocalHilscher *) ap->Local;
/*** Data exchange code goes here: ***/
......@@ -1382,7 +1382,7 @@ IoAgentRead(io_tCtx ctx, io_sAgent *ap)
/*** Diagnostics collecting code goes here: ***/
local = (io_sAgentLocal *) ap->Local;
local = (io_sAgentLocalHilscher *) ap->Local;
op = (pwr_sClass_Pb_Hilscher *) ap->op;
/* If everything is fine we should be in state OPERATE.
......@@ -1474,11 +1474,11 @@ IoAgentWrite(io_tCtx ctx, io_sAgent *ap)
{
pwr_sClass_Pb_Hilscher *mp;
pwr_sClass_Pb_DP_Slave *sp;
io_sAgentLocal *local;
io_sAgentLocalHilscher *local;
io_sRack *slave_list;
/* Handle for local data structure. */
local = (io_sAgentLocal *) ap->Local;
local = (io_sAgentLocalHilscher *) ap->Local;
/* Iterates over the slaves on the bus and writes process data to their
respective addresses. This is really the rack level's responsibility,
......@@ -1519,9 +1519,9 @@ IoAgentWrite(io_tCtx ctx, io_sAgent *ap)
static pwr_tStatus
IoAgentClose(io_tCtx ctx, io_sAgent *ap)
{
io_sAgentLocal *local;
io_sAgentLocalHilscher *local;
local = (io_sAgentLocal *) ap->Local;
local = (io_sAgentLocalHilscher *) ap->Local;
dpm_exit(local, ap);
free(local);
......
......@@ -42,8 +42,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
......@@ -52,6 +50,8 @@
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_pb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Pb module Ii
......
......@@ -40,8 +40,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
......@@ -50,6 +48,8 @@
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_pb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Pb module Io
......
......@@ -42,8 +42,6 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include "rt_io_pb_locals.h"
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
......@@ -53,6 +51,8 @@
#include "rt_errh.h"
#include "rt_pb_msg.h"
#include "rt_io_pb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Pb module
\*----------------------------------------------------------------------------*/
......
......@@ -72,12 +72,48 @@
/* io_sAgentLocal now lives in the respective agent modules. */
typedef struct {
int initialized;
typedef struct _io_sRackLocal {
unsigned char fdl;
unsigned char dp;
} io_sRackLocal;
typedef struct {
void *input_area;
void *output_area;
int scancount[IO_MAXCHAN];
} io_sCardLocal;
typedef struct {
unsigned short invoke_id;
unsigned short input_area_size;
unsigned short output_area_size;
unsigned char *input_area;
unsigned char *output_area;
unsigned short byte_ordering;
unsigned short float_representation;
} io_sFDLCardLocal;
typedef struct _agent_args {
void *local;
io_sAgent *ap;
} agent_args;
typedef struct {
int hServiceReadDevice; // Handle for Service device
int hServiceWriteDevice; // Handle for Service device
int hDpDataDevice; // Handle for DP-Data device
int hDpsInputDataDevice; // Handle for DP-Slave Input-Data device
int hDpsOutputDataDevice; // Handle for DP-Slave Output-Data device
unsigned char CurrentBoardNumber;
int slave_diag_requested; // Slave diag requested
int parallel_service; // parallel activity
int hDpsBoardDevice; // Handle for DP-Slave Output-Data device
pthread_t events;
pthread_mutex_t mutex;
agent_args args;
unsigned char fdl;
unsigned char dp;
unsigned char invoke_id;
} io_sAgentLocal;
......@@ -9,6 +9,8 @@ Pb_Ai
Pb_Ao
Pb_Ii
Pb_Io
Pb_FDL_SAP
Pb_FDL_DataTransfer
PnControllerSoftingPNAK
PnDevice
PnModule
......
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