[etherlab-users] EtherCAT stack for 2.6.24, patch v2

Sergej Stepanov Sergej.Stepanov at ids.de
Tue Feb 19 17:19:02 CET 2008


Hallo Florian.

thanks for your response. 
Am Dienstag, den 19.02.2008, 15:28 +0100 schrieb Florian Pose:
> Hi Sergej,
> 
> thanks for your patches!
> 
> On Tue, Feb 19, 2008 at 03:17:01PM +0100, Sergej Stepanov wrote:
> > 1. Backward compatibility was done with KERNEL_VERSION(..) macro.
> 
> Does 2.6.24 no provide the kobject_init() function any more?
The function kobject_init() is provided.
The call is no more "void kobject_init (struct kobject *  kobj)",
but 
int kobject_init(struct kobject *kobj,
                 struct kobj_type *ktype,
                 const char *fmt, ...)
ktype has not to be NULL.

And I thought it would be little bit shorter and more comfortable
to use kobject_init_and_add(..) :)...
> 
> > 2. it was fixed many warnings with EC_WRITE_U16-/EC_WRITE_U32-macro.
> 
> I don't understand, why this is necessary. If you take a closer look at
> the macros, the pointers are internally typecasted, f. e.:
> 
> #define EC_WRITE_U32(DATA, VAL) \
>     do { \
>         *((uint32_t *) (DATA)) = (uint32_t) (VAL); \
>         cpu_to_le32s(DATA); \
>     } while (0)
You know... i had warnings:
- passing argument 1 of '__swab16s' from incompatible pointer type
- passing argument 1 of '__swab32s' from incompatible pointer type
and did it fast :) (with no think) 

May be, would be better do here something like this:
------------------------------------------------------
 Index: include/ecrt.h
===================================================================
--- include/ecrt.h	(revision 28972)
+++ include/ecrt.h	(working copy)
@@ -319,7 +319,7 @@
 #define EC_WRITE_U16(DATA, VAL) \
     do { \
         *((uint16_t *) (DATA)) = (uint16_t) (VAL); \
-        cpu_to_le16s(DATA); \
+        cpu_to_le16s((uint16_t *)DATA); \
     } while (0)
 
 /**
@@ -339,7 +339,7 @@
 #define EC_WRITE_U32(DATA, VAL) \
     do { \
         *((uint32_t *) (DATA)) = (uint32_t) (VAL); \
-        cpu_to_le32s(DATA); \
+        cpu_to_le32s((uint32_t *)DATA); \
     } while (0)
 
 /**
------------------
I have tested it now, looks good, see patch v2.

> Do you get warnings otherwise?
I got 2 warnings because of EC_DBG(..),
Whether it is of your interesting, i don't know.
It was debug info for cpu_khz - it is unsinged long
You can see it in the patch v2.
------

And i found error in my patch:
-----------
Index: master/module.c
===================================================================
--- master/module.c	(revision 28982)
+++ master/module.c	(working copy)
@@ -90,7 +90,7 @@
 /** \endcond */
 
 /*****************************************************************************/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
 static struct attribute *ecm_def_attrs[] = {
     NULL,
 };


Because of all above i send you the patch v2 in attachment.
Could you once again look it through?
it is much more shorter now...

Is your firm presented at "embedded world"-exhibition?

Thanks and regards.

-- 
Dipl.-Ing. Sergej Stepanov 
Software-Entwicklung

IDS GmbH 
E-PA  (Entwicklung - Prozess Automatisierung)
Nobelstr. 18, 
D-76275 Ettlingen 
T. (0) 72 43/2 18-615 
F. (0) 72 43/2 18-100 
E. Sergej.Stepanov at ids.de

<http://www.ids.de>
Geschäftsführer: Norbert Wagner, Friedrich Abriß 
Sitz der Gesellschaft: Ettlingen 
Amtsgericht Mannheim HRB 362503 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: master.diff
Type: text/x-patch
Size: 8534 bytes
Desc: not available
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20080219/90851b37/attachment-0003.bin>


More information about the Etherlab-users mailing list