--- a/examples/xenomai/Makefile.am Wed Mar 16 22:12:23 2011 +0100
+++ b/examples/xenomai/Makefile.am Thu Mar 17 21:13:36 2011 +0100
@@ -34,6 +34,6 @@
ec_xenomai_example_SOURCES = main.c
ec_xenomai_example_CFLAGS = -I/opt/etherlab/xenomai/include -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -I$(top_srcdir)/include
-ec_xenomai_example_LDFLAGS = -lrtdm -L$(top_builddir)/lib/.libs -lethercat -lnative -L/opt/etherlab/xenomai/lib -lxenomai -lpthread
+ec_xenomai_example_LDFLAGS = -lrtdm -L$(top_builddir)/lib/.libs -lethercat -lnative -L/opt/etherlab/xenomai/lib -lrtdk -lxenomai -lpthread
#------------------------------------------------------------------------------
--- a/examples/xenomai/main.c Wed Mar 16 22:12:23 2011 +0100
+++ b/examples/xenomai/main.c Thu Mar 17 21:13:36 2011 +0100
@@ -45,6 +45,7 @@
#include <native/sem.h>
#include <native/mutex.h>
#include <native/timer.h>
+#include <rtdk.h>
#include <pthread.h>
/****************************************************************************/
@@ -58,7 +59,7 @@
int rt_fd = -1;
int run=0;
-struct timeval tv;
+//struct timeval tv;
unsigned int sync_ref_counter = 0;
CstructMstrAttach MstrAttach;
@@ -66,8 +67,8 @@
/****************************************************************************/
// Application parameters
-#define FREQUENCY 1000
-#define PRIORITY 1
+//#define FREQUENCY 1000
+//#define PRIORITY 1
// Optional features
#define CONFIGURE_PDOS 1
@@ -102,7 +103,7 @@
#define AnaInSlave01_Pos 0, 5
#define BusCoupler02_Pos 0, 6
#define AnaInSlave02_Pos 0, 7
-
+#define DPSlave01_Pos 0, 8
#define Beckhoff_EK1100 0x00000002, 0x044c2c52
@@ -429,116 +430,56 @@
void rt_check_domain_state(void)
{
ec_domain_state_t ds;
- unsigned int printed=0;
if (rt_fd>=0)
{
ecrt_rtdm_domain_state(rt_fd,&ds);
}
-/* if (ds.working_counter != domain1_state.working_counter)
+ if (ds.working_counter != domain1_state.working_counter)
{
- printf("Domain1: WC %u.\n", ds.working_counter);
- printed=1;
-
+ rt_printf("Domain1: WC %u.\n", ds.working_counter);
}
if (ds.wc_state != domain1_state.wc_state)
{
- printf("Domain1: State %u.\n", ds.wc_state);
- printed=1;
-
+ rt_printf("Domain1: State %u.\n", ds.wc_state);
}
- if (printed)
- {
- int ret;
-
- // return to realtime mode after print
-
- ret = rt_task_set_mode(0, T_PRIMARY, NULL);
- if (ret)
- {
- printf("error while rt_task_set_mode, code %d\n",ret);
- }
- }
-*/
+
domain1_state = ds;
}
void rt_check_master_state(void)
{
ec_master_state_t ms;
- unsigned int printed=0;
if (rt_fd>=0)
{
ecrt_rtdm_master_state(rt_fd,&ms);
}
-/*
if (ms.slaves_responding != master_state.slaves_responding)
{
- printf("%u slave(s).\n", ms.slaves_responding);
- printed=1;
-
+ rt_printf("%u slave(s).\n", ms.slaves_responding);
}
if (ms.al_states != master_state.al_states)
{
- printf("AL states: 0x%02X.\n", ms.al_states);
- printed=1;
-
+ rt_printf("AL states: 0x%02X.\n", ms.al_states);
}
if (ms.link_up != master_state.link_up)
{
- printf("Link is %s.\n", ms.link_up ? "up" : "down");
- printed=1;
-
- }
- if (printed)
- {
- int ret;
-
- // return to realtime mode after print
-
- ret = rt_task_set_mode(0, T_PRIMARY, NULL);
- if (ret)
- {
- printf("error while rt_task_set_mode, code %d\n",ret);
- }
- }*/
+ rt_printf("Link is %s.\n", ms.link_up ? "up" : "down");
+ }
master_state = ms;
}
-void rt_receive()
-{
-
- if (rt_fd>=0)
- {
- ecrt_rtdm_master_recieve(rt_fd);
- }
-}
-
-void rt_send()
-{
-
- if (rt_fd>=0)
- {
- ecrt_rtdm_master_send(rt_fd);
- }
-}
+
+
void rt_sync()
{
RTIME now;
- int ret;
now = rt_timer_read();
- //now -= 946684800ULL * 1000000000ULL;
-
- printf("Write Sync Time %i\n",now);
- ret = rt_task_set_mode(0, T_PRIMARY, NULL);
- if (ret)
- {
- printf("error while rt_task_set_mode, code %d\n",ret);
- }
+
if (rt_fd>=0)
{
@@ -565,45 +506,45 @@
#if SDO_ACCESS
void read_sdo(void)
{
- switch (ecrt_sdo_request_state(sdo))
- {
- case EC_REQUEST_UNUSED: // request was not used yet
- ecrt_sdo_request_read(sdo); // trigger first read
- break;
- case EC_REQUEST_BUSY:
- fprintf(stderr, "Still busy...\n");
- break;
- case EC_REQUEST_SUCCESS:
- fprintf(stderr, "SDO value: 0x%04X\n",
- EC_READ_U16(ecrt_sdo_request_data(sdo)));
- ecrt_sdo_request_read(sdo); // trigger next read
- break;
- case EC_REQUEST_ERROR:
- fprintf(stderr, "Failed to read SDO!\n");
- ecrt_sdo_request_read(sdo); // retry reading
- break;
- }
+ switch (ecrt_sdo_request_state(sdo))
+ {
+ case EC_REQUEST_UNUSED: // request was not used yet
+ ecrt_sdo_request_read(sdo); // trigger first read
+ break;
+ case EC_REQUEST_BUSY:
+ fprintf(stderr, "Still busy...\n");
+ break;
+ case EC_REQUEST_SUCCESS:
+ fprintf(stderr, "SDO value: 0x%04X\n",
+ EC_READ_U16(ecrt_sdo_request_data(sdo)));
+ ecrt_sdo_request_read(sdo); // trigger next read
+ break;
+ case EC_REQUEST_ERROR:
+ fprintf(stderr, "Failed to read SDO!\n");
+ ecrt_sdo_request_read(sdo); // retry reading
+ break;
+ }
}
void PrintSDOState(void)
{
- switch (ecrt_sdo_request_state(sdo))
- {
- case EC_REQUEST_UNUSED: // request was not used yet
- fprintf(stderr, "SDO State: EC_REQUEST_UNUSED\n"); // trigger first read
- break;
- case EC_REQUEST_BUSY:
- fprintf(stderr, "SDO State: EC_REQUEST_BUSY\n");
- break;
- case EC_REQUEST_SUCCESS:
- fprintf(stderr, "SDO State: EC_REQUEST_SUCCESS\n");
- break;
- case EC_REQUEST_ERROR:
- fprintf(stderr, "SDO State: EC_REQUEST_ERROR\n");
- break;
- default:
- fprintf(stderr, "SDO State: undefined\n");
- break;
+ switch (ecrt_sdo_request_state(sdo))
+ {
+ case EC_REQUEST_UNUSED: // request was not used yet
+ fprintf(stderr, "SDO State: EC_REQUEST_UNUSED\n"); // trigger first read
+ break;
+ case EC_REQUEST_BUSY:
+ fprintf(stderr, "SDO State: EC_REQUEST_BUSY\n");
+ break;
+ case EC_REQUEST_SUCCESS:
+ fprintf(stderr, "SDO State: EC_REQUEST_SUCCESS\n");
+ break;
+ case EC_REQUEST_ERROR:
+ fprintf(stderr, "SDO State: EC_REQUEST_ERROR\n");
+ break;
+ default:
+ fprintf(stderr, "SDO State: undefined\n");
+ break;
}
}
#endif
@@ -646,7 +587,7 @@
ret = rt_task_set_mode(0, T_PRIMARY, NULL);
if (ret) {
- printf("error while rt_task_set_mode, code %d\n",ret);
+ rt_printf("error while rt_task_set_mode, code %d\n",ret);
return;
}
@@ -661,7 +602,9 @@
}
// receive ethercat
- rt_receive();
+ ecrt_rtdm_master_recieve(rt_fd);
+ ecrt_rtdm_domain_process(rt_fd);
+
rt_check_domain_state();
if (divcounter ==0)
@@ -684,7 +627,8 @@
rt_sync();
// send process data
- rt_send();
+ ecrt_rtdm_domain_queque(rt_fd);
+ ecrt_rtdm_master_send(rt_fd);
}
}
@@ -724,6 +668,9 @@
mlockall(MCL_CURRENT | MCL_FUTURE);
+ /* Perform auto-init of rt_print buffers if the task doesn't do so */
+ rt_print_auto_init(1);
+
signal(SIGTERM, catch_signal);
signal(SIGINT, catch_signal);
@@ -851,6 +798,92 @@
return -1;
}
#endif
+
+
+ printf("Get Configuring EL6731...\n");
+ sc_dpslv_01 = ecrt_master_slave_config(master, DPSlave01_Pos, Beckhoff_EL6731);
+ if (!sc_dpslv_01) {
+ fprintf(stderr, "Failed to get slave configuration.\n");
+ return -1;
+ }
+
+ printf("Configuring EL6731...\n");
+ if (ecrt_slave_config_pdos(sc_dpslv_01, EC_END, slave_7_syncs))
+ {
+ fprintf(stderr, "Failed to configure PDOs.\n");
+ return -1;
+ }
+
+#if SDO_ACCESS
+
+
+ // DP Slave Parameter Set
+ fprintf(stderr, "Creating SDO requests...\n");
+ if (!(sdo = ecrt_slave_config_create_sdo_request(sc_dpslv_01, 0x8000, 0, 1))) {
+ fprintf(stderr, "Failed to create SDO request.\n");
+ return -1;
+ }
+ ecrt_sdo_request_timeout(sdo, 500); // ms
+ EC_WRITE_U8(ecrt_sdo_request_data(sdo), 0);
+ PrintSDOState();
+ ecrt_sdo_request_write(sdo);
+ PrintSDOState();
+
+ // Station Address
+ if (!(sdo = ecrt_slave_config_create_sdo_request(sc_dpslv_01, 0x8000, 1, 2))) {
+ fprintf(stderr, "Failed to create SDO request.\n");
+ return -1;
+ }
+ ecrt_sdo_request_timeout(sdo, 500); // ms
+ EC_WRITE_U16(ecrt_sdo_request_data(sdo), 5);
+ //EC_WRITE_U8(ecrt_sdo_request_data(sdo), 00);
+ //EC_WRITE_U8(ecrt_sdo_request_data(sdo)+1, 10);
+ PrintSDOState();
+ ecrt_sdo_request_write(sdo);
+ PrintSDOState();
+
+ // Device Type (DP Ident Number)
+ if (!(sdo = ecrt_slave_config_create_sdo_request(sc_dpslv_01, 0x8000, 4, 4))) {
+ fprintf(stderr, "Failed to create SDO request.\n");
+ return -1;
+ }
+ ecrt_sdo_request_timeout(sdo, 500); // ms
+ sdo_adr = ecrt_sdo_request_data(sdo);
+ EC_WRITE_U32(sdo_adr, 0x095F);
+ //EC_WRITE_U8(sdo_ad, 0x00); // Device Type
+ //EC_WRITE_U8(sdo_adr+1, 0x00);
+ //EC_WRITE_U8(sdo_adr+2, 0x09);
+ //EC_WRITE_U8(sdo_adr+3, 0x5F);
+ PrintSDOState();
+ ecrt_sdo_request_write(sdo);
+ PrintSDOState();
+
+ // DP CfgData Slave
+ if (!(sdo = ecrt_slave_config_create_sdo_request(sc_dpslv_01, 0x8002, 0, 244))) {
+ fprintf(stderr, "Failed to create SDO request.\n");
+ return -1;
+ }
+ ecrt_sdo_request_timeout(sdo, 500); // ms
+ sdo_adr = ecrt_sdo_request_data(sdo);
+ EC_WRITE_U8(sdo_adr, 0x10); // Device Type
+ EC_WRITE_U8(sdo_adr+1, 0x20);
+ PrintSDOState();
+ ecrt_sdo_request_write(sdo);
+ PrintSDOState();
+
+ // DP Slave Parameter Set
+ if (!(sdo = ecrt_slave_config_create_sdo_request(sc_dpslv_01, 0x8000, 0, 1))) {
+ fprintf(stderr, "Failed to create SDO request.\n");
+ return -1;
+ }
+
+ ecrt_sdo_request_timeout(sdo, 500); // ms
+
+ EC_WRITE_U8(ecrt_sdo_request_data(sdo), 0x33); // DP Slave Parameter Set
+ PrintSDOState();
+ ecrt_sdo_request_write(sdo);
+ PrintSDOState();
+#endif
--- a/include/ec_rtdm.h Wed Mar 16 22:12:23 2011 +0100
+++ b/include/ec_rtdm.h Thu Mar 17 21:13:36 2011 +0100
@@ -5,11 +5,9 @@
* ec_rtdm.h Copyright (C) 2009-2010 Moehwald GmbH B.Benner
* 2011 IgH Andreas Stewering-Bone
*
- * This file is used for Prisma RT to interface to EtherCAT devices
- *
- * This file is part of ethercatrtdm interface to IgH EtherCAT master
+ * This file is part of the IgH EtherCAT master
*
- * The Moehwald ethercatrtdm interface is free software; you can
+ * The IgH EtherCAT master is free software; you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; version 2.1
* of the License.
@@ -41,15 +39,19 @@
// IOCTRL Values for RTDM_EXTENSION
//
// Realtime IOCTRL function
-#define EC_RTDM_MSTRATTACH 1 // attach to a running master
-#define EC_RTDM_MSTRGETMUTNAME 2 // return the mutexname
-#define EC_RTDM_MSTRRECEIVE 3 // call the master receive
-#define EC_RTDM_MSTRSEND 4 // call the master send
-#define EC_RTDM_DOMAINSTATE 5 // get domain state
-#define EC_RTDM_MASTERSTATE 6 // get master state
-#define EC_RTDM_MASTER_APP_TIME 7
-#define EC_RTDM_SYNC_REF_CLOCK 8
-#define EC_RTDM_SYNC_SLAVE_CLOCK 9
+#define EC_RTDM_MSTRATTACH 1 // attach to a running master
+#define EC_RTDM_MSTRGETMUTNAME 2 // return the mutexname
+#define EC_RTDM_MASTER_RECEIVE 3 // call the master receive
+#define EC_RTDM_DOMAIN_PROCESS 4 // process domain data
+#define EC_RTDM_DOMAIN_QUEQUE 5 // prepare domain data
+#define EC_RTDM_MASTER_SEND 6 // call the master send
+#define EC_RTDM_DOMAINSTATE 7 // get domain state
+#define EC_RTDM_MASTERSTATE 8 // get master state
+#define EC_RTDM_MASTER_APP_TIME 9 // set app time
+#define EC_RTDM_SYNC_REF_CLOCK 10 // sync ref clock
+#define EC_RTDM_SYNC_SLAVE_CLOCK 11 // sync slave clocks
+#define EC_RTDM_MASTER_SYNC_MONITOR_QUEQUE 12 // prepare DC sync information
+#define EC_RTDM_MASTER_SYNC_MONITOR_PROCESS 13 // get DC sync information
typedef struct _CstructMstrAttach
{
@@ -58,14 +60,18 @@
} CstructMstrAttach;
-#define ecrt_rtdm_master_attach(X,Y) rt_dev_ioctl(X, EC_RTDM_MSTRATTACH, Y)
-#define ecrt_rtdm_master_recieve(X) rt_dev_ioctl(X, EC_RTDM_MSTRRECEIVE)
-#define ecrt_rtdm_master_send(X) rt_dev_ioctl(X, EC_RTDM_MSTRSEND)
-#define ecrt_rtdm_domain_state(X,Y) rt_dev_ioctl(X, EC_RTDM_DOMAINSTATE, Y)
-#define ecrt_rtdm_master_state(X,Y) rt_dev_ioctl(X, EC_RTDM_MASTERSTATE, Y)
-#define ecrt_rtdm_master_application_time(X,Y) rt_dev_ioctl(X, EC_RTDM_MASTER_APP_TIME, Y)
-#define ecrt_rtdm_master_sync_reference_clock(X) rt_dev_ioctl(X, EC_RTDM_SYNC_REF_CLOCK)
-#define ecrt_rtdm_master_sync_slave_clocks(X) rt_dev_ioctl(X, EC_RTDM_SYNC_SLAVE_CLOCK);
+#define ecrt_rtdm_master_attach(X,Y) rt_dev_ioctl(X, EC_RTDM_MSTRATTACH, Y)
+#define ecrt_rtdm_master_recieve(X) rt_dev_ioctl(X, EC_RTDM_MASTER_RECEIVE)
+#define ecrt_rtdm_domain_process(X) rt_dev_ioctl(X, EC_RTDM_DOMAIN_PROCESS)
+#define ecrt_rtdm_domain_queque(X) rt_dev_ioctl(X, EC_RTDM_DOMAIN_QUEQUE)
+#define ecrt_rtdm_master_send(X) rt_dev_ioctl(X, EC_RTDM_MASTER_SEND)
+#define ecrt_rtdm_domain_state(X,Y) rt_dev_ioctl(X, EC_RTDM_DOMAINSTATE, Y)
+#define ecrt_rtdm_master_state(X,Y) rt_dev_ioctl(X, EC_RTDM_MASTERSTATE, Y)
+#define ecrt_rtdm_master_application_time(X,Y) rt_dev_ioctl(X, EC_RTDM_MASTER_APP_TIME, Y)
+#define ecrt_rtdm_master_sync_reference_clock(X) rt_dev_ioctl(X, EC_RTDM_SYNC_REF_CLOCK)
+#define ecrt_rtdm_master_sync_slave_clocks(X) rt_dev_ioctl(X, EC_RTDM_SYNC_SLAVE_CLOCK)
+#define ecrt_rtdm_master_sync_monitor_queque(X) rt_dev_ioctl(X, EC_RTDM_MASTER_MONITOR_QUEQUE)
+#define ecrt_rtdm_master_sync_monitor_process(X,Y) rt_dev_ioctl(X, EC_RTDM_MASTER_MONITOR_PROCESS,Y)
#endif
--- a/rtdm/module.c Wed Mar 16 22:12:23 2011 +0100
+++ b/rtdm/module.c Thu Mar 17 21:13:36 2011 +0100
@@ -5,11 +5,10 @@
* ec_rtdm.c Copyright (C) 2009-2010 Moehwald GmbH B.Benner
* 2011 IgH Andreas Stewering-Bone
*
- * This file is used for Prisma RT to interface to EtherCAT devices
*
- * This file is part of ethercatrtdm interface to IgH EtherCAT master
+ * This file is part of the IgH EtherCAT master
*
- * The Moehwald ec_rtdm interface is free software; you can
+ * The IgH EtherCAT master is free software; you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; version 2.1
* of the License.
@@ -43,23 +42,23 @@
#define EC_RTDM_MAX_MASTERS 5 /**< Maximum number of masters. */
#define EC_RTDM_GINFO(fmt, args...) \
- printk(KERN_INFO "EtherCATrtdm: " fmt, ##args)
+ rtdm_printk(KERN_INFO "EtherCATrtdm: " fmt, ##args)
#define EC_RTDM_GERR(fmt, args...) \
- printk(KERN_ERR "EtherCATrtdm ERROR: " fmt, ##args)
+ rtdm_printk(KERN_ERR "EtherCATrtdm ERROR: " fmt, ##args)
#define EC_RTDM_GWARN(fmt, args...) \
- printk(KERN_WARNING "EtherCATrtdm WARNING: " fmt, ##args)
+ rtdm_printk(KERN_WARNING "EtherCATrtdm WARNING: " fmt, ##args)
#define EC_RTDM_INFO(devno, fmt, args...) \
- printk(KERN_INFO "EtherCATrtdm %u: " fmt, devno, ##args)
+ rtdm_printk(KERN_INFO "EtherCATrtdm %u: " fmt, devno, ##args)
#define EC_RTDM_ERR(devno, fmt, args...) \
- printk(KERN_ERR "EtherCATrtdm %u ERROR: " fmt, devno, ##args)
+ rtdm_printk(KERN_ERR "EtherCATrtdm %u ERROR: " fmt, devno, ##args)
#define EC_RTDM_WARN(devno, fmt, args...) \
- printk(KERN_WARNING "EtherCATrtdm %u WARNING: " fmt, devno, ##args)
+ rtdm_printk(KERN_WARNING "EtherCATrtdm %u WARNING: " fmt, devno, ##args)
@@ -161,29 +160,8 @@
}
}
-void receive_process(EC_RTDM_DRV_STRUCT * pdrvstruc)
-{
- if (pdrvstruc->master)
- {
- rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
- ecrt_master_receive(pdrvstruc->master);
- ecrt_domain_process(pdrvstruc->domain);
- pdrvstruc->reccnt++;
- rt_mutex_release(&pdrvstruc->masterlock);
- }
-}
-
-void send_process(EC_RTDM_DRV_STRUCT * pdrvstruc)
-{
- if (pdrvstruc->master)
- {
- rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
- ecrt_domain_queue(pdrvstruc->domain);
- ecrt_master_send(pdrvstruc->master);
- pdrvstruc->sendcnt++;
- rt_mutex_release(&pdrvstruc->masterlock);
- }
-}
+
+
void detach_master(EC_RTDM_DRV_STRUCT * pdrvstruc)
{
@@ -342,49 +320,79 @@
}
}
break;
-
- case EC_RTDM_MSTRRECEIVE:
+ case EC_RTDM_MASTER_RECEIVE:
{
if (pdrvstruc->isattached)
{
- receive_process(pdrvstruc);
- }
- }
- break;
- case EC_RTDM_MSTRSEND:
- {
-
- if (pdrvstruc->isattached)
- {
- send_process(pdrvstruc);
- }
- }
- break;
- case EC_RTDM_MASTER_APP_TIME:
- {
- if (!pdrvstruc->isattached)
- {
- return -EFAULT;
- }
- if (rtdm_rw_user_ok(user_info, arg, sizeof(app_time)))
- {
- // copy data from user
- if (rtdm_copy_from_user(user_info, &app_time, arg, sizeof(app_time)))
- {
- return -EFAULT;
- }
if (pdrvstruc->master)
{
rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
-
- ecrt_master_application_time(pdrvstruc->master, app_time);
-
+ ecrt_master_receive(pdrvstruc->master);
+ pdrvstruc->reccnt++;
rt_mutex_release(&pdrvstruc->masterlock);
-
}
}
}
break;
+ case EC_RTDM_DOMAIN_PROCESS:
+ {
+ if (pdrvstruc->isattached)
+ {
+ rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
+ ecrt_domain_process(pdrvstruc->domain);
+ rt_mutex_release(&pdrvstruc->masterlock);
+ }
+ }
+ break;
+ case EC_RTDM_MASTER_SEND:
+ {
+
+ if (pdrvstruc->isattached)
+ {
+ if (pdrvstruc->master)
+ {
+ rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
+ ecrt_master_send(pdrvstruc->master);
+ pdrvstruc->sendcnt++;
+ rt_mutex_release(&pdrvstruc->masterlock);
+ }
+ }
+ }
+ break;
+ case EC_RTDM_DOMAIN_QUEQUE:
+ {
+ if (pdrvstruc->isattached)
+ {
+ rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
+ ecrt_domain_queue(pdrvstruc->domain);
+ rt_mutex_release(&pdrvstruc->masterlock);
+ }
+ }
+ break;
+
+ case EC_RTDM_MASTER_APP_TIME:
+ {
+ if (!pdrvstruc->isattached)
+ {
+ rtdm_printk("ERROR : No Master attached\n");
+ return -EFAULT;
+ }
+ if (rtdm_safe_copy_from_user(user_info, &app_time, arg, sizeof(app_time)))
+ {
+ rtdm_printk("ERROR : can't copy data to driver\n");
+ return -EFAULT;
+ }
+
+ if (pdrvstruc->master)
+ {
+ rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
+
+ ecrt_master_application_time(pdrvstruc->master, app_time);
+ rt_mutex_release(&pdrvstruc->masterlock);
+
+ }
+ }
+ break;
case EC_RTDM_SYNC_REF_CLOCK:
{
if (!pdrvstruc->isattached)
@@ -419,6 +427,40 @@
}
}
break;
+ case EC_RTDM_MASTER_SYNC_MONITOR_QUEQUE:
+ {
+ if (!pdrvstruc->isattached)
+ {
+ return -EFAULT;
+ }
+ if (pdrvstruc->master)
+ {
+ rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
+ ecrt_master_sync_monitor_queue(pdrvstruc->master);
+ rt_mutex_release(&pdrvstruc->masterlock);
+ }
+ }
+ break;
+ case EC_RTDM_MASTER_SYNC_MONITOR_PROCESS:
+ {
+ uint32_t ret;
+ if (!pdrvstruc->isattached)
+ {
+ return -EFAULT;
+ }
+ if (pdrvstruc->master)
+ {
+ rt_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE);
+ ret = ecrt_master_sync_monitor_process(pdrvstruc->master);
+ rt_mutex_release(&pdrvstruc->masterlock);
+ if (rtdm_safe_copy_to_user(user_info, arg, &ret, sizeof(ret)))
+ {
+ EC_RTDM_ERR(pdrvstruc->masterno,"copy to user param failed!\n");
+ ret=-EFAULT;
+ }
+ }
+ }
+ break;
case EC_RTDM_MSTRATTACH:
{
unsigned int mstridx;
@@ -650,7 +692,7 @@
driver_name: EC_RTDM_DEV_FILE_NAME,
driver_version: RTDM_DRIVER_VER(1,0,1),
peripheral_name: EC_RTDM_DEV_FILE_NAME,
- provider_name: "Moehwald GmbH - Bosch Group",
+ provider_name: "EtherLab Community",
// proc_name: ethcatrtdm_device.device_name,
};
@@ -703,7 +745,7 @@
{
unsigned int i;
- EC_RTDM_GINFO("Cleanup EtherCAT RTDM Interface to Igh EtherCAT Master - Moehwald GmbH\n");
+ EC_RTDM_GINFO("Cleanup EtherCAT RTDM Interface \n");
for (i=0;i<EC_RTDM_MAX_MASTERS;i++)
{
if (ec_rtdm_masterintf[i].isattached)
@@ -716,4 +758,4 @@
}
MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("EtherCAT RTDM Interface to Igh EtherCAT Master");
+MODULE_DESCRIPTION("EtherCAT RTDM Interface");