RTEMS  5.1
Data Structures | Macros | Enumerations | Functions
lpc-ethernet.c File Reference

Ethernet driver. More...

#include <machine/rtems-bsd-kernel-space.h>
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <rtems.h>
#include <rtems/rtems_bsdnet.h>
#include <rtems/rtems_mii_ioctl.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <bsp.h>
#include <bsp/irq.h>
#include <bsp/lpc-ethernet-config.h>
#include <bsp/utility.h>

Data Structures

struct  lpc_eth_transfer_descriptor
 
struct  lpc_eth_receive_status
 
struct  lpc_eth_controller
 
struct  lpc_eth_driver_entry
 
struct  lpc_eth_phy_action
 

Macros

#define LPC_ETH_CONFIG_TX_BUF_SIZE   1518U
 
#define DEFAULT_PHY   0
 
#define WATCHDOG_TIMEOUT   5
 
#define ETH_RX_CTRL_SIZE_MASK   0x000007ffU
 
#define ETH_RX_CTRL_INTERRUPT   0x80000000U
 
#define ETH_RX_STAT_RXSIZE_MASK   0x000007ffU
 
#define ETH_RX_STAT_BYTES   0x00000100U
 
#define ETH_RX_STAT_CONTROL_FRAME   0x00040000U
 
#define ETH_RX_STAT_VLAN   0x00080000U
 
#define ETH_RX_STAT_FAIL_FILTER   0x00100000U
 
#define ETH_RX_STAT_MULTICAST   0x00200000U
 
#define ETH_RX_STAT_BROADCAST   0x00400000U
 
#define ETH_RX_STAT_CRC_ERROR   0x00800000U
 
#define ETH_RX_STAT_SYMBOL_ERROR   0x01000000U
 
#define ETH_RX_STAT_LENGTH_ERROR   0x02000000U
 
#define ETH_RX_STAT_RANGE_ERROR   0x04000000U
 
#define ETH_RX_STAT_ALIGNMENT_ERROR   0x08000000U
 
#define ETH_RX_STAT_OVERRUN   0x10000000U
 
#define ETH_RX_STAT_NO_DESCRIPTOR   0x20000000U
 
#define ETH_RX_STAT_LAST_FLAG   0x40000000U
 
#define ETH_RX_STAT_ERROR   0x80000000U
 
#define ETH_TX_CTRL_SIZE_MASK   0x7ffU
 
#define ETH_TX_CTRL_SIZE_SHIFT   0
 
#define ETH_TX_CTRL_OVERRIDE   0x04000000U
 
#define ETH_TX_CTRL_HUGE   0x08000000U
 
#define ETH_TX_CTRL_PAD   0x10000000U
 
#define ETH_TX_CTRL_CRC   0x20000000U
 
#define ETH_TX_CTRL_LAST   0x40000000U
 
#define ETH_TX_CTRL_INTERRUPT   0x80000000U
 
#define ETH_TX_STAT_COLLISION_COUNT_MASK   0x01e00000U
 
#define ETH_TX_STAT_DEFER   0x02000000U
 
#define ETH_TX_STAT_EXCESSIVE_DEFER   0x04000000U
 
#define ETH_TX_STAT_EXCESSIVE_COLLISION   0x08000000U
 
#define ETH_TX_STAT_LATE_COLLISION   0x10000000U
 
#define ETH_TX_STAT_UNDERRUN   0x20000000U
 
#define ETH_TX_STAT_NO_DESCRIPTOR   0x40000000U
 
#define ETH_TX_STAT_ERROR   0x80000000U
 
#define ETH_INT_RX_OVERRUN   0x00000001U
 
#define ETH_INT_RX_ERROR   0x00000002U
 
#define ETH_INT_RX_FINISHED   0x00000004U
 
#define ETH_INT_RX_DONE   0x00000008U
 
#define ETH_INT_TX_UNDERRUN   0x00000010U
 
#define ETH_INT_TX_ERROR   0x00000020U
 
#define ETH_INT_TX_FINISHED   0x00000040U
 
#define ETH_INT_TX_DONE   0x00000080U
 
#define ETH_INT_SOFT   0x00001000U
 
#define ETH_INT_WAKEUP   0x00002000U
 
#define ETH_RX_FIL_CTRL_ACCEPT_UNICAST   0x00000001U
 
#define ETH_RX_FIL_CTRL_ACCEPT_BROADCAST   0x00000002U
 
#define ETH_RX_FIL_CTRL_ACCEPT_MULTICAST   0x00000004U
 
#define ETH_RX_FIL_CTRL_ACCEPT_UNICAST_HASH   0x00000008U
 
#define ETH_RX_FIL_CTRL_ACCEPT_MULTICAST_HASH   0x00000010U
 
#define ETH_RX_FIL_CTRL_ACCEPT_PERFECT   0x00000020U
 
#define ETH_RX_FIL_CTRL_MAGIC_PACKET_WOL   0x00001000U
 
#define ETH_RX_FIL_CTRL_RX_FILTER_WOL   0x00002000U
 
#define ETH_CMD_RX_ENABLE   0x00000001U
 
#define ETH_CMD_TX_ENABLE   0x00000002U
 
#define ETH_CMD_REG_RESET   0x00000008U
 
#define ETH_CMD_TX_RESET   0x00000010U
 
#define ETH_CMD_RX_RESET   0x00000020U
 
#define ETH_CMD_PASS_RUNT_FRAME   0x00000040U
 
#define ETH_CMD_PASS_RX_FILTER   0X00000080U
 
#define ETH_CMD_TX_FLOW_CONTROL   0x00000100U
 
#define ETH_CMD_RMII   0x00000200U
 
#define ETH_CMD_FULL_DUPLEX   0x00000400U
 
#define ETH_STAT_RX_ACTIVE   0x00000001U
 
#define ETH_STAT_TX_ACTIVE   0x00000002U
 
#define ETH_MAC2_FULL_DUPLEX   BSP_BIT32(8)
 
#define ETH_SUPP_SPEED   BSP_BIT32(8)
 
#define ETH_MCFG_CLOCK_SELECT(val)   BSP_FLD32(val, 2, 4)
 
#define ETH_MCFG_RESETMIIMGMT   BSP_BIT32(15)
 
#define ETH_MCMD_READ   BSP_BIT32(0)
 
#define ETH_MCMD_SCAN   BSP_BIT32(1)
 
#define ETH_MADR_REG(val)   BSP_FLD32(val, 0, 4)
 
#define ETH_MADR_PHY(val)   BSP_FLD32(val, 8, 12)
 
#define ETH_MIND_BUSY   BSP_BIT32(0)
 
#define ETH_MIND_SCANNING   BSP_BIT32(1)
 
#define ETH_MIND_NOT_VALID   BSP_BIT32(2)
 
#define ETH_MIND_MII_LINK_FAIL   BSP_BIT32(3)
 
#define LPC_ETH_EVENT_INITIALIZE   RTEMS_EVENT_1
 
#define LPC_ETH_EVENT_TXSTART   RTEMS_EVENT_2
 
#define LPC_ETH_EVENT_INTERRUPT   RTEMS_EVENT_3
 
#define LPC_ETH_EVENT_STOP   RTEMS_EVENT_4
 
#define LPC_ETH_INTERRUPT_RECEIVE   (ETH_INT_RX_ERROR | ETH_INT_RX_FINISHED | ETH_INT_RX_DONE)
 
#define LPC_ETH_INTERRUPT_TRANSMIT   (ETH_INT_TX_DONE | ETH_INT_TX_FINISHED | ETH_INT_TX_ERROR)
 
#define LPC_ETH_RX_STAT_ERRORS
 
#define LPC_ETH_LAST_FRAGMENT_FLAGS
 
#define LPC_ETH_PRINTF(...)
 
#define LPC_ETH_PRINTK(...)
 
#define LPC_ETH_RX_DATA_OFFSET   2
 
#define PHY_KSZ80X1RNL   0x221550
 
#define PHY_DP83848   0x20005c90
 

Enumerations

enum  lpc_eth_state { LPC_ETH_STATE_NOT_INITIALIZED = 0, LPC_ETH_STATE_DOWN, LPC_ETH_STATE_UP }
 

Functions

int lpc_eth_attach_detach (struct rtems_bsdnet_ifconfig *config, int attaching)
 Network driver attach and detach function.
 

Detailed Description

Ethernet driver.

Macro Definition Documentation

◆ LPC_ETH_LAST_FRAGMENT_FLAGS

#define LPC_ETH_LAST_FRAGMENT_FLAGS
Value:
(ETH_TX_CTRL_OVERRIDE \
| ETH_TX_CTRL_PAD \
| ETH_TX_CTRL_CRC \
| ETH_TX_CTRL_INTERRUPT \
| ETH_TX_CTRL_LAST)

◆ LPC_ETH_RX_STAT_ERRORS

#define LPC_ETH_RX_STAT_ERRORS
Value:
(ETH_RX_STAT_CRC_ERROR \
| ETH_RX_STAT_SYMBOL_ERROR \
| ETH_RX_STAT_LENGTH_ERROR \
| ETH_RX_STAT_ALIGNMENT_ERROR \
| ETH_RX_STAT_OVERRUN \
| ETH_RX_STAT_NO_DESCRIPTOR)