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
375db67a
Commit
375db67a
authored
Jun 02, 2010
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix for diagnostic messages
parent
aa2abb46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
22 deletions
+41
-22
profibus/lib/rt/src/os_linux/rt_io_m_pb_profiboard.c
profibus/lib/rt/src/os_linux/rt_io_m_pb_profiboard.c
+41
-22
No files found.
profibus/lib/rt/src/os_linux/rt_io_m_pb_profiboard.c
View file @
375db67a
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
The board we use is Profiboard from Softing
The board we use is Profiboard from Softing
*/
*/
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <errno.h>
#include <errno.h>
...
@@ -147,8 +148,8 @@ static short fmb_set_configuration(T_PROFI_DEVICE_HANDLE *hDevice,
...
@@ -147,8 +148,8 @@ static short fmb_set_configuration(T_PROFI_DEVICE_HANDLE *hDevice,
data
.
dp
.
max_number_slaves
=
op
->
MaxNumberSlaves
;
data
.
dp
.
max_number_slaves
=
op
->
MaxNumberSlaves
;
data
.
dp
.
max_slave_output_len
=
op
->
MaxSlaveOutputLen
;
data
.
dp
.
max_slave_output_len
=
op
->
MaxSlaveOutputLen
;
data
.
dp
.
max_slave_input_len
=
op
->
MaxSlaveInputLen
;
data
.
dp
.
max_slave_input_len
=
op
->
MaxSlaveInputLen
;
data
.
dp
.
max_slave_diag_entries
=
op
->
MaxNumberSlaves
;
data
.
dp
.
max_slave_diag_entries
=
op
->
MaxNumberSlaves
*
4
;
data
.
dp
.
max_slave_diag_len
=
244
;
data
.
dp
.
max_slave_diag_len
=
60
;
data
.
dp
.
max_bus_para_len
=
1024
;
data
.
dp
.
max_bus_para_len
=
1024
;
data
.
dp
.
max_slave_para_len
=
1024
;
data
.
dp
.
max_slave_para_len
=
1024
;
...
@@ -227,7 +228,7 @@ static short dp_download_bus(T_PROFI_DEVICE_HANDLE *hDevice,
...
@@ -227,7 +228,7 @@ static short dp_download_bus(T_PROFI_DEVICE_HANDLE *hDevice,
T_PROFI_SERVICE_DESCR
con_ind_sdb
;
T_PROFI_SERVICE_DESCR
con_ind_sdb
;
INT16
result
;
/* !!! local result variable !!! */
INT16
result
;
/* !!! local result variable !!! */
sdb
.
comm_ref
=
0
;
sdb
.
comm_ref
=
0
;
sdb
.
layer
=
DP
;
sdb
.
layer
=
DP
;
sdb
.
service
=
DP_DOWNLOAD_LOC
;
sdb
.
service
=
DP_DOWNLOAD_LOC
;
sdb
.
primitive
=
REQ
;
sdb
.
primitive
=
REQ
;
...
@@ -351,10 +352,10 @@ static pwr_tBoolean dp_get_slave_diag(T_PROFI_DEVICE_HANDLE *hDevice)
...
@@ -351,10 +352,10 @@ static pwr_tBoolean dp_get_slave_diag(T_PROFI_DEVICE_HANDLE *hDevice)
/*----------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------*\
Get slave diagnostics
Get slave diagnostics
\*----------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------*/
static
void
dp_get_slave_diag_con
(
T_DP_GET_SLAVE_DIAG_CON
*
get_slave_diag_con_ptr
,
io_sRack
*
slave_list
)
static
void
dp_get_slave_diag_con
(
T_DP_GET_SLAVE_DIAG_CON
*
get_slave_diag_con_ptr
,
io_sRack
*
slave_list
,
char
log
)
{
{
T_DP_DIAG_DATA
FAR
*
diag_data_ptr
;
T_DP_DIAG_DATA
FAR
*
diag_data_ptr
;
//
char s [128];
char
s
[
128
];
pwr_sClass_Pb_DP_Slave
*
sp
;
pwr_sClass_Pb_DP_Slave
*
sp
;
if
(
get_slave_diag_con_ptr
->
diag_data_len
>=
DP_MIN_SLAVE_DIAG_LEN
)
if
(
get_slave_diag_con_ptr
->
diag_data_len
>=
DP_MIN_SLAVE_DIAG_LEN
)
...
@@ -403,17 +404,19 @@ static void dp_get_slave_diag_con(T_DP_GET_SLAVE_DIAG_CON * get_slave_diag_con_p
...
@@ -403,17 +404,19 @@ static void dp_get_slave_diag_con(T_DP_GET_SLAVE_DIAG_CON * get_slave_diag_con_p
slave_list
=
slave_list
->
next
;
slave_list
=
slave_list
->
next
;
}
}
/* sprintf (s, "Slave [%3hu] [0x%04hX]: Status = 0x%02hX 0x%02hX 0x%02hX, Master = %3hu, Ext = %hu, Diags = %hu",
if
(
log
)
{
get_slave_diag_con_ptr->rem_add,
sprintf
(
s
,
"Slave [%3hu] [0x%04hX]: Status = 0x%02hX 0x%02hX 0x%02hX, Master = %3hu, Ext = %hu, Diags = %hu"
,
swap16 (diag_data_ptr->ident_number),
get_slave_diag_con_ptr
->
rem_add
,
diag_data_ptr->station_status_1,
swap16
(
diag_data_ptr
->
ident_number
),
diag_data_ptr->station_status_2,
diag_data_ptr
->
station_status_1
,
diag_data_ptr->station_status_3,
diag_data_ptr
->
station_status_2
,
diag_data_ptr->master_add,
diag_data_ptr
->
station_status_3
,
get_slave_diag_con_ptr->diag_data_len - DP_MIN_SLAVE_DIAG_LEN,
diag_data_ptr
->
master_add
,
get_slave_diag_con_ptr->diag_entries);
get_slave_diag_con_ptr
->
diag_data_len
-
DP_MIN_SLAVE_DIAG_LEN
,
get_slave_diag_con_ptr
->
diag_entries
);
errh_Info( "Profibus DP slave diag - %s", s); */
errh_Info
(
"Profibus DP slave diag - %s"
,
s
);
}
}
/* diag_data_len */
}
/* diag_data_len */
...
@@ -894,12 +897,17 @@ static pwr_tStatus IoAgentRead (
...
@@ -894,12 +897,17 @@ static pwr_tStatus IoAgentRead (
case
DP_GET_SLAVE_DIAG
:
{
case
DP_GET_SLAVE_DIAG
:
{
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
);
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
,
op
->
Diag
[
0
]);
op
->
Diag
[
2
]
++
;
local
->
slave_diag_requested
=
op
->
Diag
[
3
]
=
PB_FALSE
;
local
->
slave_diag_requested
=
PB_FALSE
;
if
(
get_slave_diag_con_ptr
->
diag_entries
<
0
)
{
errh_Warning
(
"Profibus - diagnostic circular buffer owerflow."
);
}
if
(
get_slave_diag_con_ptr
->
diag_entries
)
{
if
(
get_slave_diag_con_ptr
->
diag_entries
)
{
local
->
slave_diag_requested
=
PB_TRUE
;
local
->
slave_diag_requested
=
op
->
Diag
[
3
]
=
PB_TRUE
;
dp_get_slave_diag
(
hDevice
);
dp_get_slave_diag
(
hDevice
);
}
}
break
;
break
;
...
@@ -983,15 +991,21 @@ static pwr_tStatus IoAgentRead (
...
@@ -983,15 +991,21 @@ static pwr_tStatus IoAgentRead (
case
DP_GET_SLAVE_DIAG
:
{
case
DP_GET_SLAVE_DIAG
:
{
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
);
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
,
op
->
Diag
[
1
]
);
op
->
Diag
[
0
]
++
;
op
->
Diag
[
0
]
++
;
if
(
get_slave_diag_con_ptr
->
diag_entries
<
0
)
{
errh_Warning
(
"Profibus - diagnostic circular buffer owerflow."
);
}
if
(
(
get_slave_diag_con_ptr
->
diag_entries
)
&&
if
(
(
get_slave_diag_con_ptr
->
diag_entries
)
&&
(
!
local
->
slave_diag_requested
)
)
{
(
!
local
->
slave_diag_requested
)
)
{
if
(
dp_get_slave_diag
(
hDevice
))
{
if
(
dp_get_slave_diag
(
hDevice
))
{
local
->
slave_diag_requested
=
PB_TRUE
;
local
->
slave_diag_requested
=
op
->
Diag
[
3
]
=
PB_TRUE
;
}
}
else
{
errh_Warning
(
"Profibus - Request for diag failed."
);
}
}
}
break
;
break
;
...
@@ -1011,7 +1025,12 @@ static pwr_tStatus IoAgentRead (
...
@@ -1011,7 +1025,12 @@ static pwr_tStatus IoAgentRead (
}
/* if IND */
}
/* if IND */
}
else
if
(
sts
!=
NO_CON_IND_RECEIVED
)
{
}
else
if
(
sts
!=
NO_CON_IND_RECEIVED
)
{
op
->
Status
=
PB__NOTINIT
;
op
->
Status
=
PB__NOTINIT
;
}
else
{
if
(
local
->
slave_diag_requested
)
{
errh_Info
(
"Profibus - Diag re-request"
);
dp_get_slave_diag
(
hDevice
);
}
}
}
break
;
break
;
...
...
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