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
14b9b8ad
Commit
14b9b8ad
authored
Dec 22, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Profinet, support for different API's
parent
8e2b1320
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
14 deletions
+71
-14
profibus/exe/profinet_viewer/src/pn_viewer_pnac.cpp
profibus/exe/profinet_viewer/src/pn_viewer_pnac.cpp
+5
-5
profibus/lib/rt/src/os_linux/rt_io_pnak_locals.h
profibus/lib/rt/src/os_linux/rt_io_pnak_locals.h
+12
-0
profibus/lib/rt/src/os_linux/rt_pn_iface.cpp
profibus/lib/rt/src/os_linux/rt_pn_iface.cpp
+54
-9
No files found.
profibus/exe/profinet_viewer/src/pn_viewer_pnac.cpp
View file @
14b9b8ad
...
@@ -109,7 +109,7 @@ PnViewerPNAC::PnViewerPNAC( pwr_tStatus *sts, const char *dev_name)
...
@@ -109,7 +109,7 @@ PnViewerPNAC::PnViewerPNAC( pwr_tStatus *sts, const char *dev_name)
*
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
*
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
if
(
*
sts
==
PNAK_OK
)
{
if
(
*
sts
==
PNAK_OK
)
{
*
sts
=
handle
_service_con
(
local
,
0
);
*
sts
=
wait
_service_con
(
local
,
0
);
if
(
*
sts
!=
PNAK_OK
)
{
if
(
*
sts
!=
PNAK_OK
)
{
/* Loop through devices and calculate offset for io */
/* Loop through devices and calculate offset for io */
...
@@ -123,7 +123,7 @@ PnViewerPNAC::PnViewerPNAC( pwr_tStatus *sts, const char *dev_name)
...
@@ -123,7 +123,7 @@ PnViewerPNAC::PnViewerPNAC( pwr_tStatus *sts, const char *dev_name)
*
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
*
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
if
(
*
sts
==
PNAK_OK
)
{
if
(
*
sts
==
PNAK_OK
)
{
*
sts
=
handle
_service_con
(
local
,
0
);
*
sts
=
wait
_service_con
(
local
,
0
);
}
}
pMode
.
Mode
=
PNAK_MODE_ONLINE
;
pMode
.
Mode
=
PNAK_MODE_ONLINE
;
...
@@ -167,7 +167,7 @@ void PnViewerPNAC::fetch_devices( vector<PnDevice>& dev_vect)
...
@@ -167,7 +167,7 @@ void PnViewerPNAC::fetch_devices( vector<PnDevice>& dev_vect)
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
if
(
sts
==
PNAK_OK
)
{
if
(
sts
==
PNAK_OK
)
{
sts
=
handle
_service_con
(
local
,
0
);
sts
=
wait
_service_con
(
local
,
0
);
if
(
sts
==
PNAK_OK
)
{
if
(
sts
==
PNAK_OK
)
{
if
(
local
->
dev_info
.
size
()
>
0
)
{
if
(
local
->
dev_info
.
size
()
>
0
)
{
for
(
ii
=
0
;
ii
<
local
->
dev_info
.
size
();
ii
++
)
{
for
(
ii
=
0
;
ii
<
local
->
dev_info
.
size
();
ii
++
)
{
...
@@ -238,14 +238,14 @@ void PnViewerPNAC::set_device_properties( unsigned char *macaddress, unsigned ch
...
@@ -238,14 +238,14 @@ void PnViewerPNAC::set_device_properties( unsigned char *macaddress, unsigned ch
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
if
(
sts
==
PNAK_OK
)
{
if
(
sts
==
PNAK_OK
)
{
sts
=
handle
_service_con
(
local
,
0
);
sts
=
wait
_service_con
(
local
,
0
);
}
}
pack_set_ip_settings_req
(
&
local
->
service_req_res
,
&
dev_info
);
pack_set_ip_settings_req
(
&
local
->
service_req_res
,
&
dev_info
);
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
sts
=
pnak_send_service_req_res
(
0
,
&
local
->
service_req_res
);
if
(
sts
==
PNAK_OK
)
{
if
(
sts
==
PNAK_OK
)
{
sts
=
handle
_service_con
(
local
,
0
);
sts
=
wait
_service_con
(
local
,
0
);
}
}
}
}
...
...
profibus/lib/rt/src/os_linux/rt_io_pnak_locals.h
View file @
14b9b8ad
...
@@ -55,6 +55,18 @@ typedef struct _PN_Alarm_Data {
...
@@ -55,6 +55,18 @@ typedef struct _PN_Alarm_Data {
unsigned
char
*
data
;
unsigned
char
*
data
;
}
PN_Alarm_Data
;
}
PN_Alarm_Data
;
class
PnApiData
{
public:
PnApiData
()
:
api
(
0
)
{}
unsigned
int
api
;
vector
<
unsigned
int
>
module_index
;
~
PnApiData
()
{}
int
print
(
ofstream
&
fp
);
};
class
PnIOCRData
{
class
PnIOCRData
{
public:
public:
PnIOCRData
()
:
type
(
0
),
number_modules
(
0
),
identifier
(
0
),
io_data_length
(
0
),
clean_io_data_length
(
0
)
{}
PnIOCRData
()
:
type
(
0
),
number_modules
(
0
),
identifier
(
0
),
io_data_length
(
0
),
clean_io_data_length
(
0
)
{}
...
...
profibus/lib/rt/src/os_linux/rt_pn_iface.cpp
View file @
14b9b8ad
...
@@ -394,7 +394,9 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
...
@@ -394,7 +394,9 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
unsigned
short
datarecord_ind
=
0
;
unsigned
short
datarecord_ind
=
0
;
unsigned
short
data_record_length
=
0
;
unsigned
short
data_record_length
=
0
;
unsigned
short
no_items
;
unsigned
short
no_items
;
unsigned
short
ii
,
jj
,
kk
,
length
;
unsigned
short
ii
,
jj
,
kk
,
length
,
slot_api
,
found
;
vector
<
PnApiData
>
apis
;
static
unsigned
short
phase
=
1
;
static
unsigned
short
phase
=
1
;
// static unsigned short old_red_ratio = 1;
// static unsigned short old_red_ratio = 1;
...
@@ -418,8 +420,7 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
...
@@ -418,8 +420,7 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
num_iocrs
=
dev_data
->
iocr_data
.
size
();
num_iocrs
=
dev_data
->
iocr_data
.
size
();
if
(
num_iocrs
>
0
)
/* Calculate num modules */
num_apis
=
1
;
for
(
ii
=
0
;
ii
<
dev_data
->
slot_data
.
size
();
ii
++
)
{
for
(
ii
=
0
;
ii
<
dev_data
->
slot_data
.
size
();
ii
++
)
{
if
((
dev_data
->
slot_data
[
ii
]
->
module_enum_number
!=
0
)
||
if
((
dev_data
->
slot_data
[
ii
]
->
module_enum_number
!=
0
)
||
...
@@ -430,6 +431,42 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
...
@@ -430,6 +431,42 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
// num_modules = dev_data->slot_data.size();
// num_modules = dev_data->slot_data.size();
/* Calculate num apis */
if
(
num_iocrs
>
0
)
{
for
(
ii
=
0
;
ii
<
num_modules
;
ii
++
)
{
slot_api
=
PROFINET_DEFAULT_API
;
for
(
jj
=
0
;
jj
<
dev_data
->
slot_data
[
ii
]
->
subslot_data
.
size
();
jj
++
)
{
if
(
dev_data
->
slot_data
[
ii
]
->
subslot_data
[
jj
]
->
api
>
0
)
{
slot_api
=
dev_data
->
slot_data
[
ii
]
->
subslot_data
[
jj
]
->
api
;
break
;
}
}
found
=
0
;
for
(
kk
=
0
;
kk
<
apis
.
size
();
kk
++
)
{
if
(
apis
[
kk
].
api
==
slot_api
)
{
found
=
TRUE
;
break
;
}
}
if
(
!
found
)
{
PnApiData
api
;
api
.
api
=
slot_api
;
api
.
module_index
.
push_back
(
ii
);
apis
.
push_back
(
api
);
}
else
{
apis
[
kk
].
module_index
.
push_back
(
ii
);
}
}
num_apis
=
apis
.
size
();
}
/* Calculate num sub modules */
for
(
ii
=
0
;
ii
<
num_modules
;
ii
++
)
{
for
(
ii
=
0
;
ii
<
num_modules
;
ii
++
)
{
num_sm
=
dev_data
->
slot_data
[
ii
]
->
subslot_data
.
size
();
num_sm
=
dev_data
->
slot_data
[
ii
]
->
subslot_data
.
size
();
num_submodules
+=
num_sm
;
num_submodules
+=
num_sm
;
...
@@ -647,21 +684,29 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
...
@@ -647,21 +684,29 @@ void pack_download_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, GsdmlDeviceData *d
/* Fill data for API */
/* Fill data for API */
/* pAPI->APIHighWordHighByte = _PN_U32_HIGH_HIGH_BYTE(15616);
pAPI->APIHighWordLowByte = _PN_U32_HIGH_LOW_BYTE(15616);
pAPI->APILowWordHighByte = _PN_U32_LOW_HIGH_BYTE(15616);
pAPI->APILowWordLowByte = _PN_U32_LOW_LOW_BYTE(15616);
pAPI->APIHighWordHighByte = _PN_U32_HIGH_HIGH_BYTE(PROFINET_DEFAULT_API);
pAPI->APIHighWordHighByte = _PN_U32_HIGH_HIGH_BYTE(PROFINET_DEFAULT_API);
pAPI->APIHighWordLowByte = _PN_U32_HIGH_LOW_BYTE(PROFINET_DEFAULT_API);
pAPI->APIHighWordLowByte = _PN_U32_HIGH_LOW_BYTE(PROFINET_DEFAULT_API);
pAPI->APILowWordHighByte = _PN_U32_LOW_HIGH_BYTE(PROFINET_DEFAULT_API);
pAPI->APILowWordHighByte = _PN_U32_LOW_HIGH_BYTE(PROFINET_DEFAULT_API);
pAPI
->
APILowWordLowByte
=
_PN_U32_LOW_LOW_BYTE
(
PROFINET_DEFAULT_API
);
pAPI->APILowWordLowByte = _PN_U32_LOW_LOW_BYTE(PROFINET_DEFAULT_API); */
pAPI
->
APIHighWordHighByte
=
_PN_U32_HIGH_HIGH_BYTE
(
apis
[
ii
].
api
);
pAPI
->
APIHighWordLowByte
=
_PN_U32_HIGH_LOW_BYTE
(
apis
[
ii
].
api
);
pAPI
->
APILowWordHighByte
=
_PN_U32_LOW_HIGH_BYTE
(
apis
[
ii
].
api
);
pAPI
->
APILowWordLowByte
=
_PN_U32_LOW_LOW_BYTE
(
apis
[
ii
].
api
);
pAPI
->
NumberOfModulesHighByte
=
_PN_U16_HIGH_BYTE
(
num_modules
);
pAPI
->
NumberOfModulesHighByte
=
_PN_U16_HIGH_BYTE
(
apis
[
ii
].
module_index
.
size
()
);
pAPI
->
NumberOfModulesLowByte
=
_PN_U16_LOW_BYTE
(
num_modules
);
pAPI
->
NumberOfModulesLowByte
=
_PN_U16_LOW_BYTE
(
apis
[
ii
].
module_index
.
size
()
);
/* Fill references to Modules */
/* Fill references to Modules */
pModuleReference
=
(
T_PN_REFERENCE
*
)
(
pAPI
+
1
);
pModuleReference
=
(
T_PN_REFERENCE
*
)
(
pAPI
+
1
);
for
(
module_ind
=
0
;
module_ind
<
num_modules
;
module_ind
++
)
{
for
(
module_ind
=
0
;
module_ind
<
apis
[
ii
].
module_index
.
size
()
;
module_ind
++
)
{
pModuleReference
->
ReferenceHighByte
=
_PN_U16_HIGH_BYTE
(
module_ind
);
pModuleReference
->
ReferenceHighByte
=
_PN_U16_HIGH_BYTE
(
apis
[
ii
].
module_index
[
module_ind
]
);
pModuleReference
->
ReferenceLowByte
=
_PN_U16_LOW_BYTE
(
module_ind
);
pModuleReference
->
ReferenceLowByte
=
_PN_U16_LOW_BYTE
(
apis
[
ii
].
module_index
[
module_ind
]
);
pModuleReference
++
;
pModuleReference
++
;
}
}
...
...
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