Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EtherBone Core
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
EtherBone Core
Commits
3c566721
Commit
3c566721
authored
13 years ago
by
Wesley W. Terpstra
Browse files
Options
Downloads
Patches
Plain Diff
Support sub-word access with the command-line tools.
Provide a slave which is useful for testing endian.
parent
3aeba2c2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/demo/eb-read.c
+8
-3
8 additions, 3 deletions
api/demo/eb-read.c
api/demo/eb-snoop.c
+13
-2
13 additions, 2 deletions
api/demo/eb-snoop.c
api/demo/eb-write.c
+8
-3
8 additions, 3 deletions
api/demo/eb-write.c
with
29 additions
and
8 deletions
api/demo/eb-read.c
+
8
−
3
View file @
3c566721
...
...
@@ -48,19 +48,24 @@ int main(int argc, const char** argv) {
eb_status_t
status
;
eb_device_t
device
;
eb_width_t
width
;
eb_width_t
op_width
;
eb_cycle_t
cycle
;
eb_address_t
address
;
const
char
*
netaddress
;
int
stop
;
if
(
argc
!=
3
)
{
fprintf
(
stderr
,
"Syntax: %s <protocol/host/port> <address>
\n
"
,
argv
[
0
]);
if
(
argc
<
3
||
argc
>
4
)
{
fprintf
(
stderr
,
"Syntax: %s <protocol/host/port> <address>
[width]
\n
"
,
argv
[
0
]);
return
1
;
}
netaddress
=
argv
[
1
];
address
=
strtoll
(
argv
[
2
],
0
,
0
);
op_width
=
EB_DATAX
;
if
(
argc
==
4
)
op_width
&=
strtol
(
argv
[
3
],
0
,
0
);
if
((
status
=
eb_socket_open
(
0
,
EB_DATAX
|
EB_ADDRX
,
&
socket
))
!=
EB_OK
)
{
fprintf
(
stderr
,
"Failed to open Etherbone socket: %s
\n
"
,
eb_status
(
status
));
return
1
;
...
...
@@ -82,7 +87,7 @@ int main(int argc, const char** argv) {
return
1
;
}
eb_cycle_read
(
cycle
,
address
,
EB_DATAX
,
0
);
eb_cycle_read
(
cycle
,
address
,
op_width
,
0
);
eb_cycle_close
(
cycle
);
stop
=
0
;
...
...
This diff is collapsed.
Click to expand it.
api/demo/eb-snoop.c
+
13
−
2
View file @
3c566721
...
...
@@ -30,9 +30,20 @@
#include
"../etherbone.h"
static
eb_status_t
my_read
(
eb_user_data_t
user
,
eb_address_t
address
,
eb_width_t
width
,
eb_data_t
*
data
)
{
eb_data_t
out
;
fprintf
(
stdout
,
"Received read to address %016"
EB_ADDR_FMT
" of %d bits
\n
"
,
address
,
(
width
&
EB_DATAX
)
*
8
);
*
data
=
UINT64_C
(
0x1234567890abcdef
);
return
(
address
==
0
)
?
EB_FAIL
:
EB_OK
;
/* Pretend to be a bigendian device with the identity function */
width
&=
EB_DATAX
;
for
(
out
=
0
;
width
>
0
;
--
width
)
{
out
<<=
8
;
out
|=
address
&
0xFF
;
++
address
;
}
*
data
=
out
;
return
EB_OK
;
}
static
eb_status_t
my_write
(
eb_user_data_t
user
,
eb_address_t
address
,
eb_width_t
width
,
eb_data_t
data
)
{
...
...
This diff is collapsed.
Click to expand it.
api/demo/eb-write.c
+
8
−
3
View file @
3c566721
...
...
@@ -48,14 +48,15 @@ int main(int argc, const char** argv) {
eb_status_t
status
;
eb_device_t
device
;
eb_width_t
width
;
eb_width_t
op_width
;
eb_cycle_t
cycle
;
eb_address_t
address
;
eb_data_t
data
;
const
char
*
netaddress
;
int
stop
;
if
(
argc
!=
4
)
{
fprintf
(
stderr
,
"Syntax: %s <protocol/host/port> <address> <data>
\n
"
,
argv
[
0
]);
if
(
argc
<
4
||
argc
>
5
)
{
fprintf
(
stderr
,
"Syntax: %s <protocol/host/port> <address> <data>
[width]
\n
"
,
argv
[
0
]);
return
1
;
}
...
...
@@ -63,6 +64,10 @@ int main(int argc, const char** argv) {
address
=
strtoll
(
argv
[
2
],
0
,
0
);
data
=
strtoll
(
argv
[
3
],
0
,
0
);
op_width
=
EB_DATAX
;
if
(
argc
==
5
)
op_width
&=
strtol
(
argv
[
4
],
0
,
0
);
if
((
status
=
eb_socket_open
(
0
,
EB_DATAX
|
EB_ADDRX
,
&
socket
))
!=
EB_OK
)
{
fprintf
(
stderr
,
"Failed to open Etherbone socket: %s
\n
"
,
eb_status
(
status
));
return
1
;
...
...
@@ -84,7 +89,7 @@ int main(int argc, const char** argv) {
return
1
;
}
eb_cycle_write
(
cycle
,
address
,
EB_DATAX
,
data
);
eb_cycle_write
(
cycle
,
address
,
op_width
,
data
);
eb_cycle_close
(
cycle
);
stop
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment