Locking callback interface.
authorFlorian Pose <fp@igh-essen.com>
Tue, 25 Apr 2006 12:04:04 +0000
changeset 204 5ab50514d9b2
parent 203 c1f305e339c6
child 205 7fa6de7e3823
Locking callback interface.
include/ecrt.h
master/master.c
master/master.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);
--- 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
--- 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 */
 };
 
 /*****************************************************************************/