# HG changeset patch # User Florian Pose # Date 1145966644 0 # Node ID 5ab50514d9b202b7615fc674b345c043cfa7d898 # Parent c1f305e339c6b108a0c687e5207b6dec3f0de430 Locking callback interface. diff -r c1f305e339c6 -r 5ab50514d9b2 include/ecrt.h --- a/include/ecrt.h Tue Apr 25 11:39:33 2006 +0000 +++ b/include/ecrt.h Tue Apr 25 12:04:04 2006 +0000 @@ -88,6 +88,9 @@ * Master methods *****************************************************************************/ +void ecrt_master_callbacks(ec_master_t *master, int (*request_cb)(void *), + void (*release_cb)(void *), void *cb_data); + ec_domain_t *ecrt_master_create_domain(ec_master_t *master); int ecrt_master_activate(ec_master_t *master); diff -r c1f305e339c6 -r 5ab50514d9b2 master/master.c --- a/master/master.c Tue Apr 25 11:39:33 2006 +0000 +++ b/master/master.c Tue Apr 25 12:04:04 2006 +0000 @@ -208,6 +208,10 @@ master->stats.t_last = 0; master->mode = EC_MASTER_MODE_IDLE; + + master->request_cb = NULL; + master->release_cb = NULL; + master->cb_data = NULL; } /*****************************************************************************/ @@ -1410,6 +1414,24 @@ /*****************************************************************************/ /** + Sets the locking callbacks. + \ingroup RealtimeInterface +*/ + +void ecrt_master_callbacks(ec_master_t *master, /**< EtherCAT master */ + int (*request_cb)(void *), /**< request lock CB */ + void (*release_cb)(void *), /**< release lock CB */ + void *cb_data /**< data parameter */ + ) +{ + master->request_cb = request_cb; + master->release_cb = release_cb; + master->cb_data = cb_data; +} + +/*****************************************************************************/ + +/** Sets the debug level of the master. The following levels are valid: - 1: only output positions marks and basic data diff -r c1f305e339c6 -r 5ab50514d9b2 master/master.h --- a/master/master.h Tue Apr 25 11:39:33 2006 +0000 +++ b/master/master.h Tue Apr 25 12:04:04 2006 +0000 @@ -98,6 +98,9 @@ unsigned int reserved; /**< true, if the master is reserved for RT */ struct timer_list freerun_timer; /**< timer object for free run mode */ ec_master_mode_t mode; /**< master mode */ + int (*request_cb)(void *); /**< lock request callback */ + void (*release_cb)(void *); /**< lock release callback */ + void *cb_data; /**< data parameter of locking callbacks */ }; /*****************************************************************************/