MDIO Functions
[MDIO]

Functions

CSL_IDEF_INLINE void CSL_MDIO_getVersionInfo (CSL_MDIO_VERSION *mdioVersionInfo)
CSL_IDEF_INLINE Uint16 CSL_MDIO_getClkDivVal (void)
CSL_IDEF_INLINE void CSL_MDIO_setClkDivVal (Uint16 clkDivVal)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isFaultDetectEnabled (void)
CSL_IDEF_INLINE void CSL_MDIO_enableFaultDetect ()
CSL_IDEF_INLINE void CSL_MDIO_disableFaultDetect ()
CSL_IDEF_INLINE Uint32 CSL_MDIO_isFaultDetected (void)
CSL_IDEF_INLINE void CSL_MDIO_clearFault ()
CSL_IDEF_INLINE Uint32 CSL_MDIO_isPreambleEnabled (void)
CSL_IDEF_INLINE void CSL_MDIO_enablePreamble ()
CSL_IDEF_INLINE void CSL_MDIO_disablePreamble ()
CSL_IDEF_INLINE Uint32 CSL_MDIO_getHighestUserChannel (void)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isStateMachineEnabled (void)
CSL_IDEF_INLINE void CSL_MDIO_enableStateMachine ()
CSL_IDEF_INLINE void CSL_MDIO_disableStateMachine ()
CSL_IDEF_INLINE Uint32 CSL_MDIO_isStateMachineIdle (void)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isPhyAlive (Uint32 phyAddr)
CSL_IDEF_INLINE void CSL_MDIO_clearPhyAliveStatus (Uint32 phyAddr)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isPhyLinked (Uint32 phyAddr)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isUnmaskedLinkStatusChangeIntSet (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_clearUnmaskedLinkStatusChangeInt (Uint32 index)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isMaskedLinkStatusChangeIntSet (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_clearMaskedLinkStatusChangeInt (Uint32 index)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isUnmaskedUserCmdCompleteIntSet (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_clearUnmaskedUserCmdCompleteInt (Uint32 index)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isMaskedUserCmdCompleteIntSet (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_clearMaskedUserCmdCompleteInt (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_enableUserCmdCompleteInterrupt (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_disableUserCmdCompleteInterrupt (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_getUserAccessRegister (Uint32 index, CSL_MDIO_USERACCESS *pUserAccessReg)
CSL_IDEF_INLINE void CSL_MDIO_setUserAccessRegister (Uint32 index, CSL_MDIO_USERACCESS *pUserAccessReg)
CSL_IDEF_INLINE Uint32 CSL_MDIO_isUserAccessPending (Uint32 index)
CSL_IDEF_INLINE void CSL_MDIO_enableLinkStatusChangeInterrupt (Uint32 index, Uint32 phyAddr)
CSL_IDEF_INLINE void CSL_MDIO_disableLinkStatusChangeInterrupt (Uint32 index, Uint32 phyAddr)
CSL_IDEF_INLINE void CSL_MDIO_getUserPhySelect (Uint32 index, CSL_MDIO_USERPHYSEL *pUserPhySelect)

Function Documentation

CSL_IDEF_INLINE void CSL_MDIO_clearFault (  ) 

============================================================================
CSL_MDIO_clearFault

Description
This function clears the 'FAULT' bit of the MDIO control register.

Arguments None

Return Value
None

Pre Condition
None

Post Condition
Clears the 'FAULT' bit of MDIO 'CONTROL_REG'.

Writes
MDIO_CONTROL_REG_FAULT=1

Affects
MDIO_CONTROL_REG_FAULT=0

Example

 *
        // Clear MDIO fault bit
        CSL_MDIO_clearFault ();

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_clearMaskedLinkStatusChangeInt ( Uint32  index  ) 

============================================================================
CSL_MDIO_clearMaskedLinkStatusChangeInt

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERPHYSEL register, this function clears the 'LINKINTMASKED' register contents corresponding to it.

Arguments

 *      index              The PHY selector (0-1) for which the link status change
 *                          bit must be read. Phy selector value 0 corresponds to the
 *                          PHY address programmed in USERPHYSEL0 register and a Phy
 *                          selector value 1 corresponds to the PHY address in 
 *                          USERPHYSEL1 register.
 *   

Return Value
None

Pre Condition
None

Post Condition
Clears the Link change interrupt.

Writes
MDIO_LINK_INT_MASKED_REG

Example

 *      Uint32      index = 0;
       
        CSL_MDIO_clearMaskedLinkStatusChangeInt (index);
	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_clearMaskedUserCmdCompleteInt ( Uint32  index  ) 

============================================================================
CSL_MDIO_clearMaskedUserCmdCompleteInt

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERACCESS register, this function clears the 'USERINTMASKED' register contents corresponding to it.

Arguments

 *      index              The PHY selector (0-1) for which the masked user 
 *                          command complete interrupt bit must be cleared. Phy selector 
 *                          value 0 corresponds to the PHY address used in USERACCESS0
 *                          register and a Phy selector value 1 corresponds to the PHY 
 *                          address in USERACCESS1 register.
 *   

Return Value
None

Pre Condition
None

Post Condition
Clears the User command complete interrupt.

Writes
MDIO_USER_INT_MASKED_REG

Example

 *      Uint32      index = 0;
       
        CSL_MDIO_clearMaskedUserCmdCompleteInt (index);
	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_clearPhyAliveStatus ( Uint32  phyAddr  ) 

============================================================================
CSL_MDIO_clearPhyAliveStatus

Description
For a given PHY address provided to this function in 'phyAddr', this function clears the 'ALIVE' bit corresponding to that PHY.

Arguments

 *      phyAddr             The PHY address number (0-31) for which the alive bit
 *                          status must be cleared.
 *   

Return Value
None

Pre Condition
None

Post Condition
Clears the ALIVE bit for the PHY address specified

Writes
MDIO_ALIVE_REG

Example

 *      Uint32      phyAddr = 0;
       
        // Clear PHY 0 alive status bit
        CSL_MDIO_clearPhyAliveStatus (phyAddr);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_clearUnmaskedLinkStatusChangeInt ( Uint32  index  ) 

============================================================================
CSL_MDIO_clearUnmaskedLinkStatusChangeInt

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERPHYSEL register, this function clears the 'LINKINTRAW' register contents corresponding to it.

Arguments

 *      index              The PHY selector (0-1) for which the link status change
 *                          bit must be read. Phy selector value 0 corresponds to the
 *                          PHY address programmed in USERPHYSEL0 register and a Phy
 *                          selector value 1 corresponds to the PHY address in 
 *                          USERPHYSEL1 register.
 *   

Return Value
None

Pre Condition
None

Post Condition
Clears the Link change interrupt.

Writes
MDIO_LINK_INT_RAW_REG

Example

 *      Uint32      index = 0;
       
        CSL_MDIO_clearUnmaskedLinkStatusChangeInt (index);
	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_clearUnmaskedUserCmdCompleteInt ( Uint32  index  ) 

============================================================================
CSL_MDIO_clearUnmaskedUserCmdCompleteInt

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERACCESS register, this function clears the 'USERINTRAW' register contents corresponding to it.

Arguments

 *      index              The PHY selector (0-1) for which the unmasked user 
 *                          command complete interrupt bit must be cleared. Phy selector 
 *                          value 0 corresponds to the PHY address used in USERACCESS0
 *                          register and a Phy selector value 1 corresponds to the PHY 
 *                          address in USERACCESS1 register.
 *   

Return Value
None

Pre Condition
None

Post Condition
Clears the User command complete interrupt.

Writes
MDIO_USER_INT_RAW_REG

Example

 *      Uint32      index = 0;
       
        CSL_MDIO_clearUnmaskedUserCmdCompleteInt (index);
	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_disableFaultDetect (  ) 

============================================================================
CSL_MDIO_disableFaultDetect

Description
This function disables the Physical layer fault detection mechanism by setting 'FAULTENB' bit of the MDIO Control register to 0.

Arguments None

Return Value
None

Pre Condition
None

Post Condition
Disables PHY layer fault detection.

Writes
MDIO_CONTROL_REG_FAULT_DETECT_ENABLE=0

Example

 *
        // Disable Phy Layer fault detection
        CSL_MDIO_disableFaultDetect ();

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_disableLinkStatusChangeInterrupt ( Uint32  index,
Uint32  phyAddr 
)

============================================================================
CSL_MDIO_disableLinkStatusChangeInterrupt

Description
This function sets the 'LINKINTENB' bit to 0 for a PHY address 'phyAddr' being monitored by the MDIO module. This configuration is done for the 'USERPHYSEL' register corresponding to the index specified here.

Arguments

 *      index               Specifies which of the USERPHYSEL register contents
 *                          must be configured by this function. Valid values are 0-1,
 *                          both inclusive.
 *      phyAddr             PHY Address for which the Link Status change interrupt 
 *                          must be disabled.                         
 *   

Return Value
None

Pre Condition
None

Post Condition
USERPHYSEL register's 'PHYADDRMON' and 'LINKINTENB' bits are configured for the index specified.Link Status Change interrupt disabled for PHY address specified.

Writes
MDIO_USER_PHY_SEL_REG_PHYADR_MON, MDIO_USER_PHY_SEL_REG_LINKINT_ENABLE=0

Example

 *      
        // Disable PHY 0's interrupt
        CSL_MDIO_disableLinkStatusChangeInterrupt (0, 0);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_disablePreamble (  ) 

============================================================================
CSL_MDIO_disablePreamble

Description
This function disables the MDIO preamble.

Arguments None

Return Value
None

Pre Condition
None

Post Condition
Disables MDIO Preamble frames.

Writes
MDIO_CONTROL_REG_PREAMBLE=1

Example

 *
        // Disable MDIO preamble frames
        CSL_MDIO_disablePreamble ();

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_disableStateMachine (  ) 

============================================================================
CSL_MDIO_disableStateMachine

Description
This function sets the 'ENABLE' bit of the MDIO control register to 0, triggering the disable of MDIO state machine if active.

Arguments None

Return Value
None

Pre Condition
None

Post Condition
If the MDIO state machine is active at the time it is disabled, will complete the current operation before halting it and setting the idle bit.

Writes
MDIO_CONTROL_REG_ENABLE=0

Example

 *
        // Disable MDIO state machine
        CSL_MDIO_disableStateMachine ();

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_disableUserCmdCompleteInterrupt ( Uint32  index  ) 

============================================================================
CSL_MDIO_disableUserCmdCompleteInterrupt

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERACCESS register, this function disables the user command complete interrupts for it.

Arguments

 *      index              The PHY selector (0-1) for which the masked user 
 *                          command complete interrupt bit must be enabled. Phy selector 
 *                          value 0 corresponds to the PHY address used in USERACCESS0
 *                          register and a Phy selector value 1 corresponds to the PHY 
 *                          address in USERACCESS1 register.
 *   

Return Value
None

Pre Condition
None

Post Condition
Disables the interrupt for User command complete events posted using USERACCESS register.

Writes
MDIO_USER_INT_MASK_CLEAR_REG

Example

 *      Uint32      index = 0;
       
        CSL_MDIO_disableUserCmdCompleteInterrupt (index);
	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_enableFaultDetect (  ) 

============================================================================
CSL_MDIO_enableFaultDetect

Description
This function enables the Physical layer fault detection mechanism by setting 'FAULTENB' bit of the MDIO Control register to 1.

Arguments None

Return Value
None

Pre Condition
None

Post Condition
Enables PHY layer fault detection.

Writes
MDIO_CONTROL_REG_FAULT_DETECT_ENABLE=1

Example

 *
        // Enable Phy Layer fault detection
        CSL_MDIO_enableFaultDetect ();

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_enableLinkStatusChangeInterrupt ( Uint32  index,
Uint32  phyAddr 
)

============================================================================
CSL_MDIO_enableLinkStatusChangeInterrupt

Description
This function sets the 'LINKINTENB' bit to 1 for a PHY address 'phyAddr' being monitored by the MDIO module. This configuration is done for the 'USERPHYSEL' register corresponding to the index specified here.

Arguments

 *      index               Specifies which of the USERPHYSEL register contents
 *                          must be configured by this function. Valid values are 0-1,
 *                          both inclusive.
 *      phyAddr             PHY Address for which the Link Status change interrupt 
 *                          must be enabled.                         
 *   

Return Value
None

Pre Condition
None

Post Condition
USERPHYSEL register's 'PHYADDRMON' and 'LINKINTENB' bits are configured for the index specified. Link Status Change interrupt enabled for PHY address specified.

Writes
MDIO_USER_PHY_SEL_REG_PHYADR_MON, MDIO_USER_PHY_SEL_REG_LINKINT_ENABLE=1

Example

 *      
        // Enable PHY 0's interrupt
        CSL_MDIO_enableLinkStatusChangeInterrupt (0, 0);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_enablePreamble (  ) 

============================================================================
CSL_MDIO_enablePreamble

Description
This function enables the MDIO preamble.

Arguments None

Return Value
None

Pre Condition
None

Post Condition
Enables MDIO Preamble frames.

Writes
MDIO_CONTROL_REG_PREAMBLE=0

Example

 *
        // Enable MDIO preamble frames
        CSL_MDIO_enablePreamble ();

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_enableStateMachine (  ) 

============================================================================
CSL_MDIO_enableStateMachine

Description
This function enables the MDIO state machine if not already active.

Arguments None

Return Value
None

Pre Condition
None

Post Condition
Enables MDIO State machine.

Writes
MDIO_CONTROL_REG_ENABLE

Example

 *
        // Enable MDIO state machine
        CSL_MDIO_enableStateMachine ();

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_enableUserCmdCompleteInterrupt ( Uint32  index  ) 

============================================================================
CSL_MDIO_enableUserCmdCompleteInterrupt

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERACCESS register, this function enables the user command complete interrupts for it.

Arguments

 *      index              The PHY selector (0-1) for which the masked user 
 *                          command complete interrupt bit must be enabled. Phy selector 
 *                          value 0 corresponds to the PHY address used in USERACCESS0
 *                          register and a Phy selector value 1 corresponds to the PHY 
 *                          address in USERACCESS1 register.
 *   

Return Value
None

Pre Condition
None

Post Condition
Enables the interrupt for User command complete events posted using USERACCESS register.

Writes
MDIO_USER_INT_MASK_SET_REG

Example

 *      Uint32      index = 0;
       
        CSL_MDIO_enableUserCmdCompleteInterrupt (index);
	 

=============================================================================

CSL_IDEF_INLINE Uint16 CSL_MDIO_getClkDivVal ( void   ) 

============================================================================
CSL_MDIO_getClkDivVal

Description
This function retrieves the clock divider value (CLKDIV) from the MDIO control register.

Arguments None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_CONTROL_REG_CLKDIV

Example

 *      Uint16      clkDivVal;

        clkDivVal   =   CSL_MDIO_getClkDivVal ();

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_getHighestUserChannel ( void   ) 

============================================================================
CSL_MDIO_getHighestUserChannel

Description
This function returns the highest user access channel available in MDIO module.

Arguments None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_CONTROL_REG_HIGHEST_USER_CHANNEL

Example

 *      Uint32  userAccChannel;
     
        // Get the highest user access channel.
        userAccChannel = CSL_MDIO_getHighestUserChannel ();
	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_getUserAccessRegister ( Uint32  index,
CSL_MDIO_USERACCESS pUserAccessReg 
)

============================================================================
CSL_MDIO_getUserAccessRegister

Description
This function retrieves the contents of the USERACCESS register corresponding to the 'index' (0-1) provided.

Arguments

 *      index               Specifies which of the USERACCESS register contents
 *                          must be read by this function. Valid values are 0-1,
 *                          both inclusive.
 *      pUserAccessReg      CSL_MDIO_USERACCESS structure that needs to be 
 *                          populated with the User Access register contents.
 *   

Return Value
None

Pre Condition
None

Post Condition
None

Reads
MDIO_USER_ACCESS_REG_DATA, MDIO_USER_ACCESS_REG_PHYADR, MDIO_USER_ACCESS_REG_REGADR, MDIO_USER_ACCESS_REG_ACK, MDIO_USER_ACCESS_REG_GO

Example

 *      CSL_MDIO_USERACCESS      userAccReg;

        // Get User Access Reg 0 contents
        CSL_MDIO_getUserAccessRegister (0, &userAccReg);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_getUserPhySelect ( Uint32  index,
CSL_MDIO_USERPHYSEL pUserPhySelect 
)

============================================================================
CSL_MDIO_getUserPhySelect

Description
This function reads the 'USERPHYSEL' register contents corresponding to the index specified here and returns its contents in the output param 'pUserPhySelect'.

Arguments

 *      index               Specifies which of the USERPHYSEL register contents
 *                          must be configured by this function. Valid values are 0-1,
 *                          both inclusive.
 *      pUserPhySelect      CSL_MDIO_USERPHYSEL structure that needs to be populated
 *                          with register contents
 *   

Return Value
None

Pre Condition
None

Post Condition
None.

Reads
MDIO_USER_PHY_SEL_REG_PHYADR_MON, MDIO_USER_PHY_SEL_REG_LINKINT_ENABLE, MDIO_USER_PHY_SEL_REG_LINKSEL

Example

 *      CSL_MDIO_USERPHYSEL    userPhySelect; 
 
        // Get USERPHYSEL0 contents
        CSL_MDIO_getUserPhySelect (0, &userPhySelect);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_getVersionInfo ( CSL_MDIO_VERSION mdioVersionInfo  ) 

============================================================================
CSL_MDIO_getVersionInfo

Description
This function retrieves the MDIO version information.

Arguments

        mdioVersionInfo     CSL_MDIO_VERSION structure that needs to be populated
                            with the version info read from the hardware.
 *	 

Return Value
None

Pre Condition
None

Post Condition
None

Reads
MDIO_VERSION_REG_REVMINOR, MDIO_VERSION_REG_REVMAJ, MDIO_VERSION_REG_MODID

Example

        CSL_MDIO_VERSION    mdioVersionInfo;

        CSL_MDIO_getVersion (&mdioVersionInfo);

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isFaultDetected ( void   ) 

============================================================================
CSL_MDIO_isFaultDetected

Description
This function returns physical layer fault status, i.e., 1 to indicate that the MDIO module has detected a physical layer fault and 0 otherwise.

Arguments None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_CONTROL_REG_FAULT

Example

        
        if (CSL_MDIO_isFaultDetected ())
        {
            // Physical Layer fault detected
        }
        else
        {
            // No Physical Layer fault detected
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isFaultDetectEnabled ( void   ) 

============================================================================
CSL_MDIO_isFaultDetectEnabled

Description
This function returns the value of the Fault detect enable bit of the MDIO control register. The Fault detect enable bit indicates whether physical layer fault detection is enabled.

Arguments None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_CONTROL_REG_FAULT_DETECT_ENABLE

Example

        
        if (CSL_MDIO_isFaultDetectEnabled ())
        {
            // MDIO/Physical Layer fault detection is enabled
        }
        else
        {
            // MDIO/Physical Layer fault detection is disabled
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isMaskedLinkStatusChangeIntSet ( Uint32  index  ) 

============================================================================
CSL_MDIO_isMaskedLinkStatusChangeIntSet

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERPHYSEL register, this function returns the 'LINKINTMASKED' register contents corresponding to it. This functions returns a 1 to indicate that the link status has changed for the PHY provided and 0 otherwise.

Arguments

 *      index              The PHY selector (0-1) for which the link status change
 *                          bit must be read. Phy selector value 0 corresponds to the
 *                          PHY address programmed in USERPHYSEL0 register and a Phy
 *                          selector value 1 corresponds to the PHY address in 
 *                          USERPHYSEL1 register.
 *   

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_LINK_INT_MASKED_REG

Example

 *      Uint32      index = 0;
       
        if (CSL_MDIO_isMaskedLinkStatusChangeIntSet (index))
        {
            // Link status has changed
        }
        else
        {
            // Link status has not changed
        }
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isMaskedUserCmdCompleteIntSet ( Uint32  index  ) 

============================================================================
CSL_MDIO_isMaskedUserCmdCompleteIntSet

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERACCESS register, this function returns the 'USERINTMASKED' register contents corresponding to it. This functions returns a 1 to indicate that the previously scheduled PHY read/write command using that particular USERACCESS register has completed and corresponding USERINTMASKSET bit is set to 1 and returns 0 otherwise.

Arguments

 *      index              The PHY selector (0-1) for which the masked user 
 *                          command complete interrupt bit must be read. Phy selector 
 *                          value 0 corresponds to the PHY address used in USERACCESS0
 *                          register and a Phy selector value 1 corresponds to the PHY 
 *                          address in USERACCESS1 register.
 *   

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_USER_INT_MASKED_REG

Example

 *      Uint32      index = 0;
       
        if (CSL_MDIO_isMaskedUserCmdCompleteIntSet (index))
        {
            // User command completed
        }
        else
        {
            // User command not done
        }
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isPhyAlive ( Uint32  phyAddr  ) 

============================================================================
CSL_MDIO_isPhyAlive

Description
For a given PHY address provided to this function in 'phyAddr', this function reads the 'ALIVE' bit corresponding to that PHY; The function returns 1 to indicate that the most recent access for the address was acknowledged by the PHY and 0 otherwise.

Arguments

 *      phyAddr             The PHY address number (0-31) for which the alive bit
 *                          status must be checked and returned by this function.
 *   

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_ALIVE_REG

Example

 *      Uint32      phyAddr = 0;
       
        // Check if PHY Address 0 is alive
        if (CSL_MDIO_isPhyAlive (phyAddr))
        {
            // MDIO PHY 0 access succeeded
        }
        else
        {
            // MDIO PHY 0 access failed
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isPhyLinked ( Uint32  phyAddr  ) 

============================================================================
CSL_MDIO_isPhyLinked

Description
For a given PHY address provided to this function in 'phyAddr', this function reads the 'LINK' bit corresponding to that PHY; The function returns 1 to indicate that the corresponding PHY address has a link.

Arguments

 *      phyAddr             The PHY address number (0-31) for which the link bit
 *                          status must be checked and returned by this function.
 *   

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_LINK_REG

Example

 *      Uint32      phyAddr = 0;
       
        // Check if PHY Address 0 link is up
        if (CSL_MDIO_isPhyLinked (phyAddr))
        {
            // MDIO PHY 0 link up
        }
        else
        {
            // MDIO PHY 0 link not up
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isPreambleEnabled ( void   ) 

============================================================================
CSL_MDIO_isPreambleEnabled

Description
This function returns the value of the Preamble disable bit of the MDIO control register. It returns 1 to indicate the MDIO preamble is enabled and 0 otherwise.

Arguments None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_CONTROL_REG_PREAMBLE

Example

        
        if (CSL_MDIO_isPreambleEnabled ())
        {
            // MDIO preamble enabled
        }
        else
        {
            // MDIO preamble disabled
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isStateMachineEnabled ( void   ) 

============================================================================
CSL_MDIO_isStateMachineEnabled

Description
This function returns the value of the Enable bit of the MDIO control register. It returns 1 to indicate that the MDIO state machine is enabled and is active and 0 to indicate otherwise.

Arguments None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_CONTROL_REG_ENABLE

Example

        
        if (CSL_MDIO_isStateMachineEnabled ())
        {
            // MDIO state machine enabled
        }
        else
        {
            // MDIO state machine disabled
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isStateMachineIdle ( void   ) 

============================================================================
CSL_MDIO_isStateMachineIdle

Description
This function returns the value of the 'IDLE' bit of the MDIO control register. It returns 1 to indicate that the MDIO state machine is in idle state and 0 otherwise.

Arguments None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_CONTROL_REG_IDLE

Example

        
        if (CSL_MDIO_isStateMachineIdle ())
        {
            // MDIO state machine idle
        }
        else
        {
            // MDIO state machine not idle
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isUnmaskedLinkStatusChangeIntSet ( Uint32  index  ) 

============================================================================
CSL_MDIO_isUnmaskedLinkStatusChangeIntSet

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERPHYSEL register, this function returns the 'LINKINTRAW' register contents corresponding to it. This functions returns a 1 to indicate that the link status has changed for the PHY provided and 0 otherwise.

Arguments

 *      index              The PHY selector (0-1) for which the link status change
 *                          bit must be read. Phy selector value 0 corresponds to the
 *                          PHY address programmed in USERPHYSEL0 register and a Phy
 *                          selector value 1 corresponds to the PHY address in 
 *                          USERPHYSEL1 register.
 *   

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_ALIVE_REG

Example

 *      Uint32      index = 0;
       
        if (CSL_MDIO_isUnmaskedLinkStatusChangeIntSet (index))
        {
            // Link status has changed
        }
        else
        {
            // Link status has not changed
        }
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isUnmaskedUserCmdCompleteIntSet ( Uint32  index  ) 

============================================================================
CSL_MDIO_isUnmaskedUserCmdCompleteIntSet

Description
For a given PHY selector(0-1) provided corresponding to the PHY address in USERACCESS register, this function returns the 'USERINTRAW' register contents corresponding to it. This functions returns a 1 to indicate that the previously scheduled PHY read/write command using that particular USERACCESS register has completed and returns 0 otherwise.

Arguments

 *      index              The PHY selector (0-1) for which the unmasked user 
 *                          command complete interrupt bit must be read. Phy selector 
 *                          value 0 corresponds to the PHY address used in USERACCESS0
 *                          register and a Phy selector value 1 corresponds to the PHY 
 *                          address in USERACCESS1 register.
 *   

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
MDIO_USER_INT_RAW_REG

Example

 *      Uint32      index = 0;
       
        if (CSL_MDIO_isUnmaskedUserCmdCompleteIntSet (index))
        {
            // User command completed
        }
        else
        {
            // User command not done
        }
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_MDIO_isUserAccessPending ( Uint32  index  ) 

============================================================================
CSL_MDIO_isUserAccessPending

Description
This function reads the 'GO' bit of the USERACCESS register corresponding to the 'index' specified and returns its value. When 1 returned, indicates that the user access transaction (read/write) performed earlier is still pending and has not yet completed. 0 indicates that the transaction has completed.

Arguments

 *      index               Specifies which of the USERACCESS register's GO bit
 *                          must be read by this function. Valid values are 0-1,
 *                          both inclusive.
 *   

Return Value
None

Pre Condition
None

Post Condition
None.

Reads
MDIO_USER_ACCESS_REG_GO

Example

 *      CSL_MDIO_USERACCESS      userAccReg;
 
        userAccessReg.data      =   1;
        userAccessReg.phyAddr   =   0;
        ...
        userAccessReg.go        =   1;

        // Set User Access Reg 0 contents
        CSL_MDIO_setUserAccessRegister (0, &userAccReg);

        // Wait till the set completes
        while (CSL_MDIO_isUserAccessPending (0));

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_setClkDivVal ( Uint16  clkDivVal  ) 

============================================================================
CSL_MDIO_setClkDivVal

Description
This function configures the clock divider value (CLKDIV) in the MDIO control register with the value specified.

Arguments

        clkDivVal           The value to use for clock divider configuration.
                            When this set to 0, the MDIO clock is disabled.
 *	 

Return Value
None

Pre Condition
None

Post Condition
CONTROL_REG configured with the clock divider value. Configures the MDIO clock frequency.

Writes
MDIO_CONTROL_REG_CLKDIV

Example

 *      Uint16      clkDivVal;
 
        clkDivVal = 165;

        // Setup the MDIO clock frequency
        CSL_MDIO_setClkDivVal (clkDivVal);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_MDIO_setUserAccessRegister ( Uint32  index,
CSL_MDIO_USERACCESS pUserAccessReg 
)

============================================================================
CSL_MDIO_setUserAccessRegister

Description
This function configures the contents of the USERACCESS register corresponding to the 'index' (0-1) provided with the values provided in 'pUserAccessReg' input parameter.

Arguments

 *      index               Specifies which of the USERACCESS register contents
 *                          must be configured by this function. Valid values are 0-1,
 *                          both inclusive.
 *      pUserAccessReg      CSL_MDIO_USERACCESS structure that specifies the values
 *                          that need to be configured into the User Access register 
 *                          contents.
 *   

Return Value
None

Pre Condition
None

Post Condition
User Access Register(USERACCESS) corresponding to the index specified is configured.

Reads
MDIO_USER_ACCESS_REG_DATA, MDIO_USER_ACCESS_REG_PHYADR, MDIO_USER_ACCESS_REG_REGADR, MDIO_USER_ACCESS_REG_WRITE=1, MDIO_USER_ACCESS_REG_GO

Example

 *      CSL_MDIO_USERACCESS      userAccReg;
 
        userAccessReg.data      =   1;
        userAccessReg.phyAddr   =   0;
        ...
        userAccessReg.go        =   1;

        // Set User Access Reg 0 contents
        CSL_MDIO_setUserAccessRegister (0, &userAccReg);

	 

=============================================================================


Copyright 2012, Texas Instruments Incorporated