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
b76055a3
Commit
b76055a3
authored
16 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Introduced ecrt_master_sync() for synchronizing slave clocks to reference clock.
parent
a8e85e9b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/ecrt.h
+7
-1
7 additions, 1 deletion
include/ecrt.h
master/master.c
+28
-2
28 additions, 2 deletions
master/master.c
master/master.h
+3
-0
3 additions, 0 deletions
master/master.h
with
38 additions
and
3 deletions
include/ecrt.h
+
7
−
1
View file @
b76055a3
...
...
@@ -44,7 +44,7 @@
* - Added the distributed clocks feature and the respective methods
* ecrt_slave_config_dc_assign_activate() and
* ecrt_slave_config_dc_sync_cycle_times() to configure a slave for cyclic
* operation.
* operation
, and ecrt_master_sync() for drift compensation
.
* - Changed the meaning of the negative return values of
* ecrt_slave_config_reg_pdo_entry() and ecrt_slave_config_sdo*().
* - Imlemented the Vendor-specific over EtherCAT mailbox protocol. See
...
...
@@ -504,6 +504,12 @@ void ecrt_master_state(
ec_master_state_t
*
state
/**< Structure to store the information. */
);
/** Queues the DC drift compensation datagram for sending.
*/
void
ecrt_master_sync
(
ec_master_t
*
master
/**< EtherCAT master. */
);
/******************************************************************************
* Slave configuration methods
*****************************************************************************/
...
...
This diff is collapsed.
Click to expand it.
master/master.c
+
28
−
2
View file @
b76055a3
...
...
@@ -190,6 +190,7 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
snprintf
(
master
->
fsm_datagram
.
name
,
EC_DATAGRAM_NAME_SIZE
,
"master-fsm"
);
ret
=
ec_datagram_prealloc
(
&
master
->
fsm_datagram
,
EC_MAX_DATA_SIZE
);
if
(
ret
<
0
)
{
ec_datagram_clear
(
&
master
->
fsm_datagram
);
EC_ERR
(
"Failed to allocate FSM datagram.
\n
"
);
goto
out_clear_backup
;
}
...
...
@@ -197,10 +198,20 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
// create state machine object
ec_fsm_master_init
(
&
master
->
fsm
,
master
,
&
master
->
fsm_datagram
);
// init sync datagram
ec_datagram_init
(
&
master
->
sync_datagram
);
snprintf
(
master
->
sync_datagram
.
name
,
EC_DATAGRAM_NAME_SIZE
,
"sync"
);
ret
=
ec_datagram_armw
(
&
master
->
sync_datagram
,
0
/* FIXME */
,
0x0910
,
4
);
if
(
ret
<
0
)
{
ec_datagram_clear
(
&
master
->
sync_datagram
);
EC_ERR
(
"Failed to allocate synchronisation datagram.
\n
"
);
goto
out_clear_fsm
;
}
// init character device
ret
=
ec_cdev_init
(
&
master
->
cdev
,
master
,
device_number
);
if
(
ret
)
goto
out_clear_
fsm
;
goto
out_clear_
sync
;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
master
->
class_device
=
device_create
(
class
,
NULL
,
...
...
@@ -229,6 +240,8 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
out_clear_cdev:
ec_cdev_clear
(
&
master
->
cdev
);
out_clear_sync:
ec_datagram_clear
(
&
master
->
sync_datagram
);
out_clear_fsm:
ec_fsm_master_clear
(
&
master
->
fsm
);
ec_datagram_clear
(
&
master
->
fsm_datagram
);
...
...
@@ -253,13 +266,17 @@ void ec_master_clear(
#else
class_device_unregister
(
master
->
class_device
);
#endif
ec_cdev_clear
(
&
master
->
cdev
);
#ifdef EC_EOE
ec_master_clear_eoe_handlers
(
master
);
#endif
ec_master_clear_domains
(
master
);
ec_master_clear_slave_configs
(
master
);
ec_master_clear_slaves
(
master
);
ec_datagram_clear
(
&
master
->
sync_datagram
);
ec_fsm_master_clear
(
&
master
->
fsm
);
ec_datagram_clear
(
&
master
->
fsm_datagram
);
ec_device_clear
(
&
master
->
backup_device
);
...
...
@@ -1314,7 +1331,7 @@ int ec_master_debug_level(
}
/******************************************************************************
*
Realtime
interface
*
Application
interface
*****************************************************************************/
/** Same as ecrt_master_create_domain(), but with ERR_PTR() return value.
...
...
@@ -1590,6 +1607,14 @@ void ecrt_master_state(const ec_master_t *master, ec_master_state_t *state)
/*****************************************************************************/
void
ecrt_master_sync
(
ec_master_t
*
master
)
{
ec_datagram_zero
(
&
master
->
sync_datagram
);
ec_master_queue_datagram
(
master
,
&
master
->
sync_datagram
);
}
/*****************************************************************************/
/** \cond */
EXPORT_SYMBOL
(
ecrt_master_create_domain
);
...
...
@@ -1599,6 +1624,7 @@ EXPORT_SYMBOL(ecrt_master_receive);
EXPORT_SYMBOL
(
ecrt_master_callbacks
);
EXPORT_SYMBOL
(
ecrt_master_slave_config
);
EXPORT_SYMBOL
(
ecrt_master_state
);
EXPORT_SYMBOL
(
ecrt_master_sync
);
/** \endcond */
...
...
This diff is collapsed.
Click to expand it.
master/master.h
+
3
−
0
View file @
b76055a3
...
...
@@ -117,6 +117,9 @@ struct ec_master {
struct
list_head
configs
;
/**< List of slave configurations. */
ec_datagram_t
sync_datagram
;
/**< Datagram used for DC drift
compensation. */
unsigned
int
scan_busy
;
/**< Current scan state. */
unsigned
int
allow_scan
;
/**< \a True, if slave scanning is allowed. */
struct
semaphore
scan_sem
;
/**< Semaphore protecting the \a scan_busy
...
...
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