sub_mdio_xfer, sub_mdio_xfer_ex

Top  Previous  Next
Got to SUB-20 page

Synopsis

int   sub_mdio_xfer( sub_handle hndl, int count, union sub_mdio_frame* mdios )

int   sub_mdio_xfer_ex( sub_handle hndl, int channel, int count,

                                                         union sub_mdio_frame* mdios )

 

Generate a sequence of independent MDIO frames. Frames in sequence can be Clause 22 or Clause 45 format with different operations and addresses.

Parameters

channel - mdio channel (see MDIO Channels ). Optional SUB_CFP_MSA flag applied to channel (channel|SUB_CFP_MSA) will force SUB-20 to generate CFP MSA compatible transaction(s) at 4MHz MDC frequency.

count - number of frames to generate (currently up to 15).

*mdios - array of count sub_mdio_frame unions

 

union sub_mdio_frame

{

  struct

  {

    int      op;

    int      phyad;

    int      regad;

    int      data;

  }clause22;

  struct

  {

    int      op;

    int      prtad;

    int      devad;

    int      data;

  }clause45;

};

 

Frame operation is defined by op field value.

 

clause22.op can be

SUB_MDIO22_READ

READ operation

SUB_MDIO22_WRITE

WRITE operation

 

clause45.op can be

SUB_MDIO45_ADDR

ADDRESS operation

SUB_MDIO45_WRITE

WRITE operation

SUB_MDIO45_PRIA

POST-READ-INCREMENT-ADDRESS operation

SUB_MDIO45_READ

READ operation

 

For READ and POST-READ-INCREMENT-ADDRESS operations clause22.data or clause45.data will be filled with data read from PHY.

Return value

On success function returns 0. Otherwise error code.

Example

union sub_mdio_frame mdios[2];

 

mdios[0].clause22.op = SUB_MDIO22_READ;

mdios[0].clause22.phyad = 0x01;

mdios[0].clause22.regad = 0x12;

 

mdios[1].clause45.op = SUB_MDIO45_ADDR;

mdios[1].clause45.prtad = 0x04;

mdios[1].clause45.devad = 0x02;

mdios[1].clause45.data = 0x55AA;

 

rc = sub_mdio_xfer( hndl, 2, mdios );

Compatibility

sub_mdio_xfer


FW version

0.2.1 or grater

Library version

0.1.12.12 or grater



sub_mdio_xfer_ex


FW version

0.2.8 or grater

Library version

0.1.12.18 or grater



SUB_CFP_MSA


FW version

0.3.2 or grater

Library version

0.1.12.24 or grater