Giter Site home page Giter Site logo

luiskoo / acontis_atemsys Goto Github PK

View Code? Open in Web Editor NEW

This project forked from acontis/atemsys

0.0 0.0 0.0 545 KB

Kernel module that grants direct access to hardware, improving the performance of the LinkLayers, used in the EtherCAT Master Stack Software EC-Master and EtherCAT Network Simulation Software EC-Simulator.

Home Page: https://developer.acontis.com/

License: GNU General Public License v2.0

C 99.50% Makefile 0.50%

acontis_atemsys's Introduction

Kernel module atemsys

Kernel module that grants direct access to hardware, improving the performance of the LinkLayers, used in the EtherCAT Master Stack Software EC-Master and EtherCAT Network Simulation Software EC-Simulator.

It provides usermode access to:

  • PCI configuration space
  • Device IO memory
  • Contiguous DMA memory
  • Single device interrupt

The following diagram shows the architecture of EC-Master on Linux.

ec-masterarchlinux

Installation

Building on the target device

Atemsys can be built natively on the target device:

1) Get the latest version of atemsys

git clone https://github.com/acontis/atemsys.git

2) Install kernel headers if neccessary, e.g.

sudo apt-get install linux-headers-$(uname -r)

ℹ️ If kernel headers cannot be installed, see the cross-compiling section below.

3) Build atemsys

cd atemsys
make modules

3) Load the atemsys module

sudo insmod atemsys.ko

Cross-Compile for a target device

The atemsys kernel module can also be cross compiled for a target device. To do this, the additional parameters ARCH=, CROSS_COMPILE= and KERNELDIR=must be passed to make e.g.:

  • ARM 32 Bit:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KERNELDIR=<path to target kernel dir>
  • ARM 64 Bit:
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- KERNELDIR=<path to target kernel dir>

1) Get the Kernel sources of your desired version. This can be done e.g. in the following ways:

⚠️ Warning: The kernel version and source code must exactly match that installed on the target. Custom kernels with patched sources are often used in embedded devices. Contact the manufacturer for the appropriate sources for your device.

2) Unpack\clone the kernel into directory linux

3) Unpack /proc/config.gz from target into linux directory:

zcat config.gz > linux/.config

4) Prepare kernel:

cd linux
make ARCH=<...> CROSS_COMPILE=<...> oldconfig
make ARCH=<...> CROSS_COMPILE=<...> prepare
make ARCH=<...> CROSS_COMPILE=<...> modules_prepare
cd ..

5) Get the latest version of atemsys

git clone https://github.com/acontis/atemsys.git

6) Build atemsys

cd atemsys
make ARCH=<...> CROSS_COMPILE=<...> KERNELDIR=<path to target kernel dir> modules

7) Load the atemsys module

sudo insmod atemsys.ko

Build with Yocto

There are recipes for creating atemsys with Yocto. Further information can be found here https://github.com/acontis/meta-acontis.

Use atemsys as device tree Ethernet Driver

Atemsys as device tree based platform device driver for the Ethernet MAC can handle several upcoming issues:

  • Latest Linux versions bring more complex power saving behavior. To solve this a Linux driver is necessary to claim the same as the native driver from the Linux power-related management systems.
  • Some PHY configurations are currently not supported by the EC-Master. As Linux driver the atemsys can use the corresponding Linux PHY driver.
  • Systems with 2 Ethernet ports and a shared Mdio bus can be separated more easily between Linux and the EC-Master. The Ethernet port that provides the Mdio bus should be assigned to Linux.

Device tree

The device tree file can be customized before compiling the kernel and modules at <kernel sources>/arch/<cpu architecture>/boot/dts.

On the running system the compiled device tree file can be generally found next to the kernel image, which is normally in the /boot folder of the system. The *.dtb-file can be converted with the device tree compiler

> dtc -I dtb -O dts -f <file name>.dtb -o <file name>.dts

and recompiled with

> dtc -I dts -O dtb -f <file name>.dts -o <file name>.dtb

Customize device tree

  • Assign the Ethernet device tree node to the atemsys device driver by assigning the value atemsys to the compatible property. It is also possible to add atemsys to the existing compatible list
  • Add the properties atemsys-Ident and atemsys-Instance.
    • atemsys-Ident for the name of the link layer
    • atemsys-Instance with the instance number that is to be used by EC-Master.
    • See also EC_LINK_PARMS_IDENT_* in EcLink.h
  • Remove all interrupt properties, like interrupt-parent and interrupts, in the ethernet-phy sub-node.
  • To support PHY reset via a GPIO pin add (with your values)
    • atemsys-phy-reset-gpios = <0x4a 0x05 0x01>;
    • atemsys-phy-reset-duration = <0x0a>;
    • [atemsys-phy-reset-post-delay = <0x64>;]
    • [atemsys-phy-reset-active-high = <0x1>;]]

Example

ℹ️ More example device trees for different platforms can be found in the Wiki.

Ethernet device node for FslFec on Freescale/NXP i.MX6DL


ethernet@02188000 {
  compatible = "atemsys";
  atemsys-Ident = "FslFec";
  atemsys-Instance = <0x1>;
  reg = <0x2188000 0x4000>;
  interrupts-extended = <0x1 0x0 0x76 0x4 0x1 0x0 0x77 0x4>;
  clocks = <0x2 0x75 0x2 0x75 0x2 0xbe>;
  clock-names = "ipg", "ahb", "ptp";
  stop-mode = <0x4 0x34 0x1b>;
  fsl,wakeup_irq = <0x0>;
  status = "okay";
  pinctrl-names = "default";
  pinctrl-0 = <0x3e>;
  phy-mode = "rmii";
  phy-handle = <0x3f>; 
 
  mdio {
    #address-cells = <0x1>;
    #size-cells = <0x0>; 
 
    ethernet-phy@0 {
      reg = <0x0>;
      micrel,led-mode = <0x0>;
      linux,phandle = <0x3f>;
      phandle = <0x3f>;
    };
  };
};

Kernel Modul Parameters

loglevel: Set atemsys log level (Default KERN_INFO(6)) according kernel log level definition.
Example: insmod atemsys loglevel=3

AllowedPciDevices: Select PCI / PCIe devices to be registered by atemsys. By default all PCI network devices are registered. Passing an empty string turns off the PCI driver registration. A semicolon separated list of devices defined by the following format can be passed:
<domain>:<bus>:<device>.<func>
Example: insmod atemsys AllowedPciDevices="0000:01:00.0;0000:02:00.0"

acontis_atemsys's People

Contributors

ec-support avatar maxbachmann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.