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
7ec357be
Commit
7ec357be
authored
15 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Added 64-bit data access macros.
parent
6547d01a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NEWS
+1
-0
1 addition, 0 deletions
NEWS
include/ecrt.h
+49
-0
49 additions, 0 deletions
include/ecrt.h
with
50 additions
and
0 deletions
NEWS
+
1
−
0
View file @
7ec357be
...
...
@@ -28,6 +28,7 @@ Changes since 1.4.0:
command-line tool.
* Introduced ecrt_master_slave() to get information about a certain slave.
* SDO entry access rights are shown in 'ethercat sdos'.
* Added 64-bit data access macros to application header.
Changes in 1.4.0:
...
...
This diff is collapsed.
Click to expand it.
include/ecrt.h
+
49
−
0
View file @
7ec357be
...
...
@@ -50,6 +50,7 @@
* - Added ecrt_master_slave() to get information about a certain slave.
* - Removed 'const' from argument of ecrt_sdo_request_state(), because the
* userspace library has to modify object internals.
* - Added 64-bit data access macros.
*
* @{
*/
...
...
@@ -1130,9 +1131,11 @@ ec_request_state_t ecrt_voe_handler_execute(
#define le16_to_cpu(x) x
#define le32_to_cpu(x) x
#define le64_to_cpu(x) x
#define cpu_to_le16(x) x
#define cpu_to_le32(x) x
#define cpu_to_le64(x) x
#elif __BYTE_ORDER == __BIG_ENDIAN
...
...
@@ -1146,17 +1149,30 @@ ec_request_state_t ecrt_voe_handler_execute(
(((uint32_t)(x) & 0x0000ff00UL) << 8) | \
(((uint32_t)(x) & 0x00ff0000UL) >> 8) | \
(((uint32_t)(x) & 0xff000000UL) >> 24) ))
#define swap64(x) \
((uint64_t)( \
(((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \
(((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
(((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
(((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
(((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
(((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
(((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
(((uint64_t)(x) & 0xff00000000000000ULL) >> 56) ))
#define le16_to_cpu(x) swap16(x)
#define le32_to_cpu(x) swap32(x)
#define le64_to_cpu(x) swap64(x)
#define cpu_to_le16(x) swap16(x)
#define cpu_to_le32(x) swap32(x)
#define cpu_to_le64(x) swap64(x)
#endif
#define le16_to_cpup(x) le16_to_cpu(*((uint16_t *)(x)))
#define le32_to_cpup(x) le32_to_cpu(*((uint32_t *)(x)))
#define le64_to_cpup(x) le64_to_cpu(*((uint64_t *)(x)))
#endif
/* ifndef __KERNEL__ */
...
...
@@ -1211,6 +1227,22 @@ ec_request_state_t ecrt_voe_handler_execute(
#define EC_READ_S32(DATA) \
((int32_t) le32_to_cpup((void *) (DATA)))
/** Read a 64-bit unsigned value from EtherCAT data.
*
* \param DATA EtherCAT data pointer
* \return EtherCAT data value
*/
#define EC_READ_U64(DATA) \
((uint64_t) le64_to_cpup((void *) (DATA)))
/** Read a 64-bit signed value from EtherCAT data.
*
* \param DATA EtherCAT data pointer
* \return EtherCAT data value
*/
#define EC_READ_S64(DATA) \
((int64_t) le64_to_cpup((void *) (DATA)))
/******************************************************************************
* Write macros
*****************************************************************************/
...
...
@@ -1266,6 +1298,23 @@ ec_request_state_t ecrt_voe_handler_execute(
*/
#define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL)
/** Write a 64-bit unsigned value to EtherCAT data.
*
* \param DATA EtherCAT data pointer
* \param VAL new value
*/
#define EC_WRITE_U64(DATA, VAL) \
do { \
*((uint64_t *) (DATA)) = cpu_to_le64((uint64_t) (VAL)); \
} while (0)
/** Write a 64-bit signed value to EtherCAT data.
*
* \param DATA EtherCAT data pointer
* \param VAL new value
*/
#define EC_WRITE_S64(DATA, VAL) EC_WRITE_U64(DATA, VAL)
/*****************************************************************************/
/** @} */
...
...
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