Commit cb2e67d1 authored by claes's avatar claes

Files moved from kernel

parent 8d99e20a
......@@ -2,8 +2,8 @@ ifndef link_rule_mk
link_rule_mk := 1
link = $(ld) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(rt_msg_objs) \
$(pwr_eobj)/rt_io_user.o -lpwr_rs \
$(export_obj) $(objects) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o \
-lpwr_rt -lpwr_co -lpwr_msg_dummy -lrpcsvc -lpthread -lm -lrt
endif
/*
* Proview $Id: rs_nmps_bck.c,v 1.4 2005-10-25 15:28:10 claes Exp $
* Proview $Id: rs_nmps_bck.c,v 1.5 2006-01-12 05:57:42 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -69,9 +69,8 @@
#include "rt_errh.h"
#include "rt_gdh_msg.h"
#include "rt_hash_msg.h"
#include "rs_nmps.h"
#include "nmps.h"
#include "rs_nmps_msg.h"
#include "rs_sutl.h"
#include "rt_qcom.h"
#include "rt_qcom_msg.h"
#include "rt_ini_event.h"
......@@ -1131,7 +1130,7 @@ static pwr_tStatus nmpsbck_open_file( bck_ctx bckctx)
for (;;)
{
if ( wait_some_time)
sutl_sleep( reopen_time);
time_Sleep( reopen_time);
else
wait_some_time = 1;
......@@ -1193,7 +1192,7 @@ static pwr_tStatus nmpsbck_open_file( bck_ctx bckctx)
for (;;)
{
if ( wait_some_time)
sutl_sleep( reopen_time);
time_Sleep( reopen_time);
else
wait_some_time = 1;
......@@ -2518,7 +2517,7 @@ int main()
#endif
// sutl_sleep( scantime);
// time_Sleep( scantime);
first_scan = 0;
}
......
......@@ -2,8 +2,8 @@ ifndef link_rule_mk
link_rule_mk := 1
link = $(ld) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(rt_msg_objs) \
$(pwr_eobj)/rt_io_user.o -lpwr_rs\
$(export_obj) $(objects) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o\
-lpwr_rt -lpwr_co -lpwr_msg_dummy -lrpcsvc -lpthread -lm -lrt
endif
/*
* Proview $Id: rs_nmps_mirror.c,v 1.3 2005-10-25 15:28:10 claes Exp $
* Proview $Id: rs_nmps_mirror.c,v 1.4 2006-01-12 05:57:42 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -71,9 +71,8 @@
#include "rt_errh.h"
#include "rt_gdh_msg.h"
#include "rt_hash_msg.h"
#include "rs_nmps.h"
#include "nmps.h"
#include "rs_nmps_msg.h"
#include "rs_sutl.h"
/*_Globala variabler______________________________________________________*/
......@@ -2113,7 +2112,7 @@ int main()
sts = nmps_cellmir_init( mirctx);
if (EVEN(sts)) LogAndExit( sts);
sutl_sleep( 5.0);
time_Sleep( 5.0);
scantime = mirctx->mirrorconfig->ScanTime;
for (;;)
{
......@@ -2136,7 +2135,7 @@ int main()
mirctx->mirrorconfig->LoopCount++;
sutl_sleep( scantime);
time_Sleep( scantime);
mirctx->first_scan = 0;
if ( mirctx->mirrorconfig->Initialize)
......
......@@ -2,8 +2,8 @@ ifndef link_rule_mk
link_rule_mk := 1
link = $(ld) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(rt_msg_objs) \
$(pwr_eobj)/rt_io_user.o -lpwr_rs\
$(export_obj) $(objects) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o -lpwr_nmps\
-lpwr_rt -lpwr_co -lpwr_msg_dummy -lrpcsvc -lpthread -lm -lrt
endif
/*
* Proview $Id: rs_nmps_trans.c,v 1.7 2005-10-25 15:28:10 claes Exp $
* Proview $Id: rs_nmps_trans.c,v 1.8 2006-01-12 05:57:43 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -64,7 +64,7 @@
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_nmpsclasses.h"
#include "pwr_ssabclasses.h"
#include "pwr_remoteclasses.h"
#include "co_cdh.h"
#include "co_time.h"
#include "rt_gdh.h"
......@@ -78,10 +78,8 @@
#include "rt_plc_utl.h"
#include "rt_gdh_msg.h"
#include "rt_hash_msg.h"
#include "rs_nmps_cnv.h"
#include "rs_sutl.h"
#include "nmps_cnv.h"
#include "rs_nmps_msg.h"
#include "rs_ssabutil.h"
/*_Globala variabler______________________________________________________*/
......@@ -327,6 +325,7 @@ static int nmpstrans_req_accept_detected( trans_ctx transctx,
nmpstrans_t_req_list *req_ptr);
static int nmpstrans_req_reset_detected( trans_ctx transctx,
nmpstrans_t_req_list *req_ptr);
static int ssabutil_lopnr_check( pwr_tInt32 lopnr);
int nmpstrans_check_checksum( int key)
......@@ -2864,3 +2863,51 @@ int main()
}
}
}
static pwr_tInt32 ssabutil_chksum_calculate( pwr_tInt32 value,
pwr_tInt16 *weights,
pwr_tInt16 num_figures)
{
pwr_tInt16 sum; /* Arbetsvariabel */
pwr_tInt16 *weightP; /* Pekar p vikter */
/* Berkna perkaren till entalssiffran */
weightP = weights + num_figures - 1;
/* Berkna den viktade summan av siffrorona i talet */
for (sum=0; num_figures>0; num_figures--) {
sum += (value % 10) * (*weightP--);
value /= 10 ;
}
/* Berkna skillnaden till nrmast hgre tiotal */
sum = ((sum/10) + 1)*10 - sum;
if (sum == 10) sum = 0;
return (sum);
}
static pwr_tInt32 ssabutil_chksum_lop( pwr_tInt32 lopnummer)
{
static pwr_tInt16 lop_fig_weights[6] = {1,7,3,1,7,3};
lopnummer=lopnummer*10 +
ssabutil_chksum_calculate( lopnummer, lop_fig_weights, 6);
return(lopnummer);
}
static int ssabutil_lopnr_check( pwr_tInt32 lopnr)
{
pwr_tInt32 tst_lopnr;
tst_lopnr = lopnr / 10;
tst_lopnr = ssabutil_chksum_lop( tst_lopnr);
if ( tst_lopnr != lopnr)
return 0;
else
return 1;
}
/*
* Proview $Id: nmps.h,v 1.1 2006-01-12 05:57:43 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.
*/
#define NMPS_CELL_SIZE 30 /* Number of dataobject in
NMpsCell och NMpsSelectCell */
#define NMPS_CELLMIR_SIZE 30 /* Number of dataobject in
NMpsMirrorCell */
#define MMPS_CELLMIR_ORIGCELL_SIZE 10 /* Size of the origcell-array
in NMpsMirrorCell */
#define NMPS_OPTYPE_EXTINSERT 0
#define NMPS_OPTYPE_EXTINSERT_IDX 1
#define NMPS_OPTYPE_EXTDELETE 2
#define NMPS_OPTYPE_EXTDELETE_IDX 3
#define NMPS_OPTYPE_EXTDELETE_OBJID 4
#define NMPS_OPTYPE_EXTSELECT_OBJID 5
#define NMPS_OPTYPE_EXTINSERTSELECT 6
#define NMPS_OPTYPE_EXTUNSELECT_OBJID 7
#define NMPS_OPTYPE_EXTMOVEFORW_OBJID 8
#define NMPS_OPTYPE_EXTMOVEBACKW_OBJID 9
#define NMPS_OPTYPE_EXTREMOVE_OBJID 10
#define NMPS_CELL_RELOADDONE 1
#define NMPS_CELL_INITIALIZED 2
#define NMPS_CELLFUNC_SINGELSELECT 1
#define NMPS_CELLFUNC_ONESELECT 2
#define NMPS_CELLFUNC_DELETE 4
#define NMPS_CELLFUNC_RESETDELETE 8
#define NMPS_CELLFUNC_BACKUP 16
#define NMPS_TRPFUNC_UNIT 1
#define NMPS_TRPFUNC_ALL 2
#define NMPS_TRPFUNC_ALLEMPTY 4
#define NMPS_TRPFUNC_TRIGGRESET 8
#define NMPS_TRPFUNC_SLOW 16
#define NMPS_TRPFUNC_LEVEL 32
/* Data structure for one dataobjekt in a NMpsCell and NMpsSelectCell */
typedef struct {
pwr_tFloat32 *DataP;
pwr_tObjid Data_ObjId;
pwr_tBoolean Data_Front;
pwr_tBoolean Data_Back;
gdh_tDlid Data_Dlid;
pwr_tBoolean Data_Select;
pwr_tBoolean Data_OldSelect;
} plc_t_DataInfo;
/* Data structure for the DLpointer and the objid in a Cell */
typedef struct {
pwr_tFloat32 *DataP;
pwr_tObjid Data_ObjId;
} plc_t_DataInfoBrief;
/* Data structure for one dataobjekt in a NMpsMirrorCell */
typedef struct {
pwr_tFloat32 *DataP;
pwr_tObjid Data_ObjId;
gdh_tDlid Data_Dlid;
} plc_t_DataInfoMirCell;
/* Data structure for the copyarea in a NMpsMirrorCell */
typedef struct {
plc_t_DataInfoMirCell datainfo[ NMPS_CELLMIR_SIZE];
} nmps_t_mircell_copyarea;
int nmps_RemoveData( pwr_tObjid objid);
int nmps_RemoveAndDeleteData( pwr_tObjid objid);
This diff is collapsed.
/*
* Proview $Id: nmps_appl.h,v 1.1 2006-01-12 05:57:43 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 ra_nmps_appl_h
#define ra_nmps_appl_h
/* ra_nmps_appl.h -- <short description>
NMps API. */
#if defined __cplusplus
extern "C" {
#endif
#define NMPSAPPL_CELLIST_MAX 32 /* Max number of cells in a
appl_init call */
#define NMPSAPPL_APPLSESS_MAX 32 /* Max number of application
sessions */
#define nmpsappl_mOption_Remove (1 << 0)
#define nmpsappl_mOption_NamePath (1 << 1)
#define nmpsappl_mOption_ReverseOrder (1 << 2)
typedef struct nmpsappl_s_cellist {
pwr_tString80 name;
pwr_tObjid objid;
pwr_tAddress object_ptr;
gdh_tDlid subid;
pwr_tClassId classid;
unsigned long index_mask[NMPSAPPL_APPLSESS_MAX];
int tmp_size;
void *tmp_cell;
struct nmpsappl_s_cellist *next;
} nmpsappl_t_cellist;
typedef struct {
pwr_tObjid objid;
pwr_tString80 name;
pwr_tAddress object_ptr;
pwr_tBoolean select;
pwr_tBoolean front;
pwr_tBoolean back;
pwr_tBoolean newdata;
pwr_tBoolean removed;
unsigned long cell_mask;
} nmpsappl_t_datainfo;
typedef struct nmpsappl_s_ctx {
nmpsappl_t_cellist *cellist[NMPSAPPL_CELLIST_MAX];
unsigned long options;
int index;
unsigned long index_mask;
int cellist_count;
int total_cellsize;
int data_count;
nmpsappl_t_datainfo *datainfo;
struct nmpsappl_s_ctx *next;
} *nmpsappl_t_ctx;
pwr_tStatus nmpsappl_MirrorInit( pwr_tString80 *cell_array,
unsigned long options,
nmpsappl_t_ctx *ctx);
pwr_tStatus nmpsappl_Mirror( nmpsappl_t_ctx applctx,
int *data_count,
nmpsappl_t_datainfo **datainfo);
pwr_tStatus nmpsappl_RemoveData(
nmpsappl_t_ctx applctx,
pwr_tObjid objid);
pwr_tStatus nmpsappl_RemoveAndDeleteData(
nmpsappl_t_ctx applctx,
pwr_tObjid objid);
pwr_tStatus nmpsappl_SelectData(
nmpsappl_t_ctx applctx,
pwr_tObjid objid);
pwr_tStatus nmpsappl_TransportData(
nmpsappl_t_ctx applctx,
pwr_tObjid objid,
unsigned int from_cell_mask,
unsigned int to_cell_mask);
pwr_tStatus nmpsappl_InsertData(
nmpsappl_t_ctx applctx,
pwr_tObjid objid,
unsigned int cell_mask);
pwr_tStatus nmpsappl_RemoveAndKeepData(
nmpsappl_t_ctx applctx,
pwr_tObjid objid,
unsigned int cell_mask);
#if defined __cplusplus
}
#endif
#endif
This diff is collapsed.
/*
* Proview $Id: nmps_cnv.h,v 1.1 2006-01-12 05:57:43 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.
*/
typedef enum {
cnv_eConvType_memcpy,
cnv_eConvType_CharToString,
cnv_eConvType_Int16ToInt32,
cnv_eConvType_Int32ToInt16,
cnv_eConvType_Int32ToFloat32,
cnv_eConvType_Int32ToString,
cnv_eConvType_Int32ToAscii,
cnv_eConvType_Float32ToInt32,
cnv_eConvType_Float32ToString,
cnv_eConvType_Float32ToAscii,
cnv_eConvType_StringToInt32,
cnv_eConvType_StringToFloat32,
cnv_eConvType_AsciiToInt32,
cnv_eConvType_AsciiToFloat32
} cnv_eConvType;
typedef enum {
cnv_eParType__ = 0,
cnv_eParType_Char,
cnv_eParType_Boolean,
cnv_eParType_Int8,
cnv_eParType_UInt8,
cnv_eParType_Int16,
cnv_eParType_UInt16,
cnv_eParType_Int32,
cnv_eParType_UInt32,
cnv_eParType_Float32,
cnv_eParType_Float64,
cnv_eParType_String,
cnv_eParType_Ascii,
cnv_eParType_Binary,
cnv_eParType_Unknown,
cnv_eParType_Time,
cnv_eParType_
} cnv_eParType;
typedef struct {
int from;
int to;
int size;
cnv_eConvType type;
char format[20];
} cnv_t_conv_item;
#define CNV_CONV_TABLE_SIZE 200
typedef cnv_t_conv_item cnv_t_conv_table [CNV_CONV_TABLE_SIZE];
int cnv_ConvertData(
cnv_t_conv_table *conv_table,
int conv_table_count,
char *from_data,
char *to_data);
int cvn_ConvInit(
pwr_tInt32 ToConvdefType,
pwr_tObjid ToConvdef,
char *ToConvdefFile,
pwr_tInt32 FromConvdefType,
pwr_tObjid FromConvdef,
char *FromConvdefFile,
pwr_tInt32 *ConvTableSize,
pwr_tInt32 AllocConvTable,
char **ConvTable);
This diff is collapsed.
This diff is collapsed.
/*
* Proview $Id: nmps_plc_macro.h,v 1.1 2006-01-12 05:57:43 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.
*/
/* PREPROCESSOR RUTINER */
#if defined OS_ELN
# include float
#else
# include <float.h>
#endif
typedef struct {
char Key[40];
pwr_tStatus Status;
char Data[1];
} nmps_sTrans;
typedef struct {
pwr_tUInt32 *DataP;
pwr_tObjid Data_ObjId;
pwr_tBoolean Data_Front;
pwr_tBoolean Data_Back;
pwr_tRefId Data_Dlid;
pwr_tBoolean Data_Select;
pwr_tBoolean Data_OldSelect;
} plc_t_DataInfo;
typedef struct {
pwr_tUInt32 *DataP;
pwr_tObjid Data_ObjId;
pwr_tRefId Data_Dlid;
} plc_t_DataInfoMirCell;
/**
DataCopy
@aref datacopy DataCopy
*/
#define datacopy_exec( object, datasize) \
if ( *object->ConditionP ) \
{ \
if ( *object->DataToP != 0 && *object->DataFromP != 0) \
memcpy( *object->DataToP, *object->DataFromP, datasize); \
}
/**
DataReset
@aref datareset DataReset
*/
#define datareset_exec( object, datasize) \
if ( *object->ConditionP ) \
{ \
if ( *object->DataP != 0 ) \
memset( *object->DataP, 0, datasize); \
}
/**
NMpsCellSubWind
@aref nmpscellsubwind NMpsCellSubWind
*/
#define NMpsCellSubWind_exec( object, subwindow) \
if ( !(object->InitTime && !object->ReloadDone)) \
{ \
object->CurrentIndex = 0; \
memset( &(object->DataCurrentP), 0, \
sizeof( plc_t_DataInfo) - 16); \
subwindow; \
for ( object->Idx = 1; object->Idx <= \
object->LastIndex; object->Idx++ ) \
{ \
memcpy( &(object->DataCurrentP), \
(char *) &object->Data1P + \
(object->Idx - 1) * sizeof( plc_t_DataInfo), \
sizeof( plc_t_DataInfo) - 16); \
object->CurrentIndex = object->Idx; \
subwindow; \
} \
}
/**
NMpsStoreCellSubWind
@aref nmpscellstoresubwind NMpsStoreCellSubWind
*/
#define NMpsStoreCellSubWind_exec( object, subwindow) \
if ( !(object->InitTime && !object->ReloadDone)) \
{ \
object->CurrentIndex = 0; \
memset( &(object->DataCurrentP), 0, \
sizeof( plc_t_DataInfo) - 16); \
subwindow; \
for ( object->Idx = 1; object->Idx <= \
object->LastIndex; object->Idx++ ) \
{ \
memcpy( &(object->DataCurrentP), \
(char *) &object->Data1P + \
(object->Idx - 1) * sizeof( plc_t_DataInfo), \
sizeof( plc_t_DataInfo) - 16); \
object->CurrentIndex = object->Idx; \
subwindow; \
} \
}
/**
CLoop
@aref cloop CLoop
*/
#define CLoop_exec( object, subwindow) \
if ( *object->ConditionP) \
{ \
object->CurrentIndex = object->StartIndex; \
for ( object->CurrentIndex = object->StartIndex; \
object->CurrentIndex <= object->StopIndex + FLT_EPSILON; \
object->CurrentIndex += object->Increment) \
{ \
subwindow; \
} \
}
/**
GetDap
@aref getdap GetDap
*/
#define GetDap_exec( object, attribute) \
memcpy( &object->OutDataP, &attribute, \
sizeof( object->OutDataP) + sizeof( object->OutData_ObjId));
/**
GetObjidp
@aref getobjidp GetObjidp
*/
#define GetObjidp_exec( object, attribute) \
object->ObjId = attribute;
/**
Func
@aref func Func
*/
#define Func_exec( object, subwindow) \
if ( object->ConditionP) object->Condition = *object->ConditionP; \
if ( object->A1P) object->A1 = *object->A1P; \
if ( object->A2P) object->A2 = *object->A2P; \
if ( object->A3P) object->A3 = *object->A3P; \
if ( object->A4P) object->A4 = *object->A4P; \
if ( object->A5P) object->A5 = *object->A5P; \
if ( object->A6P) object->A6 = *object->A6P; \
if ( object->A7P) object->A7 = *object->A7P; \
if ( object->A8P) object->A8 = *object->A8P; \
if ( object->d1P) object->d1 = *object->d1P; \
if ( object->d2P) object->d2 = *object->d2P; \
if ( object->d3P) object->d3 = *object->d3P; \
if ( object->d4P) object->d4 = *object->d4P; \
if ( object->d5P) object->d5 = *object->d5P; \
if ( object->d6P) object->d6 = *object->d6P; \
if ( object->d7P) object->d7 = *object->d7P; \
if ( object->d8P) object->d8 = *object->d8P; \
if ( object->Condition) { \
subwindow; \
}
/**
FuncExtend
@aref funcextend FuncExtend
*/
#define FuncExtend_exec( object) \
if ( object->A1P) object->A1 = *object->A1P; \
if ( object->A2P) object->A2 = *object->A2P; \
if ( object->A3P) object->A3 = *object->A3P; \
if ( object->A4P) object->A4 = *object->A4P; \
if ( object->A5P) object->A5 = *object->A5P; \
if ( object->A6P) object->A6 = *object->A6P; \
if ( object->A7P) object->A7 = *object->A7P; \
if ( object->A8P) object->A8 = *object->A8P; \
if ( object->d1P) object->d1 = *object->d1P; \
if ( object->d2P) object->d2 = *object->d2P; \
if ( object->d3P) object->d3 = *object->d3P; \
if ( object->d4P) object->d4 = *object->d4P; \
if ( object->d5P) object->d5 = *object->d5P; \
if ( object->d6P) object->d6 = *object->d6P; \
if ( object->d7P) object->d7 = *object->d7P; \
if ( object->d8P) object->d8 = *object->d8P;
/**
FuncInput
@aref funcinput FuncInput
*/
#define FuncInput_exec( object, funcobject) \
object->A1 = funcobject->A1; \
object->A2 = funcobject->A2; \
object->A3 = funcobject->A3; \
object->A4 = funcobject->A4; \
object->A5 = funcobject->A5; \
object->A6 = funcobject->A6; \
object->A7 = funcobject->A7; \
object->A8 = funcobject->A8; \
object->d1 = funcobject->d1; \
object->d2 = funcobject->d2; \
object->d3 = funcobject->d3; \
object->d4 = funcobject->d4; \
object->d5 = funcobject->d5; \
object->d6 = funcobject->d6; \
object->d7 = funcobject->d7; \
object->d8 = funcobject->d8;
/**
FuncOutput
@aref funcoutput FuncOutput
*/
#define FuncOutput_exec( object, funcobject) \
funcobject->OA1 = *object->OA1P; \
funcobject->OA2 = *object->OA2P; \
funcobject->OA3 = *object->OA3P; \
funcobject->OA4 = *object->OA4P; \
funcobject->OA5 = *object->OA5P; \
funcobject->OA6 = *object->OA6P; \
funcobject->OA7 = *object->OA7P; \
funcobject->OA8 = *object->OA8P; \
funcobject->od1 = *object->od1P; \
funcobject->od2 = *object->od2P; \
funcobject->od3 = *object->od3P; \
funcobject->od4 = *object->od4P; \
funcobject->od5 = *object->od5P; \
funcobject->od6 = *object->od6P; \
funcobject->od7 = *object->od7P; \
funcobject->od8 = *object->od8P;
/**
NMpsMirrorCellSubWind
@aref nmpsmirrorcellsubwind NMpsMirroCellSubWind
*/
#define NMpsMirrorCellSubWind_exec( object, subwindow) \
object->CurrentIndex = 0; \
memset( &(object->DataCurrentP), 0, \
sizeof( plc_t_DataInfoMirCell) - sizeof(pwr_tRefId)); \
subwindow; \
for ( object->Idx = 1; object->Idx <= \
object->LastIndex; object->Idx++ ) \
{ \
memcpy( &(object->DataCurrentP), \
(char *) &object->Data1P + \
(object->Idx - 1) * sizeof( plc_t_DataInfoMirCell), \
sizeof( plc_t_DataInfoMirCell) - sizeof(pwr_tRefId)); \
object->CurrentIndex = object->Idx; \
subwindow; \
}
/**
RemTransSend
@aref remtranssend RemTransSend
*/
#define RemTransSend_exec( object, subwindow) \
if ( *object->SendP && !object->Send) { \
if ( ((pwr_sClass_RemTrans *)(*object->RemTransP))->DataValid > 0) \
object->Error = 1; \
else { \
subwindow; \
((pwr_sClass_RemTrans *)(*object->RemTransP))->DataValid = 1; \
object->Error = 0; \
} \
} \
else \
object->Error = \
EVEN( ((pwr_sClass_RemTrans *)(*object->RemTransP))->LastSts); \
\
object->Send = *object->SendP; \
\
if ( ((pwr_sClass_RemTrans *)(*object->RemTransP))->DataValid > 0) \
object->Occupied = 1; \
else \
object->Occupied = 0; \
\
if ( ((pwr_sClass_RemTrans *)(*object->RemTransP))->Buffers > 0) { \
object->Buffer = 1; \
if ( ((pwr_sClass_RemTrans *)(*object->RemTransP))->Buffers >= \
((pwr_sClass_RemTrans *)(*object->RemTransP))->MaxBuffers) \
object->Occupied = 1; \
} \
else \
object->Buffer = 0;
/**
RemTransRcv
@aref remtransrcv RemTransRcv
*/
#define RemTransRcv_exec( object, subwindow) \
if ( ((pwr_sClass_RemTrans *)(*object->RemTransP))->DataValid > 0) { \
subwindow; \
((pwr_sClass_RemTrans *)(*object->RemTransP))->DataValid = 0; \
object->Received = 1; \
} \
else \
object->Received = 0;
/*
* Proview $Id: nmps_plc_runtime.c,v 1.1 2006-01-12 05:57:43 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.
*/
#ifdef OS_ELN
#include stdio
#else
#include <stdio.h>
#endif
#include "pwr.h"
#include "pwr_nmpsclasses.h"
#include "rt_plc.h"
#include "co_time.h"
#define ODD(a) (((int)(a) & 1) != 0)
#define EVEN(a) (((int)(a) & 1) == 0)
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define min(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
#ifndef __ALPHA
#define abs(Dragon) ((Dragon) >= 0 ? (Dragon) : (-(Dragon)))
#endif
/**
RunningTime
@aref runningtime RunningTime
*/
void RunningTime_exec(
plc_sThread *tp,
pwr_sClass_RunningTime *object)
{
pwr_tFloat32 TimeSince;
/* Safeguard reasonable time 10 ms - 30 min */
TimeSince = *object->ScanTime;
if (TimeSince <= 0.0) TimeSince = 0.01;
if (TimeSince > 1800.0) TimeSince = 0.01;
/* Test if New Trip */
if (object->TripReset)
{
object->OldTripNOfStarts = object->TripNOfStarts;
object->OldTripRunHours = object->TripRunHours;
object->OldTripRunSeconds = object->TripRunSeconds;
object->OldTripHours = object->TripHours;
object->OldTripSeconds = object->TripSeconds;
object->OldTripUsage = object->TripUsage;
object->TripNOfStarts = 0;
object->TripRunHours = 0;
object->TripRunSeconds = 0.0;
object->TripHours = 0;
object->TripSeconds = 0.0;
clock_gettime(CLOCK_REALTIME, &object->ResetTime);
object->TripReset = 0;
}
/* Update Calendar time */
object->TotalSeconds += TimeSince;
if (object->TotalSeconds >= 3600.0)
{
object->TotalSeconds -= 3600.0;
object->TotalHours++;
}
object->TripSeconds += TimeSince;
if (object->TripSeconds >= 3600.0)
{
object->TripSeconds -= 3600.0;
object->TripHours++;
}
/* Test if running */
object->Start = 0;
if (*object->RunningP)
{
/* New start ? */
if (!object->Running)
{
object->Start = 1;
object->TotalNOfStarts++;
object->TripNOfStarts++;
clock_gettime(CLOCK_REALTIME, &object->StartTime);
} /* End if new start */
/* Update Running Time */
object->TripRunSeconds += TimeSince;
if (object->TripRunSeconds >= 3600.0)
{
object->TripRunSeconds -= 3600.0;
object->TripRunHours++;
}
object->TotalRunSeconds += TimeSince;
if (object->TotalRunSeconds >= 3600.0)
{
object->TotalRunSeconds -= 3600.0;
object->TotalRunHours++;
}
} /* End if Running */
object->Running = *object->RunningP;
/* Calculate usage % */
object->TotalUsage = (object->TotalRunHours * 3600.0 +
object->TotalRunSeconds) /
(object->TotalHours * 3600.0 + object->TotalSeconds) * 100.0;
object->TripUsage = (object->TripRunHours * 3600.0 +
object->TripRunSeconds) /
(object->TripHours * 3600.0 + object->TripSeconds) * 100.0;
}
This diff is collapsed.
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
!
! Proview $Id: nmps_c_loctrans.wb_load,v 1.1 2006-01-12 05:57:43 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.
!
! nmps_c_loctrans.wb_load -- Defines the class LocTrans.
!
SObject NMps:Class
!
! LocTrans - Local Trans descripton
!
Object LocTrans $ClassDef 49
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
!
! RemTrans Runtime Body
!
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "LocTrans"
EndBody
!
! Parameter Description
!
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!
! Parameter DataValid
!
Object DataValid $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
EndObject
EndObject ! $ClassDef
EndSObject ! SObject
/*
* Proview $Id: qbus_io.h,v 1.1 2006-01-12 05:54:27 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund 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.
*/
#define QBUS_IOCTL_PHYSBADLA 1
typedef struct {
unsigned int Address;
unsigned int Data;
} qbus_io_read;
typedef struct {
unsigned int Address;
unsigned int Data;
} qbus_io_write;
typedef struct {
unsigned int PhysBadla;
} qbus_io_ioctl;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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