Commit 09d072f4 authored by claes's avatar claes

Support for IO board Hilscher cifX added

parent 15911f49
typedef struct {
unsigned long channel;
unsigned long board;
CIFXHANDLE chan;
unsigned int diag_cnt;
unsigned int diag_interval;
unsigned int dev_init;
unsigned int dev_init_cnt;
unsigned int dev_init_limit;
int input_area_size;
int output_area_size;
void *input_area;
void *output_area;
} io_sLocalHilscher_cifX_Master;
typedef struct {
int byte_ordering;
int float_representation;
} io_sLocalHilscher_cifX_Device;
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_io_m_hilscher_cifx_module.c -- I/O methods for class Hilscher_cifX_Module. */
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "co_cdh.h"
#include "rt_io_base.h"
#include "rt_io_bus.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
#include "rt_io_msg.h"
#if defined PWRE_CONF_CIFX
static pwr_tStatus IoCardInit( io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
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
};
......@@ -101,7 +101,7 @@ static pwr_tStatus IoCardRead (
}
if (slave->Status == MB__NORMAL) {
io_card_read(ctx, rp, cp, local->input_area, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_read(ctx, rp, cp, local->input_area, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS;
......@@ -142,7 +142,7 @@ static pwr_tStatus IoCardWrite (
}
if (slave->Status == MB__NORMAL) {
io_card_write(ctx, cp, local->output_area, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_write(ctx, cp, local->output_area, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
......
......@@ -98,7 +98,7 @@ static pwr_tStatus IoCardRead (
if (server->Status == MB__NORMAL) {
thread_MutexLock( &local_server->mutex);
io_card_read(ctx, rp, cp, local->input_area, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_read(ctx, rp, cp, local->input_area, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock( &local_server->mutex);
}
......@@ -133,7 +133,7 @@ static pwr_tStatus IoCardWrite (
if (server->Status == MB__NORMAL) {
thread_MutexLock( &local_server->mutex);
io_card_write(ctx, cp, local->output_area, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_write(ctx, cp, local->output_area, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock( &local_server->mutex);
}
......
......@@ -12,4 +12,6 @@ GPIO_Module
Maxim_DS18B20
USB_Agent
Velleman_K8055_Board
Hilscher_cifX_Master
Hilscher_cifX_Module
#endif
\ No newline at end of file
This diff is collapsed.
......@@ -87,7 +87,7 @@ static pwr_tStatus IoCardRead (
/* on all inputs. Default StallAction is ResetInputs which means that */
/* all inputs will be zeroed */
io_card_read(ctx, rp, cp, local->input_area, slave->Diag, slave->ByteOrdering,
io_bus_card_read(ctx, rp, cp, local->input_area, slave->Diag, slave->ByteOrdering,
slave->FloatRepresentation);
// printf("Method Pb_Module-IoCardRead\n");
......@@ -116,7 +116,7 @@ static pwr_tStatus IoCardWrite (
op->Status = slave->Status;
if (op->Status == PB__NORMAL) {
io_card_write(ctx, cp, local->output_area, slave->ByteOrdering,
io_bus_card_write(ctx, cp, local->output_area, slave->ByteOrdering,
slave->FloatRepresentation);
}
// printf("Method Pb_Module-IoCardWrite\n");
......
......@@ -88,7 +88,7 @@ static pwr_tStatus IoCardRead (
/* 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,
io_bus_card_read(ctx, rp, cp, local->input_area, 0, slave->ByteOrdering,
slave->FloatRepresentation);
return IO__SUCCESS;
......@@ -116,7 +116,7 @@ static pwr_tStatus IoCardWrite (
op->Status = slave->Status;
if (op->Status == PB__NORMAL) {
io_card_write(ctx, cp, local->output_area, slave->ByteOrdering,
io_bus_card_write(ctx, cp, local->output_area, slave->ByteOrdering,
slave->FloatRepresentation);
}
// printf("Method Pb_Module-IoCardWrite\n");
......
......@@ -178,7 +178,7 @@ a realtime database, rtdb. The transfer from the Workbench to rtdb is done with
loadfiles, files that are generated from the Workbench and contains all its objects.
<h1>Control program
Proview offers a graphical programming language in witch logic, Grafcet sequences and control
Proview offers a graphical programming language in which logic, Grafcet sequences and control
loops is programmed. It is named the PLC program. Also the PLC program is a part of the object
tree. It is configured by placing specific program objects, PlcPgm, in the Plant hierarchy.
When opening a PlcPgm you enter the Plc Editor, in which the graphical programming is preformed.
......@@ -7393,7 +7393,7 @@ IndError in the main object, and color the symbol yellow or red, or flashing red
are set.
<image> ced_fig20.gif
<b>The grahic symbol is drawn in Ge witch HostObject default dynamic.
<b>The grahic symbol is drawn in Ge with HostObject default dynamic.
......
......@@ -2541,7 +2541,8 @@ pwr_tStatus io_init (
{
if ( rp->Process & process)
{
if ( rp->Init != NULL)
if ( rp->Init != NULL &&
!rp->MethodDisabled)
{
sts = (rp->Init) ( *ctx, ap, rp);
if ( EVEN(sts)) return sts;
......@@ -2551,7 +2552,8 @@ pwr_tStatus io_init (
}
for ( cp = rp->cardlist; cp != NULL; cp = cp->next)
{
if ( cp->Init != NULL)
if ( cp->Init != NULL &&
!cp->MethodDisabled)
{
sts = (cp->Init) ( *ctx, ap, rp, cp);
if ( EVEN(sts)) return sts;
......@@ -2670,7 +2672,8 @@ pwr_tStatus io_read(
for ( rp = ap->racklist; rp != NULL; rp = rp->next)
{
if ( rp->Process & ctx->Process &&
rp->Action & io_mAction_Read)
rp->Action & io_mAction_Read &&
!rp->MethodDisabled)
{
if ( rp->scan_interval_cnt <= 1)
{
......@@ -2684,7 +2687,8 @@ pwr_tStatus io_read(
for ( cp = rp->cardlist; cp != NULL; cp = cp->next)
{
if ( cp->Action & io_mAction_Read)
if ( cp->Action & io_mAction_Read &&
!cp->MethodDisabled)
{
if ( cp->scan_interval_cnt <= 1)
{
......@@ -2728,7 +2732,7 @@ pwr_tStatus io_write(
{
for ( cp = rp->cardlist; cp != NULL; cp = cp->next)
{
if ( cp->Action & io_mAction_Write)
if ( cp->Action & io_mAction_Write && !cp->MethodDisabled)
{
if ( cp->scan_interval_cnt <= 1)
{
......@@ -2741,7 +2745,8 @@ pwr_tStatus io_write(
}
}
if ( rp->Process & ctx->Process &&
rp->Action & io_mAction_Write)
rp->Action & io_mAction_Write &&
!rp->MethodDisabled)
{
if ( rp->scan_interval_cnt <= 1)
{
......@@ -2803,7 +2808,8 @@ pwr_tStatus io_swap(
for ( rp = ap->racklist; rp != NULL; rp = rp->next)
{
if (rp->Action & io_mAction_Swap)
if (rp->Action & io_mAction_Swap &&
!rp->MethodDisabled)
{
if ( rp->scan_interval_cnt <= 1)
{
......@@ -2817,7 +2823,8 @@ pwr_tStatus io_swap(
for ( cp = rp->cardlist; cp != NULL; cp = cp->next)
{
if (cp->Action & io_mAction_Swap)
if (cp->Action & io_mAction_Swap &&
!cp->MethodDisabled)
{
if ( cp->scan_interval_cnt <= 1)
{
......
......@@ -116,7 +116,7 @@ typedef struct s_Card {
pwr_tStatus (* Close) (); /* Close method */
pwr_tStatus (* Read) (); /* Read method */
pwr_tStatus (* Write) (); /* Write method */
pwr_tStatus (* Swap) (); /* Write method */
pwr_tStatus (* Swap) (); /* Swap method */
pwr_tAddress *op; /* Pointer to card object */
pwr_tDlid Dlid; /* Dlid for card object pointer */
pwr_tUInt32 size; /* Size of card data area in byte */
......@@ -127,6 +127,7 @@ typedef struct s_Card {
int ChanListSize; /* Size of chanlist */
io_sChannel *chanlist; /* Array of channel structures */
void *Local; /* Pointer to method defined data structure */
int MethodDisabled; /* Card method disabled */
struct s_Card *next; /* Next card */
} io_sCard;
......@@ -150,6 +151,7 @@ typedef struct s_Rack {
int AgentControlled;/* TRUE if kontrolled by agent */
io_sCard *cardlist; /* List of card structures */
void *Local; /* Pointer to method defined data structure */
int MethodDisabled; /* Rack method disabled */
struct s_Rack *next; /* Next rack */
} io_sRack;
......@@ -163,7 +165,7 @@ typedef struct s_Agent {
pwr_tStatus (* Close) (); /* Close method */
pwr_tStatus (* Read) (); /* Read method */
pwr_tStatus (* Write) (); /* Write method */
pwr_tStatus (* Swap) (); /* Write method */
pwr_tStatus (* Swap) (); /* Swap method */
void *op; /* Pointer to agent object */
pwr_tDlid Dlid; /* Dlid for agent object pointer */
int scan_interval; /* Interval between scans */
......
......@@ -180,18 +180,129 @@ static void ConvertAi ( io_tCtx ctx,
}
/*----------------------------------------------------------------------------*\
Initialization of ai signals and channels.
Initialization of a bus card.
\*----------------------------------------------------------------------------*/
void io_card_read(
io_tCtx ctx,
pwr_tStatus io_bus_card_init( io_tCtx ctx,
io_sCard *cp,
unsigned int *input_area_offset,
unsigned int *input_area_chansize,
unsigned int *output_area_offset,
unsigned int *output_area_chansize,
pwr_tByteOrderingEnum byte_order)
{
int i;
for ( i = 0; i < cp->ChanListSize; i++) {
io_sChannel *chanp = &cp->chanlist[i];
if ( !chanp->sop)
continue;
switch (chanp->ChanClass) {
case pwr_cClass_ChanDi: {
pwr_sClass_ChanDi *chan_di = (pwr_sClass_ChanDi *) chanp->cop;
if (chan_di->Number == 0) {
*input_area_offset += *input_area_chansize;
*input_area_chansize = GetChanSize( chan_di->Representation);
}
chanp->offset = *input_area_offset;
chanp->mask = 1 << chan_di->Number;
if ( byte_order == pwr_eByteOrderingEnum_BigEndian) {
if ( chan_di->Representation == pwr_eDataRepEnum_Bit16)
chanp->mask = swap16( (unsigned short)chanp->mask);
else if ( chan_di->Representation == pwr_eDataRepEnum_Bit32)
chanp->mask = swap32( chanp->mask);
}
break;
}
case pwr_cClass_ChanAi: {
pwr_sClass_ChanAi *chan_ai = (pwr_sClass_ChanAi *) chanp->cop;
*input_area_offset += *input_area_chansize;
*input_area_chansize = GetChanSize(chan_ai->Representation);
chanp->offset = *input_area_offset;
chanp->size = *input_area_chansize;
chanp->mask = 0;
io_AiRangeToCoef(chanp);
break;
}
case pwr_cClass_ChanAit: {
pwr_sClass_ChanAit *chan_ai = (pwr_sClass_ChanAit *) chanp->cop;
*input_area_offset += *input_area_chansize;
*input_area_chansize = GetChanSize(chan_ai->Representation);
chanp->offset = *input_area_offset;
chanp->size = *input_area_chansize;
chanp->mask = 0;
io_AiRangeToCoef(chanp);
break;
}
case pwr_cClass_ChanIi: {
pwr_sClass_ChanIi *chan_ii = (pwr_sClass_ChanIi *) chanp->cop;
*input_area_offset += *input_area_chansize;
*input_area_chansize = GetChanSize(chan_ii->Representation);
chanp->offset = *input_area_offset;
chanp->size = *input_area_chansize;
chanp->mask = 0;
break;
}
case pwr_cClass_ChanDo: {
pwr_sClass_ChanDo *chan_do = (pwr_sClass_ChanDo *) chanp->cop;
if (chan_do->Number == 0) {
*output_area_offset += *output_area_chansize;
*output_area_chansize = GetChanSize( chan_do->Representation);
}
chanp->offset = *output_area_offset;
chanp->mask = 1 << chan_do->Number;
if ( byte_order == pwr_eByteOrderingEnum_BigEndian) {
if ( chan_do->Representation == pwr_eDataRepEnum_Bit16)
chanp->mask = swap16( (unsigned short)chanp->mask);
else if ( chan_do->Representation == pwr_eDataRepEnum_Bit32)
chanp->mask = swap32( chanp->mask);
}
break;
}
case pwr_cClass_ChanAo: {
pwr_sClass_ChanAo *chan_ao = (pwr_sClass_ChanAo *) chanp->cop;
*output_area_offset += *output_area_chansize;
*output_area_chansize = GetChanSize(chan_ao->Representation);
chanp->offset = *output_area_offset;
chanp->size = *output_area_chansize;
chanp->mask = 0;
io_AoRangeToCoef(chanp);
break;
}
case pwr_cClass_ChanIo: {
pwr_sClass_ChanIo *chan_io = (pwr_sClass_ChanIo *) chanp->cop;
*output_area_offset += *output_area_chansize;
*output_area_chansize = GetChanSize(chan_io->Representation);
chanp->offset = *output_area_offset;
chanp->size = *output_area_chansize;
chanp->mask = 0;
break;
}
}
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for bus-card
\*----------------------------------------------------------------------------*/
void io_bus_card_read( io_tCtx ctx,
io_sRack *rp,
io_sCard *cp,
void *input_area,
void *diag_area,
pwr_tByteOrderingEnum byte_order,
pwr_tFloatRepEnum float_rep
)
pwr_tFloatRepEnum float_rep)
{
io_sChannel *chanp;
pwr_sClass_ChanDi *chan_di;
......@@ -485,14 +596,11 @@ void io_card_read(
\*----------------------------------------------------------------------------*/
void io_card_write(
io_tCtx ctx,
void io_bus_card_write( io_tCtx ctx,
io_sCard *cp,
void *output_area,
pwr_tByteOrderingEnum byte_order,
pwr_tFloatRepEnum float_rep
)
pwr_tFloatRepEnum float_rep)
{
io_sChannel *chanp;
......
......@@ -65,23 +65,27 @@ unsigned short swap16(unsigned short in);
unsigned int swap32(unsigned int in);
void io_card_read(
io_tCtx ctx,
pwr_tStatus io_bus_card_init( io_tCtx ctx,
io_sCard *cp,
unsigned int *input_area_offset,
unsigned int *input_area_chansize,
unsigned int *output_area_offset,
unsigned int *output_area_chansize,
pwr_tByteOrderingEnum byte_order);
void io_bus_card_read( io_tCtx ctx,
io_sRack *rp,
io_sCard *cp,
void *input_area,
void *diag_area,
pwr_tByteOrderingEnum byte_order,
pwr_tFloatRepEnum float_rep
);
pwr_tFloatRepEnum float_rep);
void io_card_write(
io_tCtx ctx,
void io_bus_card_write( io_tCtx ctx,
io_sCard *cp,
void *output_area,
pwr_tByteOrderingEnum byte_order,
pwr_tFloatRepEnum float_rep
);
pwr_tFloatRepEnum float_rep);
#ifdef __cplusplus
}
......
......@@ -116,7 +116,7 @@ pwre_config_check_lib()
elif test $4 == "wmq"; then
conf_libwmq=$conf_libwmq" -l${lib%.*}"
else
conf_lib=$conf_lib" -l${lib%.*}"
conf_lib=$conf_lib" -l${lib%%.*}"
fi
elif test $3 == "gtk"; then
conf_libgtk=$conf_libgtk" \\\`pkg-config --libs gtk+-2.0\\\`"
......@@ -318,6 +318,7 @@ else
pwre_config_check_lib wmq WMQ lib wmq 1 /usr/lib/libmqic.so
pwre_config_check_lib libpnioif PNAK lib lib 1 /usr/lib/libpnioif.a:/usr/local/lib/libpnioif.a
pwre_config_check_lib libusb LIBUSB lib lib 1 /usr/lib/libusb-1.0.so
pwre_config_check_lib libcifx LIBCIFX lib lib 1 /usr/lib/libcifx.so.1
pwre_config_check_lib librt LIBRT lib lib 0 /usr/lib/librt.so:/usr/lib/librt.a
pwre_config_check_lib libfl LIBFL lib lib 0 /usr/lib/libfl.so:/usr/lib/libfl.a
pwre_config_check_lib libX11 LIBX11 lib lib 0 /usr/lib/libX11.so
......@@ -329,6 +330,7 @@ else
pwre_config_check_include jni JNI 1 $jdk/include/jni.h
pwre_config_check_include jni JNI 0 $jdk/include/linux/jni_md.h
pwre_config_check_include wmq WMQ 1 /opt/mqm/inc/cmqc.h
pwre_config_check_include cifx CIFX 1 /usr/local/include/cifx/cifxlinux.h
export pwre_conf_alsa=1
......
......@@ -41,7 +41,7 @@ SObject pwrb:Class
Attr StructName = "Max"
EndBody
!/**
! Integer input.
! Analog input.
!*/
Object In1 $Input 1
Body SysBody
......@@ -51,7 +51,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In2 $Input 2
Body SysBody
......@@ -61,7 +61,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In3 $Input 3
Body SysBody
......@@ -71,7 +71,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In4 $Input 4
Body SysBody
......@@ -81,7 +81,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In5 $Input 5
Body SysBody
......@@ -91,7 +91,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In6 $Input 6
Body SysBody
......@@ -101,7 +101,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In7 $Input 7
Body SysBody
......@@ -111,7 +111,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In8 $Input 8
Body SysBody
......
......@@ -41,7 +41,7 @@ SObject pwrb:Class
Attr StructName = "Min"
EndBody
!/**
! Integer input.
! Analog input.
!*/
Object In1 $Input 1
Body SysBody
......@@ -51,7 +51,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In2 $Input 2
Body SysBody
......@@ -61,7 +61,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In3 $Input 3
Body SysBody
......@@ -71,7 +71,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In4 $Input 4
Body SysBody
......@@ -81,7 +81,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In5 $Input 5
Body SysBody
......@@ -91,7 +91,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In6 $Input 6
Body SysBody
......@@ -101,7 +101,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In7 $Input 7
Body SysBody
......@@ -111,7 +111,7 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Integer input.
! Analog input.
!*/
Object In8 $Input 8
Body SysBody
......
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