Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
2450ffeb
Commit
2450ffeb
authored
Aug 23, 2010
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of pwrcvs:/data1/git/pwr
parents
baf0fb5f
12a967ab
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
616 additions
and
4 deletions
+616
-4
java/jpwr/jop/src/os_linux/hw_x86_64/makefile
java/jpwr/jop/src/os_linux/hw_x86_64/makefile
+6
-0
java/jpwr/jop/src/os_macos/hw_x86_64/makefile
java/jpwr/jop/src/os_macos/hw_x86_64/makefile
+6
-0
java/jpwr/jopc/src/os_linux/hw_x86_64/makefile
java/jpwr/jopc/src/os_linux/hw_x86_64/makefile
+0
-1
java/jpwr/jopc/src/os_macos/hw_x86_64/makefile
java/jpwr/jopc/src/os_macos/hw_x86_64/makefile
+0
-1
otherio/lib/rt/src/rt_io_otherio.meth
otherio/lib/rt/src/rt_io_otherio.meth
+2
-0
src/exe/co_merge/src/co_merge.c
src/exe/co_merge/src/co_merge.c
+34
-1
src/lib/co/src/co_lng.cpp
src/lib/co/src/co_lng.cpp
+1
-1
ssabox/lib/rt/src/os_macos/rt_io_m_ssab_mioup.c
ssabox/lib/rt/src/os_macos/rt_io_m_ssab_mioup.c
+567
-0
No files found.
java/jpwr/jop/src/os_linux/hw_x86_64/makefile
View file @
2450ffeb
...
@@ -15,6 +15,8 @@ local_java_sources := \
...
@@ -15,6 +15,8 @@ local_java_sources := \
JopUtilityIfc.java
\
JopUtilityIfc.java
\
JopUtility.java
\
JopUtility.java
\
JopSession.java
\
JopSession.java
\
JopLang.java
\
JopMethods.java
\
JopMethodsMenu.java
\
JopMethodsMenu.java
\
JopConfirm.java
\
JopConfirm.java
\
JopConfirmDialog.java
\
JopConfirmDialog.java
\
...
@@ -69,6 +71,7 @@ local_java_sources := \
...
@@ -69,6 +71,7 @@ local_java_sources := \
GeDynTable.java
\
GeDynTable.java
\
GeDynHostObject.java
\
GeDynHostObject.java
\
GeDynXYCurve.java
\
GeDynXYCurve.java
\
GeDynSetValue.java
\
JopXYCurve.java
\
JopXYCurve.java
\
Proportion.java
\
Proportion.java
\
RatioLayout.java
\
RatioLayout.java
\
...
@@ -76,6 +79,7 @@ local_java_sources := \
...
@@ -76,6 +79,7 @@ local_java_sources := \
JopSpiderFrame.java
\
JopSpiderFrame.java
\
JopLoginFrame.java
\
JopLoginFrame.java
\
JopLoginApplet.java
\
JopLoginApplet.java
\
JopLanguageFrame.java
\
GeColorEditor.java
\
GeColorEditor.java
\
GeColorBrightnessEditor.java
\
GeColorBrightnessEditor.java
\
GeColorToneEditor.java
\
GeColorToneEditor.java
\
...
@@ -85,6 +89,7 @@ local_java_sources := \
...
@@ -85,6 +89,7 @@ local_java_sources := \
JopUtilities.java
\
JopUtilities.java
\
GeImage.java
\
GeImage.java
\
GeFrameThin.java
\
GeFrameThin.java
\
GeGradient.java
\
Flow.java
\
Flow.java
\
FlowCtxInterface.java
\
FlowCtxInterface.java
\
FlowCmn.java
\
FlowCmn.java
\
...
@@ -138,6 +143,7 @@ local_java_sources := \
...
@@ -138,6 +143,7 @@ local_java_sources := \
HistStatModel2.java
\
HistStatModel2.java
\
HistStatistics.java
\
HistStatistics.java
\
HistSearch.java
\
HistSearch.java
\
JopOp.java
\
JopSessionRep.java
JopSessionRep.java
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
...
...
java/jpwr/jop/src/os_macos/hw_x86_64/makefile
View file @
2450ffeb
...
@@ -15,6 +15,8 @@ local_java_sources := \
...
@@ -15,6 +15,8 @@ local_java_sources := \
JopUtilityIfc.java
\
JopUtilityIfc.java
\
JopUtility.java
\
JopUtility.java
\
JopSession.java
\
JopSession.java
\
JopLang.java
\
JopMethods.java
\
JopMethodsMenu.java
\
JopMethodsMenu.java
\
JopConfirm.java
\
JopConfirm.java
\
JopConfirmDialog.java
\
JopConfirmDialog.java
\
...
@@ -69,6 +71,7 @@ local_java_sources := \
...
@@ -69,6 +71,7 @@ local_java_sources := \
GeDynTable.java
\
GeDynTable.java
\
GeDynHostObject.java
\
GeDynHostObject.java
\
GeDynXYCurve.java
\
GeDynXYCurve.java
\
GeDynSetValue.java
\
JopXYCurve.java
\
JopXYCurve.java
\
Proportion.java
\
Proportion.java
\
RatioLayout.java
\
RatioLayout.java
\
...
@@ -76,6 +79,7 @@ local_java_sources := \
...
@@ -76,6 +79,7 @@ local_java_sources := \
JopSpiderFrame.java
\
JopSpiderFrame.java
\
JopLoginFrame.java
\
JopLoginFrame.java
\
JopLoginApplet.java
\
JopLoginApplet.java
\
JopLanguageFrame.java
\
GeColorEditor.java
\
GeColorEditor.java
\
GeColorBrightnessEditor.java
\
GeColorBrightnessEditor.java
\
GeColorToneEditor.java
\
GeColorToneEditor.java
\
...
@@ -85,6 +89,7 @@ local_java_sources := \
...
@@ -85,6 +89,7 @@ local_java_sources := \
JopUtilities.java
\
JopUtilities.java
\
GeImage.java
\
GeImage.java
\
GeFrameThin.java
\
GeFrameThin.java
\
GeGradient.java
\
Flow.java
\
Flow.java
\
FlowCtxInterface.java
\
FlowCtxInterface.java
\
FlowCmn.java
\
FlowCmn.java
\
...
@@ -138,6 +143,7 @@ local_java_sources := \
...
@@ -138,6 +143,7 @@ local_java_sources := \
HistStatModel2.java
\
HistStatModel2.java
\
HistStatistics.java
\
HistStatistics.java
\
HistSearch.java
\
HistSearch.java
\
JopOp.java
\
JopSessionRep.java
JopSessionRep.java
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
...
...
java/jpwr/jopc/src/os_linux/hw_x86_64/makefile
View file @
2450ffeb
...
@@ -34,7 +34,6 @@ local_java_sources := \
...
@@ -34,7 +34,6 @@ local_java_sources := \
JopcIi.java,
\
JopcIi.java,
\
JopcIoGen.java,
\
JopcIoGen.java,
\
JopcIo.java,
\
JopcIo.java,
\
JopcModeGen.java,
\
JopcMode.java,
\
JopcMode.java,
\
JopcMode_sub.java,
\
JopcMode_sub.java,
\
JopcPidGen.java,
\
JopcPidGen.java,
\
...
...
java/jpwr/jopc/src/os_macos/hw_x86_64/makefile
View file @
2450ffeb
...
@@ -34,7 +34,6 @@ local_java_sources := \
...
@@ -34,7 +34,6 @@ local_java_sources := \
JopcIi.java,
\
JopcIi.java,
\
JopcIoGen.java,
\
JopcIoGen.java,
\
JopcIo.java,
\
JopcIo.java,
\
JopcModeGen.java,
\
JopcMode.java,
\
JopcMode.java,
\
JopcMode_sub.java,
\
JopcMode_sub.java,
\
JopcPidGen.java,
\
JopcPidGen.java,
\
...
...
otherio/lib/rt/src/rt_io_otherio.meth
View file @
2450ffeb
...
@@ -5,8 +5,10 @@ Modbus_Module
...
@@ -5,8 +5,10 @@ Modbus_Module
Modbus_Master
Modbus_Master
Modbus_TCP_Server
Modbus_TCP_Server
Modbus_TCP_ServerModule
Modbus_TCP_ServerModule
#if OS_LINUX
GPIO
GPIO
GPIO_Module
GPIO_Module
Maxim_DS18B20
Maxim_DS18B20
USB_Agent
USB_Agent
Velleman_K8055_Board
Velleman_K8055_Board
#endif
\ No newline at end of file
src/exe/co_merge/src/co_merge.c
View file @
2450ffeb
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include "pwr.h"
#include "pwr.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_dcli.h"
typedef
enum
{
typedef
enum
{
...
@@ -40,6 +41,25 @@ void usage()
...
@@ -40,6 +41,25 @@ void usage()
"
);
"
);
}
}
static
int
check_os
(
char
*
str
,
char
*
os
)
{
char
os_vect
[
10
][
20
];
int
nr
;
int
i
;
char
os_element
[
20
];
nr
=
dcli_parse
(
str
,
"||"
,
""
,
(
char
*
)
os_vect
,
sizeof
(
os_vect
)
/
sizeof
(
os_vect
[
0
]),
sizeof
(
os_vect
[
0
]),
0
);
for
(
i
=
0
;
i
<
nr
;
i
++
)
{
dcli_trim
(
os_element
,
os_vect
[
i
]);
if
(
cdh_NoCaseStrcmp
(
os
,
os_element
)
==
0
)
return
1
;
}
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
pwr_tFileName
filespec
;
pwr_tFileName
filespec
;
...
@@ -61,6 +81,7 @@ int main( int argc, char *argv[])
...
@@ -61,6 +81,7 @@ int main( int argc, char *argv[])
char
pwre_cxx
[
80
];
char
pwre_cxx
[
80
];
char
pwre_ar
[
80
];
char
pwre_ar
[
80
];
char
*
s
;
char
*
s
;
int
in_if
=
0
;
#if defined OS_LINUX
#if defined OS_LINUX
char
dos
[]
=
"OS_LINUX"
;
char
dos
[]
=
"OS_LINUX"
;
#elif defined OS_MACOS
#elif defined OS_MACOS
...
@@ -108,7 +129,19 @@ int main( int argc, char *argv[])
...
@@ -108,7 +129,19 @@ int main( int argc, char *argv[])
while
(
dcli_read_line
(
line
,
sizeof
(
line
),
fp
))
{
while
(
dcli_read_line
(
line
,
sizeof
(
line
),
fp
))
{
dcli_trim
(
line
,
line
);
dcli_trim
(
line
,
line
);
if
(
line
[
0
]
==
0
||
line
[
0
]
==
'#'
)
if
(
strncmp
(
line
,
"#if"
,
3
)
==
0
)
{
in_if
=
!
check_os
(
&
line
[
5
],
dos
);
continue
;
}
else
if
(
in_if
)
{
if
(
strncmp
(
line
,
"#endif"
,
6
)
==
0
)
{
if
(
in_if
)
in_if
=
0
;
continue
;
}
continue
;
}
else
if
(
line
[
0
]
==
0
||
line
[
0
]
==
'#'
)
continue
;
continue
;
strncpy
(
mtab
[
mtabcnt
++
],
line
,
sizeof
(
mtab
[
0
]));
strncpy
(
mtab
[
mtabcnt
++
],
line
,
sizeof
(
mtab
[
0
]));
if
(
mtabcnt
>
(
int
)
sizeof
(
mtab
)
/
sizeof
(
mtab
[
0
])
-
1
)
if
(
mtabcnt
>
(
int
)
sizeof
(
mtab
)
/
sizeof
(
mtab
[
0
])
-
1
)
...
...
src/lib/co/src/co_lng.cpp
View file @
2450ffeb
...
@@ -418,7 +418,7 @@ bool Lng::read()
...
@@ -418,7 +418,7 @@ bool Lng::read()
lang_sKey
key
;
lang_sKey
key
;
lang_sRecord
*
record
;
lang_sRecord
*
record
;
str
cpy
(
key
.
text
,
r1
.
text
);
str
ncpy
(
key
.
text
,
r1
.
text
,
sizeof
(
key
.
text
)
);
key
.
type
=
r1
.
type
;
key
.
type
=
r1
.
type
;
record
=
(
lang_sRecord
*
)
tree_Insert
(
&
sts
,
tree
,
&
key
);
record
=
(
lang_sRecord
*
)
tree_Insert
(
&
sts
,
tree
,
&
key
);
strcpy
(
record
->
transl
,
r2
.
text
);
strcpy
(
record
->
transl
,
r2
.
text
);
...
...
ssabox/lib/rt/src/os_macos/rt_io_m_ssab_mioup.c
0 → 100644
View file @
2450ffeb
/*
* 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_ssab_mioup.c -- io methods for ssab cards. */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include "pwr.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_gdh.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_ssaboxclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_io_ssab.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
#include "rt_io_card_read.h"
#include "qbus_io.h"
#include "rt_io_m_ssab_locals.h"
#include "rt_io_bfbeth.h"
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
#define IO_MAXCHAN 32
#define ADDR_DO_OFFSET 1
#define ADDR_AI_OFFSET 3
#define ADDR_AO_OFFSET 19
typedef
struct
{
unsigned
int
Address
;
int
Qbus_fp
;
int
ScanCount
[
IO_MAXCHAN
];
unsigned
int
bfb_item
;
pwr_tFloat32
OldValue
[
IO_MAXCHAN
];
pwr_tBoolean
OldTestOn
[
IO_MAXCHAN
];
int
WriteFirst
;
pwr_tTime
ErrTime
;
}
io_sLocal
;
static
pwr_tStatus
AoRangeToCoef
(
io_sChannel
*
chanp
)
{
pwr_sClass_ChanAo
*
cop
;
char
buf
[
120
];
pwr_tStatus
sts
;
pwr_tFloat32
PolyCoef1
;
pwr_tFloat32
PolyCoef0
;
cop
=
chanp
->
cop
;
if
(
cop
)
{
cop
->
CalculateNewCoef
=
0
;
/* Coef for ActualValue to RawValue conversion */
if
(
cop
->
ActValRangeHigh
!=
cop
->
ActValRangeLow
)
{
cop
->
SigValPolyCoef1
=
(
cop
->
SensorSigValRangeHigh
-
cop
->
SensorSigValRangeLow
)
/
(
cop
->
ActValRangeHigh
-
cop
->
ActValRangeLow
);
cop
->
SigValPolyCoef0
=
cop
->
SensorSigValRangeHigh
-
cop
->
ActValRangeHigh
*
cop
->
SigValPolyCoef1
;
}
else
{
sts
=
gdh_AttrrefToName
(
&
chanp
->
ChanAref
,
buf
,
sizeof
(
buf
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
sts
;
errh_Error
(
"Invalid ActValueRange in Ao channel %s"
,
buf
);
return
IO__CHANRANGE
;
}
/* Coef for ActualValue to SignalValue conversion */
if
(
cop
->
ChannelSigValRangeHigh
!=
0
)
{
PolyCoef0
=
0
;
PolyCoef1
=
cop
->
RawValRangeHigh
/
cop
->
ChannelSigValRangeHigh
;
cop
->
OutPolyCoef1
=
cop
->
SigValPolyCoef1
*
PolyCoef1
;
cop
->
OutPolyCoef0
=
PolyCoef0
+
PolyCoef1
*
cop
->
SigValPolyCoef0
;
}
else
{
sts
=
gdh_AttrrefToName
(
&
chanp
->
ChanAref
,
buf
,
sizeof
(
buf
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
sts
;
errh_Error
(
"Invalid SigValueRange in Ao channel %s"
,
buf
);
return
IO__CHANRANGE
;
}
}
return
IO__SUCCESS
;
}
static
pwr_tStatus
AiRangeToCoef
(
io_sChannel
*
chanp
)
{
pwr_sClass_ChanAi
*
cop
;
char
buf
[
120
];
pwr_tStatus
sts
;
pwr_tFloat32
PolyCoef1
;
pwr_tFloat32
PolyCoef0
;
cop
=
chanp
->
cop
;
if
(
cop
)
{
cop
->
CalculateNewCoef
=
0
;
/* Coef for RawValue to SignalValue conversion */
cop
->
SigValPolyCoef0
=
0
;
cop
->
SigValPolyCoef1
=
cop
->
ChannelSigValRangeHigh
/
30000
;
/* Coef for SignalValue to ActualValue conversion */
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanAit
&&
cop
->
SensorPolyType
==
1
)
{
if
(
cop
->
SensorSigValRangeHigh
!=
cop
->
SensorSigValRangeLow
)
{
PolyCoef1
=
(
cop
->
ActValRangeHigh
-
cop
->
ActValRangeLow
)
/
(
cop
->
SensorSigValRangeHigh
-
cop
->
SensorSigValRangeLow
);
PolyCoef0
=
cop
->
ActValRangeHigh
-
cop
->
SensorSigValRangeHigh
*
PolyCoef1
;
cop
->
SensorPolyCoef1
=
cop
->
SigValPolyCoef1
*
PolyCoef1
;
cop
->
SensorPolyCoef0
=
PolyCoef0
+
PolyCoef1
*
cop
->
SigValPolyCoef0
;
}
else
{
sts
=
gdh_AttrrefToName
(
&
chanp
->
ChanAref
,
buf
,
sizeof
(
buf
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
sts
;
errh_Error
(
"Invalid SigValueRange in Ai channel %s"
,
buf
);
return
IO__CHANRANGE
;
}
}
}
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
pwr_sClass_Ssab_BaseMCard
*
op
;
io_sLocal
*
local
;
int
i
;
io_sChannel
*
chanp
;
op
=
(
pwr_sClass_Ssab_BaseMCard
*
)
cp
->
op
;
local
=
calloc
(
1
,
sizeof
(
*
local
));
cp
->
Local
=
local
;
local
->
Address
=
op
->
RegAddress
;
local
->
Qbus_fp
=
((
io_sRackLocal
*
)(
rp
->
Local
))
->
Qbus_fp
;
errh_Info
(
"Init of Multi IO card '%s'"
,
cp
->
Name
);
/* Write the first 50 loops */
local
->
WriteFirst
=
50
;
/* Calculate polycoeff for Ai */
chanp
=
cp
->
chanlist
;
for
(
i
=
0
;
i
<
op
->
MaxNoOfAiChannels
;
i
++
)
{
if
(
chanp
->
sop
)
AiRangeToCoef
(
chanp
);
chanp
++
;
}
/* Caluclate polycoeff for Ao */
chanp
=
cp
->
chanlist
+
op
->
MaxNoOfAiChannels
;
for
(
i
=
0
;
i
<
op
->
MaxNoOfAoChannels
;
i
++
)
{
if
(
chanp
->
sop
)
AoRangeToCoef
(
chanp
);
chanp
++
;
}
return
1
;
}
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sLocal
*
local
;
errh_Info
(
"IO closing ai card '%s'"
,
cp
->
Name
);
local
=
(
io_sLocal
*
)
cp
->
Local
;
free
(
(
char
*
)
local
);
return
1
;
}
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sLocal
*
local
;
io_sRackLocal
*
r_local
=
(
io_sRackLocal
*
)(
rp
->
Local
);
pwr_tInt16
data
=
0
;
pwr_sClass_Ssab_BaseMCard
*
op
;
pwr_sClass_Ssab_RemoteRack
*
rrp
;
int
i
;
pwr_tFloat32
actvalue
;
io_sChannel
*
chanp
;
pwr_sClass_ChanAi
*
cop
;
pwr_sClass_Ai
*
sop
;
int
sts
;
qbus_io_read
rb
;
int
bfb_error
=
0
;
pwr_tTime
now
;
local
=
(
io_sLocal
*
)
cp
->
Local
;
op
=
(
pwr_sClass_Ssab_BaseMCard
*
)
cp
->
op
;
chanp
=
&
cp
->
chanlist
[
0
];
for
(
i
=
0
;
i
<
op
->
MaxNoOfAiChannels
;
i
++
)
{
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
{
chanp
++
;
continue
;
}
cop
=
(
pwr_sClass_ChanAi
*
)
chanp
->
cop
;
sop
=
(
pwr_sClass_Ai
*
)
chanp
->
sop
;
if
(
cop
->
CalculateNewCoef
)
AiRangeToCoef
(
chanp
);
if
(
cop
->
ConversionOn
)
{
if
(
local
->
ScanCount
[
i
]
<=
1
)
{
if
(
r_local
->
Qbus_fp
!=
0
&&
r_local
->
s
==
0
)
{
rb
.
Address
=
local
->
Address
+
2
*
i
+
ADDR_AI_OFFSET
;
sts
=
read
(
local
->
Qbus_fp
,
&
rb
,
sizeof
(
rb
));
data
=
(
unsigned
short
)
rb
.
Data
;
}
else
{
/* Ethernet I/O, Get data from current address */
data
=
bfbeth_get_data
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
+
2
*
i
+
ADDR_AI_OFFSET
),
&
sts
);
/* Yes, we want to read this address the next time aswell */
bfbeth_set_read_req
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
+
2
*
i
+
ADDR_AI_OFFSET
));
if
(
sts
==
-
1
)
{
/* Error handling for ethernet Qbus-I/O */
rrp
=
(
pwr_sClass_Ssab_RemoteRack
*
)
rp
->
op
;
if
(
bfb_error
==
0
)
{
op
->
ErrorCount
++
;
bfb_error
=
1
;
if
(
op
->
ErrorCount
==
op
->
ErrorSoftLimit
)
errh_Error
(
"IO Error soft limit reached on card '%s'"
,
cp
->
Name
);
if
(
op
->
ErrorCount
==
op
->
ErrorHardLimit
)
errh_Error
(
"IO Error hard limit reached on card '%s', stall action %d"
,
cp
->
Name
,
rrp
->
StallAction
);
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
&&
rrp
->
StallAction
==
pwr_eSsabStallAction_ResetInputs
)
{
data
=
0
;
sts
=
1
;
}
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
&&
rrp
->
StallAction
==
pwr_eSsabStallAction_EmergencyBreak
)
{
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
}
}
if
(
sts
==
-
1
)
{
chanp
++
;
continue
;
}
}
else
{
op
->
ErrorCount
=
0
;
}
}
if
(
sts
==
-
1
)
/* Error handling for local Qbus-I/O */
{
/* Increase error count and check error limits */
time_GetTime
(
&
now
);
if
(
op
->
ErrorCount
>
op
->
ErrorSoftLimit
)
{
/* Ignore if some time has expired */
if
(
now
.
tv_sec
-
local
->
ErrTime
.
tv_sec
<
600
)
op
->
ErrorCount
++
;
}
else
op
->
ErrorCount
++
;
local
->
ErrTime
=
now
;
if
(
op
->
ErrorCount
==
op
->
ErrorSoftLimit
)
errh_Error
(
"IO Error soft limit reached on card '%s'"
,
cp
->
Name
);
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
)
{
errh_Error
(
"IO Error hard limit reached on card '%s', IO stopped"
,
cp
->
Name
);
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
}
chanp
++
;
continue
;
}
/* Convert rawvalue to sigvalue and actualvalue */
sop
->
RawValue
=
data
;
sop
->
SigValue
=
data
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanAi
:
io_ConvertAi
(
cop
,
data
,
&
actvalue
);
break
;
case
pwr_cClass_ChanAit
:
io_ConvertAit
(
(
pwr_sClass_ChanAit
*
)
cop
,
data
,
&
actvalue
);
break
;
}
/* Filter */
if
(
sop
->
FilterType
==
1
&&
sop
->
FilterAttribute
[
0
]
>
0
&&
sop
->
FilterAttribute
[
0
]
>
ctx
->
ScanTime
)
{
actvalue
=
*
(
pwr_tFloat32
*
)
chanp
->
vbp
+
ctx
->
ScanTime
/
sop
->
FilterAttribute
[
0
]
*
(
actvalue
-
*
(
pwr_tFloat32
*
)
chanp
->
vbp
);
}
*
(
pwr_tFloat32
*
)
chanp
->
vbp
=
actvalue
;
local
->
ScanCount
[
i
]
=
cop
->
ScanInterval
+
1
;
}
local
->
ScanCount
[
i
]
--
;
}
chanp
++
;
}
return
1
;
}
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sLocal
*
local
;
io_sRackLocal
*
r_local
=
(
io_sRackLocal
*
)(
rp
->
Local
);
pwr_sClass_Ssab_BaseMCard
*
op
;
int
i
;
io_sChannel
*
chanp
;
pwr_sClass_ChanAo
*
cop
;
pwr_sClass_Ao
*
sop
;
pwr_tFloat32
value
;
int
fixout
;
pwr_tUInt16
data
=
0
;
pwr_tFloat32
rawvalue
;
qbus_io_write
wb
;
int
sts
;
pwr_tTime
now
;
pwr_tUInt16
invmask
;
pwr_tUInt16
testmask
;
pwr_tUInt16
testvalue
;
local
=
(
io_sLocal
*
)
cp
->
Local
;
op
=
(
pwr_sClass_Ssab_BaseMCard
*
)
cp
->
op
;
fixout
=
ctx
->
Node
->
EmergBreakTrue
&&
ctx
->
Node
->
EmergBreakSelect
==
FIXOUT
;
chanp
=
&
cp
->
chanlist
[
op
->
MaxNoOfAiChannels
];
for
(
i
=
0
;
i
<
op
->
MaxNoOfAoChannels
;
i
++
)
{
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
{
chanp
++
;
continue
;
}
cop
=
(
pwr_sClass_ChanAo
*
)
chanp
->
cop
;
sop
=
(
pwr_sClass_Ao
*
)
chanp
->
sop
;
if
(
*
(
pwr_tFloat32
*
)
chanp
->
vbp
!=
local
->
OldValue
[
i
]
||
local
->
WriteFirst
>
0
||
cop
->
CalculateNewCoef
||
fixout
||
cop
->
TestOn
||
local
->
OldTestOn
[
i
]
!=
cop
->
TestOn
)
{
if
(
fixout
)
value
=
cop
->
FixedOutValue
;
else
if
(
cop
->
TestOn
)
value
=
cop
->
TestValue
;
else
value
=
*
(
pwr_tFloat32
*
)
chanp
->
vbp
;
if
(
cop
->
CalculateNewCoef
)
AoRangeToCoef
(
chanp
);
/* Convert to rawvalue */
if
(
value
>
cop
->
ActValRangeHigh
)
value
=
cop
->
ActValRangeHigh
;
else
if
(
value
<
cop
->
ActValRangeLow
)
value
=
cop
->
ActValRangeLow
;
rawvalue
=
cop
->
OutPolyCoef1
*
value
+
cop
->
OutPolyCoef0
;
if
(
rawvalue
>
0
)
sop
->
RawValue
=
rawvalue
+
0
.
5
;
else
sop
->
RawValue
=
rawvalue
-
0
.
5
;
data
=
sop
->
RawValue
;
if
(
r_local
->
Qbus_fp
!=
0
&&
r_local
->
s
==
0
)
{
wb
.
Data
=
data
;
wb
.
Address
=
local
->
Address
+
2
*
i
+
ADDR_AO_OFFSET
;
sts
=
write
(
local
->
Qbus_fp
,
&
wb
,
sizeof
(
wb
));
}
else
{
/* Ethernet I/O, Request a write to current address */
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
+
2
*
i
+
ADDR_AO_OFFSET
),
data
);
sts
=
1
;
}
if
(
sts
==
-
1
)
{
/* Exceptionhandler was called */
/* Increase error count and check error limits */
time_GetTime
(
&
now
);
if
(
op
->
ErrorCount
>
op
->
ErrorSoftLimit
)
{
/* Ignore if some time has expired */
if
(
now
.
tv_sec
-
local
->
ErrTime
.
tv_sec
<
600
)
op
->
ErrorCount
++
;
}
else
op
->
ErrorCount
++
;
local
->
ErrTime
=
now
;
if
(
op
->
ErrorCount
==
op
->
ErrorSoftLimit
)
errh_Error
(
"IO Error soft limit reached on card '%s'"
,
cp
->
Name
);
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
)
{
errh_Error
(
"IO Error hard limit reached on card '%s', IO stopped"
,
cp
->
Name
);
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
}
chanp
++
;
continue
;
}
else
local
->
OldValue
[
i
]
=
value
;
}
local
->
OldTestOn
[
i
]
=
cop
->
TestOn
;
chanp
++
;
}
if
(
local
->
WriteFirst
)
local
->
WriteFirst
--
;
if
(
ctx
->
Node
->
EmergBreakTrue
&&
ctx
->
Node
->
EmergBreakSelect
==
FIXOUT
)
data
=
op
->
DoFixedOutValue
;
else
io_DoPackWord
(
cp
,
&
data
,
i
);
testmask
=
op
->
DoTestMask
;
invmask
=
op
->
DoInvMask
;
/* Invert */
data
=
data
^
invmask
;
/* Testvalues */
if
(
testmask
)
{
testvalue
=
op
->
DoTestValue
;
data
=
(
data
&
~
testmask
)
|
(
testmask
&
testvalue
);
}
if
(
r_local
->
Qbus_fp
!=
0
&&
r_local
->
s
==
0
)
{
/* Write to local Q-bus */
wb
.
Data
=
data
;
wb
.
Address
=
local
->
Address
+
ADDR_DO_OFFSET
;
sts
=
write
(
local
->
Qbus_fp
,
&
wb
,
sizeof
(
wb
));
}
else
{
/* Ethernet I/O, Request a write to current address */
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
+
ADDR_DO_OFFSET
,
data
);
sts
=
1
;
}
if
(
sts
==
-
1
)
{
/* Increase error count and check error limits */
time_GetTime
(
&
now
);
if
(
op
->
ErrorCount
>
op
->
ErrorSoftLimit
)
{
/* Ignore if some time has expired */
if
(
now
.
tv_sec
-
local
->
ErrTime
.
tv_sec
<
600
)
op
->
ErrorCount
++
;
}
else
op
->
ErrorCount
++
;
local
->
ErrTime
=
now
;
if
(
op
->
ErrorCount
==
op
->
ErrorSoftLimit
)
errh_Error
(
"IO Error soft limit reached on card '%s'"
,
cp
->
Name
);
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
)
{
errh_Error
(
"IO Error hard limit reached on card '%s', IO stopped"
,
cp
->
Name
);
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
}
}
return
1
;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Ssab_MIOuP
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_NullMethod
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment