# Real-time Ethernet Driver initialization The different Real-time Ethernet Driver modules are selected and parameterized by a Real-time Ethernet Driver specific structure. Each Real-time Ethernet Driver specific structure starts with a common [`EC_T_LINK_PARMS`](#_CPPv415EC_T_LINK_PARMS) structure, followed by some Real-time Ethernet Driver specific members. The common link parameter structure is passed to [`EC_T_INIT_MASTER_PARMS::pLinkParms`](api_general_functions.html.md#_CPPv4N22EC_T_INIT_MASTER_PARMS10pLinkParmsE) with the call of [`emInitMaster()`](api_general_functions.html.md#_CPPv412emInitMaster10EC_T_DWORDPK22EC_T_INIT_MASTER_PARMS) like in the following example: ```cpp /* identify Link Layer in the common struture */ oLinkParmsSockRaw.linkParms.dwSignature = EC_LINK_PARMS_SIGNATURE_SOCKRAW; oLinkParmsSockRaw.linkParms.dwSize = sizeof(EC_T_LINK_PARMS_SOCKRAW); OsSafeStrncpy(oLinkParmsSockRaw.linkParms.szDriverIdent, EC_LINK_PARMS_IDENT_SOCKRAW, EC_DRIVER_IDENT_NAME_SIZE); /* specific Link Layer parameters should be set here */ /* pass Link Layer parameters */ oInitMasterParms.dwSignature = ATECAT_SIGNATURE; oInitMasterParms.dwSize = sizeof(EC_T_INIT_MASTER_PARMS); oInitMasterParms.pLinkParms = &oLinkParmsSockRaw.linkParms; /* more parameters should be set here */ /* initialize master */ emInitMaster(dwInstanceId, &oInitMasterParms); ``` ### struct EC_T_LINK_PARMS ### Public Members ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwSignature [in] Signature of the adapter specific structure containing the [EC_T_LINK_PARMS](#d1/d58/struct_e_c___t___l_i_n_k___p_a_r_m_s) structure ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwSize [in] Size of the adapter specific structure containing the [EC_T_LINK_PARMS](#d1/d58/struct_e_c___t___l_i_n_k___p_a_r_m_s) structure ### [EC_T_LOG_PARMS](api_general_functions.html.md#_CPPv414EC_T_LOG_PARMS) LogParms [in] Logging parameters ### [EC_T_CHAR](toc_api.html.md#_CPPv49EC_T_CHAR) szDriverIdent[EC_DRIVER_IDENT_NAME_SIZE] [in] Name of Link Layer module (driver identification) for Link Layer Selection ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwInstance [in] Instance of the adapter. If EC_LINKUNIT_PCILOCATION is set: contains PCI address. ### [EC_T_LINKMODE](#_CPPv413EC_T_LINKMODE) eLinkMode [in] Mode of operation ### EC_T_CPUSET cpuIstCpuAffinityMask [in] Interrupt service thread CPU affinity mask ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwIstPriority [in] Task priority of the interrupt service task (not used in polling mode) ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwIstStackSize [in] Task stack size ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwLinkSpeed [in] 10, 100, 1000 Mbit/s ### [EC_T_LINKLAYER_TIMINGTASK](#_CPPv425EC_T_LINKLAYER_TIMINGTASK) oLinkLayerTimingTask [in] LinkLayer timimg task parameters ### [EC_T_CHAR](toc_api.html.md#_CPPv49EC_T_CHAR) szLoadPath[EC_DRIVER_PATH_SIZE] [in] Path from which the libraries should be loaded ### enum EC_T_LINKMODE *Values:* ### enumerator EcLinkMode_UNDEFINED Link is in an undefined state, must be polling or interrupt ### enumerator EcLinkMode_INTERRUPT Link is in interrupt mode and is triggered by interrupts ### enumerator EcLinkMode_POLLING Link is in polling mode and is polled periodically ### struct EC_T_LINKLAYER_TIMINGTASK ### Public Members ### [EC_T_LINKLAYER_TIMING](#_CPPv421EC_T_LINKLAYER_TIMING) eLinkLayerTiming [in] LinkLayer timing task mode ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwCycleTimeNsec [in] Cycle time between 2 pfnStartCycle calls in ns. Will be set by the master stack for the link layer. ### EC_T_LINK_STARTCYCLE_CALLBACK pfnStartCycle [in] Callback function called cyclically according to dwCycleTimeNsec ### EC_T_VOID \*pvStartCycleContext [in] Context passed to each pfnStartCycle call ### [EC_T_DWORD](toc_api.html.md#_CPPv410EC_T_DWORD) dwTtsSendOffsetUsec [in] Time between pfnStartCycle call and TTS frame transmission ### EC_T_UINT64 nSystemTime [in] System ### enum EC_T_LINKLAYER_TIMING *Values:* ### enumerator eLinkLayerTiming_Undefined Link Layer Timing is undefined must be TTS or TMR ### enumerator eLinkLayerTiming_TTS Real-time Ethernet Driver Time Triggered Send ### enumerator eLinkLayerTiming_TMR Real-time Ethernet Driver Timer ### enum EC_T_PHYINTERFACE *Values:* ### enumerator ePHY_UNDEFINED Undefined ### enumerator ePHY_FIXED_LINK No PHY access at all ### enumerator ePHY_MII MII 10 / 100 MBit ### enumerator ePHY_RMII Reduced MII, 10 / 100 MBit ### enumerator ePHY_GMII Gigabit MII, 10, 100, 1000 MBit ### enumerator ePHY_SGMII Serial (SERDES) Gigabit MII, 10, 100, 1000 MBit ### enumerator ePHY_RGMII Reduced Gigabit MII, 10, 100, 1000 MBit ### enumerator ePHY_OSDRIVER Get interface type from OS ### enumerator ePHY_RMII_50MHZ ePHY_RMII with 50 MHz clock mode ### enumerator ePhy_10GBASER 10GBASE-R (64b/66b) serial interface, 10 GBit ### enumerator ePhy_25GBASER 25GBASE-R (64b/66b) serial interface, 25 GBit ## Real-time Ethernet Driver instance selection via PCI location For some operating systems it is possible to address the Real-time Ethernet Driver instance using its PCI address as an alternative. To do this, EC_LINKUNIT_PCILOCATION (0x01000000) and the PCI location must be set as [`EC_T_LINK_PARMS::dwInstance`](#_CPPv4N15EC_T_LINK_PARMS10dwInstanceE). On Linux the PCI address can be shown using e.g.: ```console $ lspci | grep Ethernet ``` ```console $ 00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-LM (rev 04) $ 04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection $ 05:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection ``` The format of [`EC_T_LINK_PARMS::dwInstance`](#_CPPv4N15EC_T_LINK_PARMS10dwInstanceE) using PCI bus address is: 0x01bbddff : - bb Bus Number - dd Device Number - ff Function Number ```cpp EC_T_LINK_PARMS::dwInstance = 0x01001900; //"0000:00:19.0" ``` On Windows the integer value displayed in properties dialog must be converted to HEX. E.g the number from the following dialog (PCI bus 11, device 0, function 0) corresponds to 0x010B0000 (bus 0x0B). ![Network Connection Properties Window for the Intel 82574L Gigabit Ethernet adapter showing the physical interface location to be used as a Real-time Ethernet Driver](../Media/Intel82574L.png)