This file defines the net_iface functions, which sit between the MityDSP network drivers and the lwIP stack. More...
#include <stddef.h>#include <stdlib.h>#include <stdio.h>#include <assert.h>#include "core/DspError.h"#include "net/net_drvr/net_drvr.h"#include "net/net_iface.h"#include "netif/etharp.h"#include "netif_access.h"Classes | |
| struct | tsPbufQueue |
| struct | tsMbxData |
Functions | |
| static int | net_iface_rx_thread (struct netif *apNetif) |
| static err_t | net_iface_output (struct netif *apNetif, struct pbuf *apPbuf, struct ip_addr *apIpAddr) |
| static err_t | net_iface_linkoutput (struct netif *apNetif, struct pbuf *apPbuf) |
| static err_t | net_iface_mac_filter (struct netif *apNetif, struct ip_addr *apIp, unsigned char anAdd) |
| void | net_iface_set_defaults (tsNetIface *apNetIface, tcNetDrvr *apNetDrvr) |
| void | net_iface_copy_pbuff (tsNetIface *apNetIfaceDst, tsNetIface *apNetIfaceSrc) |
| err_t | net_iface_init (struct netif *apNetif) |
| void | net_iface_rx_cb (void *apBuffer, int anLen, void *apUser, bool abInIsr) |
| void * | net_iface_buf_alloc (int anLen, void *apUser) |
Variables | |
| struct eth_addr | ethbroadcast |
This file defines the net_iface functions, which sit between the MityDSP network drivers and the lwIP stack.
o 0 | / Copyright (c) 2005-2009 (CL)—o Critical Link, LLC \ O
|
static |
This function is started as a thread by net_iface_init. It pends on a mailbox which is filled by net_iface_rx_cb with packet data. The payload retrieved via the mailbox is compared to the queue of pbufs allocated by net_iface_buf_alloc. When a match is found, the underlying pbuf is passed directly to the network stack.
| [in] | apNetif | Pointer to the netif structure. |
|
static |
This function is called by the TCP/IP stack when an IP packet should be sent. It calls the function etharp_output() to resolve the MAC address, which eventually calls net_iface_linkoutput() to do the actual transmission of the packet.
| [in] | apNetif | Pointer to the netif structure. |
| [in] | apPbuf | Pointer to the pbuf containing the packet. |
| [in] | apIpAddr | Pointer to the IP address of the destination. |
|
static |
This function is called to direct the actual transmission of the packet. The packet is contained in a pbuf (or chain of pbufs), which must be passed to the network driver transmit routine.
| [in] | apNetif | Pointer to the netif structure. |
| [in] | apPbuf | Pointer to the pbuf containing the packet. |
|
static |
This function is called to add or remove a particular MAC address to/from the interface's multicast filter list.
| [in] | apNetif | Pointer to the netif structure. |
| [in] | apIp | Pointer to an ip_addr structure. |
| [in] | anAdd | Zero to remove the filter, non-zero to add. |
| void net_iface_set_defaults | ( | tsNetIface * | apNetIface, |
| tcNetDrvr * | apNetDrvr | ||
| ) |
This function provides defaults for the tsNetIface structure.
| [in] | apNetIface | Pointer to the tsNetIface structure to set to default values. |
| [in] | apNetDrvr | Pointer to the network driver to associate with the provided tsNetIface. |
| void net_iface_copy_pbuff | ( | tsNetIface * | apNetIfaceDst, |
| tsNetIface * | apNetIfaceSrc | ||
| ) |
| err_t net_iface_init | ( | struct netif * | apNetif | ) |
This function should be registered as the lwIP network interface (netif) initialization function. When activated, it sets up the interface, starts the receiver thread, and initializes the network hardware.
| [in] | apNetif | Pointer to the netif structure for the interface being initialized. |
| void net_iface_rx_cb | ( | void * | apBuffer, |
| int | anLen, | ||
| void * | apUser, | ||
| bool | abInIsr | ||
| ) |
This function is registered as the receive packet callback for the network driver by the "open" call in net_iface_init. When activated, it posts the pointer to the received data to the net_iface_rx_thread.
| [in] | apBuffer | Pointer to the received packet. |
| [in] | anLen | The length of the received packet. |
| [in] | apUser | Pointer to the netif structure. |
| [in] | abInIsr | True if called from ISR (not used). |
| void* net_iface_buf_alloc | ( | int | anLen, |
| void * | apUser | ||
| ) |
This function is registered as the buffer allocation callback for the network driver by the "open" call in net_iface_init. When activated, it provides a valid location where the next packet is to be written.
| [in] | anLen | The length of the buffer to allocate. |
| [in] | apUser | Pointer to the netif structure. |
| struct eth_addr ethbroadcast |