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
0f9189f4
Commit
0f9189f4
authored
16 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Introduced EC_MBOX_HEADER_SIZE.
parent
81dd0163
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/globals.h
+3
-0
3 additions, 0 deletions
master/globals.h
master/mailbox.c
+8
-8
8 additions, 8 deletions
master/mailbox.c
with
11 additions
and
8 deletions
master/globals.h
+
3
−
0
View file @
0f9189f4
...
...
@@ -88,6 +88,9 @@
#define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \
- EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE)
/** Mailbox header size. */
#define EC_MBOX_HEADER_SIZE 6
/** Word offset of first SII category. */
#define EC_FIRST_SII_CATEGORY_OFFSET 0x40
...
...
This diff is collapsed.
Click to expand it.
master/mailbox.c
+
8
−
8
View file @
0f9189f4
...
...
@@ -66,7 +66,7 @@ uint8_t *ec_slave_mbox_prepare_send(const ec_slave_t *slave, /**< slave */
return
NULL
;
}
total_size
=
size
+
6
;
total_size
=
EC_MBOX_HEADER_SIZE
+
size
;
if
(
unlikely
(
total_size
>
slave
->
sii
.
rx_mailbox_size
))
{
EC_ERR
(
"Data size does not fit in mailbox!
\n
"
);
return
NULL
;
...
...
@@ -82,7 +82,7 @@ uint8_t *ec_slave_mbox_prepare_send(const ec_slave_t *slave, /**< slave */
EC_WRITE_U8
(
datagram
->
data
+
4
,
0x00
);
// channel & priority
EC_WRITE_U8
(
datagram
->
data
+
5
,
type
);
// underlying protocol type
return
datagram
->
data
+
6
;
return
datagram
->
data
+
EC_MBOX_HEADER_SIZE
;
}
/*****************************************************************************/
...
...
@@ -167,7 +167,7 @@ uint8_t *ec_slave_mbox_fetch(const ec_slave_t *slave, /**< slave */
data_size
=
EC_READ_U16
(
datagram
->
data
);
if
(
data_size
>
slave
->
sii
.
tx_mailbox_size
-
6
)
{
if
(
data_size
+
EC_MBOX_HEADER_SIZE
>
slave
->
sii
.
tx_mailbox_size
)
{
EC_ERR
(
"Corrupt mailbox response received from slave %u!
\n
"
,
slave
->
ring_position
);
ec_print_data
(
datagram
->
data
,
slave
->
sii
.
tx_mailbox_size
);
...
...
@@ -179,12 +179,12 @@ uint8_t *ec_slave_mbox_fetch(const ec_slave_t *slave, /**< slave */
if
(
*
type
==
0x00
)
{
const
ec_code_msg_t
*
mbox_msg
;
uint16_t
code
=
EC_READ_U16
(
datagram
->
data
+
8
);
uint16_t
code
=
EC_READ_U16
(
datagram
->
data
+
8
);
EC_ERR
(
"Mailbox error response received from slave %u - "
,
slave
->
ring_position
);
slave
->
ring_position
);
for
(
mbox_msg
=
mbox_error_messages
;
mbox_msg
->
code
;
mbox_msg
++
)
{
for
(
mbox_msg
=
mbox_error_messages
;
mbox_msg
->
code
;
mbox_msg
++
)
{
if
(
mbox_msg
->
code
!=
code
)
continue
;
printk
(
"Code 0x%04X:
\"
%s
\"
.
\n
"
,
mbox_msg
->
code
,
mbox_msg
->
message
);
...
...
@@ -195,12 +195,12 @@ uint8_t *ec_slave_mbox_fetch(const ec_slave_t *slave, /**< slave */
printk
(
"Unknown error reply code 0x%04X.
\n
"
,
code
);
if
(
slave
->
master
->
debug_level
)
ec_print_data
(
datagram
->
data
+
6
,
data_size
);
ec_print_data
(
datagram
->
data
+
EC_MBOX_HEADER_SIZE
,
data_size
);
return
NULL
;
}
return
datagram
->
data
+
6
;
return
datagram
->
data
+
EC_MBOX_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