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
710f2cb4
Commit
710f2cb4
authored
13 years ago
by
Wesley W. Terpstra
Browse files
Options
Downloads
Patches
Plain Diff
Handle attempts=0 sensibly
parent
6af5e6c8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/glue/device.c
+24
-17
24 additions, 17 deletions
api/glue/device.c
api/glue/socket.c
+1
-1
1 addition, 1 deletion
api/glue/socket.c
with
25 additions
and
18 deletions
api/glue/device.c
+
24
−
17
View file @
710f2cb4
...
...
@@ -107,10 +107,17 @@ eb_status_t eb_device_open(eb_socket_t socketp, const char* address, eb_width_t
if
(
eb_transports
[
transport
->
link_type
].
mtu
==
0
)
attempts
=
1
;
/* Try to determine port width */
if
(
attempts
==
0
)
{
device
->
widths
=
EB_DATAX
|
EB_ADDRX
;
/* Only ok if the proposed widths are distinct */
if
(
!
eb_width_refined
(
proposed_widths
))
{
eb_device_close
(
devicep
);
*
result
=
EB_NULL
;
return
EB_WIDTH
;
}
device
->
widths
=
proposed_widths
;
}
else
{
/* Try to determine port width */
device
->
widths
=
0
;
do
{
uint8_t
buf
[
8
]
=
{
0x4E
,
0x6F
,
0x11
,
proposed_widths
,
0x0
,
0x0
,
0x0
,
0x0
};
...
...
@@ -126,23 +133,23 @@ eb_status_t eb_device_open(eb_socket_t socketp, const char* address, eb_width_t
eb_socket_poll
(
socketp
);
}
}
while
(
device
->
widths
==
0
&&
--
attempts
!=
0
);
if
(
device
->
widths
==
0
)
{
eb_device_close
(
devicep
);
*
result
=
EB_NULL
;
return
EB_TIMEOUT
;
}
device
->
widths
&=
proposed_widths
;
if
(
eb_width_possible
(
device
->
widths
)
==
0
)
{
eb_device_close
(
devicep
);
*
result
=
EB_NULL
;
return
EB_WIDTH
;
}
device
->
widths
=
eb_width_refine
(
device
->
widths
);
}
if
(
device
->
widths
==
0
)
{
eb_device_close
(
devicep
);
*
result
=
EB_NULL
;
return
EB_TIMEOUT
;
}
device
->
widths
&=
proposed_widths
;
if
(
eb_width_possible
(
device
->
widths
)
==
0
)
{
eb_device_close
(
devicep
);
*
result
=
EB_NULL
;
return
EB_WIDTH
;
}
device
->
widths
=
eb_width_refine
(
device
->
widths
);
*
result
=
devicep
;
return
EB_OK
;
}
...
...
This diff is collapsed.
Click to expand it.
api/glue/socket.c
+
1
−
1
View file @
710f2cb4
...
...
@@ -42,7 +42,7 @@ const char* eb_status(eb_status_t code) {
case
EB_OK
:
return
"success"
;
case
EB_FAIL
:
return
"system failure"
;
case
EB_ADDRESS
:
return
"invalid address"
;
case
EB_WIDTH
:
return
"
bus width mismatc
h"
;
case
EB_WIDTH
:
return
"
impossible bus widt
h"
;
case
EB_OVERFLOW
:
return
"cycle length overflow"
;
case
EB_BUSY
:
return
"resource busy"
;
case
EB_TIMEOUT
:
return
"timeout"
;
...
...
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