# SGMII Functions
[SGMII]

## Functions

Uint32 | SGMII_reset ()
Uint32 | SGMII_config (SGMII_Config *config)
Uint32 | SGMII_getStatus (SGMII_Status *pStatus)
Uint32 | SGMII_getLinkPartnerStatus ()
Uint32 | SGMII_getAnErrorStatus ()
Uint32 | SGMII_getStatusReg ()

## Function Documentation

Uint32 SGMII_config | ( | SGMII_Config * | config | ) |

============================================================================
SGMII_config

Description
Module configuration is achieved by calling SGMII_config(). Arguments

                config        Reference to struture which contains configuration for the SGMII module

Return Value Uint32

- 0 - Configure successful
- SGMII_ERROR_INVALID - Invalid parameter

Pre Condition
None.

Post Condition
Module configuration is achieved.

Modifies
SGMII registers are modified.

Example

         ...
         SGMII_Config SgmiiCfg;

        SgmiiCfg.masterEn   = 0x0;
        SgmiiCfg.loopbackEn = 0x1;
        SgmiiCfg.txConfig   = 0x00000e13;
        SgmiiCfg.rxConfig   = 0x00081013;
        SgmiiCfg.auxConfig  = 0x0000000b;
        SgmiiCfg.modeOfOperation = 0x0;

         SGMII_reset();
         SGMII_config (&SgmiiCfg);
         ...

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

Uint32 SGMII_getAnErrorStatus | ( |  | ) |

============================================================================
SGMII_getAnErrorStatus

Description
The function returns Error status of Auto negotiation process.

Return Value Uint32

- Error status of Auto negotiation process.

Pre Condition
None.

Post Condition
None

Modifies
None.

Example

        SGMII_Config SgmiiCfg;

        SgmiiCfg.masterEn   = 0x0;
        SgmiiCfg.loopbackEn = 0x1;
        SgmiiCfg.speed      = 0x0;
        SgmiiCfg.txConfig   = 0x00000e13;
        SgmiiCfg.rxConfig   = 0x00081013;
        SgmiiCfg.auxConfig  = 0x0000000b;
        SgmiiCfg.diagSmSel = 0x0;
        SgmiiCfg.diagEdgeSel = 0x0;
        SgmiiCfg.modeOfOperation = 0x0;

        SGMII_reset();
        SGMII_config (&SgmiiCfg);

        SGMII_getAnErrorStatus ( );

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

Uint32 SGMII_getLinkPartnerStatus | ( |  | ) |

============================================================================
SGMII_getLinkPatnerStatus

Description
Gets the status value of link partner.

Return Value Uint32

- SGMII_ERROR_DEVICE - auto negotiation not complete

Pre Condition
None.

Post Condition
returns auto negotiation status value

Modifies
None.

Example

        SGMII_Config SgmiiCfg;

        SgmiiCfg.masterEn   = 0x0;
        SgmiiCfg.loopbackEn = 0x1;
        SgmiiCfg.txConfig   = 0x00000e13;
        SgmiiCfg.rxConfig   = 0x00081013;
        SgmiiCfg.auxConfig  = 0x0000000b;
        SgmiiCfg.modeOfOperation = 0x0;

         SGMII_reset();
         SGMII_config (&SgmiiCfg);

         SGMII_getLinkPartnerStatus ( );
         ...

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

Uint32 SGMII_getStatus | ( | SGMII_Status * | pStatus | ) |

============================================================================
SGMII_getStatus SGMII module Status Structure

Description
Module status is obtained by calling SGMII_getStatus(). Arguments

                status         Reference to an SGMII module Status Structure.

Return Value Uint32

- 0 - Status is obtained successfully.
- SGMII_ERROR_INVALID - Invalid parameter.

Pre Condition
None.

Post Condition
None

Modifies
Updates the argument "status".

Example

         ...
        SGMII_Status status;
        SGMII_Config SgmiiCfg;

        SgmiiCfg.masterEn   = 0x0;
        SgmiiCfg.loopbackEn = 0x1;
        SgmiiCfg.txConfig   = 0x00000e13;
        SgmiiCfg.rxConfig   = 0x00081013;
        SgmiiCfg.auxConfig  = 0x0000000b;
        SgmiiCfg.modeOfOperation = 0x0;

         SGMII_reset();
         SGMII_config (&SgmiiCfg);

         SGMII_getStatus (&status);
         ...

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

Uint32 SGMII_getStatusReg | ( |  | ) |

============================================================================
SGMII_getStatusReg

Description
The function returns the value read from STATUS register

Return Value Uint32

- Returns value read from STATUS register

Pre Condition
None.

Post Condition
None

Modifies
None.

Example

         SGMII_reset();
         SGMII_getStatusReg ( );

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

Uint32 SGMII_reset | ( |  | ) |

============================================================================
SGMII_reset

Description
Module reset is achieved by calling SGMII_reset().

Return Value Uint32

- Always returns a '0' if reset happens properly.

Pre Condition
None.

Post Condition
SGMII logic is reset

Modifies
Memory mapped register SOFT_RESET is modified.

Example

         SGMII_reset ();

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

Copyright 2012, Texas Instruments Incorporated