Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Macros | Functions | Variables
lpc17 EMAC driver for LWIP

Data Structures

 Structure of a TX/RX descriptor. More...
 Structure of a RX status entry. More...
struct  lpc_enetdata


#define RX_PRIORITY   (osPriorityNormal)
 Driver transmit and receive thread priorities. More...
#define TX_PRIORITY   (osPriorityNormal)
#define PHY_PRIORITY   (osPriorityNormal)
 Debug output formatter lock define. More...
 Transmit group interrupts.
#define RX_SIGNAL   1
 Signal used for ethernet ISR to signal packet_rx() thread.


void LPC17xxEthernetHandler (void)
 LPC EMAC interrupt handler. More...
void lpc_emac_set_duplex (int full_duplex)
void lpc_emac_set_speed (int mbs_100)
virtual bool LPC17_EMAC::link_out (emac_mem_buf_t *buf)
 Low level output of a packet. Never call this from an interrupt context, as it may block until TX descriptors become available. More...
void LPC17_EMAC::update_link_status (bool up)
virtual bool LPC17_EMAC::power_up ()
virtual uint32_t LPC17_EMAC::get_mtu_size () const
virtual uint32_t LPC17_EMAC::get_align_preference () const
virtual void LPC17_EMAC::get_ifname (char *name, uint8_t size) const
virtual uint8_t LPC17_EMAC::get_hwaddr_size () const
virtual bool LPC17_EMAC::get_hwaddr (uint8_t *addr) const
virtual void LPC17_EMAC::set_hwaddr (const uint8_t *addr)
virtual void LPC17_EMAC::set_link_input_cb (emac_link_input_cb_t input_cb)
virtual void LPC17_EMAC::set_link_state_cb (emac_link_state_change_cb_t state_cb)
virtual void LPC17_EMAC::add_multicast_group (const uint8_t *address)
virtual void LPC17_EMAC::remove_multicast_group (const uint8_t *address)
virtual void LPC17_EMAC::set_all_multicast (bool all)
virtual void LPC17_EMAC::power_down ()
virtual void LPC17_EMAC::set_memory_manager (EMACMemoryManager &mem_mngr)
static LPC17_EMACLPC17_EMAC::get_instance ()
static EMACEMAC::get_default_instance ()


volatile uint32_t LPC_TXRX_DESC_T::packet
volatile uint32_t LPC_TXRX_DESC_T::control
volatile uint32_t LPC_TXRX_STATUS_T::statusinfo
volatile uint32_t LPC_TXRX_STATUS_T::statushashcrc
LPC_TXRX_STATUS_T lpc_enetdata::prxs [4]
LPC_TXRX_DESC_T lpc_enetdata::ptxd [9]
LPC_TXRX_STATUS_T lpc_enetdata::ptxs [9]
LPC_TXRX_DESC_T lpc_enetdata::prxd [4]
emac_mem_buf_t * lpc_enetdata::rxb [4]
uint32_t lpc_enetdata::rx_fill_desc_index
volatile uint32_t lpc_enetdata::rx_free_descs
emac_mem_buf_t * lpc_enetdata::txb [9]
uint32_t lpc_enetdata::lpc_last_tx_idx
uint32_t lpc_enetdata::lpc_reserved_tx_num
struct lpc_enetdata lpc_enetdata
 LPC EMAC driver work data.
uint8_t rx_thread_stack [512]
uint8_t tx_clean_thread_stack [512]
uint8_t phy_thread_stack [512]

Detailed Description

Macro Definition Documentation

#define RX_PRIORITY   (osPriorityNormal)

Driver transmit and receive thread priorities.

Thread priorities for receive thread and TX cleanup thread. Alter to prioritize receive or transmit bandwidth. In a heavily loaded system or with LEIP_DEBUG enabled, the priorities might be better the same.


Debug output formatter lock define.

When using FreeRTOS and with LWIP_DEBUG enabled, enabling this define will allow RX debug messages to not interleave with the TX messages (so they are actually readable). Not enabling this define when the system is under load will cause the output to be unreadable. There is a small tradeoff in performance for this so use it only for debug. Receive group interrupts

Function Documentation

void LPC17_EMAC::add_multicast_group ( const uint8_t *  address)

Add device to a multicast group

addressA multicast group hardware address

Implements EMAC.

uint32_t LPC17_EMAC::get_align_preference ( ) const

Gets memory buffer alignment preference

Gets preferred memory buffer alignment of the Emac device. IP stack may or may not align link out memory buffer chains using the alignment.

Memory alignment requirement in bytes

Implements EMAC.

MBED_WEAK EMAC & EMAC::get_default_instance ( )

Return the default on-board EMAC

Returns the default on-board EMAC - this will be target-specific, and may not be available on all targets.

bool LPC17_EMAC::get_hwaddr ( uint8_t *  addr) const

Return interface-supplied HW address

Copies HW address to provided memory,

addrhas to be of correct size see get_hwaddr_size

HW address need not be provided if this interface does not have its own HW address configuration; stack will choose address from central system configuration if the function returns false and does not write to addr.

addrHW address for underlying interface
true if HW address is available

Implements EMAC.

uint8_t LPC17_EMAC::get_hwaddr_size ( ) const

Returns size of the underlying interface HW address size.

HW address size in bytes

Implements EMAC.

void LPC17_EMAC::get_ifname ( char *  name,
uint8_t  size 
) const

Return interface name

namePointer to where the name should be written
sizeMaximum number of character to copy

Implements EMAC.

uint32_t LPC17_EMAC::get_mtu_size ( ) const

Return maximum transmission unit

MTU in bytes

Implements EMAC.

bool LPC17_EMAC::link_out ( emac_mem_buf_t *  p)

Low level output of a packet. Never call this from an interrupt context, as it may block until TX descriptors become available.

Sends the packet over the link

That can not be called from an interrupt context.

bufPacket to be send
True if the packet was send successfully, False otherwise
[in]pthe MAC packet to send (e.g. IP packet including MAC addresses and type)
ERR_OK if the packet could be sent or an err_t value if the packet couldn't be sent

< Generate TxDone Interrupt

< Last Descriptor for TX Frame

< Generate TxDone Interrupt

Implements EMAC.

void LPC17xxEthernetHandler ( void  )

LPC EMAC interrupt handler.

This function handles the transmit, receive, and error interrupt of the LPC177x_8x. This is meant to be used when NO_SYS=0.

< Overrun Error in RX Queue

< Receive Error

< Receive Done

< Transmit Underrun

< Transmit Error

< Transmit Done

void lpc_emac_set_duplex ( int  full_duplex)

This function provides a method for the PHY to setup the EMAC for the PHY negotiated duplex mode.

[in]full_duplex0 = half duplex, 1 = full duplex

< Full-Duplex Mode

< Full Duplex

< Full-Duplex Mode

< Full Duplex

void lpc_emac_set_speed ( int  mbs_100)

This function provides a method for the PHY to setup the EMAC for the PHY negotiated bit rate.

[in]mbs_1000 = 10mbs mode, 1 = 100mbs mode

< Reduced MII Logic Current Speed

void LPC17_EMAC::power_down ( )

Deinitializes the HW

Implements EMAC.

bool LPC17_EMAC::power_up ( )

Initializes the HW

True on success, False in case of an error.

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

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

ERR_OK if the loopif is initialized ERR_MEM if private data couldn't be allocated any other err_t on error

Implements EMAC.

void LPC17_EMAC::remove_multicast_group ( const uint8_t *  address)

Remove device from a multicast group

addressA multicast group hardware address

Implements EMAC.

void LPC17_EMAC::set_all_multicast ( bool  all)

Request reception of all multicast packets

allTrue to receive all multicasts False to receive only multicasts addressed to specified groups

Implements EMAC.

void LPC17_EMAC::set_hwaddr ( const uint8_t *  addr)

Set HW address for interface

Provided address has to be of correct size, see get_hwaddr_size

Called to set the MAC address to actually use - if get_hwaddr is provided the stack would normally use that, but it could be overridden, eg for test purposes.

addrAddress to be set

Implements EMAC.

void LPC17_EMAC::set_link_input_cb ( emac_link_input_cb_t  input_cb)

Sets a callback that needs to be called for packets received for that interface

input_cbFunction to be register as a callback

Implements EMAC.

void LPC17_EMAC::set_link_state_cb ( emac_link_state_change_cb_t  state_cb)

Sets a callback that needs to be called on link status changes for given interface

state_cbFunction to be register as a callback

Implements EMAC.

void LPC17_EMAC::set_memory_manager ( EMACMemoryManager mem_mngr)

Sets memory manager that is used to handle memory buffers

mem_mngrPointer to memory manager

Implements EMAC.

Variable Documentation

volatile uint32_t LPC_TXRX_DESC_T::control

Control word

uint32_t lpc_enetdata::lpc_last_tx_idx

TX last descriptor index, zero-copy mode

uint32_t lpc_enetdata::lpc_reserved_tx_num

Number of reserved TX descriptors, zero-copy mode

volatile uint32_t LPC_TXRX_DESC_T::packet

Pointer to buffer

LPC_TXRX_DESC_T lpc_enetdata::prxd[4]

Pointer to RX descriptor list

LPC_TXRX_STATUS_T lpc_enetdata::prxs[4]

Pointer to RX statuses

LPC_TXRX_DESC_T lpc_enetdata::ptxd[9]

Pointer to TX descriptor list

LPC_TXRX_STATUS_T lpc_enetdata::ptxs[9]

Pointer to TX statuses

uint32_t lpc_enetdata::rx_fill_desc_index

RX descriptor next available index

volatile uint32_t lpc_enetdata::rx_free_descs

Count of free RX descriptors

emac_mem_buf_t* lpc_enetdata::rxb[4]

RX pbuf pointer list, zero-copy mode

volatile uint32_t LPC_TXRX_STATUS_T::statushashcrc

RX hash CRC

volatile uint32_t LPC_TXRX_STATUS_T::statusinfo

RX status word

emac_mem_buf_t* lpc_enetdata::txb[9]

TX pbuf pointer list, zero-copy mode

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.