Ralf Ermes | 23 Jul 15:50 2013
Picon

Trying to write value for watchdog register (0x0420/0x0421) to slave EEPROM

Hello everybody,

 

I want to change the value for the watchdog at ESC register 0x0420/0x0421. This is easily done by specifying

 

<ESC>

   <Reg0420>50000</Reg0420>

</ESC>

 

in the corresponding XML-file for the slave.

 

When using TwinCat with this new XML-file the new value is automatically transferred to the slave ESC-register when TwinCat scans the bus and I actually see a watchdog with a 5 second timeout.

As we are using Etherlab Ethercat Master instead of TwinCat I would like to save this changed value in the EEPROM on the slave.

I tried to write the EEPROM using TwinCat, did a power-reset, but the changed value was either not written to the EEPROM or not read out by the ESC…the watchdog time has not changed and remains at the default 100ms.

 

The EtherCat Knowledge Base at the ETG web site states that ESI and SII both supply the same information about a slave.

 

So what am I doing wrong? Is TwinCat not writing the EEPROM correctly? Is it generally not possible to write this configuration information to the slave EEPROM?

 

I hope somebody can help.

Best regards

Ralf

 

-- This email was Anti Virus checked by CAE
<div>
<div class="WordSection1">
<p class="MsoNormal">Hello everybody,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><span lang="EN-US">I want to change the value for the watchdog at ESC register 0x0420/0x0421. This is easily done by specifying<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">&lt;ESC&gt;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp; &lt;Reg0420&gt;50000&lt;/Reg0420&gt;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&lt;/ESC&gt;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">in the corresponding XML-file for the slave.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">When using TwinCat with this new XML-file the new value is automatically transferred to the slave ESC-register when TwinCat scans the bus and I actually see a watchdog with a 5 second timeout.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">As we are using Etherlab Ethercat Master instead of TwinCat I would like to save this changed value in the EEPROM on the slave.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">I tried to write the EEPROM using TwinCat, did a power-reset, but the changed value was either not written to the EEPROM or not read out by the ESC&hellip;the watchdog time has not changed and remains at the default 100ms.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">The EtherCat Knowledge Base at the ETG web site states that ESI and SII both supply the same information about a slave.
<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">So what am I doing wrong? Is TwinCat not writing the EEPROM correctly? Is it generally not possible to write this configuration information to the slave EEPROM?<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I hope somebody can help.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Ralf<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
</div>

--

-- 
This email was Anti Virus checked by CAE</div>
Thomas Bitsky Jr | 16 Jul 19:03 2013

mmap process data to user-space

Hello,

 

I have the master up and running and can connect from a kernel module. I’m trying to mmap a customer struct in the kernel-space to the user-space to exchange process data. I’ve been trying for days, but can’t get it to work.

 

Everything seems to go fine in kernel-space and the user-space program can open the mmap'd file, but the data is absolute garbage. I must not be allocating the memory properly or something else fundamentally wrong. I've spent days reading on the Internet, but I always get the same result. Can someone tell me what I'm doing wrong?

 

Thanks in advance,

Tom

 

 

    ////////////////////////////////////////////////////////////

    // Includes

    ////////////////////////////////////////////////////////////

 

    #include <linux/module.h>

    #include <linux/kernel.h>

    #include <linux/init.h>

    #include <linux/fs.h>

    #include <linux/debugfs.h>

 

    // for kfree, kmalloc

    #include <linux/slab.h>

 

    // for mmap

    #include <linux/mm.h>

 

 

    #include "CtsSharedData.h"

    #include "ProcessData.h"

    #include "globals.h"

 

 

    /////////////////////////////////////////////////////////////////

    // Private variables

    //////////////////////////////////////////////////////////////////

 

    //

    // Pointer to the file in debugfs RAM file system

   static struct dentry* _ocFile;

 

 

 

    //

    // keep track of how often the item is mapped

    //

    void

    mmap_open(struct vm_area_struct* vma)

    {

        CtsProcessData* info = (CtsProcessData*)vma->vm_private_data;

        info->reference += 1;

    }

 

 

    //

    // keep track of how often the item is mapped

    //

    void

    mmap_close(struct vm_area_struct* vma)

    {

        CtsProcessData* info = (CtsProcessData*)vma->vm_private_data;

                info->reference -= 1;

    }

 

    int

    mmap_fault(struct vm_area_struct* vma, struct vm_fault *vmf)

    {

 

        unsigned long offset = vmf->pgoff << PAGE_SHIFT;

                CtsProcessData* priv = (CtsProcessData*) vma->vm_private_data;

        struct page *page;

                page = virt_to_page(priv + offset);

        if (!page)

                        return VM_FAULT_SIGBUS;

 

                get_page(page);

        vmf->page = page;

 

                priv->reference = 98765;

 

 

        PRINTF(CTSMSG_INFO "Vma fault, virtual_address = %p,"

                " offset = %lu, page = %p\n", vmf->virtual_address, offset, page);

 

                return 0;

 

    }

 

 

    static struct vm_operations_struct mmap_vm_ops =

    {

                .open = mmap_open,

        .close = mmap_close,

        .fault = mmap_fault,

    };

 

 

 

    //

    // Initilize the vm_area_struct to point to the mmap functions specific to

    // our implementation.

    //

    int

    ocMapPdTable(struct file* filp, struct vm_area_struct* vma)

    {

        PRINTF(CTSMSG_INFO": BEGIN: ocMapPdTable \n");

 

        //

                // The operations table describes the specific methods

        // that can operate on this particular instance of the object.

                //

        vma->vm_ops = &mmap_vm_ops;

 

                vma->vm_flags |= VM_RESERVED;

                               

        vma->vm_private_data = filp->private_data;

                mmap_open(vma);

 

 

        PRINTF(CTSMSG_INFO": END: ocMapPdTable \n");

 

                return 0;

    }

 

 

    //

    // Frees the shared data table.

    //

    int

    ocClosePdTable(struct inode* inode, struct file* filp)

    {

                CtsProcessData* info = filp->private_data;

               

                PRINTF(CTSMSG_INFO": BEGIN: ocClosePdTable \n");

               

                kfree(info);

                filp->private_data = NULL;

               

                PRINTF(CTSMSG_INFO": END: ocClosePdTable \n");

                return 0;

    }

               

               

    //

    // Allocate the shared memory

    //

    int

    ocOpenPdTable(struct inode* inode, struct file* filp)

    {

               

                CtsProcessData* info;   

                // unsigned long virt_addr;

               

                PRINTF(CTSMSG_INFO": BEGIN ocOpenPdTable\n");    

               

               

               

               

                //

                // Create the process data in the kernel's memory

                //

                info = kmalloc(sizeof(CtsProcessData), GFP_KERNEL);

               

                /* round it up to the page bondary */ 

                // kmalloc_area = (int *)((((unsigned long)kmalloc_ptr) + PAGE_SIZE - 1) & PAGE_MASK); 

               

               

                //

                // initialize the process data instance

                //

                memset(info, 0, sizeof(CtsProcessData));

               

                info->rawData = (CtsRawData*)kmalloc(sizeof(CtsRawData) * 1000, GFP_KERNEL);

                if (info->rawData == NULL)

                {

                                PRINTF("Failed to allocate memory for raw data!");

                }

                else

                {

                                memset(info->rawData, 0, (sizeof(CtsRawData) * 1000));

                               

                               

                                //

                                // FOR TESTING ONLY! Delete!

                               

                                FPSET_16_16(info->rawData[0].load, 12, 0);

                                FPSET_16_16(info->rawData[0].position, 99, 0);

                                info->rawData[0].ticks = 54321;

               

                }

               

               

                filp->private_data = info;

               

                PRINTF(CTSMSG_INFO": END ocOpenPdTable\n");        

                return 0;

    }

   

    

    static const struct file_operations oc_fops =

    {

                .open = ocOpenPdTable,

                .release = ocClosePdTable,

                .mmap = ocMapPdTable,

    };        

               

               

               

               

    

    //////////////////////////////////////////////////

    // PUBLIC INTERFACE FUNCTIONS

    //////////////////////////////////////////////////

               

               

    //

    // Create the file in the debugfs RAM file system, which will trigger

    // mapping the memory

    //

    int

    ctsSharedTableCreate(void)

    {

                BOOL ret = FALSE;

               

                PRINTF(CTSMSG_INFO": BEGIN ocSharedTableCreate\n");

   

                               

                _ocFile = debugfs_create_file(

                                CTSRT_DEBUGFS_SHAREDTABLE, // a pointer to a string containing the name of

                                                                                                                                                                                                                                                // the file to create.

                                0644, // the permission that the file should have

                                NULL, // a pointer to the parent entry for this file.

                                                                                // This should be a directory dentry if set.

                                                                                // If this paramater is NULL, then the file will be created in the

                                                                                // root of the debugfs filesystem.

                                NULL, // a pointer to something that the caller will want to get to later

                                                                                // on. The inode.i_private pointer will point to this

                                                                                // value on the open call.

                                &oc_fops);  // a pointer to a struct file_operations that should be used

                                                                                                                                // for this file.                   

                               

                if (_ocFile == NULL)

                {

                                //

                                // Most likely, the kernel module crashed on exit and the file already

                                // exists. We don't have any way of deletlying it. The computer will

                                // need to be restarted.

                                //

                                PRINTF(CTSMSG_INFO": ctsSharedTableCreate failed to create debugfs file!\n");           

                }

                else if ((int)_ocFile == -ENODEV)

                {

                                PRINTF(CTSMSG_INFO": ctsSharedTableCreate failed because of ENODEV!\n");

                }

                else

                {

                                PRINTF(CTSMSG_INFO": ctsSharedTableCreate succeeded.\n");

                                ret = TRUE;

                }

               

                return ret;

    }

   

    

    

    //

    // Close and delete the shared table and all associated memory.

    //

    void

    ctsSharedTableClose(void)

    {

                debugfs_remove(_ocFile);

    }         

 

 

 

 

Thomas C. Bitsky Jr. | Lead Developer

ADC | automateddesign.com

P: 630-783-1150 F: 630-783-1159 M: 630-632-6679

 

<div>
<div class="WordSection1">
<p class="MsoNormal">Hello,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I have the master up and running and can connect from a kernel module. I&rsquo;m trying to mmap a customer struct in the kernel-space to the user-space to exchange process data. I&rsquo;ve been trying for days, but can&rsquo;t get it to work.
<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Everything seems to go fine in kernel-space and the user-space program can open the mmap'd file, but the data is absolute garbage. I must not be allocating the memory properly or something else fundamentally wrong. I've spent days reading
 on the Internet, but I always get the same result. Can someone tell me what I'm doing wrong?<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks in advance,<p></p></p>
<p class="MsoNormal">Tom<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; ////////////////////////////////////////////////////////////<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Includes<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; ////////////////////////////////////////////////////////////<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include &lt;linux/module.h&gt;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include &lt;linux/kernel.h&gt;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include &lt;linux/init.h&gt;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include &lt;linux/fs.h&gt;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include &lt;linux/debugfs.h&gt;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // for kfree, kmalloc<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include &lt;linux/slab.h&gt;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // for mmap<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include &lt;linux/mm.h&gt;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include "CtsSharedData.h"<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include "ProcessData.h"<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; #include "globals.h"<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; /////////////////////////////////////////////////////////////////<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Private variables<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //////////////////////////////////////////////////////////////////<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Pointer to the file in debugfs RAM file system<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;static struct dentry* _ocFile;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // keep track of how often the item is mapped<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; void<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; mmap_open(struct vm_area_struct* vma)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CtsProcessData* info = (CtsProcessData*)vma-&gt;vm_private_data;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; info-&gt;reference += 1;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // keep track of how often the item is mapped<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; void<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; mmap_close(struct vm_area_struct* vma)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CtsProcessData* info = (CtsProcessData*)vma-&gt;vm_private_data;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; info-&gt;reference -= 1;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;int <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;mmap_fault(struct vm_area_struct* vma, struct vm_fault *vmf)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long offset = vmf-&gt;pgoff &lt;&lt; PAGE_SHIFT;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CtsProcessData* priv = (CtsProcessData*) vma-&gt;vm_private_data;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct page *page;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; page = virt_to_page(priv + offset);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!page)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return VM_FAULT_SIGBUS;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get_page(page);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vmf-&gt;page = page;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; priv-&gt;reference = 98765;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO "Vma fault, virtual_address = %p,"<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " offset = %lu, page = %p\n", vmf-&gt;virtual_address, offset, page);<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; } <p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; static struct vm_operations_struct mmap_vm_ops = <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;{<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .open = mmap_open,<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .close = mmap_close,<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .fault = mmap_fault,<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; };<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Initilize the vm_area_struct to point to the mmap functions specific to<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // our implementation.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; int<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; ocMapPdTable(struct file* filp, struct vm_area_struct* vma)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": BEGIN: ocMapPdTable \n");<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The operations table describes the specific methods<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // that can operate on this particular instance of the object.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vma-&gt;vm_ops = &amp;mmap_vm_ops;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vma-&gt;vm_flags |= VM_RESERVED;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vma-&gt;vm_private_data = filp-&gt;private_data;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mmap_open(vma);<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": END: ocMapPdTable \n");<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Frees the shared data table.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; int<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; ocClosePdTable(struct inode* inode, struct file* filp)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CtsProcessData* info = filp-&gt;private_data;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": BEGIN: ocClosePdTable \n");<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kfree(info);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filp-&gt;private_data = NULL;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": END: ocClosePdTable \n");<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;//<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Allocate the shared memory<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; int<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; ocOpenPdTable(struct inode* inode, struct file* filp)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CtsProcessData* info;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // unsigned long virt_addr;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": BEGIN ocOpenPdTable\n");&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create the process data in the kernel's memory<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; info = kmalloc(sizeof(CtsProcessData), GFP_KERNEL);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* round it up to the page bondary */&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // kmalloc_area = (int *)((((unsigned long)kmalloc_ptr) + PAGE_SIZE - 1) &amp; PAGE_MASK);&nbsp;
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // initialize the process data instance<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset(info, 0, sizeof(CtsProcessData));<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; info-&gt;rawData = (CtsRawData*)kmalloc(sizeof(CtsRawData) * 1000, GFP_KERNEL);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (info-&gt;rawData == NULL)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF("Failed to allocate memory for raw data!");<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset(info-&gt;rawData, 0, (sizeof(CtsRawData) * 1000));<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // FOR TESTING ONLY! Delete!<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FPSET_16_16(info-&gt;rawData[0].load, 12, 0);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FPSET_16_16(info-&gt;rawData[0].position, 99, 0);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; info-&gt;rawData[0].ticks = 54321;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filp-&gt;private_data = info;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": END ocOpenPdTable\n");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;static const struct file_operations oc_fops = <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;{<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .open = ocOpenPdTable,<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .release = ocClosePdTable,<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .mmap = ocMapPdTable,<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; };&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;//////////////////////////////////////////////////<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // PUBLIC INTERFACE FUNCTIONS<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //////////////////////////////////////////////////<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;//<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Create the file in the debugfs RAM file system, which will trigger<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // mapping the memory<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; int <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;ctsSharedTableCreate(void)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BOOL ret = FALSE;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": BEGIN ocSharedTableCreate\n");<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ocFile = debugfs_create_file(<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CTSRT_DEBUGFS_SHAREDTABLE, // a pointer to a string containing the name of<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 // the file to create.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0644, // the permission that the file should have<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL, // a pointer to the parent entry for this file.
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // This should be a directory dentry if set.
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // If this paramater is NULL, then the file will be created in the
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // root of the debugfs filesystem.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL, // a pointer to something that the caller will want to get to later
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // on. The inode.i_private pointer will point to this
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // value on the open call.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;oc_fops);&nbsp; // a pointer to a struct file_operations that should be used
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // for this file.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_ocFile == NULL)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Most likely, the kernel module crashed on exit and the file already<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // exists. We don't have any way of deletlying it. The computer will<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // need to be restarted.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": ctsSharedTableCreate failed to create debugfs file!\n");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if ((int)_ocFile == -ENODEV)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": ctsSharedTableCreate failed because of ENODEV!\n");<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINTF(CTSMSG_INFO": ctsSharedTableCreate succeeded.\n");<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = TRUE;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return ret;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;//<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; // Close and delete the shared table and all associated memory.<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; //<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; void <p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;ctsSharedTableClose(void)<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; {<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debugfs_remove(_ocFile);<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><span>Thomas C. Bitsky Jr. |&nbsp;Lead Developer</span><span><p></p></span></p>
<p class="MsoNormal"><span>ADC |&nbsp;<a href="http://automateddesign.com/" target="_blank"><span>automateddesign.com</span></a></span><span><p></p></span></p>
<p class="MsoNormal"><span>P: 630-783-1150 F: 630-783-1159 M: 630-632-6679<p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
</div>
vilian_ch | 10 Jul 11:47 2013

Beckhoff EL5032

 Anyone has used beckhoff EL5032 with ethercat master(version 1.5.1)?
The EL5032 EnDat 2.2 EtherCAT Terminal is used for direct connection of two encoders with EnDat 2.2 interface. The EL5032 enables reading of position values, diagnosis encoder data, internal and external temperature values and the electronic identification plate. With the electronic identification plate all measuring device-specific information is directly available. In addition, user-defined data can be stored in the encoder. This enables cost-effective and quicker commissioning. The position value is output with up to 48 bits, depending on the resolution of the connected measuring device. In addition to the position value, further information such as status information, addresses and data can be transferred. A list of additional information supported by the encoder is stored in the parameters. The EL5032 features distributed clocks, which means that the position value can be read in exact synchrony with the system. If the distributed clock function is deactivated, the EL5032 cycles synchronous with the EtherCAT cycle.
I have used this module to sample encoder position, but found that the feedback position was jitter sometimes. And I have also enabled its DC function(with Sync0 cycle time 1ms).
 
 

 

----- 原始邮件 -----
发件人:etherlab-users-request <at> etherlab.org
收件人:etherlab-users <at> etherlab.org
主题:etherlab-users Digest, Vol 74, Issue 7
日期:2013年07月09日 18点00分

<div>
<div>&nbsp;Anyone has used beckhoff EL5032 with ethercat master(version 1.5.1)?</div>
<div>The EL5032 EnDat 2.2 EtherCAT Terminal is used for direct connection of two encoders with EnDat 2.2 interface. The EL5032 enables reading of position values, diagnosis encoder data, internal and external temperature values and the electronic identification plate. With the electronic identification plate all measuring device-specific information is directly available. In addition, user-defined data can be stored in the encoder. This enables cost-effective and quicker commissioning. The position value is output with up to 48 bits, depending on the resolution of the connected measuring device. In addition to the position value, further information such as status information, addresses and data can be transferred. A list of additional information supported by the encoder is stored in the parameters. The EL5032 features distributed clocks, which means that the position value can be read in exact synchrony with the system. If the distributed clock function is deactivated, the EL5032 cycles synchronous with the EtherCAT cycle.</div>
<div>I have used this module to sample encoder position, but found that the feedback position was jitter sometimes. And I have also enabled its DC function(with Sync0 cycle time 1ms).</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>
<br>&nbsp;</div>
<br><div>
<div>----- &#21407;&#22987;&#37038;&#20214; -----<br>&#21457;&#20214;&#20154;&#65306;etherlab-users-request <at> etherlab.org<br>&#25910;&#20214;&#20154;&#65306;etherlab-users <at> etherlab.org<br>&#20027;&#39064;&#65306;etherlab-users Digest, Vol 74, Issue 7<br>&#26085;&#26399;&#65306;2013&#24180;07&#26376;09&#26085; 18&#28857;00&#20998;<br>
</div>
<br>
</div>
</div>
Thomas Bitsky Jr | 8 Jul 17:31 2013

Point to Point Motion Control

Hello, 

I have an EtherCAT drive from AKD here and I'm trying to use the EtherLAB EtherCAT master as the motion
controller. I've done motion profile calculation in the past with TwinCAT, but never directly commanded
the positions to the drive. I was wondering if anyone knew of or was willing to share any examples.

Thanks in advance,
Tom
Thomas Bitsky Jr | 3 Jul 23:25 2013

e1000e Limited to frame rate of 250/sec

Hello, all.

 

I’ve been working for a week on running the EtherCAT master 1.5.1 on an Intel Atom Desktop with two e1000e Intel cards. I need to get a frame rate of 2000/sec, but with both the generic driver and ec_e1000e driver, I can get no more than 250/sec. There are no errors or warning while running.

 

The Operating System is Linux 2.6.33 with the RT PREMPT patch. I also tried running the generic driver on 3.2.46-rt67 with the same results.

 

To get the network statistics, I type “ethercat master” at the command line. When the EtherCAT master starts up, it seems to burst at a massively fast frame rate, then quickly settle to 250/sec. Note that on three different machines, the results are the same, although I think they all have Intel NICs. When I start up the kernel module I wrote and the network goes into Operation, the speed results are unchanged.

 

I know the e1000e driver can be slower than the 8139too driver, but 250/sec seems excessively slow and the fact that it’s ALWAYS 250 regardless of driver or machine leads me to believe I’m doing something wrong. I’ve tried turning off the InterruptThrottleRate feature of the card (with both the e1000e and ec_e1000e driver), but with no effect.

 

Below is the code that I’m using to run the test, which is based off the “mini” example. Can anyone tell me what I’m doing wrong, or if there is some feature in the e1000e driver that I need to disable?

 

Thanks in advance,

Tom

 

 

#include <linux/version.h>

#include <linux/module.h>

#include <linux/timer.h>

#include <linux/interrupt.h>

#include <linux/err.h>

#include <linux/semaphore.h>

#include <linux/time.h>

 

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)

#include <linux/semaphore.h>

#else

#include <asm/semaphore.h>

#endif

 

 

#define MY_PRIORITY (49) /* we use 49 as the PRREMPT_RT use 50

                            as the priority of kernel tasklets

                            and interrupt handler by default */

 

#define MAX_SAFE_STACK (8*1024) /* The maximum stack size which is

                                   guaranteed safe to access without

                                   faulting */

 

// #define NSEC_PER_SEC    (1000000000) /* The number of nsecs per sec. */

 

 

#define PFX "durability.c: "

 

#include "/home/tbj/srcroot/ethercat/include/ecrt.h" // EtherCAT realtime interface

/*

* Import the bus topology generated by EtherLAB

*/

#include "2369topology.h"

 

/*

* Application Parameters

*/

#define FREQUENCY 2000

#define INHIBIT_TIME 20

 

// process data

static uint8_t *processData = NULL;

 

/*

* macros for any of the hardware on the network.

* Use # ethercat slaves to see this info

* You can also use # ethercat cstruct > topology.h to generate a slave header.

* The vendor id and product code for each slave will be listed in comments in that file.

*/

#define Beckhoff_EK1100 0x00000002, 0x044c2c52        // uint32_t vendor_id, uint32_t product_code     

#define Beckhoff_EL1004 0x00000002, 0x03ec3052

#define Beckhoff_EL5101 0x00000002, 0x13ed3052

#define Beckhoff_EL2004 0x00000002, 0x07d43052

#define Beckhoff_EL6601 0x00000002, 0x19c93052

#define SMC_EX260SEC3 0x00000114, 0x01000003

#define Beckhoff_EP1809 0x00000002, 0x07114052

#define Beckhoff_EP2028 0x00000002, 0x07ec4052

#define Beckhoff_EP4174 0x00000002, 0x104e4052

 

 

/*

* Global variables for interacting with the EtherCAT master.

*/

static ec_master_t *master = NULL;

static ec_master_state_t master_state = {};

struct semaphore master_sem;

 

 

 

static ec_domain_t *domain = NULL;

static ec_domain_state_t domain_state = {};

 

// Timer

static struct timer_list timer;

 

struct timespec lastCycle_;

struct timespec lastSend_;

struct timespec lastRead_;

struct sched_param param;

struct timespec interval; // = 50000; /* 50us*/

                       

 

struct PdoOffset

      {

      unsigned int offset;

      unsigned int bitPosition;

      };

 

 

static struct PdoOffset digInOffsets[255];

static struct PdoOffset digOutOffsets[255];

static struct PdoOffset analogInOffsets[255];

static struct PdoOffset analogOutOffsets[255];

 

 

const static ec_pdo_entry_reg_t domain_regs[] =

      {

            {0,1, Beckhoff_EL1004, 0x6000, 1, &digInOffsets[0].offset, &digInOffsets[0].bitPosition},

            {0,1, Beckhoff_EL1004, 0x6010, 1, &digInOffsets[1].offset, &digInOffsets[1].bitPosition},

            {0,1, Beckhoff_EL1004, 0x6020, 1, &digInOffsets[2].offset, &digInOffsets[2].bitPosition},

            {0,1, Beckhoff_EL1004, 0x6030, 1, &digInOffsets[3].offset, &digInOffsets[3].bitPosition},

           

            {0,2, Beckhoff_EL1004, 0x6000, 1, &digInOffsets[4].offset, &digInOffsets[4].bitPosition},

            {0,2, Beckhoff_EL1004, 0x6010, 1, &digInOffsets[5].offset, &digInOffsets[5].bitPosition},

            {0,2, Beckhoff_EL1004, 0x6020, 1, &digInOffsets[6].offset, &digInOffsets[6].bitPosition},

            {0,2, Beckhoff_EL1004, 0x6030, 1, &digInOffsets[7].offset, &digInOffsets[7].bitPosition},

           

            {0,3, Beckhoff_EL1004, 0x6000, 1, &digInOffsets[8].offset, &digInOffsets[8].bitPosition},

            {0,3, Beckhoff_EL1004, 0x6010, 1, &digInOffsets[9].offset, &digInOffsets[9].bitPosition},

            {0,3, Beckhoff_EL1004, 0x6020, 1, &digInOffsets[10].offset, &digInOffsets[10].bitPosition},

            {0,3, Beckhoff_EL1004, 0x6030, 1, &digInOffsets[11].offset, &digInOffsets[11].bitPosition},          

                       

            {0,9, Beckhoff_EP1809, 0x6000, 1, &digInOffsets[12].offset, &digInOffsets[12].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6010, 1, &digInOffsets[13].offset, &digInOffsets[13].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6020, 1, &digInOffsets[14].offset, &digInOffsets[14].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6030, 1, &digInOffsets[15].offset, &digInOffsets[15].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6040, 1, &digInOffsets[16].offset, &digInOffsets[16].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6050, 1, &digInOffsets[17].offset, &digInOffsets[17].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6060, 1, &digInOffsets[18].offset, &digInOffsets[18].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6070, 1, &digInOffsets[19].offset, &digInOffsets[19].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6080, 1, &digInOffsets[20].offset, &digInOffsets[20].bitPosition},

            {0,9, Beckhoff_EP1809, 0x6090, 1, &digInOffsets[21].offset, &digInOffsets[21].bitPosition},

            {0,9, Beckhoff_EP1809, 0x60A0, 1, &digInOffsets[22].offset, &digInOffsets[22].bitPosition},

            {0,9, Beckhoff_EP1809, 0x60B0, 1, &digInOffsets[23].offset, &digInOffsets[23].bitPosition},

            {0,9, Beckhoff_EP1809, 0x60C0, 1, &digInOffsets[24].offset, &digInOffsets[24].bitPosition},

            {0,9, Beckhoff_EP1809, 0x60D0, 1, &digInOffsets[25].offset, &digInOffsets[25].bitPosition},

            {0,9, Beckhoff_EP1809, 0x60E0, 1, &digInOffsets[26].offset, &digInOffsets[26].bitPosition},

            {0,9, Beckhoff_EP1809, 0x60F0, 1, &digInOffsets[27].offset, &digInOffsets[27].bitPosition},

                       

            {0,4, Beckhoff_EL5101, 0x6010, 0x11, &analogInOffsets[0].offset, &analogInOffsets[0].bitPosition},

           

            {0,5, Beckhoff_EL2004, 0x7000, 1, &digOutOffsets[0].offset, &digOutOffsets[0].bitPosition},

            {0,5, Beckhoff_EL2004, 0x7010, 1, &digOutOffsets[1].offset, &digOutOffsets[1].bitPosition},

            {0,5, Beckhoff_EL2004, 0x7020, 1, &digOutOffsets[2].offset, &digOutOffsets[2].bitPosition},

            {0,5, Beckhoff_EL2004, 0x7030, 1, &digOutOffsets[3].offset, &digOutOffsets[3].bitPosition},

           

            {0,6, Beckhoff_EL2004, 0x7000, 1, &digOutOffsets[4].offset, &digOutOffsets[4].bitPosition},

            {0,6, Beckhoff_EL2004, 0x7010, 1, &digOutOffsets[5].offset, &digOutOffsets[5].bitPosition},

            {0,6, Beckhoff_EL2004, 0x7020, 1, &digOutOffsets[6].offset, &digOutOffsets[6].bitPosition},

            {0,6, Beckhoff_EL2004, 0x7030, 1, &digOutOffsets[7].offset, &digOutOffsets[7].bitPosition},    

           

            {0,10, Beckhoff_EP2028, 0x7000, 1, &digOutOffsets[8].offset, &digOutOffsets[8].bitPosition},    

            {0,10, Beckhoff_EP2028, 0x7010, 1, &digOutOffsets[9].offset, &digOutOffsets[9].bitPosition},          

            {0,10, Beckhoff_EP2028, 0x7020, 1, &digOutOffsets[10].offset, &digOutOffsets[10].bitPosition},   

            {0,10, Beckhoff_EP2028, 0x7030, 1, &digOutOffsets[11].offset, &digOutOffsets[11].bitPosition},   

            {0,10, Beckhoff_EP2028, 0x7040, 1, &digOutOffsets[12].offset, &digOutOffsets[12].bitPosition},   

            {0,10, Beckhoff_EP2028, 0x7050, 1, &digOutOffsets[13].offset, &digOutOffsets[13].bitPosition},               

            {0,10, Beckhoff_EP2028, 0x7060, 1, &digOutOffsets[14].offset, &digOutOffsets[14].bitPosition},   

            {0,10, Beckhoff_EP2028, 0x7070, 1, &digOutOffsets[15].offset, &digOutOffsets[15].bitPosition},               

           

           

            // Encoder card registers for setting the counter

            {0,4, Beckhoff_EL5101, 0x7010, 0x03, &analogOutOffsets[0].offset, &analogOutOffsets[0].bitPosition},             

            {0,4, Beckhoff_EL5101, 0x7010, 0x11, &analogOutOffsets[1].offset, &analogOutOffsets[1].bitPosition},             

           

            // The bits of two bytes covers the valves on the block

            {0,8, SMC_EX260SEC3, 0x3101, 0x01, &analogOutOffsets[2].offset, &analogOutOffsets[2].bitPosition},       

            {0,8, SMC_EX260SEC3, 0x3101, 0x02, &analogOutOffsets[3].offset, &analogOutOffsets[3].bitPosition},

           

            {0,11, Beckhoff_EP4174, 0x7000, 0x11, &analogOutOffsets[4].offset, &analogOutOffsets[4].bitPosition},

            {0,11, Beckhoff_EP4174, 0x7010, 0x11, &analogOutOffsets[5].offset, &analogOutOffsets[5].bitPosition},

            {0,11, Beckhoff_EP4174, 0x7020, 0x11, &analogOutOffsets[6].offset, &analogOutOffsets[6].bitPosition},

            {0,11, Beckhoff_EP4174, 0x7030, 0x11, &analogOutOffsets[7].offset, &analogOutOffsets[7].bitPosition},

           

            {}

           

      };

 

 

// process variables

static unsigned int counter = 0;

 

/*

* Check and report on the state of the domain.

*/

void

check_domain_state(void)

      {

      ec_domain_state_t ds;

 

      down(&master_sem);

      ecrt_domain_state(domain, &ds);

      up(&master_sem);

 

      if (ds.working_counter != domain_state.working_counter)

                  printk(KERN_INFO PFX "Domain: WC %u.\n", ds.working_counter);

      if (ds.wc_state != domain_state.wc_state)

                  printk(KERN_INFO PFX "Domain: State %u.\n", ds.wc_state);

 

      domain_state = ds;

      }

 

 

 

/*

* Check and report on the state of the master service.

*/

void

check_master_state(void)

      {

      ec_master_state_t ms;

 

      down(&master_sem);

      ecrt_master_state(master, &ms);

      up(&master_sem);

 

      if (ms.slaves_responding != master_state.slaves_responding)

                  printk(KERN_INFO PFX "%u slave(s).\n", ms.slaves_responding);

      if (ms.al_states != master_state.al_states)

                  printk(KERN_INFO PFX "AL states: 0x%02X.\n", ms.al_states);

      if (ms.link_up != master_state.link_up)

                  printk(KERN_INFO PFX "Link is %s.\n", ms.link_up ? "up" : "down");

 

      master_state = ms;

      }

 

 

void

check_slave_config_states(void)

      {

      /*

    ec_slave_config_state_t s;

 

    ecrt_slave_config_state(sc_ana_in, &s);

 

    if (s.al_state != sc_ana_in_state.al_state)

        printk(KERN_ERR PFX "AnaIn: State 0x%02X.\n", s.al_state);

    if (s.online != sc_ana_in_state.online)

        printk(KERN_ERR PFX "AnaIn: %s.\n", s.online ? "online" : "offline");

    if (s.operational != sc_ana_in_state.operational)

        printk(KERN_ERR PFX "AnaIn: %soperational.\n",

                s.operational ? "" : "Not ");

      */

      }

 

 

 

void

cyclic_task(unsigned long data)

      {

      // receive process data

      down(&master_sem);

      ecrt_master_receive(master);

      ecrt_domain_process(domain);

      up(&master_sem);

     

     

      ktime_get_ts(&lastCycle_);

     

      // check process data state (optional)

      check_domain_state();

 

      if (counter)

            {

            counter--;

            }

      else

            {

            counter = FREQUENCY;

 

            // check for master state

            check_master_state();

            }

 

      // send process data

      down(&master_sem);

      ecrt_domain_queue(domain);

      ecrt_master_send(master);

      up(&master_sem);

           

      // restart timer

  timer.expires += HZ / FREQUENCY;

  add_timer(&timer);   

      }

 

 

void

send_callback(void *cb_data)

      {

     

      struct timespec delta = timespec_sub(lastCycle_, lastSend_);

      ec_master_t *m = NULL;

 

      printk(KERN_INFO PFX "send_callback");

     

      if (timespec_compare(&delta, &interval) > 0)

            {

 

            printk(KERN_INFO PFX "ecrt_master_send_ext");

            m = (ec_master_t *) cb_data;

            down(&master_sem);

            ecrt_master_send_ext(m);

            up(&master_sem);

           

            ktime_get_ts(&lastSend_);

            }

      }

 

void

receive_callback(void *cb_data)

      {

     

      struct timespec delta = timespec_sub(lastCycle_, lastRead_);

      ec_master_t *m = NULL;

 

      printk(KERN_INFO PFX "receive_callback");

     

      if (timespec_compare(&delta, &interval) > 0)

            {

     

            printk(KERN_INFO PFX "ecrt_master_receive");

            m = (ec_master_t *) cb_data;

 

            down(&master_sem);

            ecrt_master_receive(m);      

            up(&master_sem);

           

            ktime_get_ts(&lastRead_);

            }

      }

 

int

__init init_mini_module(void)

      {

  ec_slave_config_t *sc;

  int ret = -1;

     

      /*

      * Requests an EtherCAT master for realtime operation.

      * Before an application can access an EtherCAT master, it has to reserve one for exclusive use.

      * In userspace, this is a convenience function for ecrt_open_master() and ecrt_master_reserve().

      * This function has to be the first function an application has to call to use EtherCAT.

       * The function takes the index of the master as its argument.

       * The first master has index 0, the n-th master has index n - 1.

       * The number of masters has to be specified when loading the master module.

      */

  master = ecrt_request_master(0);

  if (!master)

            {

            printk(KERN_INFO PFX "Could not connect to the master service. Exiting.\n\n");

            ret = -EBUSY;

            goto out_return;

            }

           

           

      ktime_get_ts(&lastCycle_);

      ktime_get_ts(&lastSend_);

      ktime_get_ts(&lastRead_);

     

      // setup a comparison

      interval.tv_nsec = 50000;

           

           

      sema_init(&master_sem, 1);

      ecrt_master_callbacks(

            master,                                   // pointer to master

            send_callback,                // fp to send ext callback

            receive_callback,       // fp to receive callback

            master);                                  // parameter to callback

           

           

      /*

      * Creates a new process data domain.

      * For process data exchange, at least one process data domain is needed.

       * This method creates a new process data domain and returns a pointer to the new domain object.

       * This object can be used for registering PDOs and exchanging them in cyclic operation.

      */

      domain = ecrt_master_create_domain(master);

      if (!domain)

            {

            printk(KERN_INFO PFX "Could not create a domain on the master. Exiting.\n\n");

            goto out_release_master;     

            }

           

           

      /*         

      * Register the slaves on the master

      * Doing the method this way means the registration will work whether or

      * not the computer is connected to the network.

      */

     

      // Main Rack, Slot 1

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,1,                                            // Bus position

                  Beckhoff_EL1004               // Slave type

                  )))

            {

            printk(KERN_INFO PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_1_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }

                 

      // Main Rack, Slot 2

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,2,                                            // Bus position

                  Beckhoff_EL1004               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_2_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      // Main Rack, Slot 3

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,3,                                            // Bus position

                  Beckhoff_EL1004               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_3_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      // Main Rack, Slot 4

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,4,                                            // Bus position

                  Beckhoff_EL5101               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_4_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }                

                       

      // Main Rack, Slot 5

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,5,                                            // Bus position

                  Beckhoff_EL2004               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

    ret = -ENOMEM;

    goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_5_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }                      

           

      // Main Rack, Slot 6

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,6,                                            // Bus position

                  Beckhoff_EL2004               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_6_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }                

           

      // Main Rack, Slot 7

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,7,                                            // Bus position

                  Beckhoff_EL6601               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_7_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }          

           

      // SMC EtherCAT Manifold, Slave 8, "EX260-SEC3"

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,8,                                            // Bus position

                  SMC_EX260SEC3                       // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_8_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }                      

           

      // EP1809 Input Fieldbox, Slave 9,

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,9,                                            // Bus position

                  Beckhoff_EP1809               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

                  }    

 

      if (ecrt_slave_config_pdos(sc, EC_END, slave_9_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }                      

           

      // EP2028 Input Fieldbox, Slave 10,

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,10,                                           // Bus position

                  Beckhoff_EP2028               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_10_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }                      

           

      // EP4174 Input Fieldbox, Slave 11,

      if (!(sc = ecrt_master_slave_config(

                  master,

                  0,11,                                           // Bus position

                  Beckhoff_EP4174               // Slave type

                  )))

            {

            printk(KERN_ERR PFX "Failed to get slave configuration.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }    

           

      if (ecrt_slave_config_pdos(sc, EC_END, slave_11_syncs))

            {

            printk(KERN_ERR PFX "Failed to configure PDOs.\n");

            ret = -ENOMEM;

            goto out_release_master;

            }                

           

      // Create configuration for bus coupler

      sc = ecrt_master_slave_config(master, 0,0, Beckhoff_EK1100);

  if (!sc)

            {

            ret = -ENOMEM;

            goto out_release_master;

            }

           

      /*

       * Registers a bunch of PDO entries for a domain.

       */

      printk(KERN_ERR PFX "\nAttempting to register PDOs on domain...\n");

      if (ecrt_domain_reg_pdo_entry_list(domain, domain_regs))

            {

            printk(KERN_ERR PFX "PDO entry registration failed!\n");

            ret = -EBUSY;

            goto out_release_master;

            }          

           

      /*

      * Finishes the configuration phase and prepares for cyclic operation.

      * This function tells the master that the configuration phase is finished and the realtime operation will begin.

      * The function allocates internal memory for the domains and calculates the logical FMMU addresses for domain members.

       * It tells the master state machine that the bus configuration is now to be applied

      */

      if (ecrt_master_activate(master))

            {

            ret = -EBUSY;

            goto out_release_master;;          

            }

           

      /*

      * Returns the domain's process data.

       */

      if (!(processData = ecrt_domain_data(domain)))

            {

            ret = -EBUSY;

            goto out_release_master;

            }          

           

      printk(KERN_INFO PFX "Starting cyclic thread.\n");

      init_timer(&timer);

      timer.function = cyclic_task;

      timer.expires = jiffies + 10;

      add_timer(&timer);           

           

      printk(KERN_INFO PFX "Durability Service Started.\n");

      return 0;        

 

out_release_master:

  printk(KERN_ERR PFX "Releasing master...\n");

  ecrt_release_master(master);

out_return:

  printk(KERN_ERR PFX "Failed to load. Aborting.\n");

      return ret;

      } // main

     

     

void

__exit cleanup_mini_module(void)

      {

      printk(KERN_INFO PFX "Stopping...\n");

 

      del_timer_sync(&timer);

 

      printk(KERN_INFO PFX "Releasing master...\n");

      ecrt_release_master(master);

 

      printk(KERN_INFO PFX "Unloading.\n");

      }

 

/*****************************************************************************/

 

MODULE_LICENSE("GPL");

MODULE_AUTHOR("Thomas Bitsky <tbj-WvSCG1/GQymhOUbg5DNyDkEOCMrvLtNR@public.gmane.org>");

MODULE_DESCRIPTION("Durability test environment");

 

module_init(init_mini_module);

module_exit(cleanup_mini_module);

 

<div>
<div class="WordSection1">
<p class="MsoNormal">Hello, all.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I&rsquo;ve been working for a week on running the EtherCAT master 1.5.1 on an Intel Atom Desktop with two e1000e Intel cards. I need to get a frame rate of 2000/sec, but with both the generic driver and ec_e1000e driver, I can get no more than
 250/sec. There are no errors or warning while running.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">The Operating System is Linux 2.6.33 with the RT PREMPT patch. I also tried running the generic driver on 3.2.46-rt67 with the same results.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">To get the network statistics, I type &ldquo;ethercat master&rdquo; at the command line. When the EtherCAT master starts up, it seems to burst at a massively fast frame rate, then quickly settle to 250/sec. Note that on three different machines, the
 results are the same, although I think they all have Intel NICs. When I start up the kernel module I wrote and the network goes into Operation, the speed results are unchanged.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I know the e1000e driver can be slower than the 8139too driver, but 250/sec seems excessively slow and the fact that it&rsquo;s ALWAYS 250 regardless of driver or machine leads me to believe I&rsquo;m doing something wrong. I&rsquo;ve tried turning off the
 InterruptThrottleRate feature of the card (with both the e1000e and ec_e1000e driver), but with no effect.
<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Below is the code that I&rsquo;m using to run the test, which is based off the &ldquo;mini&rdquo; example. Can anyone tell me what I&rsquo;m doing wrong, or if there is some feature in the e1000e driver that I need to disable?<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks in advance,<p></p></p>
<p class="MsoNormal">Tom<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/version.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/module.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/timer.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/interrupt.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/err.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/semaphore.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/time.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>#if</span><span> LINUX_VERSION_CODE &gt;= KERNEL_VERSION(2, 6, 27)<p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;linux/semaphore.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#else</span><span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>&lt;asm/semaphore.h&gt;</span><p></p></span></p>
<p class="MsoNormal"><span>#endif</span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>#define</span><span> MY_PRIORITY (49)
<span>/* we use 49 as the PRREMPT_RT use 50</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as the priority of kernel tasklets</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and interrupt handler by default */</span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>#define</span><span> MAX_SAFE_STACK (8*1024)
<span>/* The maximum stack size which is</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; guaranteed safe to access without</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; faulting */</span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>// #define NSEC_PER_SEC&nbsp;&nbsp;&nbsp; (1000000000) /* The number of nsecs per sec. */</span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>#define</span><span> PFX
<span>"durability.c: "</span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>"/home/tbj/srcroot/ethercat/include/ecrt.h"</span> <span>
// EtherCAT realtime interface</span><p></p></span></p>
<p class="MsoNormal"><span><p></p></span></p>
<p class="MsoNormal"><span>/*</span><span><p></p></span></p>
<p class="MsoNormal"><span>* Import the bus topology generated by EtherLAB</span><span><p></p></span></p>
<p class="MsoNormal"><span>*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>#include</span><span>
<span>"2369topology.h"</span><p></p></span></p>
<p class="MsoNormal"><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;<p></p></span></p>
<p class="MsoNormal"><span>/*</span><span><p></p></span></p>
<p class="MsoNormal"><span>* Application Parameters</span><span><p></p></span></p>
<p class="MsoNormal"><span>*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> FREQUENCY 2000<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> INHIBIT_TIME 20<p></p></span></p>
<p class="MsoNormal"><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;<p></p></span></p>
<p class="MsoNormal"><span>// process data</span><span><p></p></span></p>
<p class="MsoNormal"><span>static</span><span> uint8_t *processData = NULL;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>/*</span><span><p></p></span></p>
<p class="MsoNormal"><span>* macros for any of the hardware on the network.</span><span><p></p></span></p>
<p class="MsoNormal"><span>* Use # ethercat slaves to see this info</span><span><p></p></span></p>
<p class="MsoNormal"><span>* You can also use # ethercat cstruct &gt; topology.h to generate a slave header.</span><span><p></p></span></p>
<p class="MsoNormal"><span>* The vendor id and product code for each slave will be listed in comments in that file.</span><span><p></p></span></p>
<p class="MsoNormal"><span>*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EK1100 0x00000002, 0x044c2c52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// uint32_t vendor_id, uint32_t product_code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EL1004 0x00000002, 0x03ec3052<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EL5101 0x00000002, 0x13ed3052<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EL2004 0x00000002, 0x07d43052<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EL6601 0x00000002, 0x19c93052<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> SMC_EX260SEC3 0x00000114, 0x01000003<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EP1809 0x00000002, 0x07114052<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EP2028 0x00000002, 0x07ec4052<p></p></span></p>
<p class="MsoNormal"><span>#define</span><span> Beckhoff_EP4174 0x00000002, 0x104e4052<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>/*</span><span><p></p></span></p>
<p class="MsoNormal"><span>* Global variables for interacting with the EtherCAT master.</span><span><p></p></span></p>
<p class="MsoNormal"><span>*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>static</span><span> ec_master_t *master = NULL;<p></p></span></p>
<p class="MsoNormal"><span>static</span><span> ec_master_state_t master_state = {};<p></p></span></p>
<p class="MsoNormal"><span>struct</span><span> semaphore master_sem;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>static</span><span> ec_domain_t *domain = NULL;<p></p></span></p>
<p class="MsoNormal"><span>static</span><span> ec_domain_state_t domain_state = {};<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>// Timer</span><span><p></p></span></p>
<p class="MsoNormal"><span>static</span><span>
<span>struct</span> timer_list timer;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>struct</span><span> timespec lastCycle_;<p></p></span></p>
<p class="MsoNormal"><span>struct</span><span> timespec lastSend_;<p></p></span></p>
<p class="MsoNormal"><span>struct</span><span> timespec lastRead_;<p></p></span></p>
<p class="MsoNormal"><span>struct</span><span> sched_param param;<p></p></span></p>
<p class="MsoNormal"><span>struct</span><span> timespec interval;
<span>// = 50000; /* 50us*/</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>struct</span><span> PdoOffset<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>unsigned</span> <span>int</span> offset;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>unsigned</span> <span>int</span> bitPosition;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>static</span><span>
<span>struct</span> PdoOffset digInOffsets[255];<p></p></span></p>
<p class="MsoNormal"><span>static</span><span>
<span>struct</span> PdoOffset digOutOffsets[255];<p></p></span></p>
<p class="MsoNormal"><span>static</span><span>
<span>struct</span> PdoOffset analogInOffsets[255];<p></p></span></p>
<p class="MsoNormal"><span>static</span><span>
<span>struct</span> PdoOffset analogOutOffsets[255];<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>const</span><span>
<span>static</span> ec_pdo_entry_reg_t domain_regs[] =<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,1, Beckhoff_EL1004, 0x6000, 1, &amp;digInOffsets[0].offset, &amp;digInOffsets[0].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,1, Beckhoff_EL1004, 0x6010, 1, &amp;digInOffsets[1].offset, &amp;digInOffsets[1].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,1, Beckhoff_EL1004, 0x6020, 1, &amp;digInOffsets[2].offset, &amp;digInOffsets[2].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,1, Beckhoff_EL1004, 0x6030, 1, &amp;digInOffsets[3].offset, &amp;digInOffsets[3].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,2, Beckhoff_EL1004, 0x6000, 1, &amp;digInOffsets[4].offset, &amp;digInOffsets[4].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,2, Beckhoff_EL1004, 0x6010, 1, &amp;digInOffsets[5].offset, &amp;digInOffsets[5].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,2, Beckhoff_EL1004, 0x6020, 1, &amp;digInOffsets[6].offset, &amp;digInOffsets[6].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,2, Beckhoff_EL1004, 0x6030, 1, &amp;digInOffsets[7].offset, &amp;digInOffsets[7].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,3, Beckhoff_EL1004, 0x6000, 1, &amp;digInOffsets[8].offset, &amp;digInOffsets[8].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,3, Beckhoff_EL1004, 0x6010, 1, &amp;digInOffsets[9].offset, &amp;digInOffsets[9].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,3, Beckhoff_EL1004, 0x6020, 1, &amp;digInOffsets[10].offset, &amp;digInOffsets[10].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,3, Beckhoff_EL1004, 0x6030, 1, &amp;digInOffsets[11].offset, &amp;digInOffsets[11].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6000, 1, &amp;digInOffsets[12].offset, &amp;digInOffsets[12].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6010, 1, &amp;digInOffsets[13].offset, &amp;digInOffsets[13].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6020, 1, &amp;digInOffsets[14].offset, &amp;digInOffsets[14].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6030, 1, &amp;digInOffsets[15].offset, &amp;digInOffsets[15].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6040, 1, &amp;digInOffsets[16].offset, &amp;digInOffsets[16].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6050, 1, &amp;digInOffsets[17].offset, &amp;digInOffsets[17].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6060, 1, &amp;digInOffsets[18].offset, &amp;digInOffsets[18].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6070, 1, &amp;digInOffsets[19].offset, &amp;digInOffsets[19].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6080, 1, &amp;digInOffsets[20].offset, &amp;digInOffsets[20].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x6090, 1, &amp;digInOffsets[21].offset, &amp;digInOffsets[21].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x60A0, 1, &amp;digInOffsets[22].offset, &amp;digInOffsets[22].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x60B0, 1, &amp;digInOffsets[23].offset, &amp;digInOffsets[23].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x60C0, 1, &amp;digInOffsets[24].offset, &amp;digInOffsets[24].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x60D0, 1, &amp;digInOffsets[25].offset, &amp;digInOffsets[25].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x60E0, 1, &amp;digInOffsets[26].offset, &amp;digInOffsets[26].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,9, Beckhoff_EP1809, 0x60F0, 1, &amp;digInOffsets[27].offset, &amp;digInOffsets[27].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,4, Beckhoff_EL5101, 0x6010, 0x11, &amp;analogInOffsets[0].offset, &amp;analogInOffsets[0].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,5, Beckhoff_EL2004, 0x7000, 1, &amp;digOutOffsets[0].offset, &amp;digOutOffsets[0].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,5, Beckhoff_EL2004, 0x7010, 1, &amp;digOutOffsets[1].offset, &amp;digOutOffsets[1].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,5, Beckhoff_EL2004, 0x7020, 1, &amp;digOutOffsets[2].offset, &amp;digOutOffsets[2].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,5, Beckhoff_EL2004, 0x7030, 1, &amp;digOutOffsets[3].offset, &amp;digOutOffsets[3].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,6, Beckhoff_EL2004, 0x7000, 1, &amp;digOutOffsets[4].offset, &amp;digOutOffsets[4].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,6, Beckhoff_EL2004, 0x7010, 1, &amp;digOutOffsets[5].offset, &amp;digOutOffsets[5].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,6, Beckhoff_EL2004, 0x7020, 1, &amp;digOutOffsets[6].offset, &amp;digOutOffsets[6].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,6, Beckhoff_EL2004, 0x7030, 1, &amp;digOutOffsets[7].offset, &amp;digOutOffsets[7].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7000, 1, &amp;digOutOffsets[8].offset, &amp;digOutOffsets[8].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7010, 1, &amp;digOutOffsets[9].offset, &amp;digOutOffsets[9].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7020, 1, &amp;digOutOffsets[10].offset, &amp;digOutOffsets[10].bitPosition},&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7030, 1, &amp;digOutOffsets[11].offset, &amp;digOutOffsets[11].bitPosition},&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7040, 1, &amp;digOutOffsets[12].offset, &amp;digOutOffsets[12].bitPosition},&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7050, 1, &amp;digOutOffsets[13].offset, &amp;digOutOffsets[13].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7060, 1, &amp;digOutOffsets[14].offset, &amp;digOutOffsets[14].bitPosition},&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,10, Beckhoff_EP2028, 0x7070, 1, &amp;digOutOffsets[15].offset, &amp;digOutOffsets[15].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Encoder card registers for setting the counter</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,4, Beckhoff_EL5101, 0x7010, 0x03, &amp;analogOutOffsets[0].offset, &amp;analogOutOffsets[0].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,4, Beckhoff_EL5101, 0x7010, 0x11, &amp;analogOutOffsets[1].offset, &amp;analogOutOffsets[1].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// The bits of two bytes covers the valves on the block</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,8, SMC_EX260SEC3, 0x3101, 0x01, &amp;analogOutOffsets[2].offset, &amp;analogOutOffsets[2].bitPosition},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,8, SMC_EX260SEC3, 0x3101, 0x02, &amp;analogOutOffsets[3].offset, &amp;analogOutOffsets[3].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,11, Beckhoff_EP4174, 0x7000, 0x11, &amp;analogOutOffsets[4].offset, &amp;analogOutOffsets[4].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,11, Beckhoff_EP4174, 0x7010, 0x11, &amp;analogOutOffsets[5].offset, &amp;analogOutOffsets[5].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,11, Beckhoff_EP4174, 0x7020, 0x11, &amp;analogOutOffsets[6].offset, &amp;analogOutOffsets[6].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0,11, Beckhoff_EP4174, 0x7030, 0x11, &amp;analogOutOffsets[7].offset, &amp;analogOutOffsets[7].bitPosition},<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {}<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;<p></p></span></p>
<p class="MsoNormal"><span>// process variables</span><span><p></p></span></p>
<p class="MsoNormal"><span>static</span><span>
<span>unsigned</span> <span>int</span> counter = 0;<p></p></span></p>
<p class="MsoNormal"><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;<p></p></span></p>
<p class="MsoNormal"><span>/*</span><span><p></p></span></p>
<p class="MsoNormal"><span>* Check and report on the state of the domain.</span><span><p></p></span></p>
<p class="MsoNormal"><span>*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>void</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>check_domain_state(<span>void</span>)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ec_domain_state_t ds;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; down(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_domain_state(domain, &amp;ds);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; up(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ds.working_counter != domain_state.working_counter)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Domain: WC %u.\n"</span>, ds.working_counter);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ds.wc_state != domain_state.wc_state)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Domain: State %u.\n"</span>, ds.wc_state);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain_state = ds;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>/*</span><span><p></p></span></p>
<p class="MsoNormal"><span>* Check and report on the state of the master service.</span><span><p></p></span></p>
<p class="MsoNormal"><span>*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>void</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>check_master_state(<span>void</span>)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ec_master_state_t ms;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; down(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_master_state(master, &amp;ms);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; up(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ms.slaves_responding != master_state.slaves_responding)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"%u slave(s).\n"</span>, ms.slaves_responding);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ms.al_states != master_state.al_states)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"AL states: 0x%02X.\n"</span>, ms.al_states);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ms.link_up != master_state.link_up)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Link is %s.\n"</span>, ms.link_up ? <span>
"up"</span> : <span>"down"</span>);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master_state = ms;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>void</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>check_slave_config_states(<span>void</span>)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>/*</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp; ec_slave_config_state_t s;</span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp; ecrt_slave_config_state(sc_ana_in, &amp;s);</span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp; if (s.al_state != sc_ana_in_state.al_state)</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX "AnaIn: State 0x%02X.\n", s.al_state);</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp; if (s.online != sc_ana_in_state.online)</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX "AnaIn: %s.\n", s.online ? "online" : "offline");</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp; if (s.operational != sc_ana_in_state.operational)</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX "AnaIn: %soperational.\n",</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s.operational ? "" : "Not ");</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;<p></p></span></p>
<p class="MsoNormal"><span>void</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>cyclic_task(<span>unsigned</span>
<span>long</span> data)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// receive process data</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; down(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_master_receive(master);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_domain_process(domain);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; up(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ktime_get_ts(&amp;lastCycle_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// check process data state (optional)</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; check_domain_state();<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (counter) <p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; counter--;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>else</span> <p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; counter = FREQUENCY;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// check for master state</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; check_master_state();<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// send process data</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; down(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_domain_queue(domain);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_master_send(master);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; up(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// restart timer</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp; timer.expires += HZ / FREQUENCY;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp; add_timer(&amp;timer);&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>void</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>send_callback(<span>void</span> *cb_data)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>struct</span> timespec delta = timespec_sub(lastCycle_, lastSend_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ec_master_t *m = NULL;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"send_callback"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (timespec_compare(&amp;delta, &amp;interval) &gt; 0)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"ecrt_master_send_ext"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m = (ec_master_t *) cb_data;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; down(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_master_send_ext(m);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; up(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ktime_get_ts(&amp;lastSend_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>void</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>receive_callback(<span>void</span> *cb_data)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>struct</span> timespec delta = timespec_sub(lastCycle_, lastRead_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ec_master_t *m = NULL;<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"receive_callback"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (timespec_compare(&amp;delta, &amp;interval) &gt; 0)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"ecrt_master_receive"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m = (ec_master_t *) cb_data;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; down(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_master_receive(m);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; up(&amp;master_sem);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ktime_get_ts(&amp;lastRead_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;<p></p></span></p>
<p class="MsoNormal"><span>int</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>__init init_mini_module(<span>void</span>)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp; ec_slave_config_t *sc;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;
<span>int</span> ret = -1;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>/*</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Requests an EtherCAT master for realtime operation.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Before an application can access an EtherCAT master, it has to reserve one for exclusive use.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * In userspace, this is a convenience function for ecrt_open_master() and ecrt_master_reserve().</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * This function has to be the first function an application has to call to use EtherCAT.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* The function takes the index of the master as its argument.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* The first master has index 0, the n-th master has index n - 1.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* The number of masters has to be specified when loading the master module.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp; master = ecrt_request_master(0);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;
<span>if</span> (!master)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Could not connect to the master service. Exiting.\n\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -EBUSY;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_return;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ktime_get_ts(&amp;lastCycle_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ktime_get_ts(&amp;lastSend_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ktime_get_ts(&amp;lastRead_);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// setup a comparison</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interval.tv_nsec = 50000;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sema_init(&amp;master_sem, 1);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_master_callbacks(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// pointer to master</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; send_callback, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// fp to send ext callback</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; receive_callback, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// fp to receive callback</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// parameter to callback</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>/*</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Creates a new process data domain.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * For process data exchange, at least one process data domain is needed.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* This method creates a new process data domain and returns a pointer to the new domain object.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* This object can be used for registering PDOs and exchanging them in cyclic operation.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain = ecrt_master_create_domain(master);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!domain)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Could not create a domain on the master. Exiting.\n\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Register the slaves on the master</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Doing the method this way means the registration will work whether or</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * not the computer is connected to the network.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Main Rack, Slot 1</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,1, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EL1004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_1_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Main Rack, Slot 2</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,2, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EL1004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_2_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Main Rack, Slot 3</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,3, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EL1004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_3_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Main Rack, Slot 4</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,4, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EL5101&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_4_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Main Rack, Slot 5</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,5, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EL2004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_5_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Main Rack, Slot 6</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,6, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EL2004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_6_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Main Rack, Slot 7</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,7, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EL6601&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_7_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// SMC EtherCAT Manifold, Slave 8, "EX260-SEC3"</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,8, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SMC_EX260SEC3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_8_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// EP1809 Input Fieldbox, Slave 9,</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,9, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EP1809&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_9_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// EP2028 Input Fieldbox, Slave 10,</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,10, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EP2028&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_10_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// EP4174 Input Fieldbox, Slave 11,</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(sc = ecrt_master_slave_config(<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master,
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,11, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Bus position</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beckhoff_EP4174&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Slave type</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to get slave configuration.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_slave_config_pdos(sc, EC_END, slave_11_syncs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"Failed to configure PDOs.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>// Create configuration for bus coupler</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sc = ecrt_master_slave_config(master, 0,0, Beckhoff_EK1100);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;
<span>if</span> (!sc)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -ENOMEM;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>/* </span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* Registers a bunch of PDO entries for a domain.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"\nAttempting to register PDOs on domain...\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_domain_reg_pdo_entry_list(domain, domain_regs))
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_ERR PFX
<span>"PDO entry registration failed!\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -EBUSY;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>/*</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Finishes the configuration phase and prepares for cyclic operation.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * This function tells the master that the configuration phase is finished and the realtime operation will begin.</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * The function allocates internal memory for the domains and calculates the logical FMMU addresses for domain members.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* It tells the master state machine that the bus configuration is now to be applied</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (ecrt_master_activate(master))<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -EBUSY;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>/*</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Returns the domain's process data.
</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;*/</span><span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>if</span> (!(processData = ecrt_domain_data(domain))) <p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = -EBUSY;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>goto</span> out_release_master;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Starting cyclic thread.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; init_timer(&amp;timer);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timer.function = cyclic_task;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timer.expires = jiffies + 10;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; add_timer(&amp;timer);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Durability Service Started.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>return</span> 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>out_release_master:<p></p></span></p>
<p class="MsoNormal"><span>&nbsp; printk(KERN_ERR PFX
<span>"Releasing master...\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp; ecrt_release_master(master);<p></p></span></p>
<p class="MsoNormal"><span>out_return:<p></p></span></p>
<p class="MsoNormal"><span>&nbsp; printk(KERN_ERR PFX
<span>"Failed to load. Aborting.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>return</span> ret;<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<span>// main</span><p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></span></p>
<p class="MsoNormal"><span>void</span><span>
<p></p></span></p>
<p class="MsoNormal"><span>__exit cleanup_mini_module(<span>void</span>)<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Stopping...\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; del_timer_sync(&amp;timer);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Releasing master...\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ecrt_release_master(master);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_INFO PFX
<span>"Unloading.\n"</span>);<p></p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>/*****************************************************************************/</span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>MODULE_LICENSE(<span>"GPL"</span>);<p></p></span></p>
<p class="MsoNormal"><span>MODULE_AUTHOR(<span>"Thomas Bitsky &lt;tbj@...&gt;"</span>);<p></p></span></p>
<p class="MsoNormal"><span>MODULE_DESCRIPTION(<span>"Durability test environment"</span>);<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>module_init(init_mini_module);<p></p></span></p>
<p class="MsoNormal"><span>module_exit(cleanup_mini_module);<p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
</div>
Thomas Bitsky Jr | 1 Jul 01:23 2013

EtherCAT master 1.5.1 -- frame rate limited to 250/sec

 

Hello,

 

I have 1.5.1 EtherCAT Master running on two machines: one is Intel-Atom based with two e1000e network interfaces, the other is a core i7 with an Intel 82579LM Ethernet interface. The operating system is Ubuntu 10.04LTS running the 2.6.33.7.2-rt30 kernel (RT PREEMPT).

 

A year ago, I was able to get the EtherLAB EtherCAT master up and running on similar computers with frame rates around 2000/sec. However, despite running the same program from a year ago with the same hardware, I can’t get the frame rate to exceed 250/sec on either machine. With both the generic and e1000e drivers, the results are exactly the same (which is odd).

 

I saw this in the mailing list archives:

[snip]

Now as I understand the product to get an update rate of 10 micro

seconds for a small number of IO (that's what we have) we need to get

the tx frame rate much higher than the standard 250/sec.

 

[/snip]

 

Is the frame rate capped at 250/sec? Is there a setting I need to change, or some configuration I can modify? I suspect there is something easy and stupid I am overlooking, but I’m at a loss.

 

Thanks in advance for any feedback.

 

Thanks

Tom

 

<div>
<div class="WordSection1">
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Hello,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I have 1.5.1 EtherCAT Master running on two machines: one is Intel-Atom based with two e1000e network interfaces, the other is a core i7 with an Intel 82579LM Ethernet interface. The operating system is Ubuntu 10.04LTS running the 2.6.33.7.2-rt30
 kernel (RT PREEMPT).<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">A year ago, I was able to get the EtherLAB EtherCAT master up and running on similar computers with frame rates around 2000/sec. However, despite running the same program from a year ago with the same hardware, I can&rsquo;t get the frame rate
 to exceed 250/sec on either machine. With both the generic and e1000e drivers, the results are exactly the same (which is odd).<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I saw this in the mailing list archives:<p></p></p>
<p class="MsoNormal">[snip]<p></p></p>
<p class="MsoNormal"><span>Now as I understand the product to get an update rate of 10 micro<p></p></span></p>
<p class="MsoNormal"><span>seconds for a small number of IO (that's what we have) we need to get<p></p></span></p>
<p class="MsoNormal"><span>the tx frame rate much higher than the standard 250/sec.<p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">[/snip]<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Is the frame rate capped at 250/sec? Is there a setting I need to change, or some configuration I can modify? I suspect there is something easy and stupid I am overlooking, but I&rsquo;m at a loss.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks in advance for any feedback.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks<p></p></p>
<p class="MsoNormal">Tom<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
</div>
Thomas Bitsky Jr | 27 Jun 03:40 2013

Cross Compile for ARM

 

I’m trying to cross-compile the EtherCAT master for an ARM board. I successfully built a Linux RT Prempt kernel for the device.  On my development machine, the source tree where I built the kernel is at: ~/srcroot/linux/linux-3.2.46

 

I moved into the EtherLAB directory and issued:

 

./configure --host=arm-linux --enable-generic --with-linux-dir=~/srcroot/linux/linux-3.2.46

 

The result is:

 

No configured Linux kernel sources in ~/srcroot/linux/linux-3.2.46/

 

But I just built a kernel there. Is there something I have to do to the source tree to get it ready to build the ethercat master?

 

Thanks in advance,

Tome

 

<div>
<div class="WordSection1">
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I&rsquo;m trying to cross-compile the EtherCAT master for an ARM board. I successfully built a Linux RT Prempt kernel for the device. &nbsp;On my development machine, the source tree where I built the kernel is at: ~/srcroot/linux/linux-3.2.46<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I moved into the EtherLAB directory and issued:<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">./configure --host=arm-linux --enable-generic --with-linux-dir=~/srcroot/linux/linux-3.2.46<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">The result is:<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">No configured Linux kernel sources in ~/srcroot/linux/linux-3.2.46/<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">But I just built a kernel there. Is there something I have to do to the source tree to get it ready to build the ethercat master?<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks in advance,<p></p></p>
<p class="MsoNormal">Tome<span><p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
</div>
Graeme Foot | 20 Jun 00:42 2013

Re: How to install and use Etherlab for a Xenomaitarget

Hi,

 

We are using a Beckhoff CX2020 computer.  We are running it as a non-gui controller with:

 

Linux 2.6.32.11

RTAI 3.8.1

EtherLabs 1.5.2

 

The CX2020 has two e1000e NICs for the office network.  The EtherCAT NIC is part of the CX2100-0004 power module but this is specialised hardware and we needed to write our own driver for it (submitted to the etherlab forum a while ago).

 

We are building our Linux environment using Buildroot so that it is very small.

 

 

Linux 2.6.32 does not support the graphics card for this PC but we are running it headless so not a problem for us.  In the future we are intending to integrate our gui onto the same PC but we are waiting on RTAI and a few other things to come together first.

 

 

Regards,

 

Graeme Foot

 

From: Steffen Dalgard [mailto:steffen.sint-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
Sent: Thursday, 20 June 2013 00:42
To: Graeme Foot
Subject: Re: [etherlab-users] How to install and use Etherlab for a Xenomaitarget

 

Hi,

Thank you for your feedback,

We have tried to find a release supporting newer HW that has support for Ehterlab, Ubuntu and Xenomai.

It seems to be hard ot find, maybe a dead end.

  We found working Xenomai using Ubuntu 12.04 with a patched 3.5 kernel, but it is not supported by Etherlab

 

We do need a kernel with RT support but not necessarily Xenomai...

 

You wrote that you were using Etherlab master via RTDM, but using RTAI.

Can you share which releases / kernels that you are using?

 

Best regards

Steffen Dalgard

SINTEF ICT

Norway

 

On Thu, May 16, 2013 at 1:11 AM, Graeme Foot <GraemeF-/dx94a6pNkxWk0Htik3J/w@public.gmane.org> wrote:

 

Hi,

 

I have a user space application connecting to the Etherlab master via RTDM, but using RTAI.  In theory xenomai should be pretty similar.

 

If you are using the latest 1.5.2 Etherlab master you won't need a patch.  The patch was to give partial RTDM support before it was fully supported.

 

 

To get RTDM working you will need to specify the correct flags when compiling the master:

  --with-xenomai-dir=<xenomai directory>

  --enable-rtdm

 

All going well you should get a library: /usr/lib/libethercat_rtdm.so

 

When compiling your application link to the library using: -lethercat_rtdm

 

 

With RTAI you can check your application is using RTDM by calling 'cat /proc/rtai/scheduler'.  The syscalls value should remain zero.

 

 

Regards,

Graeme Foot.

 

From: etherlab-users-bounces-TgCWn71uKPpg9hUCZPvPmw@public.gmane.org [mailto:etherlab-users-bounces-TgCWn71uKPpg9hUCZPvPmw@public.gmane.org] On Behalf Of Steffen Dalgard
Sent: Wednesday, 15 May 2013 21:50
To: etherlab-users-TgCWn71uKPpg9hUCZPvPmw@public.gmane.org
Subject: [etherlab-users] How to install and use Etherlab for a Xenomaitarget

 

Hi,

We are trying to install Etherlab on a Xenomai target together with ROS and OROCOS.

The plan is to have a user space rt-application calling the Igh master.

 

Does it exist a procedure for how to get this working?

 

I have tried to read through the mail archive and the examples, but have only found piecewise information.

   I have found mails mentioning patching of driver connecting Etherlab master to user space

   It seems to be special lib libetherkat_rtdm.so

 

Hope someone can help :-)

 

Best regards

Steffen Dalgard

SINTEF ICT

Norway

 

 

<div>

<div class="Section1">

<p class="MsoNormal"><span>Hi,<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>We are using a Beckhoff CX2020
computer.&nbsp; We are running it as a non-gui controller with:<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>Linux 2.6.32.11<p></p></span></p>

<p class="MsoNormal"><span>RTAI 3.8.1<p></p></span></p>

<p class="MsoNormal"><span>EtherLabs 1.5.2<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>The CX2020 has two e1000e NICs for the
office network.&nbsp; The EtherCAT NIC is part of the CX2100-0004 power module
but this is specialised hardware and we needed to write our own driver for it
(submitted to the etherlab forum a while ago).<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>We are building our Linux environment
using Buildroot so that it is very small.<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>Linux 2.6.32 does not support the graphics
card for this PC but we are running it headless so not a problem for us.&nbsp; In
the future we are intending to integrate our gui onto the same PC but we are
waiting on RTAI and a few other things to come together first.<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>Regards,<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>Graeme Foot<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<div>

<div class="MsoNormal" align="center"><span lang="EN-US">

</span></div>

<p class="MsoNormal"><span lang="EN-US">From:</span><span lang="EN-US">
Steffen Dalgard [mailto:steffen.sint@...] <br><span>Sent:</span> Thursday, 20 June 2013 00:42<br><span>To:</span> Graeme Foot<br><span>Subject:</span> Re: [etherlab-users] How
to install and use Etherlab for a Xenomaitarget</span><span lang="EN-US"><p></p></span></p>

</div>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<div>

<div>

<p class="MsoNormal"><span>Hi,<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Thank you for your feedback,<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>We have tried to find a&nbsp;release supporting newer HW that has
support for Ehterlab, Ubuntu and Xenomai.<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>It seems to be hard ot find, maybe a dead end.<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp; We found working Xenomai using Ubuntu 12.04 with a patched 3.5
kernel, but it is not supported by Etherlab<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>We do need a kernel with RT support but not necessarily Xenomai...<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>You wrote that you were using Etherlab master via RTDM, but using RTAI.<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Can you share which&nbsp;releases / kernels that you are using?<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Best regards<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Steffen Dalgard<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>SINTEF ICT<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Norway</span><p></p></p>

</div>

</div>

<div>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<div>

<p class="MsoNormal"><span>On Thu, May 16, 2013 at 1:11 AM, Graeme Foot &lt;<a href="mailto:GraemeF@..." target="_blank">GraemeF@...</a>&gt;
wrote:<p></p></span></p>

<div>

<p class="MsoNormal"><span><a href="https://www.boxbe.com/overview" target="_blank"><span></span></a>Graeme Foot (<a href="mailto:GraemeF@..." target="_blank">GraemeF@...</a>)
is not on <a href="https://www.boxbe.com/approved-list?tc_serial=14152444570&amp;tc_rand=266417122&amp;utm_source=stf&amp;utm_medium=email&amp;utm_campaign=ANNO_MWTP&amp;utm_content=001&amp;token=Hjk5w06MCHsim%2BkE%2BXEMZbTtwqA%2BTXXMJ7spABspVmqlfWvM7lNh80hlUB%2F00a8M&amp;key=eJnd8Q%2BeCThkw7PVpCigMAaxHAX%2BsHy%2FiQ0MxxEI0Ik%3D" target="_blank"><span>your Guest List</span></a> | <a href="https://www.boxbe.com/anno?tc_serial=14152444570&amp;tc_rand=266417122&amp;utm_source=stf&amp;utm_medium=email&amp;utm_campaign=ANNO_MWTP&amp;utm_content=001&amp;token=Hjk5w06MCHsim%2BkE%2BXEMZbTtwqA%2BTXXMJ7spABspVmqlfWvM7lNh80hlUB%2F00a8M&amp;key=eJnd8Q%2BeCThkw7PVpCigMAaxHAX%2BsHy%2FiQ0MxxEI0Ik%3D" target="_blank"><span>Approve sender</span></a> | <a href="https://www.boxbe.com/anno?tc_serial=14152444570&amp;tc_rand=266417122&amp;utm_source=stf&amp;utm_medium=email&amp;utm_campaign=ANNO_MWTP&amp;utm_content=001&amp;dom&amp;token=Hjk5w06MCHsim%2BkE%2BXEMZbTtwqA%2BTXXMJ7spABspVmqlfWvM7lNh80hlUB%2F00a8M&amp;key=eJnd8Q%2BeCThkw7PVpCigMAaxHAX%2BsHy%2FiQ0MxxEI0Ik%3D" target="_blank"><span>Approve domain</span></a> <p></p></span></p>

</div>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<div vlink="purple" link="blue">

<div>

<p class="MsoNormal"><span>Hi,</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>I have a user space application connecting to the Etherlab master
via RTDM, but using RTAI.&nbsp; In theory xenomai should be pretty similar.</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>If you are using the latest 1.5.2 Etherlab master you won't need a
patch.&nbsp; The patch was to give partial RTDM support before it was fully
supported.</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>To get RTDM working you will need to specify the correct flags when
compiling the master:</span><p></p></p>

<p class="MsoNormal"><span>&nbsp; --with-xenomai-dir=&lt;xenomai directory&gt;</span><p></p></p>

<p class="MsoNormal"><span>&nbsp; --enable-rtdm</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>All going well you should get a library:
/usr/lib/libethercat_rtdm.so</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>When compiling your application link to the library using:
-lethercat_rtdm</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>With RTAI you can check your application is using RTDM by calling
'cat /proc/rtai/scheduler'.&nbsp; The syscalls value should remain zero.</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<p class="MsoNormal"><span>Regards,</span><p></p></p>

<p class="MsoNormal"><span>Graeme Foot.</span><p></p></p>

<p class="MsoNormal"><span>&nbsp;</span><p></p></p>

<div>

<div class="MsoNormal" align="center"><span lang="EN-US">

</span></div>

<p class="MsoNormal"><span lang="EN-US">From:</span><span lang="EN-US"> <a href="mailto:etherlab-users-bounces@..." target="_blank">etherlab-users-bounces@...</a>
[mailto:<a href="mailto:etherlab-users-bounces@..." target="_blank">etherlab-users-bounces@...</a>]
<span>On Behalf Of </span>Steffen Dalgard<br><span>Sent:</span> Wednesday, 15 May 2013 21:50<br><span>To:</span> <a href="mailto:etherlab-users@..." target="_blank">etherlab-users@...</a><br><span>Subject:</span> [etherlab-users] How to
install and use Etherlab for a Xenomaitarget</span><p></p></p>

</div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

<div>

<div>

<p class="MsoNormal"><span>Hi,<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>We are trying to
install Etherlab on a Xenomai target together with ROS and OROCOS.<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>The plan is to
have a user space rt-application calling the Igh master.<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Does it exist a
procedure for how to get this working?<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>I have tried to
read through the mail archive and the examples, but have only found piecewise information.<p></p></span></p>

</div>

<div>

<div>

<p class="MsoNormal"><span>&nbsp;&nbsp; I
have found mails mentioning patching of driver connecting Etherlab master to
user space<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;&nbsp; It
seems to be special lib </span><span>libetherkat_rtdm.so</span><p></p></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Hope someone can
help :-)<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Best regards<p></p></span></p>

</div>

</div>

<div>

<p class="MsoNormal"><span>Steffen Dalgard<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>SINTEF ICT<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Norway</span><p></p></p>

</div>

</div>

</div>

</div>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

</div>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

</div>

</div>

</div>
Hassan FIdai | 19 Jun 19:22 2013
Picon

Problem in running etherlab

Hi, 
I am trying to run etherLAB. I have installed RTAI, ethercat master 1.5.2 and etherLAB 1.3-rc3. I am using ubuntu 12.04. But now when I try to run it i get the following error

Starting EtherLab AppCoreinsmod: error inserting '/usr/realtime/modules/rtai_up.ko': -1 Invalid module format

Can someone please help me out with this?

Regards

--
M. Hassan Fidai
<div><div dir="ltr">
<span>Hi,&nbsp;</span><div>I am trying to run etherLAB. I have installed RTAI, ethercat master 1.5.2 and etherLAB 1.3-rc3. I am using ubuntu 12.04. But now when I try to run it i get the following error</div>
<div><br></div>
<div>
<div>Starting EtherLab AppCoreinsmod: error inserting '/usr/realtime/modules/rtai_up.ko': -1 Invalid module format</div>
<div><br></div>
<div>Can someone please help me out with this?</div>
<div><br></div>
<div>Regards</div>
</div>
<div><br></div>-- <br>M. Hassan Fidai
</div></div>
Gianluca Medini | 19 Jun 16:35 2013
Picon

LRW datagram on TI-ICE development board

Hi all,
I'm playing with IGH on a Texas instruments ICE development kit.
The process image has input (5 bytes) and outputs (7 bytes) , so the 
master configures FMMU in order to have a single datagram LRW.
The data size of the LRW is 12 bytes, although should optimize to 7; 
I've analyzed the wireshark capture of  twincat on the same hardware and 
it make this optimization (an image of 7 bytes).
With this not optimized configuration of FMMU the boards doesn't work (I 
think is problem on the ESC controller, I've checked this), however I 
was wondering if making this optimization could be a desiderable behaviour.
There is some compilation switch / parameter on IGH  that  can modify 
this behaviour ?

Regards
Gianluca Medini

-- 
Dott. Gianluca Medini
Eurosoft S.r.l.
Via Ettore Majorana, 40
Zona Industriale Fontanelle
Località CAPANNE
Montopoli Valdarno PI
ufficio (+39) 0571 261919
mobile : (+39) 335 7001588

Qualora questo messaggio fosse da Voi ricevuto per errore, vogliate cortesemente darcene notizia a mezzo
fax (oppure e-mail) e distruggere il messaggio stesso. Qualsiasi utilizzo e/o conservazione dei dati
ricevuti per errore, costituisce violazione delle disposizioni del D.Lgs 196/03 sulla tutela dei Dati Personali.

Attachment (gianluca.vcf): text/x-vcard, 276 bytes
Hi all,
I'm playing with IGH on a Texas instruments ICE development kit.
The process image has input (5 bytes) and outputs (7 bytes) , so the 
master configures FMMU in order to have a single datagram LRW.
The data size of the LRW is 12 bytes, although should optimize to 7; 
I've analyzed the wireshark capture of  twincat on the same hardware and 
it make this optimization (an image of 7 bytes).
With this not optimized configuration of FMMU the boards doesn't work (I 
think is problem on the ESC controller, I've checked this), however I 
was wondering if making this optimization could be a desiderable behaviour.
There is some compilation switch / parameter on IGH  that  can modify 
this behaviour ?

Regards
Gianluca Medini

--

-- 
Dott. Gianluca Medini
Eurosoft S.r.l.
Via Ettore Majorana, 40
Zona Industriale Fontanelle
Località CAPANNE
Montopoli Valdarno PI
ufficio (+39) 0571 261919
mobile : (+39) 335 7001588

Qualora questo messaggio fosse da Voi ricevuto per errore, vogliate cortesemente darcene notizia a mezzo
fax (oppure e-mail) e distruggere il messaggio stesso. Qualsiasi utilizzo e/o conservazione dei dati
ricevuti per errore, costituisce violazione delle disposizioni del D.Lgs 196/03 sulla tutela dei Dati Personali.

Steffen Dalgard | 19 Jun 15:39 2013
Picon

Ethernet driver support for kernel 3.5

Hi,

We have been able to get Ubuntu 12.04 with Xenomai patch to run at our target.

The procedure unvolves using a 3.5 kernel (not the original 3.2 kernel).

  Details can be found at http://www.stanley.gatech.edu/skelly/uncategorized/installing-xenomai-on-ubuntu-12-04/

 

The 3.5 kernel is now the default kernel for Ubuntu 12.04.2 so I guess it will be there for a while

 

When running the ./configure tool it fails

./configure --with-linux-dir=/lib/modules/3.5.7-xenomai-2.6.2.1/source --disable-8139too --with-xenomai-dir=$xenomai_root --enable-rtdm --enable-e1000e

error: kernel 3.5 not available for e1000e driver!

if i take out the e1000e option it configures but on the make install it fails...

Anyone played with Etherlab and kernel 3.5?

Anyone having Xenomai running at kernel 3.2?

Is it worth trying compiling the 3.4 drivers with the 3.5 kernel? 

Best regards
Steffen Dalgard
SINTEF ICT
Norway

<div><div dir="ltr">

<p>Hi,</p>

<p>We have been able to get Ubuntu 12.04 with Xenomai patch to
run at our target.</p>

<p>The procedure unvolves using a 3.5 kernel (not the original
3.2 kernel).</p>

<p>&nbsp; Details can be found at <a href="http://www.stanley.gatech.edu/skelly/uncategorized/installing-xenomai-on-ubuntu-12-04/">http://www.stanley.gatech.edu/skelly/uncategorized/installing-xenomai-on-ubuntu-12-04/</a></p>

<p>&nbsp;</p>

<p>The 3.5 kernel is now&nbsp;the default kernel for Ubuntu
12.04.2 so I guess it will be there for&nbsp;a while</p>

<p>&nbsp;</p>

<p>When running the ./configure tool it fails</p>

<p><span>./configure
--with-linux-dir=/lib/modules/3.5.7-xenomai-2.6.2.1/source --disable-8139too
--with-xenomai-dir=$xenomai_root --enable-rtdm --enable-e1000e</span></p>

<p><span>error: kernel 3.5 not available for e1000e
driver!</span></p>

<p><span>if i take out the e1000e option it configures
but on the make install it fails...</span></p>

<p><span>Anyone played with Etherlab and
kernel 3.5?</span></p>

<p><span>Anyone having Xenomai running at
kernel 3.2?</span></p>

<p><span>Is it worth trying compiling the
3.4 drivers&nbsp;with the 3.5 kernel?&nbsp;</span></p>

<p><span>Best regards<br>
Steffen Dalgard<br>
SINTEF ICT<br>
Norway</span></p>

</div></div>

Gmane