Commit c9fedbbf authored by Claes Sjofors's avatar Claes Sjofors

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

parents 2889b888 f05ac6bb
......@@ -20,3 +20,5 @@
071211 rk mmi Added supgraph mcomp_pb_dp_slave.
080115 cs - Reading of Di, Ai and Ii can be disabled by setting ConversionOn in channel object to 0.
080229 rk - I/O-handling routines generalized and some routines moved to rt_io_bus.c
100708 rk - Added functionality for PROFINET IO using Softing Profinet Stack
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) -L$(elib_dir) $(elinkflags) $(domap) -o $(pwr_exe)/profinet_viewer_gtk \
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/profinet_viewer_gtk \
$(bld_dir)/profinet_viewer_gtk.o \
$(bld_dir)/pn_viewer_gtk.o $(bld_dir)/pn_viewernav_gtk.o \
$(bld_dir)/pn_viewer.o $(bld_dir)/pn_viewernav.o $(bld_dir)/pn_viewer_pnac.o\
$(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o -L/usr/X11R6/lib \
-L/opt/gnome/lib \
-lpwr_flow_gtk -lpwr_flow -lpwr_rt \
-lpwr_cow_gtk -lpwr_cow -lpwr_co -lpwr_flow_gtk -lpwr_flow \
-lpwr_flow_gtk -lpwr_flow -lpwr_rt_gtk -lpwr_rt \
-lpwr_co_gtk -lpwr_co -lpwr_flow_gtk -lpwr_flow \
`pkg-config --libs gtk+-2.0` \
-lpwr_msg_dummy -lantlr \
-lcrypt -lrpcsvc -lpthread -lm -ldb_cxx -lz
-lcrypt -lrpcsvc -lpthread -lm -ldb_cxx -lz -lpnioif
endif
......@@ -23,10 +23,104 @@
#include "co_error.h"
#include "pn_viewer_pnac.h"
#include "profinet.h"
#include "pnak.h"
#include "sys/socket.h"
#include "sys/ioctl.h"
#include "net/if.h"
#include "netinet/in.h"
#include "arpa/inet.h"
#ifndef rt_pn_iface_h
# include "rt_pn_iface.h"
#endif
PnViewerPNAC::PnViewerPNAC( pwr_tStatus *sts)
{
// Init PNAC
int s;
struct ifreq ifr = {};
PnDeviceData *pn_dev_data;
T_PNAK_EVENT_SET_MODE pMode;
T_PNAK_WAIT_OBJECT wait_object;
/* Init PNAC */
local = new io_sAgentLocal;
pnak_init();
*sts = pnak_start_profistack(0, PNAK_CONTROLLER_MODE);
if (*sts != PNAK_OK) {
printf("Starting profistack returned with error code\n");
exit(0);
}
/* Get configs for device */
s = socket(AF_INET, SOCK_DGRAM, 0);
strncpy(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFADDR, &ifr) >= 0) {
strcpy(dev_data.ip_address, inet_ntoa(((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr));
}
if (ioctl(s, SIOCGIFNETMASK, &ifr) >= 0) {
strcpy(dev_data.subnet_mask, inet_ntoa(((struct sockaddr_in *) &ifr.ifr_netmask)->sin_addr));
}
sscanf(dev_data.ip_address, "%hhu.%hhu.%hhu.%hhu", &local->ipaddress[3], &local->ipaddress[2], &local->ipaddress[1], &local->ipaddress[0]) ;
sscanf(dev_data.subnet_mask, "%hhu.%hhu.%hhu.%hhu", &local->subnetmask[3], &local->subnetmask[2], &local->subnetmask[1], &local->subnetmask[0]) ;
strcpy(dev_data.device_name, "dumle");
dev_data.device_num = PN_DEVICE_REFERENCE_THIS_STATION;
strcpy(dev_data.device_text, "controller");
dev_data.vendor_id = 279; // Softing vendor id
dev_data.device_id = 0;
strcpy(dev_data.version, "1.0");
dev_data.byte_order = 0;
pn_dev_data = new PnDeviceData;
pn_dev_data->device_ref = PN_DEVICE_REFERENCE_THIS_STATION;
local->device_data.push_back(pn_dev_data);
/* Download config */
pack_download_req(&local->service_req_res, &dev_data, pn_dev_data->device_ref);
*sts = pnak_send_service_req_res(0, &local->service_req_res);
if (*sts == PNAK_OK) {
*sts = handle_service_con(local, 0);
if (*sts != PNAK_OK) {
/* Loop through devices and calculate offset for io */
}
}
/* Set identification */
pack_set_identification_req(&local->service_req_res);
*sts = pnak_send_service_req_res(0, &local->service_req_res);
if (*sts == PNAK_OK) {
*sts = handle_service_con(local, 0);
}
pMode.Mode = PNAK_MODE_ONLINE;
*sts = pnak_set_mode(0, &pMode);
wait_object = PNAK_WAIT_OBJECT_STATE_CHANGED;
*sts = pnak_wait_for_multiple_objects(0, &wait_object, PNAK_INFINITE_TIMEOUT);
if (*sts != PNAK_OK) {
printf("Setting state failed, sts: %d\r\n", *sts);
return;
}
*sts = 1;
}
......@@ -38,109 +132,102 @@ PnViewerPNAC::~PnViewerPNAC()
void PnViewerPNAC::fetch_devices( vector<PnDevice>& dev_vect)
{
PnDevice d1;
strcpy( d1.devname, "D1");
d1.ipaddress[3] = 168;
d1.ipaddress[2] = 192;
d1.ipaddress[1] = 101;
d1.ipaddress[0] = 56;
d1.macaddress[0] = 255;
d1.macaddress[1] = 255;
d1.macaddress[2] = 255;
d1.macaddress[3] = 36;
d1.macaddress[4] = 9;
d1.macaddress[5] = 22;
d1.vendorid = 42;
d1.deviceid = 769;
dev_vect.push_back(d1);
PnDevice d2;
strcpy( d2.devname, "D2");
d2.ipaddress[3] = 168;
d2.ipaddress[2] = 192;
d2.ipaddress[1] = 101;
d2.ipaddress[0] = 57;
d2.macaddress[0] = 255;
d2.macaddress[1] = 255;
d2.macaddress[2] = 255;
d2.macaddress[3] = 36;
d2.macaddress[4] = 9;
d2.macaddress[5] = 23;
d2.vendorid = 42;
d2.deviceid = 769;
dev_vect.push_back(d2);
PnDevice d3;
strcpy( d3.devname, "D3");
d3.ipaddress[3] = 168;
d3.ipaddress[2] = 192;
d3.ipaddress[1] = 101;
d3.ipaddress[0] = 58;
d3.macaddress[0] = 255;
d3.macaddress[1] = 255;
d3.macaddress[2] = 255;
d3.macaddress[3] = 36;
d3.macaddress[4] = 9;
d3.macaddress[5] = 24;
d3.vendorid = 42;
d3.deviceid = 769;
dev_vect.push_back(d3);
PnDevice d4;
strcpy( d4.devname, "D4");
d4.ipaddress[3] = 168;
d4.ipaddress[2] = 192;
d4.ipaddress[1] = 101;
d4.ipaddress[0] = 59;
d4.macaddress[0] = 255;
d4.macaddress[1] = 255;
d4.macaddress[2] = 255;
d4.macaddress[3] = 36;
d4.macaddress[4] = 9;
d4.macaddress[5] = 25;
d4.vendorid = 42;
d4.deviceid = 769;
dev_vect.push_back(d4);
PnDevice d5;
strcpy( d5.devname, "D5");
d5.ipaddress[3] = 168;
d5.ipaddress[2] = 192;
d5.ipaddress[1] = 101;
d5.ipaddress[0] = 60;
d5.macaddress[0] = 255;
d5.macaddress[1] = 255;
d5.macaddress[2] = 255;
d5.macaddress[3] = 36;
d5.macaddress[4] = 9;
d5.macaddress[5] = 26;
d5.vendorid = 266;
d5.deviceid = 1;
dev_vect.push_back(d5);
PnDevice d6;
strcpy( d6.devname, "D6");
d6.ipaddress[3] = 168;
d6.ipaddress[2] = 192;
d6.ipaddress[1] = 100;
d6.ipaddress[0] = 55;
d6.macaddress[0] = 200;
d6.macaddress[1] = 1;
d6.macaddress[2] = 0;
d6.macaddress[3] = 201;
d6.macaddress[4] = 202;
d6.macaddress[5] = 203;
d6.vendorid = 285;
d6.deviceid = 750;
dev_vect.push_back(d6);
PnDevice device;
unsigned int ii;
int sts;
while (1) {
for (ii = 0; ii < local->dev_info.size(); ii++) {
delete local->dev_info[ii];
}
local->dev_info.clear();
pack_get_los_req(&local->service_req_res);
sts = pnak_send_service_req_res(0, &local->service_req_res);
if (sts == PNAK_OK) {
sts = handle_service_con(local, 0);
if (sts == PNAK_OK) {
if (local->dev_info.size() > 0) {
for (ii = 0; ii < local->dev_info.size(); ii++) {
device.ipaddress[0] = local->dev_info[ii]->ipaddress[0];
device.ipaddress[1] = local->dev_info[ii]->ipaddress[1];
device.ipaddress[2] = local->dev_info[ii]->ipaddress[2];
device.ipaddress[3] = local->dev_info[ii]->ipaddress[3];
device.macaddress[0] = local->dev_info[ii]->macaddress[0];
device.macaddress[1] = local->dev_info[ii]->macaddress[1];
device.macaddress[2] = local->dev_info[ii]->macaddress[2];
device.macaddress[3] = local->dev_info[ii]->macaddress[3];
device.macaddress[4] = local->dev_info[ii]->macaddress[4];
device.macaddress[5] = local->dev_info[ii]->macaddress[5];
strncpy(device.devname, local->dev_info[ii]->devname, sizeof(device.devname));
device.vendorid = local->dev_info[ii]->vendorid;
device.deviceid = local->dev_info[ii]->deviceid;
dev_vect.push_back(device);
}
break;
} else continue;
}
}
}
/* pMode.Mode = PNAK_MODE_OFFLINE;
sts = pnak_set_mode(0, &pMode);
wait_object = PNAK_WAIT_OBJECT_STATE_CHANGED;
sts = pnak_wait_for_multiple_objects(0, &wait_object, PNAK_INFINITE_TIMEOUT);
if (sts != PNAK_OK) {
printf("Setting state failed, sts: %d\r\n", sts);
return;
} */
// if ( ...error... ) throw co_error_str( "Somethings is wrong...");
}
void PnViewerPNAC::set_device_properties( unsigned char *macaddress, unsigned char *ipaddress,
char *devname)
{
printf( "Set %s %hhu.%hhu.%hhu.%hhu\n", devname, ipaddress[3],
ipaddress[2], ipaddress[1], ipaddress[0]);
PnDevice device;
int sts;
PnDeviceInfo dev_info;
/* Set name and ip-address of device */
dev_info.ipaddress[0] = ipaddress[0];
dev_info.ipaddress[1] = ipaddress[1];
dev_info.ipaddress[2] = ipaddress[2];
dev_info.ipaddress[3] = ipaddress[3];
dev_info.subnetmask[0] = local->subnetmask[0];
dev_info.subnetmask[1] = local->subnetmask[1];
dev_info.subnetmask[2] = local->subnetmask[2];
dev_info.subnetmask[3] = local->subnetmask[3];
dev_info.macaddress[0] = macaddress[0];
dev_info.macaddress[1] = macaddress[1];
dev_info.macaddress[2] = macaddress[2];
dev_info.macaddress[3] = macaddress[3];
dev_info.macaddress[4] = macaddress[4];
dev_info.macaddress[5] = macaddress[5];
strncpy(dev_info.devname, devname, sizeof(dev_info.devname));
pack_set_device_name_req(&local->service_req_res, &dev_info);
sts = pnak_send_service_req_res(0, &local->service_req_res);
if (sts == PNAK_OK) {
sts = handle_service_con(local, 0);
}
pack_set_ip_settings_req(&local->service_req_res, &dev_info);
sts = pnak_send_service_req_res(0, &local->service_req_res);
if (sts == PNAK_OK) {
sts = handle_service_con(local, 0);
}
}
......@@ -31,6 +31,18 @@
# include "pn_viewernav.h"
#endif
# include "rt_io_base.h"
#ifndef rt_io_pn_locals_h
# include "rt_io_pn_locals.h"
#endif
#ifndef rt_pn_gsdml_data_h
# include "rt_pn_gsdml_data.h"
#endif
class PnViewerPNAC {
public:
......@@ -40,6 +52,9 @@ class PnViewerPNAC {
void fetch_devices( vector<PnDevice>& dev_vect);
void set_device_properties( unsigned char *macaddress, unsigned char *ipaddress,
char *devname);
GsdmlDeviceData dev_data;
io_sAgentLocal *local;
};
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2010 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* rt_io_m_pnmodule.cpp -- io methods for a profinet device */
#include <vector>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "pwr.h"
#include "co_cdh.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 "profinet.h"
#include "pnak.h"
#include "co_dcli.h"
#include "rt_pn_gsdml_data.h"
#include "rt_io_pn_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Pnmodule
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local;
pwr_sClass_PnModule *op;
op = (pwr_sClass_PnModule *) cp->op;
local = (io_sCardLocal *) cp->Local;
op->Status = PB__NORMAL;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Pn module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local;
pwr_sClass_PnModule *op;
pwr_sClass_PnDevice *slave;
op = (pwr_sClass_PnModule *) cp->op;
local = (io_sCardLocal *) cp->Local;
slave = (pwr_sClass_PnDevice *) rp->op;
op->Status = slave->Status;
/* I/O-read operations should always be made. This ensures correct values */
/* on all inputs. Default StallAction is ResetInputs which means that */
/* all inputs will be zeroed */
io_card_read(ctx, rp, cp, local->input_area, 0, slave->ByteOrdering,
slave->FloatRepresentation);
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Pn module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local;
pwr_sClass_PnModule *op;
pwr_sClass_PnDevice *slave;
op = (pwr_sClass_PnModule *) cp->op;
local = (io_sCardLocal *) cp->Local;
slave = (pwr_sClass_PnDevice *) rp->op;
op->Status = slave->Status;
if (op->Status == PB__NORMAL) {
io_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_sCardLocal *local;
local = (io_sCardLocal *) 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
};
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef rt_io_pn_locals_h
#define rt_io_pn_locals_h
#include "profinet.h"
#include "pnak.h"
/* rt_io_pn_locals.h -- Profinet io handling locals. */
typedef struct _PN_Alarm_Data {
unsigned short alarm_type;
unsigned short alarm_prio;
unsigned short rem_alarms;
unsigned int slot_number;
unsigned int sub_slot_number;
unsigned int module_ident_number;
unsigned int submodule_ident_number;
unsigned short alarm_spec;
unsigned short data_length;
unsigned char *data;
} PN_Alarm_Data;
class PnIOCRData {
public:
PnIOCRData() : type(0), number_modules(0), identifier(0), io_data_length(0) {}
unsigned short type;
unsigned short number_modules;
unsigned short identifier;
unsigned short io_data_length; // bytes of io-data including status;
unsigned short clean_io_data_length; // bytes of io-data including status;
unsigned char *io_data;
unsigned char *clean_io_data;
~PnIOCRData() {}
int print( ofstream& fp);
};
class PnSubmoduleData {
public:
PnSubmoduleData() : subslot_number(0), subslot_idx(0), type(0), state(0), ident_number(0), phys_ident_number(0) {}
unsigned short subslot_number;
unsigned short subslot_idx;
unsigned short type;
unsigned short state;
unsigned int ident_number;
unsigned int phys_ident_number;
unsigned short io_in_data_length; // bytes of pure io-data
unsigned short offset_io_in; // offset in io-data area for this iocr
unsigned short offset_clean_io_in; // offset in io-data area for this iocr
unsigned short offset_status_in; // offset in io-data area for this iocr
unsigned short io_out_data_length; // bytes of pure io-data
unsigned short offset_io_out; // offset in io-data area for this iocr
unsigned short offset_clean_io_out; // offset in io-data area for this iocr
unsigned short offset_status_out; // offset in io-data area for this iocr
~PnSubmoduleData() {}
int print( ofstream& fp);
};
class PnModuleData {
public:
PnModuleData() : slot_number(0), slot_idx(0), state(0), ident_number(0), phys_ident_number(0) {}
unsigned int slot_number;
unsigned int slot_idx;
unsigned short state;
unsigned int ident_number;
unsigned int phys_ident_number;
vector<PnSubmoduleData *> submodule_data;
~PnModuleData() {
for ( unsigned int i = 0; i < submodule_data.size(); i++)
delete submodule_data[i];
}
int print( ofstream& fp);
};
class PnDeviceData {
public:
PnDeviceData() : device_ref(0), alarm_ref(0), device_state(0), no_diff_modules(0) {memset(&alarm_data, 0, sizeof(PN_Alarm_Data));}
unsigned short device_ref;
unsigned short alarm_ref;
unsigned short device_state;
unsigned short no_diff_modules;
PN_Alarm_Data alarm_data;
vector<PnModuleData *> module_data;
vector<PnIOCRData *> iocr_data;
~PnDeviceData() { device_reset();}
void device_reset() {
for ( unsigned int i = 0; i < module_data.size(); i++)
delete module_data[i];
module_data.clear();
for ( unsigned int i = 0; i < iocr_data.size(); i++)
delete iocr_data[i];
iocr_data.clear();
}
int copy_slot( unsigned int slot_idx);
int cut_slot( unsigned int slot_idx);
int paste_slot( unsigned int slot_idx);
};
class PnDeviceInfo {
public:
PnDeviceInfo() {}
unsigned char ipaddress[4];
unsigned char macaddress[6];
unsigned char subnetmask[4];
char devname[80];
int vendorid;
int deviceid;
};
typedef struct _agent_args {
void *local;
io_sAgent *ap;
} agent_args;
class io_sAgentLocal {
public :
io_sAgentLocal() {}
T_PNAK_SERVICE_REQ_RES service_req_res;
T_PNAK_SERVICE_CON service_con;
unsigned char ipaddress[4];
unsigned char macaddress[6];
unsigned char subnetmask[4];
vector<PnDeviceData *> device_data;
vector<PnDeviceInfo *> dev_info;
pthread_t handle_events;
agent_args args;
};
typedef struct _io_sRackLocal {
unsigned short bytes_of_input;
unsigned short bytes_of_output;
unsigned char *inputs;
unsigned char *outputs;
} io_sRackLocal;
typedef struct _io_sCardLocal {
unsigned char *input_area;
unsigned char *output_area;
} io_sCardLocal;
#endif
Pb_Profiboard
Pb_Hilscher
Pb_DP_Slave
Pb_Module
Pb_Di
Pb_Do
Pb_Ai
Pb_Ao
Pb_Ii
Pb_Io
PnControllerSoftingPNAK
PnDevice
PnModule
This diff is collapsed.
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* rt_pn_iface.h -- Profinet driver interface routines */
#ifndef rt_pn_iface_h
#define rt_pn_iface_h
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef rt_pn_gsdml_data_h
#include "rt_pn_gsdml_data.h"
#endif
#ifndef rt_io_pn_locals_h
# include "rt_io_pn_locals_h.h"
#endif
void pack_set_ip_settings_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, PnDeviceInfo *dev_info);
void pack_set_device_name_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, PnDeviceInfo *dev_info);
void pack_set_identification_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes);
void pack_get_device_state_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, unsigned short device_ref);
void pack_get_los_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes);
void pack_get_alarm_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, unsigned short ref);
void pack_alarm_ack_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, unsigned short ref, unsigned short prio);
void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *dev_data, unsigned short device_ref);
int unpack_get_los_con(T_PNAK_SERVICE_DESCRIPTION* pSdb, io_sAgentLocal *local);
int unpack_get_alarm_con(T_PNAK_SERVICE_DESCRIPTION* pSdb, io_sAgentLocal *local, io_sAgent *ap);
int unpack_get_device_state_con(T_PNAK_SERVICE_DESCRIPTION* pSdb, io_sAgentLocal *local, io_sAgent *ap);
int unpack_download_con(T_PNAK_SERVICE_DESCRIPTION* pSdb, io_sAgentLocal *local);
int handle_service_con(io_sAgentLocal *local, io_sAgent *ap);
void handle_exception (io_sAgentLocal *local);
void handle_state_changed (io_sAgentLocal *local);
void handle_device_state_changed (io_sAgentLocal *local, io_sAgent *ap);
void handle_alarm_indication (io_sAgentLocal *local, io_sAgent *ap);
void *handle_events(void *ptr);
#endif
Volume Profibus $ClassVolume 0.0.250.7
Body SysBody 05-SEP-2005 17:51:40.00
Attr NextOix = "_X180"
Attr NextCix = "_X18"
Attr NextTix[0] = "_X9"
Attr NextOix = "_X184"
Attr NextCix = "_X19"
Attr NextTix[0] = "_X10"
EndBody
Object Type $TypeHier 55 16-JAN-2006 10:07:43.21
Object PbNumberRepEnum $TypeDef 1 16-JAN-2006 10:08:18.34
......@@ -293,7 +293,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject
EndObject
Object PnModuleStateEnum $TypeDef 8 12-JAN-2010 17:13:25.79
Body SysBody 12-JAN-2010 17:03:21.67
Body SysBody 10-JUN-2010 10:44:06.67
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
......@@ -325,6 +325,32 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
EndObject
Object PnAlarmPrioEnum $TypeDef 9 10-JUN-2010 10:52:14.50
Body SysBody 10-JUN-2010 10:44:11.25
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
Object None $Value 174 10-JUN-2010 10:44:28.58
Body SysBody 10-JUN-2010 10:44:47.90
Attr Text = "None"
Attr PgmName = "None"
EndBody
EndObject
Object Low $Value 175 10-JUN-2010 10:45:01.28
Body SysBody 10-JUN-2010 10:45:04.64
Attr Text = "Low"
Attr PgmName = "Low"
Attr Value = 1
EndBody
EndObject
Object High $Value 176 10-JUN-2010 10:45:11.89
Body SysBody 10-JUN-2010 10:45:17.29
Attr Text = "High"
Attr PgmName = "High"
Attr Value = 2
EndBody
EndObject
EndObject
EndObject
Object Class $ClassHier 1 16-JAN-2006 10:07:45.26
Object Pb_Ai $ClassDef 2 16-JAN-2006 09:46:40.49
......@@ -1353,7 +1379,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
EndObject
Object PostCreate $DbCallBack 175 05-OCT-2010 16:25:39.14
Object PostCreate $DbCallBack 182 05-OCT-2010 16:25:39.14
Body SysBody 05-OCT-2010 16:25:47.90
Attr MethodName = "BaseIORack-PostCreate"
EndBody
......@@ -1688,7 +1714,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
EndObject
Object PostCreate $DbCallBack 174 05-OCT-2010 16:24:53.44
Object PostCreate $DbCallBack 181 05-OCT-2010 16:24:53.44
Body SysBody 05-OCT-2010 16:25:08.43
Attr MethodName = "BaseIOCard-PostCreate"
EndBody
......@@ -2072,7 +2098,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
EndObject
Object PostCreate $DbCallBack 176 05-OCT-2010 16:25:58.92
Object PostCreate $DbCallBack 183 05-OCT-2010 16:25:58.92
Body SysBody 05-OCT-2010 16:26:04.76
Attr MethodName = "BaseIORack-PostCreate"
EndBody
......@@ -2432,6 +2458,79 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
EndObject
Object PnAlarm $ClassDef 18 10-JUN-2010 10:39:40.30
Body SysBody 10-JUN-2010 10:39:35.83
Attr Editor = 0
Attr Method = 0
Attr Flags = 16
EndBody
Object RtBody $ObjBodyDef 1 10-JUN-2010 10:40:04.61
Body SysBody 10-JUN-2010 10:40:04.61
Attr StructName = "PnAlarm"
Attr NextAix = "_X9"
EndBody
Object Type $Attribute 1 10-JUN-2010 10:53:19.20
Body SysBody 30-JUN-2010 11:02:27.88
Attr PgmName = "Type"
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object Prio $Attribute 2 10-JUN-2010 10:53:36.41
Body SysBody 30-JUN-2010 11:02:47.21
Attr PgmName = "Prio"
Attr Flags = 1024
Attr TypeRef = "Profibus:Type-PnAlarmPrioEnum"
EndBody
EndObject
Object Remaining $Attribute 3 10-JUN-2010 10:54:32.69
Body SysBody 30-JUN-2010 11:02:51.79
Attr PgmName = "Remaining"
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object SlotNumber $Attribute 4 10-JUN-2010 11:48:57.48
Body SysBody 30-JUN-2010 11:02:56.16
Attr PgmName = "SlotNumber"
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object SubslotNumber $Attribute 5 10-JUN-2010 11:49:10.13
Body SysBody 30-JUN-2010 11:03:00.65
Attr PgmName = "SubslotNumber"
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object ModuleIdentNumber $Attribute 6 10-JUN-2010 11:49:40.15
Body SysBody 30-JUN-2010 11:03:04.71
Attr PgmName = "ModuleIdentNumber"
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object SubmoduleIdentNumber $Attribute 7 10-JUN-2010 11:49:56.34
Body SysBody 30-JUN-2010 11:03:09.13
Attr PgmName = "SubmoduleIdentNumber"
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object Specifier $Attribute 8 10-JUN-2010 12:52:57.01
Body SysBody 30-JUN-2010 11:03:34.57
Attr PgmName = "Specifier"
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
EndObject
Object Template PnAlarm 2152431616 01-JAN-1970 01:00:00.00
Body RtBody 01-JAN-1970 01:00:00.00
EndBody
EndObject
EndObject
Object PnControllerSoftingPNAK $ClassDef 15 21-APR-2009 13:41:08.17
Body SysBody 21-APR-2009 13:41:08.17
Attr Editor = 0
......@@ -2440,7 +2539,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
Object RtBody $ObjBodyDef 1 21-APR-2009 13:41:08.17
Body SysBody 21-APR-2009 13:41:08.17
Attr StructName = "Pb_Profiboard"
Attr StructName = "PnControllerSoftingPNAK"
Attr NextAix = "_X58"
EndBody
Object Description $Attribute 53 21-APR-2009 13:41:08.17
......@@ -2523,7 +2622,7 @@ Volume Profibus $ClassVolume 0.0.250.7
Object RtBody $ObjBodyDef 1 21-APR-2009 13:41:08.17
Body SysBody 21-APR-2009 13:41:08.17
Attr StructName = "PnDevice"
Attr NextAix = "_X102"
Attr NextAix = "_X105"
EndBody
Object Description $Attribute 87 21-APR-2009 13:41:08.17
Body SysBody 21-APR-2009 13:41:08.17
......@@ -2588,10 +2687,10 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
Object State $Attribute 97 12-JAN-2010 17:06:58.08
Body SysBody 12-JAN-2010 17:09:22.26
Body SysBody 10-JUN-2010 10:30:30.44
Attr PgmName = "State"
Attr Flags = 3072
Attr TypeRef = "pwrs:Type-$UInt16"
Attr TypeRef = "Profibus:Type-PnDeviceStateEnum"
EndBody
EndObject
Object NoDiffModules $Attribute 98 12-JAN-2010 17:09:39.73
......@@ -2609,7 +2708,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
Object ErrModuleState $Attribute 100 12-JAN-2010 17:11:23.49
Body SysBody 12-JAN-2010 17:13:58.39
Body SysBody 10-JUN-2010 10:30:12.41
Attr PgmName = "ErrModuleState"
Attr Flags = 3072
Attr TypeRef = "Profibus:Type-PnModuleStateEnum"
......@@ -2622,6 +2721,25 @@ Volume Profibus $ClassVolume 0.0.250.7
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object ByteOrdering $Attribute 102 09-JUN-2010 10:31:22.82
Body SysBody 09-JUN-2010 10:31:22.82
Attr PgmName = "ByteOrdering"
Attr TypeRef = "pwrb:Type-ByteOrderingEnum"
EndBody
EndObject
Object FloatRepresentation $Attribute 103 09-JUN-2010 10:31:22.82
Body SysBody 09-JUN-2010 10:31:22.82
Attr PgmName = "FloatRepresentation"
Attr TypeRef = "pwrb:Type-FloatRepEnum"
EndBody
EndObject
Object Alarm $Attribute 104 10-JUN-2010 11:50:27.33
Body SysBody 10-JUN-2010 11:51:43.64
Attr PgmName = "Alarm"
Attr Flags = 131072
Attr TypeRef = "Profibus:Class-PnAlarm"
EndBody
EndObject
EndObject
Object ConfiguratorPosnn $Menu 122 21-APR-2009 13:41:08.17
Object Pointed $Menu 123 21-APR-2009 13:41:08.17
......@@ -2758,8 +2876,10 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
Object Template PnDevice 2151907328 01-JAN-1970 01:00:00.00
Body RtBody 05-OCT-2010 10:58:35.33
Body RtBody 30-JUN-2010 11:04:35.19
Attr Process = 1
Attr ErrorSoftLimit = 100
Attr ErrorHardLimit = 1000
EndBody
EndObject
EndObject
......@@ -2860,7 +2980,8 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
Object Template PnModule 2152169472 01-JAN-1970 01:00:00.00
Body RtBody 01-JAN-1970 01:00:00.00
Body RtBody 30-JUN-2010 11:04:44.11
Attr Process = 1
EndBody
EndObject
EndObject
......
......@@ -34,6 +34,11 @@
#include "pwr_baseclasses.h"
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct io_sCtx *io_tCtx;
#ifndef rt_io_supervise_h
......@@ -274,4 +279,8 @@ int io_CheckClassIoType(
void io_methods_print();
#ifdef __cplusplus
}
#endif
#endif
......@@ -592,10 +592,13 @@ void io_card_write(
value = chan_ao->ActValRangeLow;
rawvalue = chan_ao->OutPolyCoef1 * value + chan_ao->OutPolyCoef0;
if ( rawvalue > 0)
rawvalue = rawvalue + 0.5;
else
rawvalue = rawvalue - 0.5;
if (chan_ao->Representation != pwr_eDataRepEnum_Float32) {
if ( rawvalue > 0)
rawvalue = rawvalue + 0.5;
else
rawvalue = rawvalue - 0.5;
}
// sig_ao->RawValue = 0;
......
......@@ -34,6 +34,11 @@
#include "pwr_baseclasses.h"
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef rt_io_supervise_h
#include "rt_io_supervise.h"
#endif
......@@ -78,4 +83,8 @@ void io_card_write(
pwr_tFloatRepEnum float_rep
);
#ifdef __cplusplus
}
#endif
#endif
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