Jump to main content

##

# DRV_ETHPHY_Initialize Function

## C

    SYS_MODULE_OBJ DRV_ETHPHY_Initialize(const SYS_MODULE_INDEX index, const SYS_MODULE_INIT * const init);

## Returns

- a valid handle to a driver object, if successful.
- SYS_MODULE_OBJ_INVALID if initialization failed.

## Description

This function initializes the Ethernet PHY driver, making it ready for clients to open and use it.

## Remarks

- This function must be called before any other Ethernet PHY routine is called.
- This function should only be called once during system initialization unless DRV_ETHPHY_Deinitialize is called to deinitialize the driver instance.
- The returned object must be passed as argument to DRV_ETHPHY_Reinitialize, DRV_ETHPHY_Deinitialize, DRV_ETHPHY_Tasks and DRV_ETHPHY_Status routines.

## Preconditions

None.

## Example

    DRV_ETHPHY_INIT init; SYS_MODULE_OBJ objectHandle;

    // Populate the Ethernet PHY initialization structure
    init.phyId = ETHPHY_ID_0;

    // Populate the Ethernet PHY initialization structure
    init.phyId = ETHPHY_ID_2;
     init.pPhyObject = &DRV_ETHPHY_OBJECT_SMSC_LAN8720;

    // Do something
    objectHandle = DRV_ETHPHY_Initialize(DRV_ETHPHY_INDEX_0, (SYS_MODULE_INIT*)&init);
     if (SYS_MODULE_OBJ_INVALID == objectHandle) {
    // Handle error
    }