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
ebe93974
Commit
ebe93974
authored
13 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Allow CoE OD List Segments to have 6 bytes instead of 8.
--HG-- branch : stable-1.5
parent
3e582301
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
master/fsm_coe.c
+13
-8
13 additions, 8 deletions
master/fsm_coe.c
with
13 additions
and
8 deletions
master/fsm_coe.c
+
13
−
8
View file @
ebe93974
...
@@ -268,7 +268,7 @@ int ec_fsm_coe_check_emergency(
...
@@ -268,7 +268,7 @@ int ec_fsm_coe_check_emergency(
ec_print_data
(
data
,
size
);
ec_print_data
(
data
,
size
);
return
1
;
return
1
;
}
}
EC_SLAVE_WARN
(
fsm
->
slave
,
"CoE Emergency Request received:
\n
"
EC_SLAVE_WARN
(
fsm
->
slave
,
"CoE Emergency Request received:
\n
"
"Error code 0x%04X, Error register 0x%02X, data:
\n
"
,
"Error code 0x%04X, Error register 0x%02X, data:
\n
"
,
EC_READ_U16
(
data
+
2
),
EC_READ_U8
(
data
+
4
));
EC_READ_U16
(
data
+
2
),
EC_READ_U8
(
data
+
4
));
...
@@ -422,6 +422,8 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
...
@@ -422,6 +422,8 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
unsigned
int
sdo_count
,
i
;
unsigned
int
sdo_count
,
i
;
uint16_t
sdo_index
,
fragments_left
;
uint16_t
sdo_index
,
fragments_left
;
ec_sdo_t
*
sdo
;
ec_sdo_t
*
sdo
;
bool
first_segment
;
size_t
index_list_offset
;
if
(
datagram
->
state
==
EC_DATAGRAM_TIMED_OUT
&&
fsm
->
retries
--
)
if
(
datagram
->
state
==
EC_DATAGRAM_TIMED_OUT
&&
fsm
->
retries
--
)
return
;
// FIXME: request again?
return
;
// FIXME: request again?
...
@@ -496,17 +498,20 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
...
@@ -496,17 +498,20 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
return
;
return
;
}
}
if
(
rec_size
<
8
||
rec_size
%
2
)
{
first_segment
=
list_empty
(
&
slave
->
sdo_dictionary
)
?
true
:
false
;
index_list_offset
=
first_segment
?
8
:
6
;
if
(
rec_size
<
index_list_offset
||
rec_size
%
2
)
{
EC_SLAVE_ERR
(
slave
,
"Invalid data size %zu!
\n
"
,
rec_size
);
EC_SLAVE_ERR
(
slave
,
"Invalid data size %zu!
\n
"
,
rec_size
);
ec_print_data
(
data
,
rec_size
);
ec_print_data
(
data
,
rec_size
);
fsm
->
state
=
ec_fsm_coe_error
;
fsm
->
state
=
ec_fsm_coe_error
;
return
;
return
;
}
}
sdo_count
=
(
rec_size
-
8
)
/
2
;
sdo_count
=
(
rec_size
-
index_list_offset
)
/
2
;
for
(
i
=
0
;
i
<
sdo_count
;
i
++
)
{
for
(
i
=
0
;
i
<
sdo_count
;
i
++
)
{
sdo_index
=
EC_READ_U16
(
data
+
8
+
i
*
2
);
sdo_index
=
EC_READ_U16
(
data
+
index_list_offset
+
i
*
2
);
if
(
!
sdo_index
)
{
if
(
!
sdo_index
)
{
EC_SLAVE_DBG
(
slave
,
1
,
"SDO dictionary contains index 0x0000.
\n
"
);
EC_SLAVE_DBG
(
slave
,
1
,
"SDO dictionary contains index 0x0000.
\n
"
);
continue
;
continue
;
...
@@ -1108,7 +1113,7 @@ void ec_fsm_coe_down_start(
...
@@ -1108,7 +1113,7 @@ void ec_fsm_coe_down_start(
return
;
return
;
}
}
if
(
slave
->
configured_rx_mailbox_size
<
if
(
slave
->
configured_rx_mailbox_size
<
EC_MBOX_HEADER_SIZE
+
EC_COE_DOWN_REQ_HEADER_SIZE
)
{
EC_MBOX_HEADER_SIZE
+
EC_COE_DOWN_REQ_HEADER_SIZE
)
{
EC_SLAVE_ERR
(
slave
,
"Mailbox too small!
\n
"
);
EC_SLAVE_ERR
(
slave
,
"Mailbox too small!
\n
"
);
request
->
errno
=
EOVERFLOW
;
request
->
errno
=
EOVERFLOW
;
...
@@ -1132,7 +1137,7 @@ void ec_fsm_coe_down_start(
...
@@ -1132,7 +1137,7 @@ void ec_fsm_coe_down_start(
EC_WRITE_U16
(
data
,
0x2
<<
12
);
// SDO request
EC_WRITE_U16
(
data
,
0x2
<<
12
);
// SDO request
EC_WRITE_U8
(
data
+
2
,
(
0x3
// size specified, expedited
EC_WRITE_U8
(
data
+
2
,
(
0x3
// size specified, expedited
|
data_set_size
<<
2
|
data_set_size
<<
2
|
((
request
->
complete_access
?
1
:
0
)
<<
4
)
|
((
request
->
complete_access
?
1
:
0
)
<<
4
)
|
0x1
<<
5
));
// Download request
|
0x1
<<
5
));
// Download request
EC_WRITE_U16
(
data
+
3
,
request
->
index
);
EC_WRITE_U16
(
data
+
3
,
request
->
index
);
EC_WRITE_U8
(
data
+
5
,
EC_WRITE_U8
(
data
+
5
,
...
@@ -1173,7 +1178,7 @@ void ec_fsm_coe_down_start(
...
@@ -1173,7 +1178,7 @@ void ec_fsm_coe_down_start(
EC_WRITE_U16
(
data
,
0x2
<<
12
);
// SDO request
EC_WRITE_U16
(
data
,
0x2
<<
12
);
// SDO request
EC_WRITE_U8
(
data
+
2
,
EC_WRITE_U8
(
data
+
2
,
0x1
// size indicator, normal
0x1
// size indicator, normal
|
((
request
->
complete_access
?
1
:
0
)
<<
4
)
|
((
request
->
complete_access
?
1
:
0
)
<<
4
)
|
0x1
<<
5
);
// Download request
|
0x1
<<
5
);
// Download request
EC_WRITE_U16
(
data
+
3
,
request
->
index
);
EC_WRITE_U16
(
data
+
3
,
request
->
index
);
EC_WRITE_U8
(
data
+
5
,
EC_WRITE_U8
(
data
+
5
,
...
@@ -1359,7 +1364,7 @@ void ec_fsm_coe_down_prepare_segment_request(
...
@@ -1359,7 +1364,7 @@ void ec_fsm_coe_down_prepare_segment_request(
EC_WRITE_U16
(
data
,
0x2
<<
12
);
// SDO request
EC_WRITE_U16
(
data
,
0x2
<<
12
);
// SDO request
EC_WRITE_U8
(
data
+
2
,
(
last_segment
?
1
:
0
)
EC_WRITE_U8
(
data
+
2
,
(
last_segment
?
1
:
0
)
|
(
seg_data_size
<<
1
)
|
(
seg_data_size
<<
1
)
|
(
fsm
->
toggle
<<
4
)
|
(
fsm
->
toggle
<<
4
)
|
(
0x00
<<
5
));
// Download segment request
|
(
0x00
<<
5
));
// Download segment request
memcpy
(
data
+
EC_COE_DOWN_SEG_REQ_HEADER_SIZE
,
memcpy
(
data
+
EC_COE_DOWN_SEG_REQ_HEADER_SIZE
,
...
...
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