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
39f8971d
Commit
39f8971d
authored
Sep 04, 2011
by
claes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of 62.20.65.89:/data1/git/pwr
parents
8135fea8
93679d5b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
222 additions
and
147 deletions
+222
-147
profibus/lib/rt/src/os_linux/rt_io_m_pb_profiboard.c
profibus/lib/rt/src/os_linux/rt_io_m_pb_profiboard.c
+36
-22
src/exe/rt_emon/src/rt_emon.c
src/exe/rt_emon/src/rt_emon.c
+11
-1
src/exe/rt_io_comm/src/rt_io_comm.c
src/exe/rt_io_comm/src/rt_io_comm.c
+36
-6
src/lib/rt/src/rt_io_base.c
src/lib/rt/src/rt_io_base.c
+30
-45
src/lib/rt/src/rt_io_base.h
src/lib/rt/src/rt_io_base.h
+9
-1
src/lib/rt/src/rt_plc.h
src/lib/rt/src/rt_plc.h
+1
-0
src/lib/rt/src/rt_plc_thread.c
src/lib/rt/src/rt_plc_thread.c
+4
-0
ssabox/lib/rt/src/os_linux/rt_io_m_rack_ssab.c
ssabox/lib/rt/src/os_linux/rt_io_m_rack_ssab.c
+21
-13
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_do.c
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_do.c
+29
-23
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_remoterack.c
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_remoterack.c
+45
-36
No files found.
profibus/lib/rt/src/os_linux/rt_io_m_pb_profiboard.c
View file @
39f8971d
...
...
@@ -107,7 +107,8 @@ static pwr_tStatus IoAgentClose (
);
static
pwr_tStatus
IoAgentSwap
(
io_tCtx
ctx
,
io_sAgent
*
ap
io_sAgent
*
ap
,
io_eEvent
event
);
...
...
@@ -784,36 +785,49 @@ static pwr_tStatus IoAgentInit (
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoAgentSwap
(
io_tCtx
ctx
,
io_sAgent
*
ap
io_sAgent
*
ap
,
io_eEvent
event
)
{
pwr_sClass_Pb_Profiboard
*
op
;
char
DeviceName
[
64
];
io_sAgentLocal
*
local
;
switch
(
event
)
{
case
io_eEvent_IoCommSwapInit
:
case
io_eEvent_IoCommSwap
:
{
pwr_sClass_Pb_Profiboard
*
op
;
char
DeviceName
[
64
];
io_sAgentLocal
*
local
;
if
(
ap
->
Local
==
NULL
)
{
/* Allocate area for local data structure */
ap
->
Local
=
calloc
(
1
,
sizeof
(
io_sAgentLocal
));
if
(
!
ap
->
Local
)
{
errh_Error
(
"ERROR swap init Profibus DP Master %s - %s"
,
ap
->
Name
,
"calloc"
);
return
IO__ERRINIDEVICE
;
}
if
(
ap
->
Local
==
NULL
)
{
/* Allocate area for local data structure */
ap
->
Local
=
calloc
(
1
,
sizeof
(
io_sAgentLocal
));
if
(
!
ap
->
Local
)
{
errh_Error
(
"ERROR swap init Profibus DP Master %s - %s"
,
ap
->
Name
,
"calloc"
);
return
IO__ERRINIDEVICE
;
}
local
=
(
io_sAgentLocal
*
)
ap
->
Local
;
errh_Info
(
"Swap init interface for Profibus DP Master %s"
,
ap
->
Name
);
local
=
(
io_sAgentLocal
*
)
ap
->
Local
;
errh_Info
(
"Swap init interface for Profibus DP Master %s"
,
ap
->
Name
);
op
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
op
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
sprintf
(
DeviceName
,
"/dev/pbboard%u"
,
op
->
BusNumber
-
1
);
local
->
hDpsBoardDevice
=
open
(
DeviceName
,
O_RDONLY
|
O_NONBLOCK
);
sprintf
(
DeviceName
,
"/dev/pbboard%u"
,
op
->
BusNumber
-
1
);
local
->
hDpsBoardDevice
=
open
(
DeviceName
,
O_RDONLY
|
O_NONBLOCK
);
if
(
local
->
hDpsBoardDevice
==
-
1
)
{
errh_Error
(
"ERROR swap init Profibus DP Master %s - %s"
,
ap
->
Name
,
"open"
);
return
IO__ERRINIDEVICE
;
if
(
local
->
hDpsBoardDevice
==
-
1
)
{
errh_Error
(
"ERROR swap init Profibus DP Master %s - %s"
,
ap
->
Name
,
"open"
);
return
IO__ERRINIDEVICE
;
}
}
break
;
}
case
io_eEvent_EmergencyBreak
:
case
io_eEvent_IoCommEmergencyBreak
:
IoAgentClose
(
ctx
,
ap
);
break
;
}
return
IO__SUCCESS
;
}
...
...
src/exe/rt_emon/src/rt_emon.c
View file @
39f8971d
...
...
@@ -405,6 +405,7 @@ struct sLocal {
sNodeInfo
nodeDb
[
cNodes
];
pwr_tBoolean
outunitServer
;
pwr_sClass_IOHandler
*
iohp
;
pwr_sNode
*
nodep
;
};
/* Global variables */
...
...
@@ -1253,6 +1254,7 @@ cSup_exec (
o
->
DelayNoted
=
TRUE
;
if
(
o
->
DelayAction
==
2
)
{
l
.
iohp
->
IOReadWriteFlag
=
FALSE
;
l
.
nodep
->
EmergBreakTrue
=
TRUE
;
errh_SetStatus
(
MH__IOSTALLED
);
}
}
...
...
@@ -1996,6 +1998,7 @@ getHandlerObject ()
pwr_sAttrRef
aref
;
pwr_tDlid
dlid
;
pwr_tBoolean
created
=
FALSE
;
pwr_tOid
node_oid
;
sts
=
gdh_GetClassList
(
pwr_eClass_Node
,
&
nodeOid
);
if
(
EVEN
(
sts
))
{
...
...
@@ -2099,7 +2102,14 @@ getHandlerObject ()
l
.
iohp
=
NULL
;
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
l
.
iohp
);
sts
=
gdh_GetNodeObject
(
0
,
&
node_oid
);
if
(
ODD
(
sts
))
sts
=
gdh_ObjidToPointer
(
node_oid
,
(
void
**
)
&
l
.
nodep
);
if
(
EVEN
(
sts
))
{
errh_Fatal
(
"No node object found
\n
%m"
,
sts
);
exit
(
sts
);
}
}
static
mh_eAgent
...
...
src/exe/rt_io_comm/src/rt_io_comm.c
View file @
39f8971d
...
...
@@ -70,7 +70,7 @@
EVENT
io_comm_terminate
;
#endif
static
pwr_sClass_IOHandler
*
init
(
qcom_sQid
*
,
lst_sEntry
**
);
static
pwr_sClass_IOHandler
*
init
(
qcom_sQid
*
,
lst_sEntry
**
,
pwr_sNode
**
);
static
void
usage
()
{
...
...
@@ -100,6 +100,8 @@ int main (int argc, char **argv)
pwr_tDeltaTime
cycle
;
lst_sEntry
*
csup_lh
;
int
delay_action
=
0
;
pwr_sNode
*
nodep
;
pwr_tBoolean
old_emergency_break
=
0
;
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"-m"
)
==
0
)
{
...
...
@@ -112,7 +114,7 @@ int main (int argc, char **argv)
}
}
ihp
=
init
(
&
qid
,
&
csup_lh
);
ihp
=
init
(
&
qid
,
&
csup_lh
,
&
nodep
);
plc_UtlWaitForPlc
();
...
...
@@ -146,13 +148,28 @@ int main (int argc, char **argv)
get
.
data
=
mp
;
qcom_Get
(
&
sts
,
&
qid
,
&
get
,
tmo
);
if
(
sts
==
QCOM__TMO
||
sts
==
QCOM__QEMPTY
)
{
if
(
nodep
->
EmergBreakTrue
&&
!
old_emergency_break
)
sts
=
io_swap
(
io_ctx_swap
,
io_eEvent_IoCommEmergencyBreak
);
sts
=
io_read
(
io_ctx
);
if
(
EVEN
(
sts
))
{
ihp
->
IOReadWriteFlag
=
FALSE
;
errh_Error
(
"IO read, %m"
,
sts
);
}
sts
=
io_write
(
io_ctx
);
if
(
EVEN
(
sts
))
{
ihp
->
IOReadWriteFlag
=
FALSE
;
errh_Error
(
"IO write, %m"
,
sts
);
}
if
(
nodep
->
EmergBreakTrue
&&
!
old_emergency_break
)
sts
=
io_swap
(
io_ctx
,
io_eEvent_EmergencyBreak
);
old_emergency_break
=
nodep
->
EmergBreakTrue
;
if
(
swap_io
)
{
sts
=
io_swap
(
io_ctx_swap
);
sts
=
io_swap
(
io_ctx_swap
,
io_eEvent_IoCommSwap
);
}
io_ScanSupLst
(
io_ctx
->
SupCtx
);
...
...
@@ -193,13 +210,14 @@ int main (int argc, char **argv)
}
static
pwr_sClass_IOHandler
*
init
(
qcom_sQid
*
qid
,
lst_sEntry
**
csup_lh
)
init
(
qcom_sQid
*
qid
,
lst_sEntry
**
csup_lh
,
pwr_sNode
**
nodep
)
{
pwr_tStatus
sts
=
1
;
pwr_sClass_IOHandler
*
ihp
;
qcom_sQattr
qAttr
;
qcom_sQid
qini
;
pwr_tObjid
oid
;
pwr_tOid
oid
;
pwr_tOid
node_oid
;
errh_Init
(
"pwr_io"
,
errh_eAnix_io
);
...
...
@@ -238,6 +256,18 @@ init (qcom_sQid *qid, lst_sEntry **csup_lh)
exit
(
sts
);
}
sts
=
gdh_GetNodeObject
(
0
,
&
node_oid
);
if
(
EVEN
(
sts
))
{
errh_Fatal
(
"rt_io_comm aborted, no node object found
\n
%m"
,
sts
);
exit
(
sts
);
}
sts
=
gdh_ObjidToPointer
(
node_oid
,
(
void
**
)
nodep
);
if
(
EVEN
(
sts
))
{
errh_Fatal
(
"rt_io_comm aborted, no node object found
\n
%m"
,
sts
);
exit
(
sts
);
}
aproc_RegisterObject
(
oid
);
*
csup_lh
=
csup_Init
(
&
sts
,
oid
,
ihp
->
CycleTimeBus
);
...
...
src/lib/rt/src/rt_io_base.c
View file @
39f8971d
...
...
@@ -2143,7 +2143,7 @@ static pwr_tStatus io_init_agent(
io_tCtx
ctx
,
void
*
dummy
,
int
agent_type
,
int
swap
)
int
iocomm_
swap
)
{
pwr_tStatus
sts
;
pwr_tClassId
class
;
...
...
@@ -2181,7 +2181,7 @@ static pwr_tStatus io_init_agent(
strcat
(
attrname
,
".Process"
);
sts
=
gdh_GetObjectInfo
(
attrname
,
&
process
,
sizeof
(
process
));
if
((
EVEN
(
sts
)
||
(
ODD
(
sts
)
&&
ctx
->
Process
&
process
))
&&
!
swap
)
{
(
ODD
(
sts
)
&&
ctx
->
Process
&
process
))
&&
!
iocomm_
swap
)
{
if
(
EVEN
(
sts
))
process
=
io_mProcess_All
;
if
(
ctx
->
Process
==
io_mProcess_Profibus
)
...
...
@@ -2199,7 +2199,7 @@ static pwr_tStatus io_init_agent(
else
ok
=
1
;
}
else
if
(
ODD
(
sts
)
&&
swap
&&
AgentSwap
!=
NULL
)
{
else
if
(
ODD
(
sts
)
&&
iocomm_
swap
&&
AgentSwap
!=
NULL
)
{
/* IoComm-process should always handle the Swap-method */
ok
=
1
;
}
...
...
@@ -2213,11 +2213,13 @@ static pwr_tStatus io_init_agent(
ap
->
Objid
=
objid
;
strcpy
(
ap
->
Name
,
aname
);
ap
->
Process
=
process
;
if
(
!
swap
)
{
if
(
!
iocomm_
swap
)
{
if
(
AgentRead
!=
NULL
)
ap
->
Action
|=
io_mAction_Read
;
if
(
AgentWrite
!=
NULL
)
ap
->
Action
|=
io_mAction_Write
;
if
(
AgentSwap
!=
NULL
)
ap
->
Action
|=
io_mAction_Swap
;
ap
->
Init
=
AgentInit
;
ap
->
Close
=
AgentClose
;
ap
->
Read
=
AgentRead
;
...
...
@@ -2252,7 +2254,7 @@ static pwr_tStatus io_init_agent(
alp
->
next
=
ap
;
}
sts
=
io_trv_child
(
objid
,
0
,
io_init_rack
,
ctx
,
ap
,
agent_type
,
swap
);
sts
=
io_trv_child
(
objid
,
0
,
io_init_rack
,
ctx
,
ap
,
agent_type
,
iocomm_
swap
);
}
}
}
...
...
@@ -2646,7 +2648,7 @@ pwr_tStatus io_init_swap (
{
if
(
ap
->
Action
&
io_mAction_Swap
)
{
sts
=
(
ap
->
Swap
)
(
*
ctx
,
ap
);
sts
=
(
ap
->
Swap
)
(
*
ctx
,
ap
,
io_eEvent_IoCommSwapInit
);
if
(
EVEN
(
sts
))
return
sts
;
}
}
...
...
@@ -2798,59 +2800,42 @@ pwr_tStatus io_write(
Swap io racks and cards.
\*----------------------------------------------------------------------------*/
pwr_tStatus
io_swap
(
io_tCtx
ctx
)
io_tCtx
ctx
,
io_eEvent
event
)
{
pwr_tStatus
sts
;
io_sAgent
*
ap
;
io_sRack
*
rp
;
io_sCard
*
cp
;
if
(
ctx
->
Node
->
EmergBreakTrue
||
!
ctx
->
IOHandler
->
IOReadWriteFlag
)
return
IO__IS_STOPPED
;
switch
(
event
)
{
case
io_eEvent_EmergencyBreak
:
case
io_eEvent_IoCommEmergencyBreak
:
break
;
default:
if
(
ctx
->
Node
->
EmergBreakTrue
||
!
ctx
->
IOHandler
->
IOReadWriteFlag
)
return
IO__IS_STOPPED
;
}
/* Call the read methods for agents, racks and cards */
for
(
ap
=
ctx
->
agentlist
;
ap
!=
NULL
;
ap
=
ap
->
next
)
{
if
(
ap
->
Action
&
io_mAction_Swap
)
{
if
(
ap
->
scan_interval_cnt
<=
1
)
{
sts
=
(
ap
->
Swap
)
(
ctx
,
ap
);
if
(
EVEN
(
sts
))
return
sts
;
ap
->
scan_interval_cnt
=
ap
->
scan_interval
;
}
else
ap
->
scan_interval_cnt
--
;
for
(
ap
=
ctx
->
agentlist
;
ap
!=
NULL
;
ap
=
ap
->
next
)
{
if
(
ap
->
Action
&
io_mAction_Swap
)
{
sts
=
(
ap
->
Swap
)
(
ctx
,
ap
,
event
);
if
(
EVEN
(
sts
))
return
sts
;
}
for
(
rp
=
ap
->
racklist
;
rp
!=
NULL
;
rp
=
rp
->
next
)
{
for
(
rp
=
ap
->
racklist
;
rp
!=
NULL
;
rp
=
rp
->
next
)
{
if
(
rp
->
Action
&
io_mAction_Swap
&&
!
rp
->
MethodDisabled
)
{
if
(
rp
->
scan_interval_cnt
<=
1
)
{
sts
=
(
rp
->
Swap
)
(
ctx
,
ap
,
rp
);
if
(
EVEN
(
sts
))
return
sts
;
rp
->
scan_interval_cnt
=
rp
->
scan_interval
;
}
else
rp
->
scan_interval_cnt
--
;
!
rp
->
MethodDisabled
)
{
sts
=
(
rp
->
Swap
)
(
ctx
,
ap
,
rp
,
event
);
if
(
EVEN
(
sts
))
return
sts
;
}
for
(
cp
=
rp
->
cardlist
;
cp
!=
NULL
;
cp
=
cp
->
next
)
{
for
(
cp
=
rp
->
cardlist
;
cp
!=
NULL
;
cp
=
cp
->
next
)
{
if
(
cp
->
Action
&
io_mAction_Swap
&&
!
cp
->
MethodDisabled
)
{
if
(
cp
->
scan_interval_cnt
<=
1
)
{
sts
=
(
cp
->
Swap
)
(
ctx
,
ap
,
rp
,
cp
);
if
(
EVEN
(
sts
))
return
sts
;
cp
->
scan_interval_cnt
=
cp
->
scan_interval
;
}
else
cp
->
scan_interval_cnt
--
;
!
cp
->
MethodDisabled
)
{
sts
=
(
cp
->
Swap
)
(
ctx
,
ap
,
rp
,
cp
,
event
);
if
(
EVEN
(
sts
))
return
sts
;
}
}
}
...
...
src/lib/rt/src/rt_io_base.h
View file @
39f8971d
...
...
@@ -105,6 +105,13 @@ typedef enum {
io_mProcess_All
=
~
0
}
io_mProcess
;
typedef
enum
{
io_eEvent_EmergencyBreak
,
io_eEvent_IoCommEmergencyBreak
,
io_eEvent_IoCommSwapInit
,
io_eEvent_IoCommSwap
}
io_eEvent
;
typedef
struct
{
void
*
cop
;
/* Pointer to channel object */
pwr_tDlid
ChanDlid
;
/* Dlid for pointer to channel */
...
...
@@ -245,7 +252,8 @@ pwr_tStatus io_write(
);
pwr_tStatus
io_swap
(
io_tCtx
ctx
io_tCtx
ctx
,
io_eEvent
event
);
pwr_tStatus
io_close
(
...
...
src/lib/rt/src/rt_plc.h
View file @
39f8971d
...
...
@@ -172,6 +172,7 @@ struct plc_sThread {
io_tCtx
plc_io_ctx
;
pwr_tBoolean
first_scan
;
int
skip_count
;
pwr_tBoolean
emergency_break_old
;
};
struct
plc_sProcess
{
...
...
src/lib/rt/src/rt_plc_thread.c
View file @
39f8971d
...
...
@@ -250,6 +250,9 @@ scan (
errh_SetStatus
(
PLC__IOREAD
);
}
}
if
(
pp
->
Node
->
EmergBreakTrue
&&
!
tp
->
emergency_break_old
)
io_swap
(
tp
->
plc_io_ctx
,
io_eEvent_EmergencyBreak
);
tp
->
emergency_break_old
=
pp
->
Node
->
EmergBreakTrue
;
thread_MutexLock
(
&
pp
->
io_copy_mutex
);
...
...
@@ -307,6 +310,7 @@ scan (
delay_action
=
csup_Exec
(
&
sts
,
tp
->
csup_lh
,
(
pwr_tDeltaTime
*
)
&
tp
->
sync_time
,
(
pwr_tDeltaTime
*
)
&
tp
->
after_scan
,
&
now
);
if
(
delay_action
==
2
)
{
pp
->
IOHandler
->
IOReadWriteFlag
=
FALSE
;
pp
->
Node
->
EmergBreakTrue
=
TRUE
;
errh_SetStatus
(
PLC__IOSTALLED
);
}
}
...
...
ssabox/lib/rt/src/os_linux/rt_io_m_rack_ssab.c
View file @
39f8971d
...
...
@@ -84,25 +84,33 @@ static pwr_tStatus IoRackInit (
static
pwr_tStatus
IoRackSwap
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
io_sRack
*
rp
,
io_eEvent
event
)
{
io_sRackLocal
*
local
;
if
(
!
rp
->
Local
)
{
/* Open Qbus driver */
local
=
calloc
(
1
,
sizeof
(
*
local
));
rp
->
Local
=
local
;
local
->
Qbus_fp
=
open
(
"/dev/qbus"
,
O_RDWR
);
if
(
local
->
Qbus_fp
==
-
1
)
{
errh_Error
(
"Qbus swap initialization error, IO rack %s"
,
rp
->
Name
);
return
IO__ERRDEVICE
;
switch
(
event
)
{
case
io_eEvent_IoCommSwapInit
:
case
io_eEvent_IoCommSwap
:
if
(
!
rp
->
Local
)
{
/* Open Qbus driver */
local
=
calloc
(
1
,
sizeof
(
*
local
));
rp
->
Local
=
local
;
local
->
Qbus_fp
=
open
(
"/dev/qbus"
,
O_RDWR
);
if
(
local
->
Qbus_fp
==
-
1
)
{
errh_Error
(
"Qbus swap initialization error, IO rack %s"
,
rp
->
Name
);
return
IO__ERRDEVICE
;
}
errh_Info
(
"Swap init of IO rack %s"
,
rp
->
Name
);
}
errh_Info
(
"Swap init of IO rack %s"
,
rp
->
Name
);
default:
;
}
return
1
;
}
...
...
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_do.c
View file @
39f8971d
...
...
@@ -278,7 +278,8 @@ static pwr_tStatus IoCardSwap (
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
io_sCard
*
cp
,
io_eEvent
event
)
{
io_sLocal
*
local
;
...
...
@@ -289,32 +290,37 @@ static pwr_tStatus IoCardSwap (
qbus_io_read
rb
;
int
sts
;
op
=
(
pwr_sClass_Ssab_BaseDoCard
*
)
cp
->
op
;
if
(
!
cp
->
Local
)
{
local
=
calloc
(
1
,
sizeof
(
*
local
));
cp
->
Local
=
local
;
switch
(
event
)
{
case
io_eEvent_IoCommSwapInit
:
case
io_eEvent_IoCommSwap
:
op
=
(
pwr_sClass_Ssab_BaseDoCard
*
)
cp
->
op
;
local
->
Address
[
0
]
=
op
->
RegAddress
;
local
->
Address
[
1
]
=
op
->
RegAddress
+
2
;
local
->
Qbus_fp
=
((
io_sRackLocal
*
)(
rp
->
Local
))
->
Qbus_fp
;
}
if
(
!
cp
->
Local
)
{
local
=
calloc
(
1
,
sizeof
(
*
local
));
cp
->
Local
=
local
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
if
(
r_local
->
Qbus_fp
!=
0
&&
r_local
->
s
==
0
)
{
/* Write to local Q-bus */
rb
.
Address
=
local
->
Address
[
i
];
sts
=
read
(
local
->
Qbus_fp
,
&
rb
,
sizeof
(
rb
));
}
else
{
/* Ethernet I/O, Get data from current address */
data
=
bfbeth_get_data
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
[
i
],
&
sts
);
/* Yes, we want to read this address the next time aswell */
bfbeth_set_read_req
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
[
i
]);
sts
=
1
;
local
->
Address
[
0
]
=
op
->
RegAddress
;
local
->
Address
[
1
]
=
op
->
RegAddress
+
2
;
local
->
Qbus_fp
=
((
io_sRackLocal
*
)(
rp
->
Local
))
->
Qbus_fp
;
}
for
(
i
=
0
;
i
<
2
;
i
++
)
{
if
(
r_local
->
Qbus_fp
!=
0
&&
r_local
->
s
==
0
)
{
/* Write to local Q-bus */
rb
.
Address
=
local
->
Address
[
i
];
sts
=
read
(
local
->
Qbus_fp
,
&
rb
,
sizeof
(
rb
));
}
else
{
/* Ethernet I/O, Get data from current address */
data
=
bfbeth_get_data
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
[
i
],
&
sts
);
/* Yes, we want to read this address the next time aswell */
bfbeth_set_read_req
(
r_local
,
(
pwr_tUInt16
)
local
->
Address
[
i
]);
sts
=
1
;
}
}
break
;
default:
;
}
return
1
;
}
...
...
ssabox/lib/rt/src/os_linux/rt_io_m_ssab_remoterack.c
View file @
39f8971d
...
...
@@ -209,7 +209,9 @@ static pwr_tStatus IoRackInit (
static
pwr_tStatus
IoRackSwap
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
io_sRack
*
rp
,
io_eEvent
event
)
{
io_sRackLocal
*
local
;
...
...
@@ -220,44 +222,51 @@ static pwr_tStatus IoRackSwap (
struct
bfb_buf
rbuf
;
int
size
;
if
(
!
rp
->
Local
)
{
switch
(
event
)
{
case
io_eEvent_IoCommSwapInit
:
case
io_eEvent_IoCommSwap
:
sts
=
IoRackInitSwap
(
ctx
,
ap
,
rp
);
if
(
sts
!=
IO__SUCCESS
)
return
IO__ERRINIDEVICE
;
}
local
=
(
io_sRackLocal
*
)
rp
->
Local
;
op
=
(
pwr_sClass_Ssab_RemoteRack
*
)
rp
->
op
;
// Calc length and send read request
local
->
read_req
.
service
=
BFB_SERVICE_READ
;
local
->
read_req
.
length
=
local
->
next_read_req_item
*
4
+
4
;
sts
=
send
(
local
->
s
,
&
local
->
read_req
,
local
->
read_req
.
length
,
0
);
op
->
TX_packets
++
;
local
->
next_read_req_item
=
0
;
bzero
(
&
local
->
read_area
,
sizeof
(
local
->
read_area
));
if
(
!
rp
->
Local
)
{
sts
=
1
;
while
(
sts
>
0
)
{
FD_ZERO
(
&
fds
);
FD_SET
(
local
->
s
,
&
fds
);
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
0
;
sts
=
select
(
32
,
&
fds
,
NULL
,
NULL
,
&
tv
);
if
(
sts
>
0
)
{
size
=
recv
(
local
->
s
,
&
rbuf
,
sizeof
(
rbuf
),
0
);
if
(
rbuf
.
service
==
BFB_SERVICE_READ
)
{
bzero
(
&
local
->
read_area
,
sizeof
(
local
->
read_area
));
memcpy
(
&
local
->
read_area
,
&
rbuf
,
size
);
}
else
if
(
rbuf
.
service
==
BFB_SERVICE_WRITE
)
{
bzero
(
&
local
->
write_area
,
sizeof
(
local
->
write_area
));
memcpy
(
&
local
->
write_area
,
&
rbuf
,
size
);
}
op
->
RX_packets
++
;
sts
=
IoRackInitSwap
(
ctx
,
ap
,
rp
);
if
(
sts
!=
IO__SUCCESS
)
return
IO__ERRINIDEVICE
;
}
}
local
=
(
io_sRackLocal
*
)
rp
->
Local
;
op
=
(
pwr_sClass_Ssab_RemoteRack
*
)
rp
->
op
;
// Calc length and send read request
local
->
read_req
.
service
=
BFB_SERVICE_READ
;
local
->
read_req
.
length
=
local
->
next_read_req_item
*
4
+
4
;
sts
=
send
(
local
->
s
,
&
local
->
read_req
,
local
->
read_req
.
length
,
0
);
op
->
TX_packets
++
;
local
->
next_read_req_item
=
0
;
bzero
(
&
local
->
read_area
,
sizeof
(
local
->
read_area
));
sts
=
1
;
while
(
sts
>
0
)
{
FD_ZERO
(
&
fds
);
FD_SET
(
local
->
s
,
&
fds
);
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
0
;
sts
=
select
(
32
,
&
fds
,
NULL
,
NULL
,
&
tv
);
if
(
sts
>
0
)
{
size
=
recv
(
local
->
s
,
&
rbuf
,
sizeof
(
rbuf
),
0
);
if
(
rbuf
.
service
==
BFB_SERVICE_READ
)
{
bzero
(
&
local
->
read_area
,
sizeof
(
local
->
read_area
));
memcpy
(
&
local
->
read_area
,
&
rbuf
,
size
);
}
else
if
(
rbuf
.
service
==
BFB_SERVICE_WRITE
)
{
bzero
(
&
local
->
write_area
,
sizeof
(
local
->
write_area
));
memcpy
(
&
local
->
write_area
,
&
rbuf
,
size
);
}
op
->
RX_packets
++
;
}
}
break
;
default:
;
}
return
IO__SUCCESS
;
...
...
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