4.11. Windriver VxWorks

Optimized Link Layers for VxWorks are available. If none of the optimized Link Layers can be used, the SNARF or EtherLib Link Layer must be selected.

The identification of the Link Layer is done like this:

4.11.1. SysLoSal

If the network adapter is not mapped in the MMU table until the EC-Master stack is started (e.g. by vxBus or a driver), the BSP extension can be used to realize the mapping. To use the LinkLayer in interrupt mode, the BSP extension is required and must be included:

  1. Copy the file <InstallPath>/SDK/Files/VxWorks/sysLoSalAdd.c to the BSP directory

  2. Right before function sysHwInit in sysLib.c insert this line:

    #include "sysLoSalAdd.c"
    
  3. Register the driver in function sysHwInit in sysLib.c:

    Attention

    Not relevant for VxBus or native VxWorks network driver!

    Within the function sysHwInit locate the call:

    pciConfigForeachFunc (0, TRUE, (PCI_FOREACH_FUNC) sysNetPciInit, NULL);
    

    Right after the next line

    endif /* INCLUDE_NETWORK */)
    

    insert one of the following call:

    SLOSAL_sysInitGEI();     /* Intel Pro1000   */
    SLOSAL_sysInitFEI();     /* Intel Pro100    */
    SLOSAL_sysInitRTL8139(); /* Realtek RTL8139 */
    SLOSAL_sysInitRTL8169(); /* Realtek RTL8169/RTL8168/RTl8111 */
    
  4. Rebuild the kernel image

  5. Download to Target The Link Layer module has to be downloaded before the master stack is started. If the register function is not found in the global symbol table of VxWorks an error is given.

4.11.2. VxWorks native

The BSP has to be prepared to support Optimized Link Layers:

  1. To use an optimized Link Layer the adapter memory has to be mapped into VxWorks memory space (VxWorks 5.x only). I.e. for the Intel Pro/100 Link Layer this can be achieved by setting the INCLUDE_FEI_END macro in the BSP configuration file config.h.

  2. To avoid conflicts with the VxWorks network driver which normally will be loaded when INCLUDE_FEI_END is set the file configNet.h has to be adjusted in a way that the network driver is not loaded. The network driver entry has to be removed from the endDevTbl[]:

END_TBL_ENTRY endDevTbl [] =
    {
    :       :       :
    :       :       :
    :       :       :
/*
#ifdef INCLUDE_FEI_END
    {0, FEI82557_LOAD_FUNC, FEI82557_LOAD_STRING, FEI82557_BUFF_LOAN,
    NULL, FALSE},
#endif /* INCLUDE_FEI_END */
*/
    :       :       :
    :       :       :

Warning

Do not call muxDevUnload() for a device managed by a VxBus driver. VxBus drivers expect to call muxDevUnload() themselves in their {vxbDrvUnlink}( ) methods, and instability may result if muxDevUnload() is called for a VxBus network device instance by other code.

See also

The VxWorks Device Driver Developer’s Guide for more information about unloading VxBus network devices

4.11.3. KUKA VxWin

If using KUKA VxWin (Windows runs on top of VxWorks) the network adapter card used for EtherCAT has to be assigned to VxWorks. On APIC systems the interrupt used by the network card has to be activated for VxWorks (configuration file interrupt.config, a detailled description can be found in the VxWin manual). I.e. for the optimized Intel Pro/100 Link Layer the following VxWin support files are located in .../SDK/FILES/I8255X/VXWIN (VxWin version 3.1.1):

  • Windows INF file to assign a Intel Pro/100 network adapter card to VxWorks: RTOS_I82557.inf

  • VxWorks 6.3 image file which maps Intel Pro/100 PCI memory into VxWorks space:

    V3.1.1/VxWorks63/VxWorks63_OPT_PRO100.zip (two files, one with ELF file format to be used by the target server and a second binary file for the VxWin uploader).

The VxWin board support package has to be adjusted prior to using this Link Layer: - I.e. to use the optimized PRO/100 Link Layer the adapter memory has to be mapped into VxWorks memory space. This can be achieved by setting the INCLUDE_FEI_END macro in the BSP configuration file config.h. - To avoid conflicts with the VxWorks network driver which normally will be loaded when INCLUDE_FEI_END is set the file configNet.h has to be adjusted in a way that the network driver is not loaded. The network driver entry has to be removed from the endDevTbl[]:

END_TBL_ENTRY endDevTbl [] =
    {
    :       :       :
    :       :       :
    :       :       :
/*
#ifdef INCLUDE_FEI_END
    {0, FEI82557_LOAD_FUNC, FEI82557_LOAD_STRING, FEI82557_BUFF_LOAN,
    NULL, FALSE},
#endif /* INCLUDE_FEI_END */
*/
    :       :       :
    :       :       :

4.11.4. Freescale TSEC / eTSEC

4.11.4.1. Build instructions for VxWorks

There is no support for the WindRiver DIAB compiler. In order to use this driver in VxWorks BSP’s which are DIAB compiled, this driver should be compiled as C-Code (not C++). The driver should be compiled with the standard WindRiver Workbench settings for a “Downloadable Kernel Module” project with module name “emllETSEC.out”. Recommended compiler flags:

Debug Build:

-DDEBUG

Debug and Release Build:

-xc -std=c99 -DVXWORKS -DNO_PCI_SUPPORT -mspe=no
-xc: Generate C Code, ignore file extension.
-std=c99: Allows use of "//" as comment.
-DVXWORKS Hint for the Os-Layer.
-DNO_PCI_SUPPORT  Don't reference pciLib in VxWorks's Os-Layer.
-mspe=no Forbid generation of code which accesses the SPE unit. EC-Master VxWorks tasks are started without VX_FP_TASK or VX_SPE_TASK flags. Without this option "SPE Unavailable Exception" may raised.

4.11.4.2. VxWorks driver interactions

There may be concurrent accesses by the VxWorks and our driver if the “motetsec” VxWorks driver is configured into the BSP. Due to 3.1.1, this may also happen if the VxWorks driver is disabled (i.e. muxDevUnload() for the specified interface).

The mutex handle, specified by poDrvSpecificParam->oMiiBusMtx can be used to synchronize the concurrent accesses to the MDIO registers. Note that this handle must be created by LinkOsCreateLock(). The LinkOsLock() and LinkOsUnlock() calls in EcDeviceETSEC.cpp can also be changed, so that a native VxWorks mutex handle (SEM_ID) can be used instead. Pseudo code for getting the device mutex (see vxbEtsecEnd.c):

VXB_DEVICE_ID miiDev = vxbInstByNameFind ("motetsec", 0);
ETSEC_DRV_CTRL *pDrvCtrl = miiDev->pDrvCtrl;
semTake(pDrvCtrl->etsecDevSem);
...
semGive(pDrvCtrl->etsecDevSem);

There may also be a VxWorks task running (miiBusMonitor), which periodically checks the link status of attached PHY’s. It is recommended to disable this task in order to avoid potential link problems.

4.11.6. Setting up and running EcMasterDemo

  1. VxWorks OS configuration

    See section VxWorks, SNARF Link Layer or KUKA VxWin, SNARF Link Layer for how to prepare the operating system.

  2. Determine the network interface

    Using the command line option the network interface card and Link Layer to be used in the example application can be determined.

  3. Connection of the EtherCAT slaves

    The slaves have to be connected with the VxWorks system using an Ethernet switch or a patch cable. Local IT infrastructure should not be mixed with EtherCAT modules at the same switch as the EC-Master will send many broadcast packets! EtherCAT requires a 100Mbit/s connection. If the VxWorks network adapter card does not support this speed an 100Mbit/s (!) Ethernet switch has to be used.

  4. Download the example application

    The target has to be started and a target-server connection will have to be established. After this the example application can be downloaded into the target. There may be unresolved symbols in case of a missing Link Layer. For example if the Intel Pro/1000 network driver is not included into the image the following dialog will be shown:

    Message may be safely ignored if using the PRO/100 Link Layer.

  5. Download a Link Layer module

    The Link Layer library (e.g. emllI8255x.out) which contains hardware support for the corresponding NIC must be downloaded. By default the Link Layers emllSnarfGpp / emllSnarfPid are contained with the binary delivery.

  6. Set up a FTP server connection on host

    The demo application needs to load a XML file (eni.xml) for the configuration of the master. This file can be accessed using a FTP server. The screen shot below show, how to configure the FTP server. The directory contents can be checked via FTP using the “ls” command. The file eni.xml will have to be accessed using the default directory.

  7. Check for exclusive hardware access

    Be sure that the network adapter instance dedicated to EtherCAT is not controlled by a VxWorks driver, this can be verified using:

    muxShow
    

    If it is needed, first unload the driver using: (e.g. first instance of the Intel Pro/100):

    muxDevUnload "fei", 1
    

    (e.g. second instance of the Intel Pro/1000):

    muxDevUnload "gei", 2
    

    (e.g. first instance of the Realtek 8139):

    muxDevUnload "rtl", 1
    

    (e.g. first instance of the Realtek 8169):

    muxDevUnload "rtg", 1
    

    (e.g. first instance of the FEC on Freescale iMX platform):

    muxDevUnload "motfec", 1
    

    (e.g. first instance of the ETSEC on Freescale PPC platform):

    muxDevUnload "motetsec", 1
    
  8. Run the example application

    The downloadable module EcMasterDemo.out has to be executed. The configuration file eni.xml will be used and thus has to be accessible in the current working directory. The appropriate Link Layer and network adapter card have to be selected. If the log files shall be written the global variable bLogFileEnb has to be set to 1 prior to starting the demo.

    Loading and running the demo:

    ld<EcMasterDemo.out
    sp EcMasterAppMain,"-f eni.xml -i8254x 1 1 -v 2"
    

    Example:

4.11.7. OS Compiler settings

Besides the general settings from Compiling the EcMasterDemo the following settings are necessary to build the example application for VxWorks.

Extra include paths
<InstallPath>/SDK/INC/VxWorks
<InstallPath>/Examples/Common/VxWorks
Extra source paths
<InstallPath>/Examples/Common/VxWorks
<InstallPath>/Sources/OsLayer/VxWorks
Extra library paths to the main EtherCAT components
<InstallPath>/SDK/LIB/VxWorks

VxWorks V6.1 .. V6.4: In case the SNARF Link Layer shall be used and ifconfig() is available -D IFCONFIG_SUPPORT has to be set.

GNU/PowerPC: -mlongcall compiler option may be needed to avoid relocation offset errors when downloading .out files.