WILC Network Interface Driver for lwIP.
Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
#include <lwip/opt.h>
#include <lwip/def.h>
#include <lwip/mem.h>
#include <lwip/pbuf.h>
#include <lwip/sys.h>
#include <lwip/ethip6.h>
#include <lwip/stats.h>
#include <lwip/snmp.h>
#include <lwip/tcpip.h>
#include <netif/etharp.h>
#include <netif/include/wilc_netif.h>
#include <sysclk.h>
#include <string.h>
#include <semphr.h>
#include <os/include/m2m_wifi_ex.h>
#include <os/include/net_init.h>
Macros | |
#define | IFNAME0 'e' |
Define those to better describe your network interface. More... | |
#define | IFNAME1 'n' |
#define | NET_LINK_SPEED 100000000 |
Network link speed. More... | |
#define | NET_MTU 1500 |
Maximum transfer unit. More... | |
#define | WILC_RX_BUF_SZ (PBUF_POOL_BUFSIZE - M2M_ETHERNET_HDR_OFFSET) |
#define | WILC_TX_BUF_SIZE (PBUF_POOL_BUFSIZE - M2M_ETHERNET_HDR_OFFSET) |
Functions | |
void | wilc_fill_callback_info (tstrEthInitParam *info) |
Configure RX callback and buffer. More... | |
err_t | wilc_netif_init (struct netif *netif) |
Initialize lwIP network interface. More... | |
static void | wilc_netif_low_level_init (struct netif *netif) |
Perform low level initialization of the netif driver. More... | |
void | wilc_netif_rx_callback (uint8 msg_type, void *msg, void *ctrl_buf) |
Receive packets from the WILC under HIF thread context. More... | |
static err_t | wilc_netif_tx (struct netif *netif, struct pbuf *p) |
Send packet from lwIP to HIF task for processing. More... | |
void | wilc_netif_tx_from_queue (hif_msg_t *msg) |
Send pending packets to the WILC under HIF thread context. More... | |
Variables | |
xQueueHandle | hif_queue |
Queue used by HIF task. More... | |
static uint8_t | rx_buf [WILC_RX_BUF_SZ] |
static struct pbuf * | rx_first |
static struct pbuf * | rx_last |
static uint8_t | tx_buf [WILC_TX_BUF_SIZE] |
struct netif | wilc_netif_c_mode |
The netif for the WILC1000 in concurrent (AP or WiFi Direct) mode. More... | |
struct netif | wilc_netif_sta |
The netif for the WILC1000 in station mode. More... | |
#define IFNAME0 'e' |
Define those to better describe your network interface.
Referenced by wilc_netif_init().
#define IFNAME1 'n' |
Referenced by wilc_netif_init().
#define NET_LINK_SPEED 100000000 |
Network link speed.
Referenced by wilc_netif_init().
#define NET_MTU 1500 |
Maximum transfer unit.
Referenced by wilc_netif_low_level_init().
#define WILC_RX_BUF_SZ (PBUF_POOL_BUFSIZE - M2M_ETHERNET_HDR_OFFSET) |
Referenced by wilc_netif_rx_callback().
#define WILC_TX_BUF_SIZE (PBUF_POOL_BUFSIZE - M2M_ETHERNET_HDR_OFFSET) |
Referenced by wilc_netif_tx().
void wilc_fill_callback_info | ( | tstrEthInitParam * | info | ) |
Configure RX callback and buffer.
References tstrEthInitParam::au8ethRcvBuf, tstrEthInitParam::pfAppEthCb, rx_buf, tstrEthInitParam::u16ethRcvBufSize, and wilc_netif_rx_callback().
Referenced by os_m2m_wifi_init_imp().
Initialize lwIP network interface.
References ERR_OK, IFNAME0, IFNAME1, netif::linkoutput, netif::name, NET_LINK_SPEED, NETIF_INIT_SNMP, NULL, netif::output, snmp_ifType_ethernet_csmacd, netif::state, wilc_netif_low_level_init(), and wilc_netif_tx().
Referenced by net_add_wilc_netif().
|
static |
Perform low level initialization of the netif driver.
References netif::flags, netif::hwaddr, netif::hwaddr_len, m2m_wifi_get_mac_address(), netif::mtu, NET_MTU, NETIF_FLAG_BROADCAST, NETIF_FLAG_ETHARP, NETIF_FLAG_IGMP, and netif::num.
Referenced by wilc_netif_init().
void wilc_netif_rx_callback | ( | uint8 | msg_type, |
void * | msg, | ||
void * | ctrl_buf | ||
) |
Receive packets from the WILC under HIF thread context.
References ERR_OK, ETH_PAD_SIZE, netif::input, pbuf::len, LINK_STATS_INC, M2M_WIFI_RESP_ETHERNET_RX_PACKET, m2m_wifi_set_receive_buffer_ex, pbuf::next, NULL, osprintf(), pbuf::payload, pbuf_alloc(), pbuf_free(), pbuf_header(), PBUF_POOL, PBUF_RAW, rx_buf, pbuf::tot_len, tstrM2MDataBufCtrl::u16DataSize, tstrM2MDataBufCtrl::u16RemainigDataSize, tstrM2MDataBufCtrl::u8DataOffset, tstrM2MDataBufCtrl::u8IfcId, wilc_netif_c_mode, wilc_netif_sta, and WILC_RX_BUF_SZ.
Referenced by wilc_fill_callback_info().
Send packet from lwIP to HIF task for processing.
References ERR_BUF, ERR_OK, ETH_PAD_SIZE, hif_msg_t::id, pbuf::len, LINK_STATS_INC, M2M_ETHERNET_HDR_OFFSET, msg, MSG_TX_AP, MSG_TX_STA, pbuf::next, NULL, hif_msg_t::payload, pbuf::payload, hif_msg_t::payload_size, hif_msg_t::pbuf, pbuf_header(), pbuf_ref(), pbuf::tot_len, tx_buf, wilc_netif_sta, WILC_TX_BUF_SIZE, and xQueueSend.
Referenced by wilc_netif_init().
void wilc_netif_tx_from_queue | ( | hif_msg_t * | msg | ) |
Send pending packets to the WILC under HIF thread context.
References AP_INTERFACE, hif_msg_t::id, M2M_SUCCESS, m2m_wifi_send_ethernet_pkt(), MSG_TX_STA, hif_msg_t::payload, hif_msg_t::payload_size, hif_msg_t::pbuf, pbuf_free(), STATION_INTERFACE, and vTaskDelay().
Referenced by os_hif_task().
xQueueHandle hif_queue |
Queue used by HIF task.
|
static |
Referenced by http_request(), sta_task(), wilc_fill_callback_info(), and wilc_netif_rx_callback().
|
static |
|
static |
|
static |
Referenced by wilc_netif_tx().
struct netif wilc_netif_c_mode |
The netif for the WILC1000 in concurrent (AP or WiFi Direct) mode.
Referenced by net_add_wilc_netif(), net_interface_down_imp(), net_interface_up_imp(), net_remove_wilc_netif(), net_set_interface_address(), and wilc_netif_rx_callback().
struct netif wilc_netif_sta |
The netif for the WILC1000 in station mode.
Referenced by net_add_wilc_netif(), net_interface_down_imp(), net_interface_up_imp(), net_remove_wilc_netif(), net_set_interface_address(), net_set_mode(), status_callback(), wilc_netif_rx_callback(), and wilc_netif_tx().