Commit e5b9d057 authored by claes's avatar claes

Module profibus created

parent ee9f4177
/*
* Proview $Id: rt_io_m_pb_ai.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_ai.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -38,6 +38,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......
/*
* Proview $Id: rt_io_m_pb_ao.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_ao.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -36,6 +36,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......
/*
* Proview $Id: rt_io_m_pb_di.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_di.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -36,6 +36,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......
/*
* Proview $Id: rt_io_m_pb_do.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_do.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -36,6 +36,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......
/*
* Proview $Id: rt_io_m_pb_dp_slave.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_dp_slave.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -36,6 +36,7 @@
#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_msg.h"
......
/*
* Proview $Id: rt_io_m_pb_ii.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_ii.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -35,6 +35,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......
/*
* Proview $Id: rt_io_m_pb_io.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_io.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -33,6 +33,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......
/*
* Proview $Id: rt_io_m_pb_module.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_module.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -35,6 +35,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......
/*
* Proview $Id: rt_io_m_pb_profiboard.c,v 1.1 2006-01-16 10:55:42 claes Exp $
* Proview $Id: rt_io_m_pb_profiboard.c,v 1.2 2006-01-16 13:56:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -39,6 +39,7 @@
#include "pwr.h"
#include "co_cdh.h"
#include "pwr_baseclasses.h"
#include "pwr_profibusclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
......@@ -449,7 +450,7 @@ static pwr_tStatus IoAgentInit (
while (ODD(status)) {
status = gdh_GetObjectClass(slave_objid, &slave_class);
if (slave_class == pwr_cClass_Pb_DP_Slave) {
if (slave_class == pwr_cClass_Pb_DP_Slave ) {
status = init_dp_slave(ap, slave_objid);
op->NumberSlaves++;
}
......
This diff is collapsed.
/*
* Proview $Id: rt_io_profiboard.h,v 1.1 2006-01-16 13:56:52 claes Exp $
* 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_M_PB_UTILS__
#define __RT_IO_M_PB_UTILS__
#define PB_OK 0
#define PB_DEVICE_ERROR 1
#define PB_READ_ERROR 2
#define PB_WRITE_ERROR 3
#define PB_NO_CON_IND_RECEIVED 4
#define PB_NEG_CONF 5
extern
unsigned short swap16(unsigned short in);
extern
unsigned int swap32(unsigned int in);
extern
pwr_tUInt16 pb_cmi_init(int fp);
extern
pwr_tUInt16 pb_cmi_write(int fp,
T_PROFI_SERVICE_DESCR *sdb_ptr,
void *data_ptr,
pwr_tUInt16 data_len);
extern
pwr_tUInt16 pb_set_stalltime(int fp, unsigned short t);
extern
pwr_tUInt16 pb_cmi_read(int fp,
T_PROFI_SERVICE_DESCR *sdb_ptr,
void *data_ptr,
pwr_tUInt16 *data_len_ptr);
extern
pwr_tUInt16 pb_cmi_poll(int fp,
T_PROFI_SERVICE_DESCR *sdb_ptr,
void *data_ptr,
pwr_tUInt16 *data_len_ptr);
extern
pwr_tUInt16 pb_cmi_flush(int fp);
extern
pwr_tUInt16 pb_cmi_get_data(int fp,
pwr_tUInt8 data_id,
pwr_tUInt16 offset,
pwr_tUInt16 data_size,
void *data_ptr);
extern
pwr_tUInt16 pb_cmi_set_data(int fp,
pwr_tUInt8 data_id,
pwr_tUInt16 offset,
pwr_tUInt16 data_size,
void *data_ptr);
extern
pwr_tUInt16 pb_get_slave_info(int fp,
pwr_tUInt16 slave_address,
pwr_tUInt16 *offset_inputs,
pwr_tUInt16 *offset_outputs,
pwr_tUInt16 *bytes_of_input,
pwr_tUInt16 *bytes_of_output);
extern
pwr_tUInt16 pb_get_slave_cfg(int fp,
pwr_tUInt16 slave_address,
pwr_tUInt16 *cfg_data_len,
void *cfg_data);
extern
pwr_tUInt16 pb_download_all(int fp,
pwr_tUInt16 slave_address,
pwr_tUInt8 wd_fact1,
pwr_tUInt8 wd_fact2,
pwr_tUInt8 min_tsdr,
pwr_tUInt16 ident_number,
pwr_tUInt8 group_ident,
pwr_tUInt16 prm_user_data_len,
void *prm_user_data,
pwr_tUInt16 cfg_data_len,
void *cfg_data);
#endif
Pb_Profiboard
Pb_DP_Slave
Pb_Module
Pb_Di
Pb_Do
Pb_Ai
Pb_Ao
Pb_Ii
Pb_Io
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
/*
* Proview $Id: wb_c_pb_dp_slave.c,v 1.1 2006-01-16 13:56:52 claes Exp $
* 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.
**/
/* wb_c_pb_dp_slave.c -- work bench methods of the Pb_DP_Slave class. */
#include <X11/Intrinsic.h>
#undef Status
#include "wb_pwrs.h"
#include "pwr_baseclasses.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_pwrb_msg.h"
#include "wb_api.h"
/*----------------------------------------------------------------------------*\
Configure the slave from gsd file.
\*----------------------------------------------------------------------------*/
static pwr_tStatus Configure (
ldh_sMenuCall *ip
)
{
pwr_tOName name;
char *gsd;
int size;
int sts;
pwr_tCmd cmd;
sts = ldh_ObjidToName(ip->PointedSession, ip->Pointed.Objid,
ldh_eName_Hierarchy, name, sizeof(name), &size);
if ( EVEN(sts)) return sts;
sts = ldh_GetObjectPar( ip->PointedSession, ip->Pointed.Objid, "RtBody",
"GSDfile", &gsd, &size);
if ( EVEN(sts)) return sts;
if ( strcmp( gsd, "") == 0) {
free( gsd);
return 1;
}
free( gsd);
sprintf( cmd, "@$pwr_exe/pb_slave_config %s", name);
wtt_command( ip->EditorContext, cmd);
return 1;
}
static pwr_tStatus ConfigureFilter (
ldh_sMenuCall *ip
)
{
char *gsd;
int size;
int sts;
sts = ldh_GetObjectPar( ip->PointedSession, ip->Pointed.Objid, "RtBody",
"GSDfile", &gsd, &size);
if ( EVEN(sts)) return sts;
if ( strcmp( gsd, "") == 0) {
free( gsd);
return 0;
}
free( gsd);
return 1;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindMethods(Pb_DP_Slave) = {
pwr_BindMethod(Configure),
pwr_BindMethod(ConfigureFilter),
pwr_NullMethod
};
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