EtherNet/IP™ Adapter3.07.03

◆ EI_API_ADP_getPortState()

uint32_t EI_API_ADP_getPortState ( T *  pAdp_p,
EI_API_ADP_EPortNo_t  portNo_p,
EI_API_ADP_SPortState_t portState_p 
)

Return Interface Speed and Interface Attributes for a given Ethernet port (Instance Attribute IDs: 1, 2).

The EI_API_ADP_getPortState function returns the current value of the Interface Speed attribute and a subset of the Interface Attribute for the specified Ethernet port. Link speed may be either 10 Mbps or 100 Mbps. The interface status flags contain Link Status (up/down) and Half/Full Duplex information. Negotiation Status (bits 2-4 in Attribute ID 2) is not available.

Parameters
[in]pAdp_pPointer to the adapter.
[in]portNo_pPort number.
portState_pPointer to the port state.
Returns
ei_api_adp_error_t Error code.
Return values
EI_API_ADP_OKSuccess.
EI_API_ADP_ERRORGeneral error.
Example
void EI_APP_getPortState(void)
{
EI_API_ADP_getPortState(pAdapter_s, EI_API_ADP_ePort1, &portState);
OSAL_printf("Port 1 %s speed %s %s Duplex\r\n",
portState.link == EI_API_ADP_eLinkUp ? "Up" : "Down",
portState.speed == EI_API_ADP_ePortSpeed_10Mb ? "10 Mbps" :
portState.speed == EI_API_ADP_ePortSpeed_100Mb ? "100 Mbps" : "invalid",
portState.duplex == EI_API_ADP_ePortDuplex_Half ? "Half" :
portState.duplex == EI_API_ADP_ePortDuplex_Full ? "Full" : "invalid"
);
EI_API_ADP_getPortState(pAdapter_s, EI_API_ADP_ePort2, &portState);
OSAL_printf("Port 2 %s speed %s %s Duplex\r\n",
portState.link == EI_API_ADP_eLinkUp ? "Up" : "Down",
portState.speed == EI_API_ADP_ePortSpeed_10Mb ? "10 Mbps" :
portState.speed == EI_API_ADP_ePortSpeed_100Mb ? "100 Mbps" : "invalid",
portState.duplex == EI_API_ADP_ePortDuplex_Half ? "Half" :
portState.duplex == EI_API_ADP_ePortDuplex_Full ? "Full" : "invalid"
);
}
See also
EI_API_ADP_EPortNo_t, EI_API_ADP_SPortState_t
EI_API_ADP_SPortState::link
EI_API_ADP_EPortLink_t link
Definition: EI_API_def.h:247
EI_API_ADP_getPortState
ETHIP_API uint32_t EI_API_ADP_getPortState(T *pAdp_p, EI_API_ADP_EPortNo_t portNo_p, EI_API_ADP_SPortState_t *portState_p)
Return Interface Speed and Interface Attributes for a given Ethernet port (Instance Attribute IDs: 1,...
Definition: EI_API_ADP_stub.c:4596
EI_API_ADP_SPortState
Definition: EI_API_def.h:245
EI_API_ADP_SPortState::duplex
EI_API_ADP_EPortDuplex_t duplex
Definition: EI_API_def.h:249
EI_API_ADP_SPortState::speed
EI_API_ADP_EPortSpeed_t speed
Definition: EI_API_def.h:248