[ETH] Phy ID configurable as parameter

This commit is contained in:
brabo
2014-12-05 20:24:00 +01:00
committed by Frantisek Burian
parent c09d2583dd
commit 9cced2c0b4
3 changed files with 24 additions and 17 deletions

View File

@@ -43,11 +43,12 @@
*
* Retrieve the link speed and duplex status of the link.
*
* @param[in] phy uint8_t phy ID of the PHY
* @returns ::phy_status Link status
*/
enum phy_status phy_link_status(void)
enum phy_status phy_link_status(uint8_t phy)
{
return eth_smi_read(1, PHY_REG_CR1) & 0x07;
return eth_smi_read(phy, PHY_REG_CR1) & 0x07;
}
/*---------------------------------------------------------------------------*/
@@ -55,9 +56,10 @@ enum phy_status phy_link_status(void)
*
* Force the autonegotiation and set link speed and duplex mode of the link
*
* @param[in] phy uint8_t phy ID of the PHY
* @param[in] mode enum phy_status Desired link status
*/
void phy_autoneg_force(enum phy_status mode)
void phy_autoneg_force(uint8_t phy, enum phy_status mode)
{
uint16_t bst = 0;
@@ -70,7 +72,7 @@ void phy_autoneg_force(enum phy_status mode)
bst |= PHY_REG_BCR_100M;
}
eth_smi_bit_op(1, PHY_REG_BCR, bst,
eth_smi_bit_op(phy, PHY_REG_BCR, bst,
~(PHY_REG_BCR_AN | PHY_REG_BCR_100M | PHY_REG_BCR_FD));
}
@@ -78,10 +80,12 @@ void phy_autoneg_force(enum phy_status mode)
/** @brief Enable the autonegotiation
*
* Enable the autonegotiation of the link speed and duplex mode
*
* @param[in] phy uint8_t phy ID of the PHY
*/
void phy_autoneg_enable(void)
void phy_autoneg_enable(uint8_t phy)
{
eth_smi_bit_set(1, PHY_REG_BCR, PHY_REG_BCR_AN | PHY_REG_BCR_ANRST);
eth_smi_bit_set(phy, PHY_REG_BCR, PHY_REG_BCR_AN | PHY_REG_BCR_ANRST);
}
/*---------------------------------------------------------------------------*/