# Real-time Ethernet Driver initialization The different Real-time Ethernet Driver modules are selected and parameterized by a Real-time Ethernet Driver specific structure. The size of the Real-time Ethernet Driver parameter structure depends on the adapter type. All Real-time Ethernet Driver parameter structures start with [`EC_T_LINK_PARMS`](#_CPPv415EC_T_LINK_PARMS) followed by adapter type specific parameters. The linkParms.dwSize must be set to sizeof(EC_T_LINK_PARMS_INTELGBE) or the used structure respectively. It may not be 0. The following example shows how to pass Real-time Ethernet Driver parameters to `emInitMaster()`: ```cpp /* master init parms */ EC_T_INIT_MASTER_PARMS oInitMasterParms; OsMemset(&oInitMasterParms, 0, sizeof(EC_T_INIT_MASTER_PARMS)); /* simulator parms */ EC_T_LINK_PARMS_SIMULATOR oLinkParmsSimulator; OsMemset(&oLinkParmsSimulator, 0, sizeof(EC_T_LINK_PARMS_SIMULATOR)); /* license Link Layer parms */ EC_T_LINK_PARMS_INTELGBE oLinkParmsIntelGbe; OsMemset(&oLinkParmsIntelGbe, 0, sizeof(EC_T_LINK_PARMS_INTELGBE)); /* identify simulator Link Layer in the common structure */ oLinkParmsSimulator.linkParms.dwSignature = EC_LINK_PARMS_SIGNATURE_SIMULATOR; oLinkParmsSimulator.linkParms.dwSize = sizeof(EC_T_LINK_PARMS_SIMULATOR); OsSafeStrncpy(oLinkParmsSimulator.linkParms.szDriverIdent, EC_LINK_PARMS_IDENT_SIMULATOR, EC_DRIVER_IDENT_NAME_SIZE); oLinkParmsSimulator.linkParms.dwInstance = dwSimulatorId; oLinkParmsSimulator.linkParms.eLinkMode = EcLinkMode_POLLING; /* specific simulator parameters should be set here */ /* oLinkParmsSimulator.pbyCnfData = ENI/EXI; */ /* identify license Link Layer in the common structure */ oLinkParmsIntelGbe.linkParms.dwSignature = EC_LINK_PARMS_SIGNATURE_INTELGBE; oLinkParmsIntelGbe.linkParms.dwSize = sizeof(EC_T_LINK_PARMS_INTELGBE); OsSafeStrncpy(oLinkParmsIntelGbe.linkParms.szDriverIdent, EC_LINK_PARMS_IDENT_INTELGBE, EC_DRIVER_IDENT_NAME_SIZE); oLinkParmsIntelGbe.linkParms.dwInstance = 1; /* instance ID of the adapter */ oLinkParmsIntelGbe.linkParms.eLinkMode = EcLinkMode_POLLING; /* specific Link Layer parameters should be set here */ /* oLinkParmsIntelGbe.wRxBufferCnt = 128; */ /* pass license Link Layer parameters to simulator Link Layer */ oLinkParmsSimulator.apLinkParms[0] = (EC_T_LINK_PARMS*)&oLinkParmsIntelGbe; /* more parameters should be set here */ oInitMasterParms.dwSignature = ATECAT_SIGNATURE; oInitMasterParms.dwSize = sizeof(EC_T_INIT_MASTER_PARMS); /* pass simulator Link Layer to master init parms */ oInitMasterParms.pLinkParms = (EC_T_LINK_PARMS*)&oLinkParmsSimulator; /* initialize master */ dwRes = emInitMaster(dwInstanceId, &oInitMasterParms); ``` ### struct EC_T_LINK_PARMS ### Public Members ### [EC_T_DWORD](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](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.html.md#_CPPv414EC_T_LOG_PARMS) LogParms [in] Logging parameters ### [EC_T_CHAR](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](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](api.html.md#_CPPv410EC_T_DWORD) dwIstPriority [in] Task priority of the interrupt service task (not used in polling mode) ### [EC_T_DWORD](api.html.md#_CPPv410EC_T_DWORD) dwIstStackSize [in] Task stack size ### [EC_T_DWORD](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](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](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](api.html.md#_CPPv410EC_T_DWORD) dwTtsSendOffsetUsec [in] Time between pfnStartCycle call and TTS frame transmission ### [EC_T_UINT64](api.html.md#_CPPv411EC_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 the 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). ![Windows network adapter properties dialog showing PCI bus number, device number, and function number for the Intel 82574L used as the Real-time Ethernet Driver instance address](../Media/Intel82574L.png)