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
9f4eea2a
Commit
9f4eea2a
authored
Feb 21, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More changes in extuserprmlen
parent
7dabd84f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
13 deletions
+63
-13
profibus/lib/rt/src/rt_pb_gsd.cpp
profibus/lib/rt/src/rt_pb_gsd.cpp
+60
-12
profibus/lib/rt/src/rt_pb_gsd.h
profibus/lib/rt/src/rt_pb_gsd.h
+3
-1
No files found.
profibus/lib/rt/src/rt_pb_gsd.cpp
View file @
9f4eea2a
/*
/*
* Proview $Id: rt_pb_gsd.cpp,v 1.
6 2007-02-19 10:20:36
claes Exp $
* Proview $Id: rt_pb_gsd.cpp,v 1.
7 2007-02-21 14:08:57
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -314,7 +314,8 @@ static void *t_malloc( int a1) {
...
@@ -314,7 +314,8 @@ static void *t_malloc( int a1) {
pb_gsd
::
pb_gsd
()
:
pb_gsd
::
pb_gsd
()
:
dptype
(
0
),
modular_station
(
0
),
max_module
(
0
),
dptype
(
0
),
modular_station
(
0
),
max_module
(
0
),
user_prm_data_len
(
0
),
max_user_prm_data_len
(
0
),
status
(
0
),
address
(
0
),
user_prm_data_len
(
0
),
max_user_prm_data_len
(
0
),
items_user_prm_data_len
(
0
),
status
(
0
),
address
(
0
),
datalist
(
0
),
modulelist
(
0
),
prm_textlist
(
0
),
extuserprmdatalist
(
0
),
datalist
(
0
),
modulelist
(
0
),
prm_textlist
(
0
),
extuserprmdatalist
(
0
),
extuserprmdatareflist
(
0
),
current_module
(
0
),
current_area
(
0
),
current_prm_text
(
0
),
extuserprmdatareflist
(
0
),
current_module
(
0
),
current_area
(
0
),
current_prm_text
(
0
),
current_extuserprmdata
(
0
),
extuserprmdataconst
(
0
),
prm_dataitems
(
0
),
module_conf
(
0
),
current_extuserprmdata
(
0
),
extuserprmdataconst
(
0
),
prm_dataitems
(
0
),
module_conf
(
0
),
...
@@ -1027,14 +1028,22 @@ int pb_gsd::build()
...
@@ -1027,14 +1028,22 @@ int pb_gsd::build()
printf
(
"** Referenced ExtUserPrmData not found %d
\n
"
,
ep
->
Reference_Number
);
printf
(
"** Referenced ExtUserPrmData not found %d
\n
"
,
ep
->
Reference_Number
);
}
}
}
}
// Calculate ExtUserPrmData length
items_user_prm_data_len
=
prm_len
(
prm_dataitems
,
prm_dataitems_cnt
);
if
(
extuserprmdataconst
)
{
if
(
items_user_prm_data_len
<
extuserprmdataconst
->
len
+
extuserprmdataconst
->
Const_Offset
)
items_user_prm_data_len
=
extuserprmdataconst
->
len
+
extuserprmdataconst
->
Const_Offset
;
}
if
(
max_user_prm_data_len
)
{
if
(
max_user_prm_data_len
)
{
if
(
extuserprmdataconst
&&
if
(
extuserprmdataconst
&&
max_user_prm_data_len
<
max_user_prm_data_len
<
extuserprmdataconst
->
len
+
extuserprmdataconst
->
Const_Offset
)
extuserprmdataconst
->
len
+
extuserprmdataconst
->
Const_Offset
)
printf
(
"ExtUserPrmDataConst exceeds Max_User_Prm_Data_Len, line %d
\n
"
,
line_cnt
);
printf
(
"ExtUserPrmDataConst exceeds Max_User_Prm_Data_Len, line %d
\n
"
,
line_cnt
);
}
}
else
if
(
extuserprmdataconst
)
max_user_prm_data_len
=
extuserprmdataconst
->
len
+
extuserprmdataconst
->
Const_Offset
;
// Check Module UserPrmDataLen
// Check Module UserPrmDataLen
for
(
gsd_sModule
*
mp
=
modulelist
;
mp
;
mp
=
mp
->
next
)
{
for
(
gsd_sModule
*
mp
=
modulelist
;
mp
;
mp
=
mp
->
next
)
{
...
@@ -1063,6 +1072,40 @@ int pb_gsd::build()
...
@@ -1063,6 +1072,40 @@ int pb_gsd::build()
return
1
;
return
1
;
}
}
int
pb_gsd
::
prm_len
(
gsd_sPrmDataItem
*
item
,
int
item_size
)
{
gsd_sExtUserPrmData
*
pd
;
int
len
=
0
;
int
size
;
for
(
int
i
=
0
;
i
<
item_size
;
i
++
)
{
pd
=
item
[
i
].
ref
->
prm_data
;
// Check value
switch
(
pd
->
data_type
)
{
case
gsd_Bit
:
case
gsd_BitArea
:
case
gsd_Unsigned8
:
case
gsd_Signed8
:
size
=
1
;
break
;
case
gsd_Signed16
:
case
gsd_Unsigned16
:
size
=
2
;
break
;
case
gsd_Unsigned32
:
case
gsd_Signed32
:
size
=
4
;
break
;
default:
size
=
0
;
}
if
(
item
[
i
].
ref
->
Reference_Offset
+
size
>
len
)
len
=
item
[
i
].
ref
->
Reference_Offset
+
size
;
}
return
len
;
}
int
pb_gsd
::
prm_items_to_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
int
pb_gsd
::
prm_items_to_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
int
data_size
)
unsigned
char
*
data
,
int
data_size
)
{
{
...
@@ -1959,11 +2002,11 @@ int pb_gsd::configure_module( gsd_sModuleConf *m)
...
@@ -1959,11 +2002,11 @@ int pb_gsd::configure_module( gsd_sModuleConf *m)
m
->
module
->
extuserprmdataconst
->
len
);
m
->
module
->
extuserprmdataconst
->
len
);
prm_data_to_items
(
m
->
prm_dataitems
,
m
->
prm_dataitems_cnt
,
prm_data_to_items
(
m
->
prm_dataitems
,
m
->
prm_dataitems_cnt
,
m
->
prm_data
,
m
->
prm_data
,
m
->
module
->
extuserprmdataconst
->
l
en
,
1
);
m
->
module
->
Ext_Module_Prm_Data_L
en
,
1
);
// Test Remove this !!!
// Test Remove this !!!
prm_items_to_data
(
m
->
prm_dataitems
,
m
->
prm_dataitems_cnt
,
prm_items_to_data
(
m
->
prm_dataitems
,
m
->
prm_dataitems_cnt
,
m
->
prm_data
,
m
->
prm_data
,
m
->
module
->
extuserprmdataconst
->
l
en
);
m
->
module
->
Ext_Module_Prm_Data_L
en
);
}
}
}
}
}
}
...
@@ -2008,17 +2051,22 @@ void pb_gsd::pack_ext_user_prm_data( char *data, int *len)
...
@@ -2008,17 +2051,22 @@ void pb_gsd::pack_ext_user_prm_data( char *data, int *len)
prm_items_to_data
(
prm_dataitems
,
prm_dataitems_cnt
,
prm_items_to_data
(
prm_dataitems
,
prm_dataitems_cnt
,
extuserprmdataconst
->
Const_Prm_Data
,
extuserprmdataconst
->
Const_Prm_Data
,
max
_user_prm_data_len
);
items
_user_prm_data_len
);
data_idx
=
0
;
data_idx
=
0
;
memcpy
(
&
data
[
data_idx
],
extuserprmdataconst
->
Const_Prm_Data
,
memcpy
(
&
data
[
data_idx
],
extuserprmdataconst
->
Const_Prm_Data
,
max
_user_prm_data_len
);
items
_user_prm_data_len
);
data_idx
+=
max
_user_prm_data_len
;
data_idx
+=
items
_user_prm_data_len
;
for
(
i
=
0
;
i
<
module_conf_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
module_conf_cnt
;
i
++
)
{
if
(
!
module_conf
[
i
].
module
||
!
module_conf
[
i
].
module
->
extuserprmdataconst
)
if
(
!
module_conf
[
i
].
module
||
!
module_conf
[
i
].
module
->
extuserprmdataconst
)
continue
;
continue
;
if
(
module_conf
[
i
].
module
->
extuserprmdataconst
)
memcpy
(
module_conf
[
i
].
prm_data
+
module_conf
[
i
].
module
->
extuserprmdataconst
->
Const_Offset
,
module_conf
[
i
].
module
->
extuserprmdataconst
->
Const_Prm_Data
,
module_conf
[
i
].
module
->
extuserprmdataconst
->
len
);
prm_items_to_data
(
module_conf
[
i
].
prm_dataitems
,
module_conf
[
i
].
prm_dataitems_cnt
,
prm_items_to_data
(
module_conf
[
i
].
prm_dataitems
,
module_conf
[
i
].
prm_dataitems_cnt
,
module_conf
[
i
].
prm_data
,
module_conf
[
i
].
prm_data
,
module_conf
[
i
].
module
->
Ext_Module_Prm_Data_Len
);
module_conf
[
i
].
module
->
Ext_Module_Prm_Data_Len
);
...
@@ -2036,12 +2084,12 @@ int pb_gsd::unpack_ext_user_prm_data( char *data, int len)
...
@@ -2036,12 +2084,12 @@ int pb_gsd::unpack_ext_user_prm_data( char *data, int len)
data_idx
=
0
;
data_idx
=
0
;
memcpy
(
extuserprmdataconst
->
Const_Prm_Data
,
&
data
[
data_idx
],
memcpy
(
extuserprmdataconst
->
Const_Prm_Data
,
&
data
[
data_idx
],
max
_user_prm_data_len
);
items
_user_prm_data_len
);
data_idx
+=
max
_user_prm_data_len
;
data_idx
+=
items
_user_prm_data_len
;
prm_data_to_items
(
prm_dataitems
,
prm_dataitems_cnt
,
prm_data_to_items
(
prm_dataitems
,
prm_dataitems_cnt
,
extuserprmdataconst
->
Const_Prm_Data
,
extuserprmdataconst
->
Const_Prm_Data
,
max
_user_prm_data_len
);
items
_user_prm_data_len
);
for
(
i
=
0
;
i
<
module_conf_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
module_conf_cnt
;
i
++
)
{
if
(
!
module_conf
[
i
].
module
||
!
module_conf
[
i
].
module
->
extuserprmdataconst
)
if
(
!
module_conf
[
i
].
module
||
!
module_conf
[
i
].
module
->
extuserprmdataconst
)
...
...
profibus/lib/rt/src/rt_pb_gsd.h
View file @
9f4eea2a
/*
/*
* Proview $Id: rt_pb_gsd.h,v 1.
4 2006-07-25 11:01:19
claes Exp $
* Proview $Id: rt_pb_gsd.h,v 1.
5 2007-02-21 14:09:02
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -186,6 +186,7 @@ class pb_gsd {
...
@@ -186,6 +186,7 @@ class pb_gsd {
int
max_module
;
int
max_module
;
int
user_prm_data_len
;
int
user_prm_data_len
;
int
max_user_prm_data_len
;
int
max_user_prm_data_len
;
int
items_user_prm_data_len
;
int
line_cnt
;
int
line_cnt
;
int
status
;
int
status
;
int
address
;
int
address
;
...
@@ -217,6 +218,7 @@ class pb_gsd {
...
@@ -217,6 +218,7 @@ class pb_gsd {
int
print
();
int
print
();
int
build
();
int
build
();
int
configure_module
(
gsd_sModuleConf
*
mclist
);
int
configure_module
(
gsd_sModuleConf
*
mclist
);
int
prm_len
(
gsd_sPrmDataItem
*
item
,
int
item_size
);
int
prm_items_to_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
int
prm_items_to_data
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
int
data_size
);
int
data_size
);
int
prm_data_to_items
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
int
prm_data_to_items
(
gsd_sPrmDataItem
*
item
,
int
item_size
,
unsigned
char
*
data
,
...
...
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