[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

MDI_Register_Extended()

Register with the MII management library

Synopsis:

int MDI_Register_Extended ( void * handle,
                           MDIWriteFunc write,
                           MDIReadFunc read,
                           MDICallBack callback,
                           mdi_t **mdi,
                           struct sigevent *event,
                           int priority, 
                           int callback_interval)

Arguments:

handle
A handle that the library passes to each of the driver's callbacks.
write
A pointer to a function which writes to a PHY register through the MAC device. An MDIWriteFunc structure is declared as:
typedef void    (*MDIWriteFunc)(void *handle, uint8_t phy_id,
                 uint8_t location, uint16_t val);
where

handle is the handle that was passed to MDI_Register_Extended(),

phy_id is the address of the PHY on the MII management bus,

location is the index of the PHY register to write to, and

val is the value to write to the register.

read
A pointer to a function which reads a PHY register through the MAC device. An MDIReadFunc is declared as:
typedef uint16_t    (*MDIReadFunc)(void *handle,
                     uint8_t phy_id, uint8_t location);
where

handle is the handle that was passed to MDI_Register_Extended(),

phy_id is the address of the PHY on the MII management bus, and

location is the index of the PHY register to read from.

callback
A pointer to a function which the library calls if the link state changes. An MDICallback is declared as:
typedef void        (*MDICallback) (void *handle,
                    uint8_t phy_id, uint8_t state)  
where

handle is the handle that was passed to MDI_Register_extended(),

phy_id is the address of the PHY on the MII management bus,

state is the link state.

The state can be one of:

If the link state is MDI_LINK_UP, the driver calls MDI_GetActiveMedia() to get further information about the link state.
mdi
A pointer to an mdi_t, structure that the library initializes. The driver passes the pointer to the mdi_t structure upon all subsequent calls to the library associated with this registration.
event
If the driver wishes to receive link monitor pulses, it should pass a pointer to a struct sigevent as the event argument. The structure's sigev_coid field should contain the connection ID through which the driver receives the pulse messages. If the driver doesn't wish to receive the pulses, it should pass NULL.
priority
The priority of the link monitor pulses that are delivered. The recommended value is 10.
callback_interval
Specifies the frequency, in seconds, of link monitor pulses. The recommended value is three.
Note: Some device drivers may be able to receive an interrupt upon a link state change event. It's more efficient to use this interrupt, if possible, instead of using link monitor pulses.

Description:

This function registers with the MII management library, and must be called before calling any other MII management library function.

Returns:

MDI_SUCCESS if registration succeeds. If any other value is returned, the pointer to the mdi_t that was returned is invalid, and can't be used used to call other MII management library functions.

Classification:

QNX Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

[Previous] [Contents] [Index] [Next]