Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
3985cf77
Commit
3985cf77
authored
Jul 08, 2016
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding diag shell command for reading/writing aux diag registers
parent
73631711
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
cmd_diag.c
shell/cmd_diag.c
+62
-0
shell.mk
shell/shell.mk
+1
-0
No files found.
shell/cmd_diag.c
0 → 100644
View file @
3985cf77
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2016 CERN (www.cern.ch)
* Author: Grzegorz Daniluk <grzegorz.daniluk@cern.ch>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#include "shell.h"
#include <wrc.h>
#include <syscon.h>
#include <string.h>
#include <errno.h>
static
int
cmd_diag
(
const
char
*
args
[])
{
uint32_t
id
,
ver
,
nrw
,
nro
;
uint32_t
addr
,
val
;
int
ret
=
0
;
if
(
!
args
[
0
])
{
diag_read_info
(
&
id
,
&
ver
,
&
nrw
,
&
nro
);
pp_printf
(
"Aux diagnostics info:
\n
"
);
pp_printf
(
"id: %d.%d, r/w words: %d, r/o words: %d
\n
"
,
id
,
ver
,
nrw
,
nro
);
return
0
;
}
if
(
!
strcasecmp
(
args
[
0
],
"ro"
)
&&
args
[
1
])
{
addr
=
atoi
(
args
[
1
]);
ret
=
diag_read_word
(
addr
,
DIAG_RO_BANK
,
&
val
);
if
(
!
ret
)
pp_printf
(
"Word %d is 0x%08x
\n
"
,
addr
,
val
);
return
ret
;
}
if
(
!
strcasecmp
(
args
[
0
],
"rw"
)
&&
args
[
1
])
{
addr
=
atoi
(
args
[
1
]);
ret
=
diag_read_word
(
addr
,
DIAG_RW_BANK
,
&
val
);
if
(
!
ret
)
pp_printf
(
"Word %d is 0x%08x
\n
"
,
addr
,
val
);
return
ret
;
}
if
(
!
strcasecmp
(
args
[
0
],
"w"
)
&&
args
[
1
]
&&
args
[
2
])
{
addr
=
atoi
(
args
[
1
]);
val
=
atoi
(
args
[
2
]);
ret
=
diag_write_word
(
addr
,
val
);
if
(
!
ret
)
pp_printf
(
"Value 0x%08x written to the word %d
\n
"
,
val
,
addr
);
return
ret
;
}
return
-
EINVAL
;
}
DEFINE_WRC_COMMAND
(
diag
)
=
{
.
name
=
"diag"
,
.
exec
=
cmd_diag
,
};
shell/shell.mk
View file @
3985cf77
...
...
@@ -17,6 +17,7 @@ obj-$(CONFIG_EMBEDDED_NODE) += \
shell/cmd_gui.o \
shell/cmd_sdb.o \
shell/cmd_ptrack.o \
shell/cmd_diag.o \
obj-$(CONFIG_IP) += shell/cmd_ip.o
obj-$(CONFIG_PPSI) += shell/cmd_verbose.o
...
...
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