A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

rmii_if.c File Reference

rmii_if.c File Reference

Ethernet Interface for RMII Devices. More...

Go to the source code of this file.

Functions

static void PHY_write (unsigned long reg, unsigned long data)
 This function writes a specific value in a register of the PHY device.
static unsigned long PHY_read (unsigned long reg)
 This function reads a value from a register of the PHY device.
static int PHY_init (struct emacif *emac)
 This function starts up the PHY device.
void EMACTxDescriptor_init ()
 In this function, the Tx descriptor queue is set up for use with the DMA.
void EMACRxDescriptor_init ()
 In this function, the Rx descriptor queue is set up for use with the DMA.
static int emac_hw_init (struct netif *netif)
 In this function, the hardware will be initialized.
static err_t low_level_output (struct netif *netif, struct pbuf *p)
 This function should do the actual transmission of the packet.
static struct pbuf * low_level_input (struct netif *netif)
 Should allocate a pbuf and transfer the bytes of the incoming packet from the interface into the pbuf.
void emac_input (struct netif *netif)
 This function should be called when a packet is ready to be read from the interface.
err_t emac_init (struct netif *netif)
 Should be called at the beginning of the program to set up the network interface.

Detailed Description

Ethernet Interface for RMII Devices.

Definition in file 7/Core/lwIP/netif/rmii_if.c.


Function Documentation

static int emac_hw_init ( struct netif netif ) [static]

In this function, the hardware will be initialized.

Called from ethernetif_init().

Parameters:
netifthe already initialized lwip network interface structure for this ethernetif

Definition at line 196 of file 7/Core/lwIP/netif/rmii_if.c.

err_t emac_init ( struct netif netif )

Should be called at the beginning of the program to set up the network interface.

It calls the function low_level_init() to do the actual setup of the hardware.

This function should be passed as a parameter to netif_add().

Parameters:
netifthe lwip network interface structure for this ethernetif
Returns:
ERR_OK if the loopif is initialized ERR_MEM if private data couldn't be allocated any other err_t on error

Definition at line 533 of file 7/Core/lwIP/netif/rmii_if.c.

void emac_input ( struct netif netif )

This function should be called when a packet is ready to be read from the interface.

It uses the function low_level_input() that should handle the actual reception of bytes from the network interface. Then the type of the received packet is determined and the appropriate input function is called.

Parameters:
netifthe lwip network interface structure for this ethernetif

Definition at line 480 of file 7/Core/lwIP/netif/rmii_if.c.

void EMACRxDescriptor_init (  )

In this function, the Rx descriptor queue is set up for use with the DMA.

Definition at line 167 of file 7/Core/lwIP/netif/rmii_if.c.

void EMACTxDescriptor_init (  )

In this function, the Tx descriptor queue is set up for use with the DMA.

Definition at line 143 of file 7/Core/lwIP/netif/rmii_if.c.

static struct pbuf* low_level_input ( struct netif netif ) [static, read]

Should allocate a pbuf and transfer the bytes of the incoming packet from the interface into the pbuf.

Parameters:
netifthe lwip network interface structure for this ethernetif
Returns:
a pbuf filled with the received packet (including MAC header) NULL on memory error

Definition at line 409 of file 7/Core/lwIP/netif/rmii_if.c.

static err_t low_level_output ( struct netif netif,
struct pbuf *  p 
) [static]

This function should do the actual transmission of the packet.

The packet is contained in the pbuf that is passed to the function. This pbuf might be chained.

Parameters:
netifthe lwip network interface structure for this ethernetif
pthe MAC packet to send (e.g. IP packet including MAC addresses and type)
Returns:
ERR_OK if the packet could be sent an err_t value if the packet couldn't be sent
Note:
Returning ERR_MEM here if a DMA queue of your MAC is full can lead to strange results. You might consider waiting for space in the DMA queue to become availale since the stack doesn't retry to send a packet dropped because of memory failure (except for the TCP timers).

Definition at line 319 of file 7/Core/lwIP/netif/rmii_if.c.

static int PHY_init ( struct emacif *  emac ) [static]

This function starts up the PHY device.

Returns:
It returns TRUE if everything is fine.

Definition at line 74 of file 7/Core/lwIP/netif/rmii_if.c.

static unsigned long PHY_read ( unsigned long  reg ) [static]

This function reads a value from a register of the PHY device.

Parameters:
regThe specific register.
Returns:
The readed value.

Definition at line 61 of file 7/Core/lwIP/netif/rmii_if.c.

static void PHY_write ( unsigned long  reg,
unsigned long  data 
) [static]

This function writes a specific value in a register of the PHY device.

Parameters:
regThe specific register.
dataThe value to be stored.

Definition at line 48 of file 7/Core/lwIP/netif/rmii_if.c.