ClearCore Library
List of all members | Public Member Functions
ClearCore::EthernetManager Class Reference

Detailed Description

ClearCore Ethernet configuration manager.

This class manages setup and access to the Ethernet PHY chip and Ethernet Media Access Controller (GMAC) peripheral.

For more detailed information on the ClearCore Ethernet system, check out the ClearCore Ethernet informational page.

ClearCore Ethernet configuration manager. More...

#include <EthernetManager.h>

Public Member Functions

volatile const bool & PhyLinkActive ()
 Check the link status from the PHY. More...
 
volatile const bool & PhyRemoteFault ()
 Check the remote fault status from the PHY. More...
 
uint8_t * MacAddress ()
 Get the MAC address. More...
 
IpAddress LocalIp ()
 Get the local IP address. More...
 
void LocalIp (IpAddress ipaddr)
 Set the local IP address. More...
 
IpAddress NetmaskIp ()
 Get the netmask IP. More...
 
void NetmaskIp (IpAddress address)
 Set the netmask IP. More...
 
IpAddress GatewayIp ()
 Get the gateway IP address. More...
 
void GatewayIp (IpAddress address)
 Set the gateway IP address. More...
 
IpAddress DnsIp ()
 Get the DNS IP address used for address resolution. More...
 
void DnsIp (IpAddress dns)
 Set the DNS IP address used for address resolution. More...
 
volatile const uint16_t & RetransmissionTimeout ()
 Get the retransmission timeout. More...
 
void RetransmissionTimeout (uint8_t timeout)
 Set the retransmission timeout. More...
 
volatile const uint8_t & RetransmissionCount ()
 Get the retransmission count. More...
 
void RetransmissionCount (uint8_t count)
 Set the retransmission count. More...
 
bool DhcpBegin ()
 Set up DHCP connection to retrieve local IP. More...
 
void Setup ()
 Setup LwIP with the local network interface. More...
 
void Refresh ()
 Perform any necessary periodic Ethernet and LwIP updates. More...
 
volatile const bool & EthernetActive ()
 A flag to indicate whether Ethernet setup has been invoked. More...
 

Member Function Documentation

bool ClearCore::EthernetManager::DhcpBegin ( )
IpAddress ClearCore::EthernetManager::DnsIp ( )

Get the DNS IP address used for address resolution.

Returns
Returns the current default DNS IP address.
void ClearCore::EthernetManager::DnsIp ( IpAddress  dns)

Set the DNS IP address used for address resolution.

Parameters
[in]dnsThe DNS IP address.
Note
Doesn't have any effect when called prior to calling Setup().
volatile const bool& ClearCore::EthernetManager::EthernetActive ( )
inline

A flag to indicate whether Ethernet setup has been invoked.

Returns
true if Ethernet has been set up, false otherwise.
IpAddress ClearCore::EthernetManager::GatewayIp ( )

Get the gateway IP address.

Returns
Returns the gateway IP address.
void ClearCore::EthernetManager::GatewayIp ( IpAddress  address)

Set the gateway IP address.

Note
The gateway IP must be provided when using a static local IP.
Doesn't have any effect when using DHCP.
IpAddress ClearCore::EthernetManager::LocalIp ( )
void ClearCore::EthernetManager::LocalIp ( IpAddress  ipaddr)

Set the local IP address.

Note
The local IP must be provided when using a static local IP. In this case, be sure to specify a valid IP address on the same network as your router/switch. This is probably an address of the form "192.168.x.y". For example, if your router's address is 192.168.0.1, you should use an address of the form 192.168.0.y as long as there isn't a device on the network already that was assigned the same IP address.
Doesn't have any effect when using DHCP.
uint8_t* ClearCore::EthernetManager::MacAddress ( )

Get the MAC address.

Returns
Returns the MAC address as uint8_t pointer type.
IpAddress ClearCore::EthernetManager::NetmaskIp ( )

Get the netmask IP.

Returns
Returns the netmask IP as uint32_t type.
void ClearCore::EthernetManager::NetmaskIp ( IpAddress  address)

Set the netmask IP.

Note
Doesn't have any effect when using DHCP.
The netmask IP must be provided when using a static local IP.
volatile const bool& ClearCore::EthernetManager::PhyLinkActive ( )
inline

Check the link status from the PHY.

Returns
Returns true if the PHY has indicated link up. Returns false if the PHY has indicated link down.
Note
The PHY link should be confirmed before activating transmit and receive of frames through the GMAC.
Examples:
EthernetExamples/EthernetTcpClientHelloWorld/EthernetTcpClientHelloWorld.cpp, EthernetExamples/EthernetTcpServerHelloWorld_automatic/EthernetTcpServerHelloWorld_automatic.cpp, EthernetExamples/EthernetTcpServerHelloWorld_manual/EthernetTcpServerHelloWorld_manual.cpp, and EthernetExamples/EthernetUdpHelloWorld/EthernetUdpHelloWorld.cpp.
volatile const bool& ClearCore::EthernetManager::PhyRemoteFault ( )
inline

Check the remote fault status from the PHY.

Returns
Returns true if the PHY indicates a remote fault.
void ClearCore::EthernetManager::Refresh ( )

Perform any necessary periodic Ethernet and LwIP updates.

Sends all incoming, buffered packets to the LwIP interface. Calls sys_check_timeouts() to perform any necessary LwIP related tasks.

Note
Must be called regularly when actively using Ethernet.
Must NOT be called from an interrupt context.
Examples:
EthernetExamples/EthernetTcpClientHelloWorld/EthernetTcpClientHelloWorld.cpp, EthernetExamples/EthernetTcpServerHelloWorld_automatic/EthernetTcpServerHelloWorld_automatic.cpp, and EthernetExamples/EthernetTcpServerHelloWorld_manual/EthernetTcpServerHelloWorld_manual.cpp.
volatile const uint8_t& ClearCore::EthernetManager::RetransmissionCount ( )
inline

Get the retransmission count.

Returns
The number of times to attempt transmitting before giving up.
void ClearCore::EthernetManager::RetransmissionCount ( uint8_t  count)
inline

Set the retransmission count.

Parameters
[in]countThe retransmission count to be set.
Note
This is really the total transmission count, so you should never set this to a value less than 1.
volatile const uint16_t& ClearCore::EthernetManager::RetransmissionTimeout ( )
inline

Get the retransmission timeout.

Returns
Returns the retransmission timeout in milliseconds.
void ClearCore::EthernetManager::RetransmissionTimeout ( uint8_t  timeout)
inline

Set the retransmission timeout.

Parameters
[in]timeoutThe retransmission timeout interval to be set, in milliseconds.
void ClearCore::EthernetManager::Setup ( )

The documentation for this class was generated from the following file: