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
48c8033c
Commit
48c8033c
authored
Aug 18, 2014
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'proposed_master'
parents
245d3efb
1850ac3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
gsi_defconfig
configs/gsi_defconfig
+2
-0
eb-w1-write.c
tools/eb-w1-write.c
+27
-9
No files found.
configs/gsi_defconfig
View file @
48c8033c
...
...
@@ -11,7 +11,9 @@ CONFIG_PPSI=y
CONFIG_UART=y
CONFIG_W1=y
CONFIG_ETHERBONE=y
# CONFIG_WRNIC is not set
CONFIG_CMD_CONFIG=y
# CONFIG_NIC_PFILTER is not set
#
# wrpc-sw is tainted if you change the following options
...
...
tools/eb-w1-write.c
View file @
48c8033c
...
...
@@ -81,7 +81,7 @@ static int write_w1(int w1base, int w1len)
static
int
help
(
void
)
{
fprintf
(
stderr
,
"%s: Use:
\"
%s [-v] <device> <addr> <len>
\n
"
,
fprintf
(
stderr
,
"%s: Use:
\"
%s [-v]
[-i <index>]
<device> <addr> <len>
\n
"
,
prgname
,
prgname
);
return
1
;
}
...
...
@@ -94,15 +94,24 @@ static void die(const char *reason, eb_status_t status)
int
main
(
int
argc
,
char
**
argv
)
{
int
c
;
int
c
,
i
;
eb_status_t
status
;
eb_socket_t
socket
;
struct
sdb_device
sdb
;
struct
sdb_device
sdb
[
10
];;
char
*
tail
;
prgname
=
argv
[
0
];
i
=
-
1
;
while
((
c
=
getopt
(
argc
,
argv
,
"v"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"
i:
v"
))
!=
-
1
)
{
switch
(
c
)
{
case
'i'
:
i
=
strtol
(
optarg
,
&
tail
,
0
);
if
(
*
tail
!=
0
)
{
fprintf
(
stderr
,
"Specify a proper number, not '%s'!
\n
"
,
optarg
);
exit
(
1
);
}
break
;
case
'v'
:
verbose
++
;
break
;
...
...
@@ -120,15 +129,24 @@ int main(int argc, char **argv)
die
(
argv
[
optind
],
status
);
/* Find the W1 device */
c
=
1
;
if
((
status
=
eb_sdb_find_by_identity
(
device
,
W1_VENDOR
,
W1_DEVICE
,
&
sdb
,
&
c
))
!=
EB_OK
)
c
=
sizeof
(
sdb
)
/
sizeof
(
struct
sdb_device
)
;
if
((
status
=
eb_sdb_find_by_identity
(
device
,
W1_VENDOR
,
W1_DEVICE
,
&
sdb
[
0
]
,
&
c
))
!=
EB_OK
)
die
(
"eb_sdb_find_by_identity"
,
status
);
if
(
c
!=
1
)
{
fprintf
(
stderr
,
"Found %d 1wire controllers on that device
\n
"
,
c
);
if
(
i
==
-
1
)
{
if
(
c
>
1
)
{
fprintf
(
stderr
,
"Found %d 1wire controllers on that device; pick one with -i #
\n
"
,
c
);
exit
(
1
);
}
else
{
i
=
0
;
}
}
if
(
i
>=
c
)
{
fprintf
(
stderr
,
"Could not find 1wire controller #%d on that device (%d total)
\n
"
,
i
,
c
);
exit
(
1
);
}
BASE_ONEWIRE
=
sdb
.
sdb_component
.
addr_first
;
BASE_ONEWIRE
=
sdb
[
i
]
.
sdb_component
.
addr_first
;
return
write_w1
(
atoi
(
argv
[
optind
+
1
]),
atoi
(
argv
[
optind
+
2
]));
}
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