Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
etherlabmaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ICS Control System Infrastructure
etherlabmaster
Commits
42261a46
Commit
42261a46
authored
16 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Use jiffies instead of cycles in SII state machine.
parent
10b96fe9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
master/fsm_sii.c
+9
-8
9 additions, 8 deletions
master/fsm_sii.c
master/fsm_sii.h
+1
-1
1 addition, 1 deletion
master/fsm_sii.h
with
10 additions
and
9 deletions
master/fsm_sii.c
+
9
−
8
View file @
42261a46
...
...
@@ -225,7 +225,7 @@ void ec_fsm_sii_state_read_check(
return
;
}
fsm
->
cycl
es_start
=
datagram
->
cycl
es_sent
;
fsm
->
jiffi
es_start
=
datagram
->
jiffi
es_sent
;
fsm
->
check_once_more
=
1
;
// issue check/fetch datagram
...
...
@@ -289,8 +289,9 @@ void ec_fsm_sii_state_read_fetch(
if
(
EC_READ_U8
(
datagram
->
data
+
1
)
&
0x81
)
{
// busy bit or
// read operation busy
// still busy... timeout?
if
(
datagram
->
cycles_received
-
fsm
->
cycles_start
>=
(
cycles_t
)
SII_TIMEOUT
*
cpu_khz
)
{
unsigned
long
diff_ms
=
(
datagram
->
jiffies_received
-
fsm
->
jiffies_start
)
*
1000
/
HZ
;
if
(
diff_ms
>=
SII_TIMEOUT
)
{
if
(
fsm
->
check_once_more
)
{
fsm
->
check_once_more
=
0
;
}
else
{
...
...
@@ -372,7 +373,7 @@ void ec_fsm_sii_state_write_check(
return
;
}
fsm
->
cycl
es_start
=
datagram
->
cycl
es_sent
;
fsm
->
jiffi
es_start
=
datagram
->
jiffi
es_sent
;
fsm
->
check_once_more
=
1
;
// issue check datagram
...
...
@@ -392,6 +393,7 @@ void ec_fsm_sii_state_write_check2(
)
{
ec_datagram_t
*
datagram
=
fsm
->
datagram
;
unsigned
long
diff_ms
;
if
(
datagram
->
state
==
EC_DATAGRAM_TIMED_OUT
&&
fsm
->
retries
--
)
return
;
...
...
@@ -425,8 +427,8 @@ void ec_fsm_sii_state_write_check2(
/* FIXME: some slaves never answer with the busy flag set...
* wait a few ms for the write operation to complete. */
if
(
datagram
->
cycl
es_received
-
fsm
->
cycl
es_start
<
(
cycles_t
)
SII_INHIBIT
*
cpu_khz
)
{
diff_ms
=
(
datagram
->
jiffi
es_received
-
fsm
->
jiffi
es_start
)
*
1000
/
HZ
;
if
(
diff_ms
<
SII_INHIBIT
)
{
#ifdef SII_DEBUG
EC_DBG
(
"too early.
\n
"
);
#endif
...
...
@@ -438,8 +440,7 @@ void ec_fsm_sii_state_write_check2(
if
(
EC_READ_U8
(
datagram
->
data
+
1
)
&
0x82
)
{
// busy bit or
// write operation busy bit
// still busy... timeout?
if
(
datagram
->
cycles_received
-
fsm
->
cycles_start
>=
(
cycles_t
)
SII_TIMEOUT
*
cpu_khz
)
{
if
(
diff_ms
>=
SII_TIMEOUT
)
{
if
(
fsm
->
check_once_more
)
{
fsm
->
check_once_more
=
0
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
master/fsm_sii.h
+
1
−
1
View file @
42261a46
...
...
@@ -73,7 +73,7 @@ struct ec_fsm_sii
uint16_t
word_offset
;
/**< input: word offset in SII */
ec_fsm_sii_addressing_t
mode
;
/**< reading via APRD or NPRD */
uint8_t
value
[
4
];
/**< raw SII value (32bit) */
cycles_t
cycl
es_start
;
/**<
s
tart timestamp */
unsigned
long
jiffi
es_start
;
/**<
S
tart timestamp
.
*/
uint8_t
check_once_more
;
/**< one more try after timeout */
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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