Choco OS  V.0.16.9.0
Join to the chocolate world
oc_eth_phy.c File Reference

Stores functions for handling PHY. More...

#include <oc_eth.h>
#include <oc_eth_phy.h>
#include <oc_module.h>
#include <oc_ktime.h>

Go to the source code of this file.

Functions

static oC_ErrorCode_t WriteRegister (oC_ETH_PhyAddress_t PhyAddress, oC_ETH_PhyRegister_t Register, uint32_t Value)
 writes PHY register
 
static oC_ErrorCode_t ReadRegister (oC_ETH_PhyAddress_t PhyAddress, oC_ETH_PhyRegister_t Register, uint32_t *outValue)
 reads PHY register
 
oC_ErrorCode_t oC_ETH_WritePhyRegister (oC_ETH_PhyAddress_t PhyAddress, oC_ETH_PhyRegister_t Register, uint32_t Value)
 writes PHY register More...
 
oC_ErrorCode_t oC_ETH_ReadPhyRegister (oC_ETH_PhyAddress_t PhyAddress, oC_ETH_PhyRegister_t Register, uint32_t *outValue)
 writes PHY register More...
 
oC_ErrorCode_t oC_ETH_PhyReset (oC_ETH_PhyAddress_t PhyAddress)
 resets PHY More...
 
oC_ErrorCode_t oC_ETH_ReadLinkStatus (oC_ETH_PhyAddress_t PhyAddress, oC_Net_LinkStatus_t *outLinkStatus)
 reads link status from the PHY More...
 
oC_ErrorCode_t oC_ETH_SetAutoNegotiation (oC_ETH_PhyAddress_t PhyAddress, bool Enabled, oC_Time_t Timeout)
 enables/disables AutoNegotiation More...
 
oC_ErrorCode_t oC_ETH_SetPhyLoopback (oC_ETH_PhyAddress_t PhyAddress, bool Enabled)
 enables/disables PHY loopback mode More...
 

Detailed Description


Author
Patryk Kubiak
Note
Copyright (C) 2016 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak9.nosp@m.0@gm.nosp@m.ail.c.nosp@m.om

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Definition in file oc_eth_phy.c.

Function Documentation

oC_ErrorCode_t oC_ETH_PhyReset ( oC_ETH_PhyAddress_t  PhyAddress)

The function is for reseting the PHY. It also waits to ensure, that the PHY was successfully reseted.

Parameters
PhyAddressAddress of the external PHY
Returns
code of error or oC_ErrorCode_None if success

Definition at line 121 of file oc_eth_phy.c.

oC_ErrorCode_t oC_ETH_ReadLinkStatus ( oC_ETH_PhyAddress_t  PhyAddress,
oC_Net_LinkStatus_t outLinkStatus 
)

The function is for reading link status from the PHY.

Parameters
PhyAddressAddress of the external PHY
outLinkStatusDestination for the link status
Returns
code of error or oC_ErrorCode_None if success

Definition at line 155 of file oc_eth_phy.c.

oC_ErrorCode_t oC_ETH_ReadPhyRegister ( oC_ETH_PhyAddress_t  PhyAddress,
oC_ETH_PhyRegister_t  Register,
uint32_t *  outValue 
)

The function is for writing registers of the PHY.

Warning
This function is for debug reasons only. It should not be used if you do not know what you are doing!
Parameters
PhyAddressAddress of the external PHY
RegisterRegister to access
ValueValue to write
Returns
code of error or oC_ErrorCode_None if success

Definition at line 97 of file oc_eth_phy.c.

oC_ErrorCode_t oC_ETH_SetAutoNegotiation ( oC_ETH_PhyAddress_t  PhyAddress,
bool  Enabled,
oC_Time_t  Timeout 
)

The function is for enabling/disabling auto negotiation mode

Parameters
PhyAddressAddress of the external PHY
EnabledTrue if it should be enabled
TimeoutMaximum time for operation. If 0, the module will not wait for AutoNegotiation complete
Returns
code of error or oC_ErrorCode_None if success

Definition at line 189 of file oc_eth_phy.c.

oC_ErrorCode_t oC_ETH_SetPhyLoopback ( oC_ETH_PhyAddress_t  PhyAddress,
bool  Enabled 
)

The function is for enabling/disabling auto negotiation mode

Parameters
PhyAddressAddress of the external PHY
EnabledTrue if it should be enabled
Returns
code of error or oC_ErrorCode_None if success

Definition at line 237 of file oc_eth_phy.c.

oC_ErrorCode_t oC_ETH_WritePhyRegister ( oC_ETH_PhyAddress_t  PhyAddress,
oC_ETH_PhyRegister_t  Register,
uint32_t  Value 
)

The function is for writing registers of the PHY.

Warning
This function is for debug reasons only. It should not be used if you do not know what you are doing!
Parameters
PhyAddressAddress of the external PHY
RegisterRegister to access
ValueValue to write
Returns
code of error or oC_ErrorCode_None if success

Definition at line 70 of file oc_eth_phy.c.