NetDev_CfgGPIO

This function is called by a device driver’s NetDev_Init() to configure a specific network device’s general-purpose input/ouput (GPIO) on a specific interface.

Files

net_bsp.c

Prototype

          static void NetDev_CfgGPIO (NET_IF  *p_if,
                                      NET_ERR *p_err);

Note that since NetDev_CfgGPIO() is accessed only by function pointer via a BSP interface structure, it doesn’t need to be globally available and should therefore be declared as ‘static’.

Arguments

p_if

Pointer to specific interface to configure device’s GPIO.

p_err

Pointer to variable that will receive the return error code from this function:

NET_DEV_ERR_NONE
NET_DEV_ERR_FAULT

This is not an exclusive list of return errors and specific network device’s or device BSP functions may return any other specific errors as required.

Returned Value

None.

Required Configuration

None.

Notes / Warnings

Each network device’s NetDev_CfgGPIO() should configure all required GPIO pins for the network device. For Ethernet devices, this function is usually necessary to configure the (R)MII bus pins, depending on whether you have configured an Ethernet interface to operate in the RMII or MII mode, and optionally the Ethernet Phy interrupt pin.

Since each network device requires a unique NetDev_CfgGPIO(), it is recommended that each device’s NetDev_CfgGPIO() function be named using the following convention:

NetDev_[Device]CfgGPIO[Number]()

[Device]

Network device name or type, e.g. MACB (optional if the development board does not support multiple devices)

[Number]

Network device number for each specific instance of device (optional if the development board does not support multiple instances of the specific device)

For example, the NetDev_CfgGPIO() function for the #2 MACB Ethernet controller on an Atmel AT91SAM9263-EK should be named NetDev_MACB_CfgGPIO2(), or NetDev_MACB_CfgGPIO_2() with additional underscore optional.

See also Network Board Support Package.