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
3c22204f
Commit
3c22204f
authored
Nov 02, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PSS9000 IOM card methods updated
parent
07ff0b80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
40 deletions
+121
-40
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_mioup.c
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_mioup.c
+121
-40
No files found.
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_mioup.c
View file @
3c22204f
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
* 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
...
...
@@ -15,23 +13,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
* 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. */
...
...
@@ -61,16 +44,17 @@
#include "qbus_io.h"
#include "rt_io_m_ssab_locals.h"
#include "rt_io_bfbeth.h"
#include "rt_io_card_write.h"
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
#define IO_MAXCHAN
32
#define ADDR_DO_OFFSET 1
#define ADDR_AI_OFFSET
3
#define ADDR_AO_OFFSET
19
#define IO_MAXCHAN
128
#define ADDR_DO_OFFSET 1
6
#define ADDR_AI_OFFSET
48
#define ADDR_AO_OFFSET
32
typedef
struct
{
unsigned
int
Address
;
...
...
@@ -135,6 +119,65 @@ static pwr_tStatus AoRangeToCoef(
return
IO__SUCCESS
;
}
void
io_DoPackWord_Mio
(
io_sCard
*
cp
,
pwr_tUInt16
*
data
)
{
io_sChannel
*
chanp
;
chanp
=
&
cp
->
chanlist
[
4
];
*
data
=
0
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
1
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
2
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
4
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
8
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
16
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
32
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
64
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
128
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
256
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
512
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
1024
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
2048
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
4096
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
8192
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
16384
;
chanp
++
;
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
32768
;
chanp
++
;
}
static
pwr_tStatus
AiRangeToCoef
(
io_sChannel
*
chanp
)
{
...
...
@@ -267,11 +310,19 @@ static pwr_tStatus IoCardRead (
pwr_sClass_Ai
*
sop
;
int
sts
;
qbus_io_read
rb
;
qbus_io_write
writeb
;
int
bfb_error
=
0
;
pwr_tTime
now
;
local
=
(
io_sLocal
*
)
cp
->
Local
;
op
=
(
pwr_sClass_Ssab_BaseMCard
*
)
cp
->
op
;
writeb
.
Address
=
local
->
Address
;
writeb
.
Data
=
0
;
sts
=
write
(
local
->
Qbus_fp
,
&
writeb
,
sizeof
(
writeb
));
writeb
.
Address
=
local
->
Address
+
2
;
writeb
.
Data
=
0x0001
;
sts
=
write
(
(
int
)
local
->
Qbus_fp
,
&
writeb
,
sizeof
(
writeb
));
chanp
=
&
cp
->
chanlist
[
0
];
for
(
i
=
0
;
i
<
op
->
MaxNoOfAiChannels
;
i
++
)
...
...
@@ -293,15 +344,25 @@ static pwr_tStatus IoCardRead (
{
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
;
writeb
.
Address
=
local
->
Address
;
writeb
.
Data
=
ADDR_AI_OFFSET
+
16
*
i
;
sts
=
write
(
local
->
Qbus_fp
,
&
writeb
,
sizeof
(
writeb
));
if
(
sts
!=
-
1
)
{
rb
.
Address
=
local
->
Address
+
2
;
sts
=
read
(
local
->
Qbus_fp
,
&
rb
,
sizeof
(
rb
));
data
=
(
pwr_tInt16
)
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
);
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
),
(
pwr_tUInt16
)
(
ADDR_AI_OFFSET
+
16
*
i
));
data
=
bfbeth_get_data
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
+
2
),
&
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
));
bfbeth_set_read_req
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
+
2
));
if
(
sts
==
-
1
)
{
/* Error handling for ethernet Qbus-I/O */
...
...
@@ -413,7 +474,7 @@ static pwr_tStatus IoCardWrite (
int
fixout
;
pwr_tUInt16
data
=
0
;
pwr_tFloat32
rawvalue
;
qbus_io_write
wb
;
qbus_io_write
w
rite
b
;
int
sts
;
pwr_tTime
now
;
pwr_tUInt16
invmask
;
...
...
@@ -467,13 +528,23 @@ static pwr_tStatus IoCardWrite (
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
));
writeb
.
Address
=
local
->
Address
;
writeb
.
Data
=
ADDR_AO_OFFSET
+
16
*
i
;
sts
=
write
(
local
->
Qbus_fp
,
&
writeb
,
sizeof
(
writeb
));
if
(
sts
!=
-
1
)
{
writeb
.
Address
=
local
->
Address
+
2
;
writeb
.
Data
=
data
;
sts
=
write
(
local
->
Qbus_fp
,
&
writeb
,
sizeof
(
writeb
));
}
}
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
);
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
),
(
pwr_tUInt16
)
(
ADDR_AO_OFFSET
+
16
*
i
));
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
(
local
->
Address
+
2
),
data
);
sts
=
1
;
}
...
...
@@ -509,13 +580,16 @@ static pwr_tStatus IoCardWrite (
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
);
io_DoPackWord
_Mio
(
cp
,
&
data
);
testmask
=
op
->
DoTestMask
;
invmask
=
op
->
DoInvMask
;
...
...
@@ -532,13 +606,20 @@ static pwr_tStatus IoCardWrite (
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
));
writeb
.
Address
=
local
->
Address
;
writeb
.
Data
=
ADDR_DO_OFFSET
;
sts
=
write
(
local
->
Qbus_fp
,
&
writeb
,
sizeof
(
writeb
));
writeb
.
Data
=
data
;
writeb
.
Address
=
local
->
Address
+
2
;
sts
=
write
(
local
->
Qbus_fp
,
&
writeb
,
sizeof
(
writeb
));
}
else
{
/* Ethernet I/O, Request a write to current address */
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
+
ADDR_DO_OFFSET
,
data
);
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
,
(
pwr_tUInt16
)
(
ADDR_DO_OFFSET
));
bfbeth_set_write_req
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
+
2
,
data
);
sts
=
1
;
}
...
...
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