[etherlab-users] RTDM with RTAI
Graeme Foot
GraemeF at touchcut.com
Tue Apr 9 08:30:49 CEST 2013
Hi,
I've just been updating my project to use the latest EtherCAT 1.5.2
master (2526), using RTDM with RTAI.
The ethercat_rtdm library calls fprintf to log various errors that may
occur. This knocks the hard realtime thread back to soft realtime due
to making a standard syscall. I have created a patch that will use
rt_printk instead if RTDM is active (attached).
It does the following, in ioctl.h:
#ifdef EC_RTDM
#define KERN_ERR "<3>"
#define EC_PRINT_ERR(fmt, args...) \
printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args)
#else
#define EC_PRINT_ERR(fmt, args...) \
fprintf(stderr, fmt, ##args)
#endif
and then changes the fprintf's, eg: from:
fprintf(stderr, "Failed to get reference clock time: %s\n",
strerror(EC_IOCTL_ERRNO(ret)));
to:
EC_PRINT_ERR("Failed to get reference clock time: %s\n",
strerror(EC_IOCTL_ERRNO(ret)));
I see there is a TODO item to replace the fprintf calls with return
codes, but you may want to do this in the meantime (or both).
Regards,
Graeme.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20130409/52fdf15a/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: etherlabmaster-1.5.2-2526-aa_lib_fprintf.patch
Type: application/octet-stream
Size: 31405 bytes
Desc: etherlabmaster-1.5.2-2526-aa_lib_fprintf.patch
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20130409/52fdf15a/attachment-0003.obj>
More information about the Etherlab-users
mailing list