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
1c2285d6
Commit
1c2285d6
authored
Oct 30, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of newton:/data1/x0-0-0/pwr
parents
d640e350
e8241052
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
162 additions
and
48 deletions
+162
-48
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_server.c
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_server.c
+66
-46
otherio/lib/rt/src/os_linux/rt_io_mb_locals.h
otherio/lib/rt/src/os_linux/rt_io_mb_locals.h
+4
-0
src/lib/rt/src/rt_io_bus.c
src/lib/rt/src/rt_io_bus.c
+66
-0
src/lib/rt/src/rt_io_bus.h
src/lib/rt/src/rt_io_bus.h
+5
-0
src/tools/bld/src/os_linux/jsw_generic.mk
src/tools/bld/src/os_linux/jsw_generic.mk
+17
-2
src/tools/bld/src/os_linux/rules.mk
src/tools/bld/src/os_linux/rules.mk
+4
-0
No files found.
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_server.c
View file @
1c2285d6
...
...
@@ -801,6 +801,7 @@ static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
pwr_sClass_Modbus_TCP_Server
*
op
;
int
i
;
unsigned
short
port
;
io_sCard
*
cardp
;
// Ignore SIGPIPE signal
signal
(
SIGPIPE
,
signal_callback_handler
);
...
...
@@ -819,6 +820,12 @@ static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
if
(
op
->
DisableServer
)
return
IO__SUCCESS
;
for
(
cardp
=
rp
->
cardlist
;
cardp
;
cardp
=
cardp
->
next
)
io_bus_card_area_size
(
ctx
,
cardp
,
&
local
->
inputs_size
,
&
local
->
outputs_size
);
local
->
inputs
=
calloc
(
1
,
local
->
inputs_size
);
local
->
outputs
=
calloc
(
1
,
local
->
output_size
);
/* Create socket, store in local struct */
uid_t
ruid
;
ruid
=
getuid
();
...
...
@@ -893,80 +900,83 @@ static pwr_tStatus mb_init_channels(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
cardp
=
rp
->
cardlist
;
unsigned
int
prev_input_area_offset
=
0
;
unsigned
int
prev_output_area_offset
=
0
;
unsigned
int
input_area_offset
=
0
;
unsigned
int
output_area_offset
=
0
;
unsigned
int
input_area_chansize
=
0
;
unsigned
int
output_area_chansize
=
0
;
unsigned
int
card_input_area_offset
=
0
;
unsigned
int
card_output_area_offset
=
0
;
while
(
cardp
)
{
while
(
cardp
)
{
local_card
=
calloc
(
1
,
sizeof
(
*
local_card
));
cardp
->
Local
=
local_card
;
local_card
->
input_area
=
(
void
*
)
&
(
op
->
Inputs
)
+
input_area_offset
+
input_area_chansize
;
local_card
->
output_area
=
(
void
*
)
&
(
op
->
Outputs
)
+
output_area_offset
+
output_area_chansize
;
card_input_area_offset
+=
input_area_offset
+
input_area_chansize
;
card_output_area_offset
+=
output_area_offset
+
output_area_chansize
;
input_area_offset
=
0
;
output_area_offset
=
0
;
input_area_chansize
=
0
;
output_area_chansize
=
0
;
io_bus_card_init
(
ctx
,
cardp
,
&
input_area_offset
,
&
input_area_chansize
,
&
output_area_offset
,
&
output_area_chansize
,
pwr_eByteOrderingEnum_BigEndian
,
io_eAlignment_Packed
);
local_card
->
input_area
=
(
char
*
)
local
->
inputs
+
card_input_area_offset
;
local_card
->
output_area
=
(
char
*
)
local
->
outputs
+
card_output_area_offset
;
io_bus_card_init
(
ctx
,
cardp
,
&
input_area_offset
,
&
input_area_chansize
,
&
output_area_offset
,
&
output_area_chansize
,
pwr_eByteOrderingEnum_BigEndian
,
io_eAlignment_Packed
);
for
(
i
=
0
;
i
<
cardp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cardp
->
chanlist
[
i
];
switch
(
chanp
->
ChanClass
)
{
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDi
:
{
pwr_sClass_ChanDi
*
chan_di
=
(
pwr_sClass_ChanDi
*
)
chanp
->
cop
;
pwr_sClass_ChanDi
*
chan_di
=
(
pwr_sClass_ChanDi
*
)
chanp
->
cop
;
if
(
local_card
->
di_size
==
0
)
local_card
->
di_offset
=
chanp
->
offset
;
if
(
chan_di
->
Number
==
0
||
local_card
->
di_size
==
0
)
local_card
->
di_size
+=
GetChanSize
(
chan_di
->
Representation
);
if
(
local_card
->
di_size
==
0
)
local_card
->
di_offset
=
chanp
->
offset
;
if
(
chan_di
->
Number
==
0
||
local_card
->
di_size
==
0
)
local_card
->
di_size
+=
GetChanSize
(
chan_di
->
Representation
);
break
;
break
;
}
case
pwr_cClass_ChanDo
:
{
pwr_sClass_ChanDo
*
chan_do
=
(
pwr_sClass_ChanDo
*
)
chanp
->
cop
;
pwr_sClass_ChanDo
*
chan_do
=
(
pwr_sClass_ChanDo
*
)
chanp
->
cop
;
if
(
local_card
->
do_size
==
0
)
local_card
->
do_offset
=
chanp
->
offset
;
if
(
chan_do
->
Number
==
0
||
local_card
->
do_size
==
0
)
local_card
->
do_size
+=
GetChanSize
(
chan_do
->
Representation
);
if
(
local_card
->
do_size
==
0
)
local_card
->
do_offset
=
chanp
->
offset
;
if
(
chan_do
->
Number
==
0
||
local_card
->
do_size
==
0
)
local_card
->
do_size
+=
GetChanSize
(
chan_do
->
Representation
);
break
;
break
;
}
case
pwr_cClass_ChanD
:
{
pwr_sClass_ChanD
*
chan_d
=
(
pwr_sClass_ChanD
*
)
chanp
->
cop
;
if
(
chan_d
->
Type
==
pwr_eDChanTypeEnum_Di
)
{
if
(
local_card
->
di_size
==
0
)
local_card
->
di_offset
=
chanp
->
offset
;
if
(
chan_d
->
Number
==
0
||
local_card
->
di_size
==
0
)
local_card
->
di_size
+=
GetChanSize
(
chan_d
->
Representation
);
}
else
{
if
(
local_card
->
do_size
==
0
)
local_card
->
do_offset
=
chanp
->
offset
;
if
(
chan_d
->
Number
==
0
||
local_card
->
do_size
==
0
)
local_card
->
do_size
+=
GetChanSize
(
chan_d
->
Representation
);
}
break
;
pwr_sClass_ChanD
*
chan_d
=
(
pwr_sClass_ChanD
*
)
chanp
->
cop
;
if
(
chan_d
->
Type
==
pwr_eDChanTypeEnum_Di
)
{
if
(
local_card
->
di_size
==
0
)
local_card
->
di_offset
=
chanp
->
offset
;
if
(
chan_d
->
Number
==
0
||
local_card
->
di_size
==
0
)
local_card
->
di_size
+=
GetChanSize
(
chan_d
->
Representation
);
}
else
{
if
(
local_card
->
do_size
==
0
)
local_card
->
do_offset
=
chanp
->
offset
;
if
(
chan_d
->
Number
==
0
||
local_card
->
do_size
==
0
)
local_card
->
do_size
+=
GetChanSize
(
chan_d
->
Representation
);
}
break
;
}
}
}
local_card
->
input_size
=
input_area_offset
+
input_area_chansize
-
prev_input_area_offset
;
local_card
->
output_size
=
output_area_offset
+
output_area_chansize
-
prev_output_area_offset
;
}
prev_input_area_offset
=
input_area_offset
+
input_area_chansize
;
prev_output_area_offset
=
output_area_offset
+
output_area_chansize
;
local_card
->
input_size
=
input_area_offset
+
input_area_chansize
;
local_card
->
output_size
=
output_area_offset
+
output_area_chansize
;
cardp
=
cardp
->
next
;
}
local
->
input_size
=
input_area_offset
+
input_area_chansize
;
local
->
output_size
=
output_area_offset
+
output_area_chansize
;
local
->
input_size
=
card_input_area_offset
+
input_area_offset
+
input_area_chansize
;
local
->
output_size
=
card_output_area_offset
+
output_area_offset
+
output_area_chansize
;
return
IO__SUCCESS
;
}
...
...
@@ -1041,6 +1051,11 @@ void mb_shift_read(unsigned char* in, unsigned char* out, int sh, int quant)
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoRackRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sServerLocal
*
local
=
rp
->
Local
;
pwr_sClass_Modbus_TCP_Server
*
op
=
(
pwr_sClass_Modbus_TCP_Server
*
)
rp
->
op
;
/* For display */
memcpy
(
op
->
Inputs
,
local
->
inputs
,
MIN
(
sizeof
(
op
->
Inputs
),
local
->
inputs_size
));
return
IO__SUCCESS
;
}
...
...
@@ -1049,6 +1064,11 @@ static pwr_tStatus IoRackRead(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoRackWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sServerLocal
*
local
=
rp
->
Local
;
pwr_sClass_Modbus_TCP_Server
*
op
=
(
pwr_sClass_Modbus_TCP_Server
*
)
rp
->
op
;
/* For display */
memcpy
(
op
->
Outputs
,
local
->
outputs
,
MIN
(
sizeof
(
op
->
Outputs
),
local
->
outputs_size
));
return
IO__SUCCESS
;
}
...
...
otherio/lib/rt/src/os_linux/rt_io_mb_locals.h
View file @
1c2285d6
...
...
@@ -138,6 +138,10 @@ typedef struct {
int
output_size
;
thread_sMutex
mutex
;
io_sServerConnection
connections
[
MB_MAX_CONNECTIONS
];
void
*
inputs
;
void
*
outputs
;
unsigned
int
inputs_size
;
unsigned
int
outputs_size
;
}
io_sServerLocal
;
typedef
struct
{
...
...
src/lib/rt/src/rt_io_bus.c
View file @
1c2285d6
...
...
@@ -505,6 +505,72 @@ pwr_tStatus io_bus_card_init(io_tCtx ctx, io_sCard* cp,
return
IO__SUCCESS
;
}
/*----------------------------------------------------------------------------*\
Get channel area size for a bus card.
\*----------------------------------------------------------------------------*/
void
io_bus_card_area_size
(
io_tCtx
ctx
,
io_sCard
*
cp
,
unsigned
int
*
input_area_size
,
unsigned
int
*
output_area_size
)
{
int
i
;
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
io_sChannel
*
chanp
=
&
cp
->
chanlist
[
i
];
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDi
:
if
(
((
pwr_sClass_ChanDi
*
)
chanp
->
cop
)
->
Number
==
0
)
*
input_area_size
+=
GetChanSize
(
((
pwr_sClass_ChanDi
*
)
chanp
->
cop
)
->
Representation
);
break
;
case
pwr_cClass_ChanAi
:
*
input_area_size
+=
GetChanSize
(((
pwr_sClass_ChanAi
*
)
chanp
->
cop
)
->
Representation
);
break
;
case
pwr_cClass_ChanAit
:
*
input_area_size
+=
GetChanSize
(((
pwr_sClass_ChanAit
*
)
chanp
->
cop
)
->
Representation
);
break
;
case
pwr_cClass_ChanIi
:
*
input_area_size
+=
GetChanSize
(((
pwr_sClass_ChanIi
*
)
chanp
->
cop
)
->
Representation
);
break
;
case
pwr_cClass_ChanBi
:
*
input_area_size
+=
((
pwr_sClass_ChanBi
*
)
chanp
->
cop
)
->
Size
;
break
;
case
pwr_cClass_ChanBo
:
*
output_area_size
+=
((
pwr_sClass_ChanBo
*
)
chanp
->
cop
)
->
Size
;
break
;
case
pwr_cClass_ChanBiBlob
:
*
input_area_size
+=
((
pwr_sClass_ChanBiBlob
*
)
chanp
->
cop
)
->
Size
;
break
;
case
pwr_cClass_ChanBoBlob
:
*
output_area_size
+=
((
pwr_sClass_ChanBoBlob
*
)
chanp
->
cop
)
->
Size
;
break
;
case
pwr_cClass_ChanDo
:
if
(((
pwr_sClass_ChanDo
*
)
chanp
->
cop
)
->
Number
==
0
)
*
output_area_size
+=
GetChanSize
(
((
pwr_sClass_ChanDo
*
)
chanp
->
cop
)
->
Representation
);
break
;
case
pwr_cClass_ChanAo
:
*
output_area_size
+=
GetChanSize
(((
pwr_sClass_ChanAo
*
)
chanp
->
cop
)
->
Representation
);
break
;
case
pwr_cClass_ChanIo
:
*
output_area_size
+=
GetChanSize
(((
pwr_sClass_ChanIo
*
)
chanp
->
cop
)
->
Representation
);
break
;
case
pwr_cClass_ChanD
:
{
pwr_sClass_ChanD
*
chan_d
=
(
pwr_sClass_ChanD
*
)
chanp
->
cop
;
if
(
chan_d
->
Type
==
pwr_eDChanTypeEnum_Di
)
{
if
(
chan_d
->
Number
==
0
)
*
input_area_size
+=
GetChanSize
(
chan_d
->
Representation
);
}
else
{
if
(
chan_d
->
Number
==
0
)
*
output_area_size
+=
GetChanSize
(
chan_d
->
Representation
);
}
break
;
}
}
}
}
/*----------------------------------------------------------------------------*\
Read method for bus-card
\*----------------------------------------------------------------------------*/
...
...
src/lib/rt/src/rt_io_bus.h
View file @
1c2285d6
...
...
@@ -77,6 +77,11 @@ pwr_tStatus io_bus_card_init(io_tCtx ctx, io_sCard* cp,
unsigned
int
*
output_area_offset
,
unsigned
int
*
output_area_chansize
,
pwr_tByteOrderingEnum
byte_order
,
io_eAlignment
alignment
);
void
io_bus_card_area_size
(
io_tCtx
ctx
,
io_sCard
*
cp
,
unsigned
int
*
input_area_size
,
unsigned
int
*
output_area_size
);
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
);
...
...
src/tools/bld/src/os_linux/jsw_generic.mk
View file @
1c2285d6
...
...
@@ -64,13 +64,24 @@ png_sources := $(sort \
)
\
)
css_sources
:=
$(
sort
\
$(
foreach
file,
\
$(
foreach
dir
,
\
$(source_dirs)
,
\
$(
wildcard
$(dir)
/
*
.css
)
\
)
,
$(
notdir
$(file)
)
\
)
\
)
export_js
:=
$(
addprefix
$(web_dir)
/,
$(js_sources)
)
export_html
:=
$(
addprefix
$(web_dir)
/,
$(html_sources)
)
export_png
:=
$(
addprefix
$(web_dir)
/,
$(png_sources)
)
export_css
:=
$(
addprefix
$(web_dir)
/,
$(css_sources)
)
clean_js
:=
$(
patsubst
%.js,clean_%.js,
$(js_sources)
)
clean_html
:=
$(
patsubst
%.html,clean_%.html,
$(html_sources)
)
clean_png
:=
$(
patsubst
%.png,clean_%.png,
$(png_sources)
)
clean_css
:=
$(
patsubst
%.css,clean_%.css,
$(css_sources)
)
.PHONY
:
all init copy lib exe clean realclean
...
...
@@ -78,13 +89,13 @@ all : init copy lib exe | silent
init
:
copy
:
$(export_js) $(export_html) $(export_png) | silent
copy
:
$(export_js) $(export_html) $(export_png)
$(export_css)
| silent
lib
:
exe
:
clean
:
$(clean_js) $(clean_html) $(clean_png)
clean
:
$(clean_js) $(clean_html) $(clean_png)
$(clean_css)
clean_copy
:
$(clean)
...
...
@@ -106,6 +117,10 @@ $(clean_png) : clean_%.png : %.png
@
echo
"Removing png:
$(web_dir)
/
$*
.png"
@
$(rm)
$(rmflags)
$(web_dir)
/
$*
.png
$(clean_css)
:
clean_%.css : %.css
@
echo
"Removing png:
$(web_dir)
/
$*
.css"
@
$(rm)
$(rmflags)
$(web_dir)
/
$*
.css
-include
$(source_dependencies)
...
...
src/tools/bld/src/os_linux/rules.mk
View file @
1c2285d6
...
...
@@ -284,6 +284,10 @@ $(web_dir)/%.html : ../../%.html
@
$(log_h_h)
@
$(cp)
$(cpflags)
$(source)
$(target)
$(web_dir)/%.css
:
../../%.css
@
$(log_h_h)
@
$(cp)
$(cpflags)
$(source)
$(target)
$(web_dir)/%.js
:
../../%.js
@
$(log_h_h)
@
$(cp)
$(cpflags)
$(source)
$(target)
...
...
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