#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/mem.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
#include "lwip/sys.h"
#include "netif/etharp.h"
#include "netif/wlif.h"
#include <wl_api.h>
Data Structures | |
struct | wlif_t |
Macros | |
#define | IFNAME0 'w' |
#define | IFNAME1 'l' |
#define | PQUEUE_DEQUEUE(q) |
#define | PQUEUE_EMPTY(q) (q.last == q.first) |
#define | PQUEUE_ENQUEUE(q, p) |
#define | PQUEUE_FIRST(q) (q.buf[q.first]) |
#define | PQUEUE_FULL(q) ((q.last + 1) % PQUEUE_SIZE == q.first) |
#define | PQUEUE_SIZE 8 |
Functions | |
static err_t | low_level_init (struct netif *netif) |
In this function, the hardware should be initialized. More... | |
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. More... | |
static err_t | low_level_output (struct netif *netif, struct pbuf *p) |
This function should do the actual transmission of the packet. More... | |
static err_t | process_pqueue (struct netif *netif) |
static void | rx_isr (void *ctx) |
Called in interrupt context when we can read more data from the mac. More... | |
err_t | wlif_init (struct netif *netif) |
Should be called at the beginning of the program to set up the network interface. More... | |
static void | wlif_input (struct netif *netif) |
This function will be called by wlif_poll() when a packet has been received from the mac. More... | |
void | wlif_poll (struct netif *netif) |
#define IFNAME0 'w' |
Referenced by wlif_init().
#define IFNAME1 'l' |
Referenced by wlif_init().
#define PQUEUE_DEQUEUE | ( | q | ) |
Referenced by process_pqueue().
#define PQUEUE_EMPTY | ( | q | ) | (q.last == q.first) |
Referenced by process_pqueue().
#define PQUEUE_ENQUEUE | ( | q, | |
p | |||
) |
Referenced by low_level_output().
#define PQUEUE_FIRST | ( | q | ) | (q.buf[q.first]) |
Referenced by process_pqueue().
#define PQUEUE_FULL | ( | q | ) | ((q.last + 1) % PQUEUE_SIZE == q.first) |
Referenced by low_level_output().
#define PQUEUE_SIZE 8 |
In this function, the hardware should be initialized.
Called from wlif_init().
netif | the already initialized lwip network interface structure for this ethernetif |
References ERR_IF, ERR_OK, netif::flags, netif::hwaddr, netif::hwaddr_len, netif::mtu, NETIF_FLAG_BROADCAST, NETIF_FLAG_ETHARP, NETIF_FLAG_IGMP, and NETIF_FLAG_LINK_UP.
Referenced by wlif_init().
Should allocate a pbuf and transfer the bytes of the incoming packet from the interface into the pbuf.
netif | the lwip network interface structure for this ethernetif |
References LINK_STATS_INC, NULL, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_RAM, PBUF_RAW, pbuf_realloc(), wlif_t::rx_pending, netif::state, and status.
Referenced by wlif_input().
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.
netif | the lwip network interface structure for this ethernetif |
p | the MAC packet to send (e.g. IP packet including MAC addresses and type) |
References ERR_IF, ERR_INPROGRESS, ERR_OK, if(), pbuf::len, pbuf_ref(), wlif_t::pqueue, PQUEUE_ENQUEUE, PQUEUE_FULL, process_pqueue(), and netif::state.
Referenced by wlif_init().
References ERR_IF, ERR_INPROGRESS, ERR_OK, if(), pbuf::len, LINK_STATS_INC, pbuf::next, NULL, pbuf::payload, pbuf_free(), wlif_t::pqueue, PQUEUE_DEQUEUE, PQUEUE_EMPTY, PQUEUE_FIRST, netif::state, status, and pbuf::tot_len.
Referenced by low_level_output(), and wlif_poll().
|
static |
Called in interrupt context when we can read more data from the mac.
References ctx, wlif_t::rx_pending, and netif::state.
Referenced by wlif_init().
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().
netif | the lwip network interface structure for this ethernetif |
References IFNAME0, IFNAME1, netif::linkoutput, low_level_init(), low_level_output(), LWIP_ASSERT, netif::name, NULL, netif::output, rx_isr(), and netif::state.
|
static |
This function will be called by wlif_poll() when a packet has been received from the mac.
Then the type of the received packet is determined and the appropriate input function is called.
netif | the lwip network interface structure for this ethernetif |
References ERR_OK, htons, netif::input, low_level_input(), LWIP_DEBUGF, NETIF_DEBUG, NULL, pbuf::payload, and pbuf_free().
Referenced by wlif_poll().
void wlif_poll | ( | struct netif * | netif | ) |
References if(), NULL, process_pqueue(), wlif_t::rx_pending, netif::state, and wlif_input().