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
fcba4f8d
Commit
fcba4f8d
authored
17 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Fixed detection of missing EEPROM category limiter.
parent
2cb1a397
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
master/fsm_slave.c
+15
-10
15 additions, 10 deletions
master/fsm_slave.c
with
15 additions
and
10 deletions
master/fsm_slave.c
+
15
−
10
View file @
fcba4f8d
...
...
@@ -403,14 +403,15 @@ void ec_fsm_slave_scan_state_eeprom_size(ec_fsm_slave_t *fsm /**< slave state ma
cat_size
=
EC_READ_U16
(
fsm
->
fsm_sii
.
value
+
2
);
if
(
cat_type
!=
0xFFFF
)
{
// not the last category
fsm
->
sii_offset
+
=
cat_size
+
2
;
if
(
fsm
->
sii
_offset
>=
EC_MAX_EEPROM_SIZE
)
{
off_t
next_offset
=
2UL
+
fsm
->
sii_offset
+
cat_size
;
if
(
next
_offset
>=
EC_MAX_EEPROM_SIZE
)
{
EC_WARN
(
"EEPROM size of slave %i exceeds"
" %
i
words (0xffff limiter missing?).
\n
"
,
" %
u
words (0xffff limiter missing?).
\n
"
,
slave
->
ring_position
,
EC_MAX_EEPROM_SIZE
);
slave
->
eeprom_size
=
EC_FIRST_EEPROM_CATEGORY_OFFSET
*
2
;
goto
alloc_eeprom
;
}
fsm
->
sii_offset
=
next_offset
;
ec_fsm_sii_read
(
&
fsm
->
fsm_sii
,
slave
,
fsm
->
sii_offset
,
EC_FSM_SII_NODE
);
ec_fsm_sii_exec
(
&
fsm
->
fsm_sii
);
// execute state immediately
...
...
@@ -421,18 +422,18 @@ void ec_fsm_slave_scan_state_eeprom_size(ec_fsm_slave_t *fsm /**< slave state ma
alloc_eeprom:
if
(
slave
->
eeprom_data
)
{
EC_
INFO
(
"Freeing old EEPROM data on slave %i...
\n
"
,
EC_
WARN
(
"Freeing old EEPROM data on slave %i...
\n
"
,
slave
->
ring_position
);
kfree
(
slave
->
eeprom_data
);
}
if
(
!
(
slave
->
eeprom_data
=
(
uint8_t
*
)
kmalloc
(
slave
->
eeprom_size
,
GFP_ATOMIC
)))
{
EC_ERR
(
"Failed to allocate %u bytes of EEPROM data for slave %u.
\n
"
,
slave
->
eeprom_size
,
slave
->
ring_position
);
slave
->
eeprom_size
=
0
;
slave
->
error_flag
=
1
;
fsm
->
state
=
ec_fsm_slave_state_error
;
EC_ERR
(
"Failed to allocate EEPROM data for slave %u.
\n
"
,
slave
->
ring_position
);
return
;
}
...
...
@@ -509,7 +510,8 @@ void ec_fsm_slave_scan_state_eeprom_data(ec_fsm_slave_t *fsm /**< slave state ma
EC_READ_U16
(
slave
->
eeprom_data
+
2
*
0x001C
);
if
(
eeprom_word_size
<
EC_FIRST_EEPROM_CATEGORY_OFFSET
+
1
)
{
EC_ERR
(
"Unexpected end of EEPROM data in slave %u.
\n
"
,
EC_ERR
(
"Unexpected end of EEPROM data in slave %u:"
" First category header missing.
\n
"
,
slave
->
ring_position
);
goto
end
;
}
...
...
@@ -522,7 +524,8 @@ void ec_fsm_slave_scan_state_eeprom_data(ec_fsm_slave_t *fsm /**< slave state ma
// type and size words must fit
if
(
cat_word
+
2
-
(
uint16_t
*
)
slave
->
eeprom_data
>
eeprom_word_size
)
{
EC_ERR
(
"Unexpected end of EEPROM data in slave %u.
\n
"
,
EC_ERR
(
"Unexpected end of EEPROM data in slave %u:"
" Category header incomplete.
\n
"
,
slave
->
ring_position
);
goto
end
;
}
...
...
@@ -533,7 +536,8 @@ void ec_fsm_slave_scan_state_eeprom_data(ec_fsm_slave_t *fsm /**< slave state ma
if
(
cat_word
+
cat_size
-
(
uint16_t
*
)
slave
->
eeprom_data
>
eeprom_word_size
)
{
EC_WARN
(
"Unexpected end of EEPROM data in slave %u.
\n
"
,
EC_WARN
(
"Unexpected end of EEPROM data in slave %u:"
" Category data incomplete.
\n
"
,
slave
->
ring_position
);
goto
end
;
}
...
...
@@ -574,7 +578,8 @@ void ec_fsm_slave_scan_state_eeprom_data(ec_fsm_slave_t *fsm /**< slave state ma
cat_word
+=
cat_size
;
if
(
cat_word
-
(
uint16_t
*
)
slave
->
eeprom_data
>=
eeprom_word_size
)
{
EC_WARN
(
"Unexpected end of EEPROM data in slave %u.
\n
"
,
EC_WARN
(
"Unexpected end of EEPROM data in slave %u:"
" Next category header missing.
\n
"
,
slave
->
ring_position
);
goto
end
;
}
...
...
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