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 ( ...@@ -101,7 +101,7 @@ static pwr_tStatus IoCardRead (
} }
if (slave->Status == MB__NORMAL) { 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"); // printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS; return IO__SUCCESS;
...@@ -142,7 +142,7 @@ static pwr_tStatus IoCardWrite ( ...@@ -142,7 +142,7 @@ static pwr_tStatus IoCardWrite (
} }
if (slave->Status == MB__NORMAL) { 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"); // printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS; return IO__SUCCESS;
......
...@@ -98,7 +98,7 @@ static pwr_tStatus IoCardRead ( ...@@ -98,7 +98,7 @@ static pwr_tStatus IoCardRead (
if (server->Status == MB__NORMAL) { if (server->Status == MB__NORMAL) {
thread_MutexLock( &local_server->mutex); 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); thread_MutexUnlock( &local_server->mutex);
} }
...@@ -133,7 +133,7 @@ static pwr_tStatus IoCardWrite ( ...@@ -133,7 +133,7 @@ static pwr_tStatus IoCardWrite (
if (server->Status == MB__NORMAL) { if (server->Status == MB__NORMAL) {
thread_MutexLock( &local_server->mutex); 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); thread_MutexUnlock( &local_server->mutex);
} }
......
...@@ -48,7 +48,7 @@ static pwr_tStatus IoAgentInit( io_tCtx ctx, ...@@ -48,7 +48,7 @@ static pwr_tStatus IoAgentInit( io_tCtx ctx,
op->Status = IO__DUMMYBUILD; op->Status = IO__DUMMYBUILD;
else else
op->Status = IO__INITFAIL; op->Status = IO__INITFAIL;
errh_Error( "Init of USB agent failed '%s', error status %d", ap->Name, sts); errh_Error( "Init of USB agent failed '%s', error status %d", ap->Name, sts);
local->libusb_ctx = 0; local->libusb_ctx = 0;
return op->Status; return op->Status;
......
...@@ -12,4 +12,6 @@ GPIO_Module ...@@ -12,4 +12,6 @@ GPIO_Module
Maxim_DS18B20 Maxim_DS18B20
USB_Agent USB_Agent
Velleman_K8055_Board Velleman_K8055_Board
Hilscher_cifX_Master
Hilscher_cifX_Module
#endif #endif
\ No newline at end of file
This diff is collapsed.
...@@ -87,8 +87,8 @@ static pwr_tStatus IoCardRead ( ...@@ -87,8 +87,8 @@ static pwr_tStatus IoCardRead (
/* on all inputs. Default StallAction is ResetInputs which means that */ /* on all inputs. Default StallAction is ResetInputs which means that */
/* all inputs will be zeroed */ /* 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); slave->FloatRepresentation);
// printf("Method Pb_Module-IoCardRead\n"); // printf("Method Pb_Module-IoCardRead\n");
return IO__SUCCESS; return IO__SUCCESS;
...@@ -116,8 +116,8 @@ static pwr_tStatus IoCardWrite ( ...@@ -116,8 +116,8 @@ static pwr_tStatus IoCardWrite (
op->Status = slave->Status; op->Status = slave->Status;
if (op->Status == PB__NORMAL) { 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); slave->FloatRepresentation);
} }
// printf("Method Pb_Module-IoCardWrite\n"); // printf("Method Pb_Module-IoCardWrite\n");
return IO__SUCCESS; return IO__SUCCESS;
......
...@@ -88,8 +88,8 @@ static pwr_tStatus IoCardRead ( ...@@ -88,8 +88,8 @@ static pwr_tStatus IoCardRead (
/* on all inputs. Default StallAction is ResetInputs which means that */ /* on all inputs. Default StallAction is ResetInputs which means that */
/* all inputs will be zeroed */ /* 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); slave->FloatRepresentation);
return IO__SUCCESS; return IO__SUCCESS;
} }
...@@ -116,8 +116,8 @@ static pwr_tStatus IoCardWrite ( ...@@ -116,8 +116,8 @@ static pwr_tStatus IoCardWrite (
op->Status = slave->Status; op->Status = slave->Status;
if (op->Status == PB__NORMAL) { 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); slave->FloatRepresentation);
} }
// printf("Method Pb_Module-IoCardWrite\n"); // printf("Method Pb_Module-IoCardWrite\n");
return IO__SUCCESS; return IO__SUCCESS;
......
...@@ -178,7 +178,7 @@ a realtime database, rtdb. The transfer from the Workbench to rtdb is done with ...@@ -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. loadfiles, files that are generated from the Workbench and contains all its objects.
<h1>Control program <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 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. 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. 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 ...@@ -7393,7 +7393,7 @@ IndError in the main object, and color the symbol yellow or red, or flashing red
are set. are set.
<image> ced_fig20.gif <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 ( ...@@ -2541,7 +2541,8 @@ pwr_tStatus io_init (
{ {
if ( rp->Process & process) if ( rp->Process & process)
{ {
if ( rp->Init != NULL) if ( rp->Init != NULL &&
!rp->MethodDisabled)
{ {
sts = (rp->Init) ( *ctx, ap, rp); sts = (rp->Init) ( *ctx, ap, rp);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -2551,7 +2552,8 @@ pwr_tStatus io_init ( ...@@ -2551,7 +2552,8 @@ pwr_tStatus io_init (
} }
for ( cp = rp->cardlist; cp != NULL; cp = cp->next) 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); sts = (cp->Init) ( *ctx, ap, rp, cp);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -2670,7 +2672,8 @@ pwr_tStatus io_read( ...@@ -2670,7 +2672,8 @@ pwr_tStatus io_read(
for ( rp = ap->racklist; rp != NULL; rp = rp->next) for ( rp = ap->racklist; rp != NULL; rp = rp->next)
{ {
if ( rp->Process & ctx->Process && if ( rp->Process & ctx->Process &&
rp->Action & io_mAction_Read) rp->Action & io_mAction_Read &&
!rp->MethodDisabled)
{ {
if ( rp->scan_interval_cnt <= 1) if ( rp->scan_interval_cnt <= 1)
{ {
...@@ -2684,7 +2687,8 @@ pwr_tStatus io_read( ...@@ -2684,7 +2687,8 @@ pwr_tStatus io_read(
for ( cp = rp->cardlist; cp != NULL; cp = cp->next) 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) if ( cp->scan_interval_cnt <= 1)
{ {
...@@ -2728,7 +2732,7 @@ pwr_tStatus io_write( ...@@ -2728,7 +2732,7 @@ pwr_tStatus io_write(
{ {
for ( cp = rp->cardlist; cp != NULL; cp = cp->next) 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) if ( cp->scan_interval_cnt <= 1)
{ {
...@@ -2741,7 +2745,8 @@ pwr_tStatus io_write( ...@@ -2741,7 +2745,8 @@ pwr_tStatus io_write(
} }
} }
if ( rp->Process & ctx->Process && if ( rp->Process & ctx->Process &&
rp->Action & io_mAction_Write) rp->Action & io_mAction_Write &&
!rp->MethodDisabled)
{ {
if ( rp->scan_interval_cnt <= 1) if ( rp->scan_interval_cnt <= 1)
{ {
...@@ -2803,7 +2808,8 @@ pwr_tStatus io_swap( ...@@ -2803,7 +2808,8 @@ pwr_tStatus io_swap(
for ( rp = ap->racklist; rp != NULL; rp = rp->next) 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) if ( rp->scan_interval_cnt <= 1)
{ {
...@@ -2817,7 +2823,8 @@ pwr_tStatus io_swap( ...@@ -2817,7 +2823,8 @@ pwr_tStatus io_swap(
for ( cp = rp->cardlist; cp != NULL; cp = cp->next) 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) if ( cp->scan_interval_cnt <= 1)
{ {
......
...@@ -66,122 +66,124 @@ extern pwr_tBoolean io_fatal_error; ...@@ -66,122 +66,124 @@ extern pwr_tBoolean io_fatal_error;
typedef enum { typedef enum {
io_eType_Node, io_eType_Node,
io_eType_Agent, io_eType_Agent,
io_eType_Rack, io_eType_Rack,
io_eType_Card io_eType_Card
} io_eType; } io_eType;
typedef enum { typedef enum {
io_mAction_None = 0, io_mAction_None = 0,
io_mAction_Read = 1 << 0, io_mAction_Read = 1 << 0,
io_mAction_Write = 1 << 1, io_mAction_Write = 1 << 1,
io_mAction_Swap = 1 << 2 io_mAction_Swap = 1 << 2
} io_mAction; } io_mAction;
typedef enum { typedef enum {
io_mProcess_None = 0, io_mProcess_None = 0,
io_mProcess_Plc = 1 << 0, io_mProcess_Plc = 1 << 0,
io_mProcess_IoComm = 1 << 1, io_mProcess_IoComm = 1 << 1,
io_mProcess_Profibus = 1 << 2, io_mProcess_Profibus = 1 << 2,
io_mProcess_User = 1 << 3, io_mProcess_User = 1 << 3,
io_mProcess_All = ~0 io_mProcess_All = ~0
} io_mProcess; } io_mProcess;
typedef struct { typedef struct {
void *cop; /* Pointer to channel object */ void *cop; /* Pointer to channel object */
pwr_tDlid ChanDlid; /* Dlid for pointer to channel */ pwr_tDlid ChanDlid; /* Dlid for pointer to channel */
pwr_sAttrRef ChanAref; /* AttrRef for channel */ pwr_sAttrRef ChanAref; /* AttrRef for channel */
void *sop; /* Pointer to signal object */ void *sop; /* Pointer to signal object */
pwr_tDlid SigDlid; /* Dlid for pointer to signal */ pwr_tDlid SigDlid; /* Dlid for pointer to signal */
pwr_sAttrRef SigAref; /* AttrRef for signal */ pwr_sAttrRef SigAref; /* AttrRef for signal */
void *vbp; /* Pointer to valuebase for signal */ void *vbp; /* Pointer to valuebase for signal */
void *abs_vbp; /* Pointer to absvaluebase (Co only) */ void *abs_vbp; /* Pointer to absvaluebase (Co only) */
pwr_tClassId ChanClass; /* Class of channel object */ pwr_tClassId ChanClass; /* Class of channel object */
pwr_tClassId SigClass; /* Class of signal object */ pwr_tClassId SigClass; /* Class of signal object */
pwr_tUInt32 size; /* Size of channel in byte */ pwr_tUInt32 size; /* Size of channel in byte */
pwr_tUInt32 offset; /* Offset to channel in card */ pwr_tUInt32 offset; /* Offset to channel in card */
pwr_tUInt32 mask; /* Mask for bit oriented channels */ pwr_tUInt32 mask; /* Mask for bit oriented channels */
pwr_tUInt32 udata; /* User defined data */ pwr_tUInt32 udata; /* User defined data */
} io_sChannel; } io_sChannel;
typedef struct s_Card { typedef struct s_Card {
pwr_tClassId Class; /* Class of card object */ pwr_tClassId Class; /* Class of card object */
pwr_tObjid Objid; /* Objid of card object */ pwr_tObjid Objid; /* Objid of card object */
pwr_tOName Name; /* Full name of card object */ pwr_tOName Name; /* Full name of card object */
io_mAction Action; /* Type of method defined (Read/Write)*/ io_mAction Action; /* Type of method defined (Read/Write)*/
io_mProcess Process; /* Process number */ io_mProcess Process; /* Process number */
pwr_tStatus (* Init) (); /* Init method */ pwr_tStatus (* Init) (); /* Init method */
pwr_tStatus (* Close) (); /* Close method */ pwr_tStatus (* Close) (); /* Close method */
pwr_tStatus (* Read) (); /* Read method */ pwr_tStatus (* Read) (); /* Read method */
pwr_tStatus (* Write) (); /* Write method */ pwr_tStatus (* Write) (); /* Write method */
pwr_tStatus (* Swap) (); /* Write method */ pwr_tStatus (* Swap) (); /* Swap method */
pwr_tAddress *op; /* Pointer to card object */ pwr_tAddress *op; /* Pointer to card object */
pwr_tDlid Dlid; /* Dlid for card object pointer */ pwr_tDlid Dlid; /* Dlid for card object pointer */
pwr_tUInt32 size; /* Size of card data area in byte */ pwr_tUInt32 size; /* Size of card data area in byte */
pwr_tUInt32 offset; /* Offset to card data area in rack */ pwr_tUInt32 offset; /* Offset to card data area in rack */
int scan_interval; /* Interval between scans */ int scan_interval; /* Interval between scans */
int scan_interval_cnt;/* Counter to detect next time to scan */ int scan_interval_cnt;/* Counter to detect next time to scan */
int AgentControlled;/* TRUE if kontrolled by agent */ int AgentControlled;/* TRUE if kontrolled by agent */
int ChanListSize; /* Size of chanlist */ int ChanListSize; /* Size of chanlist */
io_sChannel *chanlist; /* Array of channel structures */ io_sChannel *chanlist; /* Array of channel structures */
void *Local; /* Pointer to method defined data structure */ void *Local; /* Pointer to method defined data structure */
struct s_Card *next; /* Next card */ int MethodDisabled; /* Card method disabled */
struct s_Card *next; /* Next card */
} io_sCard; } io_sCard;
typedef struct s_Rack { typedef struct s_Rack {
pwr_tClassId Class; /* Class of rack object */ pwr_tClassId Class; /* Class of rack object */
pwr_tObjid Objid; /* Objid of rack object */ pwr_tObjid Objid; /* Objid of rack object */
pwr_tOName Name; /* Full name of rack object */ pwr_tOName Name; /* Full name of rack object */
io_mAction Action; /* Type of method defined (Read/Write)*/ io_mAction Action; /* Type of method defined (Read/Write)*/
io_mProcess Process; /* Process number */ io_mProcess Process; /* Process number */
pwr_tStatus (* Init) (); /* Init method */ pwr_tStatus (* Init) (); /* Init method */
pwr_tStatus (* Close) (); /* Close method */ pwr_tStatus (* Close) (); /* Close method */
pwr_tStatus (* Read) (); /* Read method */ pwr_tStatus (* Read) (); /* Read method */
pwr_tStatus (* Write) (); /* Write method */ pwr_tStatus (* Write) (); /* Write method */
pwr_tStatus (* Swap) (); /* Swap method */ pwr_tStatus (* Swap) (); /* Swap method */
void *op; /* Pointer to rack object */ void *op; /* Pointer to rack object */
pwr_tDlid Dlid; /* Dlid fr rack object pointer */ pwr_tDlid Dlid; /* Dlid fr rack object pointer */
pwr_tUInt32 size; /* Size of rack data area in byte */ pwr_tUInt32 size; /* Size of rack data area in byte */
pwr_tUInt32 offset; /* Offset to rack data area in agent */ pwr_tUInt32 offset; /* Offset to rack data area in agent */
int scan_interval; /* Interval between scans */ int scan_interval; /* Interval between scans */
int scan_interval_cnt;/* Counter to detect next time to scan */ int scan_interval_cnt;/* Counter to detect next time to scan */
int AgentControlled;/* TRUE if kontrolled by agent */ int AgentControlled;/* TRUE if kontrolled by agent */
io_sCard *cardlist; /* List of card structures */ io_sCard *cardlist; /* List of card structures */
void *Local; /* Pointer to method defined data structure */ void *Local; /* Pointer to method defined data structure */
struct s_Rack *next; /* Next rack */ int MethodDisabled; /* Rack method disabled */
struct s_Rack *next; /* Next rack */
} io_sRack; } io_sRack;
typedef struct s_Agent { typedef struct s_Agent {
pwr_tClassId Class; /* Class of agent object */ pwr_tClassId Class; /* Class of agent object */
pwr_tObjid Objid; /* Objid of agent object */ pwr_tObjid Objid; /* Objid of agent object */
pwr_tOName Name; /* Full name of agent object */ pwr_tOName Name; /* Full name of agent object */
io_mAction Action; /* Type of method defined (Read/Write)*/ io_mAction Action; /* Type of method defined (Read/Write)*/
io_mProcess Process; /* Process number */ io_mProcess Process; /* Process number */
pwr_tStatus (* Init) (); /* Init method */ pwr_tStatus (* Init) (); /* Init method */
pwr_tStatus (* Close) (); /* Close method */ pwr_tStatus (* Close) (); /* Close method */
pwr_tStatus (* Read) (); /* Read method */ pwr_tStatus (* Read) (); /* Read method */
pwr_tStatus (* Write) (); /* Write method */ pwr_tStatus (* Write) (); /* Write method */
pwr_tStatus (* Swap) (); /* Write method */ pwr_tStatus (* Swap) (); /* Swap method */
void *op; /* Pointer to agent object */ void *op; /* Pointer to agent object */
pwr_tDlid Dlid; /* Dlid for agent object pointer */ pwr_tDlid Dlid; /* Dlid for agent object pointer */
int scan_interval; /* Interval between scans */ int scan_interval; /* Interval between scans */
int scan_interval_cnt;/* Counter to detect next time to scan */ int scan_interval_cnt;/* Counter to detect next time to scan */
io_sRack *racklist; /* List of rack structures */ io_sRack *racklist; /* List of rack structures */
void *Local; /* Pointer to method defined data structure */ void *Local; /* Pointer to method defined data structure */
struct s_Agent *next; /* Next agent */ struct s_Agent *next; /* Next agent */
} io_sAgent; } io_sAgent;
struct io_sCtx { struct io_sCtx {
io_sAgent *agentlist; /* List of agent structures */ io_sAgent *agentlist; /* List of agent structures */
io_mProcess Process; /* Callers process number */ io_mProcess Process; /* Callers process number */
pwr_tObjid Thread; /* Callers thread objid */ pwr_tObjid Thread; /* Callers thread objid */
int RelativVector; /* Used by plc */ int RelativVector; /* Used by plc */
pwr_sNode *Node; /* Pointer to node object */ pwr_sNode *Node; /* Pointer to node object */
pwr_sClass_IOHandler *IOHandler; /* Pointer to IO Handler object */ pwr_sClass_IOHandler *IOHandler; /* Pointer to IO Handler object */
float ScanTime; /* Scantime supplied by caller */ float ScanTime; /* Scantime supplied by caller */
io_tSupCtx SupCtx; /* Context for supervise object lists */ io_tSupCtx SupCtx; /* Context for supervise object lists */
}; };
/*----------------------------------------------------------------------------*\ /*----------------------------------------------------------------------------*\
......
...@@ -180,18 +180,129 @@ static void ConvertAi ( io_tCtx ctx, ...@@ -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( pwr_tStatus io_bus_card_init( io_tCtx ctx,
io_tCtx ctx, io_sCard *cp,
io_sRack *rp, unsigned int *input_area_offset,
io_sCard *cp, unsigned int *input_area_chansize,
void *input_area, unsigned int *output_area_offset,
void *diag_area, unsigned int *output_area_chansize,
pwr_tByteOrderingEnum byte_order, pwr_tByteOrderingEnum byte_order)
pwr_tFloatRepEnum float_rep {
) 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)
{ {
io_sChannel *chanp; io_sChannel *chanp;
pwr_sClass_ChanDi *chan_di; pwr_sClass_ChanDi *chan_di;
...@@ -485,14 +596,11 @@ void io_card_read( ...@@ -485,14 +596,11 @@ void io_card_read(
\*----------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------*/
void io_card_write( void io_bus_card_write( io_tCtx ctx,
io_tCtx ctx, io_sCard *cp,
io_sCard *cp, void *output_area,
void *output_area, pwr_tByteOrderingEnum byte_order,
pwr_tByteOrderingEnum byte_order, pwr_tFloatRepEnum float_rep)
pwr_tFloatRepEnum float_rep
)
{ {
io_sChannel *chanp; io_sChannel *chanp;
......
...@@ -65,23 +65,27 @@ unsigned short swap16(unsigned short in); ...@@ -65,23 +65,27 @@ unsigned short swap16(unsigned short in);
unsigned int swap32(unsigned int in); unsigned int swap32(unsigned int in);
void io_card_read( pwr_tStatus io_bus_card_init( io_tCtx ctx,
io_tCtx ctx, io_sCard *cp,
io_sRack *rp, unsigned int *input_area_offset,
io_sCard *cp, unsigned int *input_area_chansize,
void *input_area, unsigned int *output_area_offset,
void *diag_area, unsigned int *output_area_chansize,
pwr_tByteOrderingEnum byte_order, pwr_tByteOrderingEnum byte_order);
pwr_tFloatRepEnum float_rep
); void io_bus_card_read( io_tCtx ctx,
io_sRack *rp,
void io_card_write( io_sCard *cp,
io_tCtx ctx, void *input_area,
io_sCard *cp, void *diag_area,
void *output_area, pwr_tByteOrderingEnum byte_order,
pwr_tByteOrderingEnum byte_order, pwr_tFloatRepEnum float_rep);
pwr_tFloatRepEnum float_rep
); void io_bus_card_write( io_tCtx ctx,
io_sCard *cp,
void *output_area,
pwr_tByteOrderingEnum byte_order,
pwr_tFloatRepEnum float_rep);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -116,7 +116,7 @@ pwre_config_check_lib() ...@@ -116,7 +116,7 @@ pwre_config_check_lib()
elif test $4 == "wmq"; then elif test $4 == "wmq"; then
conf_libwmq=$conf_libwmq" -l${lib%.*}" conf_libwmq=$conf_libwmq" -l${lib%.*}"
else else
conf_lib=$conf_lib" -l${lib%.*}" conf_lib=$conf_lib" -l${lib%%.*}"
fi fi
elif test $3 == "gtk"; then elif test $3 == "gtk"; then
conf_libgtk=$conf_libgtk" \\\`pkg-config --libs gtk+-2.0\\\`" conf_libgtk=$conf_libgtk" \\\`pkg-config --libs gtk+-2.0\\\`"
...@@ -318,6 +318,7 @@ else ...@@ -318,6 +318,7 @@ else
pwre_config_check_lib wmq WMQ lib wmq 1 /usr/lib/libmqic.so 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 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 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 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 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 pwre_config_check_lib libX11 LIBX11 lib lib 0 /usr/lib/libX11.so
...@@ -329,6 +330,7 @@ else ...@@ -329,6 +330,7 @@ else
pwre_config_check_include jni JNI 1 $jdk/include/jni.h 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 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 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 export pwre_conf_alsa=1
......
...@@ -41,7 +41,7 @@ SObject pwrb:Class ...@@ -41,7 +41,7 @@ SObject pwrb:Class
Attr StructName = "Max" Attr StructName = "Max"
EndBody EndBody
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In1 $Input 1 Object In1 $Input 1
Body SysBody Body SysBody
...@@ -51,7 +51,7 @@ SObject pwrb:Class ...@@ -51,7 +51,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In2 $Input 2 Object In2 $Input 2
Body SysBody Body SysBody
...@@ -61,7 +61,7 @@ SObject pwrb:Class ...@@ -61,7 +61,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In3 $Input 3 Object In3 $Input 3
Body SysBody Body SysBody
...@@ -71,7 +71,7 @@ SObject pwrb:Class ...@@ -71,7 +71,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In4 $Input 4 Object In4 $Input 4
Body SysBody Body SysBody
...@@ -81,7 +81,7 @@ SObject pwrb:Class ...@@ -81,7 +81,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In5 $Input 5 Object In5 $Input 5
Body SysBody Body SysBody
...@@ -91,7 +91,7 @@ SObject pwrb:Class ...@@ -91,7 +91,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In6 $Input 6 Object In6 $Input 6
Body SysBody Body SysBody
...@@ -101,7 +101,7 @@ SObject pwrb:Class ...@@ -101,7 +101,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In7 $Input 7 Object In7 $Input 7
Body SysBody Body SysBody
...@@ -111,7 +111,7 @@ SObject pwrb:Class ...@@ -111,7 +111,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In8 $Input 8 Object In8 $Input 8
Body SysBody Body SysBody
......
...@@ -41,7 +41,7 @@ SObject pwrb:Class ...@@ -41,7 +41,7 @@ SObject pwrb:Class
Attr StructName = "Min" Attr StructName = "Min"
EndBody EndBody
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In1 $Input 1 Object In1 $Input 1
Body SysBody Body SysBody
...@@ -51,7 +51,7 @@ SObject pwrb:Class ...@@ -51,7 +51,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In2 $Input 2 Object In2 $Input 2
Body SysBody Body SysBody
...@@ -61,7 +61,7 @@ SObject pwrb:Class ...@@ -61,7 +61,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In3 $Input 3 Object In3 $Input 3
Body SysBody Body SysBody
...@@ -71,7 +71,7 @@ SObject pwrb:Class ...@@ -71,7 +71,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In4 $Input 4 Object In4 $Input 4
Body SysBody Body SysBody
...@@ -81,7 +81,7 @@ SObject pwrb:Class ...@@ -81,7 +81,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In5 $Input 5 Object In5 $Input 5
Body SysBody Body SysBody
...@@ -91,7 +91,7 @@ SObject pwrb:Class ...@@ -91,7 +91,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In6 $Input 6 Object In6 $Input 6
Body SysBody Body SysBody
...@@ -101,7 +101,7 @@ SObject pwrb:Class ...@@ -101,7 +101,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In7 $Input 7 Object In7 $Input 7
Body SysBody Body SysBody
...@@ -111,7 +111,7 @@ SObject pwrb:Class ...@@ -111,7 +111,7 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Integer input. ! Analog input.
!*/ !*/
Object In8 $Input 8 Object In8 $Input 8
Body SysBody 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