rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
|
Ethernet peripheral driver. More...
Go to the source code of this file.
Data Structures | |
struct | rflpc_eth_descriptor_t |
This structure holds a descriptor which describes the fragment received or sent by the ethernet DMA. More... | |
struct | rflpc_eth_rx_status_t |
This structure holds the reception status associated to a descriptor. More... | |
struct | rflpc_eth_tx_status_t |
This structure holds the transmit status associated to a descriptor. More... | |
Macros | |
#define | TX_PRODUCE_INDEX_INC(inc) ((LPC_EMAC->TxProduceIndex + (inc))% (LPC_EMAC->TxDescriptorNumber+1)) |
Helper macro for rflpc_eth_get_current_tx_packet_descriptor. | |
Link modes | |
These constants can be used to get or set the link mode using rflpc_eth_get_link_mode and rflpc_eth_set_link_mode. | |
#define | RFLPC_ETH_LINK_MODE_SPEED_BIT (1 << 0) |
This bit indicates 100Mbps/10Mbps speed. | |
#define | RFLPC_ETH_LINK_MODE_DUPLEX_BIT (1 << 1) |
This bit indicates Full/Half duplex mode. | |
#define | RFLPC_ETH_LINK_MODE_100HD (RFLPC_ETH_LINK_MODE_SPEED_BIT) |
100Mbps, Half Duplex | |
#define | RFLPC_ETH_LINK_MODE_10HD (0) |
10Mbps, Half Duplex | |
#define | RFLPC_ETH_LINK_MODE_100FD (RFLPC_ETH_LINK_MODE_SPEED_BIT | RFLPC_ETH_LINK_MODE_DUPLEX_BIT) |
100Mbps, Full Duplex | |
#define | RFLPC_ETH_LINK_MODE_10FD (RFLPC_ETH_LINK_MODE_DUPLEX_BIT) |
10Mbps, Full Duplex | |
Functions | |
int | rflpc_eth_init () |
Inits the ethernet device. | |
int | rflpc_eth_link_state () |
Returns the link state. More... | |
void | rflpc_eth_set_link_mode (int mode) |
Forces the MAC and PHY devices to operate on the given mode no matter the capability of the linked partner. More... | |
int | rflpc_eth_link_auto_negociate (int max_desired_mode) |
Force the physical link to perform auto negociation of mode. More... | |
int | rflpc_eth_get_link_mode () |
returns the current link mode. More... | |
static uint32_t | rflpc_eth_get_packet_size (uint32_t status_info) |
Returns the size of a packet from the status_info field of a rflpc_eth_tx_status_t or rflpc_eth_rx_status_t. More... | |
static void | rflpc_eth_set_tx_control_word (uint32_t size_to_send, volatile uint32_t *control, int trigger_it, int last_fragment) |
Sets the transmission control word of a rflpc_eth_descriptor_t struct. More... | |
void | rflpc_eth_set_rx_base_addresses (rflpc_eth_descriptor_t *descriptors, rflpc_eth_rx_status_t *status, int count) |
Sets rx descriptors and status base address. More... | |
static int | rflpc_eth_get_current_rx_packet_descriptor (rflpc_eth_descriptor_t **descriptor, rflpc_eth_rx_status_t **status) |
Returns the pointers on the current rx packet descriptor. More... | |
static int | rflpc_eth_rx_available () |
Returns true if a packet has been received and not yet processed available. More... | |
static void | rflpc_eth_done_process_rx_packet () |
This function has to be called when a packet (which descriptor is returned by rflpc_eth_get_current_rx_packet_descriptor) has been processed and can be discarded. | |
void | rflpc_eth_set_tx_base_addresses (rflpc_eth_descriptor_t *descriptos, rflpc_eth_tx_status_t *status, int count) |
Sets tx descriptors and status base address. More... | |
static int | rflpc_eth_get_current_tx_packet_descriptor (rflpc_eth_descriptor_t **descriptor, rflpc_eth_tx_status_t **status, int idx) |
returns the index of the current tx packet descriptor. More... | |
static int | rflpc_eth_get_last_sent_packet_idx () |
Returns the index of the last send buffer. More... | |
static void | rflpc_eth_done_process_tx_packet (int count) |
When the packet has been generated, calling this function will make it owned by the hardware and queued for emission. More... | |
void | rflpc_eth_get_mac_address (uint8_t *addr) |
returns the device MAC address | |
void | rflpc_eth_set_mac_address (const uint8_t *addr) |
sets the device MAC address | |
static void | rflpc_eth_set_irq_handler (rflpc_irq_handler_t c) |
sets the interrupt handler of the ethernet peripheral | |
static void | rflpc_eth_irq_enable (uint32_t irqs) |
enable eth interrupts More... | |
static void | rflpc_eth_irq_disable (uint32_t irqs) |
disable eth interrupts This function will remove irq enable bits. More... | |
static void | rflpc_eth_irq_enable_set (uint32_t irqs) |
sets the irq enable register This function will disable all irqs and then only enable those given. More... | |
static void | rflpc_eth_irq_clear (uint32_t irqs) |
clear given pending interrupts | |
static uint32_t | rflpc_eth_irq_get_status () |
gets the interrupt status. More... | |
static void | rflpc_eth_irq_trigger (uint32_t irqs) |
Force the generation of the given interrupt. More... | |
static void | rflpc_eth_activate_rx_filter (int accept_unicast, int accept_multicast, int accept_broadcast) |
Activate the hardware receive filter. More... | |
static void | rflpc_eth_deactivate_rx_filter () |
Deactivates the hardware receive filter. More... | |
void | rflpc_eth_dump_internals () |
Use the printf function to dump the values of the MAC registers. More... | |
Ethernet peripheral driver.
Definition in file ethernet.h.