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
9bf4167f
Commit
9bf4167f
authored
Jul 25, 2006
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PRM data byte order dependency added
parent
b3670e48
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
300 additions
and
38 deletions
+300
-38
profibus/changelog.txt
profibus/changelog.txt
+1
-1
profibus/lib/rt/src/rt_pb_gsd.cpp
profibus/lib/rt/src/rt_pb_gsd.cpp
+163
-30
profibus/lib/rt/src/rt_pb_gsd.h
profibus/lib/rt/src/rt_pb_gsd.h
+2
-1
profibus/lib/rt/src/rt_pb_gsd_attrnav.cpp
profibus/lib/rt/src/rt_pb_gsd_attrnav.cpp
+84
-2
profibus/lib/rt/src/rt_pb_gsd_attrnav.h
profibus/lib/rt/src/rt_pb_gsd_attrnav.h
+18
-2
profibus/lib/wb/src/wb_c_pb_dp_slave.cpp
profibus/lib/wb/src/wb_c_pb_dp_slave.cpp
+20
-1
profibus/lib/xtt/src/xtt_c_pb_dp_slave.cpp
profibus/lib/xtt/src/xtt_c_pb_dp_slave.cpp
+12
-1
No files found.
profibus/changelog.txt
View file @
9bf4167f
060227 cs - Changelog created.
060227 cs - Changelog created.
060509 cj - Added some commentation.
060509 cj - Added some commentation.
Fixed bug in pb_ai and pb_di. 3-byte input where not properly
Fixed bug in pb_ai and pb_di. 3-byte input where not properly
aligned when byte swapping.
aligned when byte swapping.
060725 cs - Byte order dependency added for PRM data in profibus configurator.
profibus/lib/rt/src/rt_pb_gsd.cpp
View file @
9bf4167f
/*
/*
* Proview $Id: rt_pb_gsd.cpp,v 1.
3 2006-04-12 12:17:45
claes Exp $
* Proview $Id: rt_pb_gsd.cpp,v 1.
4 2006-07-25 11:01:19
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
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include "pwr_baseclasses.h"
#include "rt_pb_msg.h"
#include "rt_pb_msg.h"
#include "rt_pb_gsd.h"
#include "rt_pb_gsd.h"
#include "co_dcli.h"
#include "co_dcli.h"
...
@@ -313,11 +314,11 @@ static void *t_malloc( int a1) {
...
@@ -313,11 +314,11 @@ 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
),
datalist
(
0
),
user_prm_data_len
(
0
),
max_user_prm_data_len
(
0
),
status
(
0
),
address
(
0
),
modulelist
(
0
),
prm_textlist
(
0
),
extuserprmdatalist
(
0
),
extuserprmdatareflist
(
0
),
datalist
(
0
),
modulelist
(
0
),
prm_textlist
(
0
),
extuserprmdatalist
(
0
),
current_module
(
0
),
current_area
(
0
),
current_prm_text
(
0
),
current_extuserprmdata
(
0
),
extuserprmdatareflist
(
0
),
current_module
(
0
),
current_area
(
0
),
current_prm_text
(
0
),
extuserprmdataconst
(
0
),
prm_dataitems
(
0
),
module_conf
(
0
),
module_conf_cnt
(
0
),
current_extuserprmdata
(
0
),
extuserprmdataconst
(
0
),
prm_dataitems
(
0
),
module_conf
(
0
),
module_c
lasslist
(
0
),
copy_buff
(
0
),
modified
(
0
)
module_c
onf_cnt
(
0
),
module_classlist
(
0
),
copy_buff
(
0
),
modified
(
0
),
byte_order
(
0
)
{
{
datalist
=
(
gsd_sData
*
)
calloc
(
sizeof
(
keywordlist
)
/
sizeof
(
keywordlist
[
0
]),
sizeof
(
gsd_sData
));
datalist
=
(
gsd_sData
*
)
calloc
(
sizeof
(
keywordlist
)
/
sizeof
(
keywordlist
[
0
]),
sizeof
(
gsd_sData
));
}
}
...
@@ -1140,12 +1141,23 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
...
@@ -1140,12 +1141,23 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
unsigned
short
v
=
(
unsigned
short
)
item
[
i
].
value
;
unsigned
short
v
=
(
unsigned
short
)
item
[
i
].
value
;
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
else
{
unsigned
char
b
[
2
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
0
];
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
unsigned
char
b
[
2
];
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
memcpy
(
b
,
&
v
,
sizeof
(
b
));
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
1
];
else
{
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
0
];
unsigned
char
b
[
2
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
0
];
}
#endif
#endif
break
;
break
;
}
}
...
@@ -1157,12 +1169,23 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
...
@@ -1157,12 +1169,23 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
short
v
=
(
short
)
item
[
i
].
value
;
short
v
=
(
short
)
item
[
i
].
value
;
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
else
{
unsigned
char
b
[
2
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
0
];
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
unsigned
char
b
[
2
];
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
memcpy
(
b
,
&
v
,
sizeof
(
b
));
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
1
];
else
{
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
0
];
unsigned
char
b
[
2
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
0
];
}
#endif
#endif
break
;
break
;
}
}
...
@@ -1173,7 +1196,29 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
...
@@ -1173,7 +1196,29 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
}
}
unsigned
int
v
=
(
unsigned
int
)
item
[
i
].
value
;
unsigned
int
v
=
(
unsigned
int
)
item
[
i
].
value
;
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
3
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
2
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
]
=
b
[
0
];
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
3
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
2
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
]
=
b
[
0
];
}
#endif
break
;
break
;
}
}
case
gsd_Signed32
:
{
case
gsd_Signed32
:
{
...
@@ -1183,7 +1228,29 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
...
@@ -1183,7 +1228,29 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
}
}
int
v
=
(
int
)
item
[
i
].
value
;
int
v
=
(
int
)
item
[
i
].
value
;
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
3
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
2
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
]
=
b
[
0
];
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
memcpy
(
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
&
v
,
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
memcpy
(
b
,
&
v
,
sizeof
(
b
));
data
[
item
[
i
].
ref
->
Reference_Offset
]
=
b
[
3
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
]
=
b
[
2
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
]
=
b
[
1
];
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
]
=
b
[
0
];
}
#endif
break
;
break
;
}
}
default:
default:
...
@@ -1242,12 +1309,23 @@ int pb_gsd::prm_data_to_items( gsd_sPrmDataItem *item, int item_size,
...
@@ -1242,12 +1309,23 @@ int pb_gsd::prm_data_to_items( gsd_sPrmDataItem *item, int item_size,
case
gsd_Unsigned16
:
{
case
gsd_Unsigned16
:
{
unsigned
short
v
;
unsigned
short
v
;
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
else
{
unsigned
char
b
[
2
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
unsigned
char
b
[
2
];
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
else
{
memcpy
(
&
v
,
b
,
sizeof
(
v
));
unsigned
char
b
[
2
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#endif
#endif
item
[
i
].
value
=
v
;
item
[
i
].
value
=
v
;
break
;
break
;
...
@@ -1255,25 +1333,80 @@ int pb_gsd::prm_data_to_items( gsd_sPrmDataItem *item, int item_size,
...
@@ -1255,25 +1333,80 @@ int pb_gsd::prm_data_to_items( gsd_sPrmDataItem *item, int item_size,
case
gsd_Signed16
:
{
case
gsd_Signed16
:
{
short
v
;
short
v
;
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
else
{
unsigned
char
b
[
2
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
unsigned
char
b
[
2
];
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
else
{
memcpy
(
&
v
,
b
,
sizeof
(
v
));
unsigned
char
b
[
2
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#endif
#endif
item
[
i
].
value
=
v
;
item
[
i
].
value
=
v
;
break
;
break
;
}
}
case
gsd_Unsigned32
:
{
case
gsd_Unsigned32
:
{
unsigned
int
v
;
unsigned
int
v
;
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
b
[
3
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
2
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
b
[
3
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
2
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#endif
item
[
i
].
value
=
v
;
item
[
i
].
value
=
v
;
break
;
break
;
}
}
case
gsd_Signed32
:
{
case
gsd_Signed32
:
{
int
v
;
int
v
;
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
if
(
byte_order
==
pwr_eByteOrdering_LittleEndian
)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
b
[
3
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
2
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
if
(
byte_order
==
pwr_eByteOrdering_BigEndian
)
memcpy
(
&
v
,
&
data
[
item
[
i
].
ref
->
Reference_Offset
],
sizeof
(
v
));
else
{
unsigned
char
b
[
4
];
b
[
3
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
];
b
[
2
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
1
];
b
[
1
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
2
];
b
[
0
]
=
data
[
item
[
i
].
ref
->
Reference_Offset
+
3
];
memcpy
(
&
v
,
b
,
sizeof
(
v
));
}
#endif
item
[
i
].
value
=
v
;
item
[
i
].
value
=
v
;
break
;
break
;
}
}
...
...
profibus/lib/rt/src/rt_pb_gsd.h
View file @
9bf4167f
/*
/*
* Proview $Id: rt_pb_gsd.h,v 1.
3 2006-04-12 12:17:45
claes Exp $
* Proview $Id: rt_pb_gsd.h,v 1.
4 2006-07-25 11:01:19
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
...
@@ -206,6 +206,7 @@ class pb_gsd {
...
@@ -206,6 +206,7 @@ class pb_gsd {
gsd_sModuleClass
*
module_classlist
;
gsd_sModuleClass
*
module_classlist
;
gsd_sModuleConf
*
copy_buff
;
gsd_sModuleConf
*
copy_buff
;
int
modified
;
int
modified
;
int
byte_order
;
static
gsd_sKeyword
keywordlist
[];
static
gsd_sKeyword
keywordlist
[];
...
...
profibus/lib/rt/src/rt_pb_gsd_attrnav.cpp
View file @
9bf4167f
/*
/*
* Proview $Id: rt_pb_gsd_attrnav.cpp,v 1.
2 2006-04-12 12:17:45
claes Exp $
* Proview $Id: rt_pb_gsd_attrnav.cpp,v 1.
3 2006-07-25 11:01:19
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
...
@@ -823,6 +823,9 @@ static int attrnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
...
@@ -823,6 +823,9 @@ static int attrnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
else
if
(
!
((
ItemPbBase
*
)
item
)
->
parent
&&
attrnav
->
change_value_cb
)
else
if
(
!
((
ItemPbBase
*
)
item
)
->
parent
&&
attrnav
->
change_value_cb
)
(
attrnav
->
change_value_cb
)
(
attrnav
->
parent_ctx
);
(
attrnav
->
change_value_cb
)
(
attrnav
->
parent_ctx
);
break
;
break
;
case
attrnav_eItemType_PbEnumByteOrder
:
item
->
open_children
(
attrnav
,
0
,
0
);
break
;
case
attrnav_eItemType_PbEnumValue
:
{
case
attrnav_eItemType_PbEnumValue
:
{
int
value
;
int
value
;
if
(
!
attrnav
->
edit_mode
)
{
if
(
!
attrnav
->
edit_mode
)
{
...
@@ -971,6 +974,30 @@ static int attrnav_trace_scan_bc( brow_tObject object, void *p)
...
@@ -971,6 +974,30 @@ static int attrnav_trace_scan_bc( brow_tObject object, void *p)
item
->
old_value
=
*
(
int
*
)
p
;
item
->
old_value
=
*
(
int
*
)
p
;
break
;
break
;
}
}
case
attrnav_eItemType_PbEnumByteOrder
:
{
ItemPbEnumByteOrder
*
item
;
item
=
(
ItemPbEnumByteOrder
*
)
base_item
;
if
(
!
item
->
first_scan
)
{
if
(
item
->
old_value
==
*
(
int
*
)
p
)
// No change since last time
return
1
;
}
else
item
->
first_scan
=
0
;
brow_GetCtxUserData
(
brow_GetCtx
(
object
),
(
void
**
)
&
attrnav
);
if
(
*
(
int
*
)
p
==
0
)
strcpy
(
buf
,
"LittleEndian"
);
else
strcpy
(
buf
,
"BigEndian"
);
brow_SetAnnotation
(
object
,
1
,
buf
,
strlen
(
buf
));
item
->
old_value
=
*
(
int
*
)
p
;
break
;
}
case
attrnav_eItemType_PbModuleType
:
{
case
attrnav_eItemType_PbModuleType
:
{
ItemPbModuleType
*
item
;
ItemPbModuleType
*
item
;
int
sts
;
int
sts
;
...
@@ -1122,7 +1149,8 @@ static int attrnav_trace_connect_bc( brow_tObject object, char *name, char *attr
...
@@ -1122,7 +1149,8 @@ static int attrnav_trace_connect_bc( brow_tObject object, char *name, char *attr
brow_GetUserData
(
object
,
(
void
**
)
&
base_item
);
brow_GetUserData
(
object
,
(
void
**
)
&
base_item
);
switch
(
base_item
->
type
)
{
switch
(
base_item
->
type
)
{
case
attrnav_eItemType_PbBase
:
case
attrnav_eItemType_PbBase
:
case
attrnav_eItemType_PbEnum
:
{
case
attrnav_eItemType_PbEnum
:
case
attrnav_eItemType_PbEnumByteOrder
:
{
ItemPbBase
*
item
=
(
ItemPbBase
*
)
base_item
;
ItemPbBase
*
item
=
(
ItemPbBase
*
)
base_item
;
if
(
item
->
size
==
0
)
if
(
item
->
size
==
0
)
break
;
break
;
...
@@ -1389,6 +1417,12 @@ int GsdAttrNav::object_attr()
...
@@ -1389,6 +1417,12 @@ int GsdAttrNav::object_attr()
p
,
0
,
0
,
p
,
0
,
0
,
NULL
,
flow_eDest_IntoLast
);
NULL
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
&
gsd
->
byte_order
;
new
ItemPbEnumByteOrder
(
this
,
"ByteOrdering"
,
"LocalGsdAttr"
,
pwr_eType_Int32
,
sizeof
(
pwr_tInt32
),
0
,
0
,
p
,
0
,
NULL
,
flow_eDest_IntoLast
);
new
ItemPbMoreData
(
this
,
"SlaveGsdData"
,
NULL
,
flow_eDest_IntoLast
);
new
ItemPbMoreData
(
this
,
"SlaveGsdData"
,
NULL
,
flow_eDest_IntoLast
);
new
ItemPbPrmData
(
this
,
"UserPrmData"
,
NULL
,
flow_eDest_IntoLast
);
new
ItemPbPrmData
(
this
,
"UserPrmData"
,
NULL
,
flow_eDest_IntoLast
);
...
@@ -2061,3 +2095,51 @@ int ItemPbMoreData::open_children( GsdAttrNav *attrnav, double x, double y)
...
@@ -2061,3 +2095,51 @@ int ItemPbMoreData::open_children( GsdAttrNav *attrnav, double x, double y)
return
1
;
return
1
;
}
}
ItemPbEnumByteOrder
::
ItemPbEnumByteOrder
(
GsdAttrNav
*
attrnav
,
char
*
item_name
,
char
*
attr
,
int
attr_type
,
int
attr_size
,
double
attr_min_limit
,
double
attr_max_limit
,
void
*
attr_value_p
,
int
attr_noedit
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
ItemPbBase
(
attrnav
,
item_name
,
attr
,
attr_type
,
attr_size
,
attr_min_limit
,
attr_max_limit
,
attr_value_p
,
attr_noedit
,
0
,
dest
,
dest_code
)
{
type
=
attrnav_eItemType_PbEnumByteOrder
;
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
}
int
ItemPbEnumByteOrder
::
open_children
(
GsdAttrNav
*
attrnav
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
))
{
// Close
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
brow_CloseNode
(
attrnav
->
brow
->
ctx
,
node
);
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Attributes
)
brow_RemoveAnnotPixmap
(
node
,
1
);
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Children
)
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
brow_ResetOpen
(
node
,
attrnav_mOpen_All
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
else
if
(
!
noedit
)
{
int
found
;
found
=
0
;
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
new
ItemPbEnumValue
(
attrnav
,
"LittleEndian"
,
0
,
pwr_eType_UInt32
,
this
->
value_p
,
node
,
flow_eDest_IntoLast
);
new
ItemPbEnumValue
(
attrnav
,
"BigEndian"
,
1
,
pwr_eType_UInt32
,
this
->
value_p
,
node
,
flow_eDest_IntoLast
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
return
1
;
}
profibus/lib/rt/src/rt_pb_gsd_attrnav.h
View file @
9bf4167f
/*
/*
* Proview $Id: rt_pb_gsd_attrnav.h,v 1.
2 2006-04-24 13:22:23
claes Exp $
* Proview $Id: rt_pb_gsd_attrnav.h,v 1.
3 2006-07-25 11:01:19
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
...
@@ -63,7 +63,8 @@ typedef enum {
...
@@ -63,7 +63,8 @@ typedef enum {
attrnav_eItemType_PbModuleData
,
attrnav_eItemType_PbModuleData
,
attrnav_eItemType_PbModuleClass
,
attrnav_eItemType_PbModuleClass
,
attrnav_eItemType_PbPrmData
,
attrnav_eItemType_PbPrmData
,
attrnav_eItemType_PbMoreData
attrnav_eItemType_PbMoreData
,
attrnav_eItemType_PbEnumByteOrder
}
attrnav_eItemType
;
}
attrnav_eItemType
;
typedef
enum
{
typedef
enum
{
...
@@ -284,6 +285,21 @@ class ItemPbMoreData : public ItemPb {
...
@@ -284,6 +285,21 @@ class ItemPbMoreData : public ItemPb {
virtual
int
open_children
(
GsdAttrNav
*
attrnav
,
double
x
,
double
y
);
virtual
int
open_children
(
GsdAttrNav
*
attrnav
,
double
x
,
double
y
);
};
};
//! Item for slave byte order.
class
ItemPbEnumByteOrder
:
public
ItemPbBase
{
public:
ItemPbEnumByteOrder
(
GsdAttrNav
*
attrnav
,
char
*
item_name
,
char
*
attr
,
int
attr_type
,
int
attr_size
,
double
attr_min_limit
,
double
attr_max_limit
,
void
*
attr_value_p
,
int
attr_noedit
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPbEnumByteOrder
()
{}
int
old_value
;
virtual
int
open_children
(
GsdAttrNav
*
attrnav
,
double
x
,
double
y
);
};
/*@}*/
/*@}*/
#if defined __cplusplus
#if defined __cplusplus
}
}
...
...
profibus/lib/wb/src/wb_c_pb_dp_slave.cpp
View file @
9bf4167f
/*
/*
* Proview $Id: wb_c_pb_dp_slave.cpp,v 1.
5 2006-05-21 22:30:49 lw
Exp $
* Proview $Id: wb_c_pb_dp_slave.cpp,v 1.
6 2006-07-25 11:01:19 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
...
@@ -131,6 +131,14 @@ static int attr_save_cb( void *sctx)
...
@@ -131,6 +131,14 @@ static int attr_save_cb( void *sctx)
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
address
,
sizeof
(
address
));
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
address
,
sizeof
(
address
));
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
return
sts
;
// ByteOrdering
pwr_tByteOrderingEnum
byte_order
=
ctx
->
gsd
->
byte_order
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
ctx
->
aref
,
"ByteOrdering"
,
&
aaref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
byte_order
,
sizeof
(
byte_order
));
if
(
EVEN
(
sts
))
return
sts
;
// VendorName
// VendorName
sts
=
ctx
->
gsd
->
get_svalue
(
"Vendor_Name"
,
svalue
,
sizeof
(
svalue
));
sts
=
ctx
->
gsd
->
get_svalue
(
"Vendor_Name"
,
svalue
,
sizeof
(
svalue
));
if
(
ODD
(
sts
))
{
if
(
ODD
(
sts
))
{
...
@@ -430,6 +438,17 @@ static pwr_tStatus load_modules( slave_sCtx *ctx)
...
@@ -430,6 +438,17 @@ static pwr_tStatus load_modules( slave_sCtx *ctx)
ctx
->
gsd
->
address
=
address
;
ctx
->
gsd
->
address
=
address
;
// Set byte order
pwr_tByteOrderingEnum
byte_order
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
ctx
->
aref
,
"ByteOrdering"
,
&
aaref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_ReadAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
byte_order
,
sizeof
(
byte_order
));
if
(
EVEN
(
sts
))
return
sts
;
ctx
->
gsd
->
byte_order
=
byte_order
;
// Set Ext_User_Prm_Data
// Set Ext_User_Prm_Data
pwr_tUInt8
prm_user_data
[
256
];
pwr_tUInt8
prm_user_data
[
256
];
pwr_tUInt16
prm_user_data_len
;
pwr_tUInt16
prm_user_data_len
;
...
...
profibus/lib/xtt/src/xtt_c_pb_dp_slave.cpp
View file @
9bf4167f
/*
/*
* Proview $Id: xtt_c_pb_dp_slave.cpp,v 1.
2 2006-04-12 12:17:45
claes Exp $
* Proview $Id: xtt_c_pb_dp_slave.cpp,v 1.
3 2006-07-25 11:01:19
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
...
@@ -128,6 +128,17 @@ static pwr_tStatus load_modules( slave_sCtx *ctx)
...
@@ -128,6 +128,17 @@ static pwr_tStatus load_modules( slave_sCtx *ctx)
ctx
->
gsd
->
address
=
address
;
ctx
->
gsd
->
address
=
address
;
// Set byte order
pwr_tByteOrderingEnum
byte_order
;
sts
=
gdh_ArefANameToAref
(
&
ctx
->
aref
,
"ByteOrdering"
,
&
aaref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetObjectInfoAttrref
(
&
aaref
,
&
byte_order
,
sizeof
(
byte_order
));
if
(
EVEN
(
sts
))
return
sts
;
ctx
->
gsd
->
byte_order
=
byte_order
;
// Set Ext_User_Prm_Data
// Set Ext_User_Prm_Data
pwr_tUInt8
prm_user_data
[
256
];
pwr_tUInt8
prm_user_data
[
256
];
pwr_tUInt16
prm_user_data_len
;
pwr_tUInt16
prm_user_data_len
;
...
...
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