winc Network Interface Driver for lwIP.
Copyright (c) 2019 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 <winc_netif.h>
#include <sysclk.h>
#include <string.h>
#include <semphr.h>
#include <m2m_wifi_ex.h>
#include <net_init.h>
#include <os_hook.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 | WINC_RX_BUF_SZ (PBUF_POOL_BUFSIZE - ETH_PAD_SIZE) |
#define | WINC_TX_BUF_SIZE (1536) |
Functions | |
void | winc_fill_callback_info (tstrEthInitParam *info) |
Configure RX callback and buffer. More... | |
err_t | winc_netif_init (struct netif *netif) |
Initialize lwIP network interface. More... | |
static void | winc_netif_low_level_init (struct netif *netif) |
Perform low level initialization of the netif driver. More... | |
void | winc_netif_rx_callback (uint8 msg_type, void *msg, void *ctrl_buf) |
Receive packets from the winc under HIF thread context. More... | |
static err_t | winc_netif_tx (struct netif *netif, struct pbuf *p) |
Send packet from lwIP to HIF task for processing. More... | |
void | winc_netif_tx_from_queue (hif_msg_t *msg) |
Send pending packets to the winc under HIF thread context. More... | |
Variables | |
xQueueHandle | hif_queue |
Queue used by HIF task. More... | |
uint32_t | os_hif_task_msg_post_counter |
static uint8_t | rx_buf [WINC_RX_BUF_SZ] |
static struct pbuf * | rx_first |
static struct pbuf * | rx_last |
static uint8_t | tx_buf [WINC_TX_BUF_SIZE] |
struct netif | winc_netif_c_mode |
The netif for the winc1000 in concurrent (AP or WiFi Direct) mode. More... | |
struct netif | winc_netif_sta |
The netif for the winc1000 in station mode. More... | |
#define IFNAME0 'e' |
Define those to better describe your network interface.
Referenced by winc_netif_init().
#define IFNAME1 'n' |
Referenced by winc_netif_init().
#define NET_LINK_SPEED 100000000 |
Network link speed.
Referenced by winc_netif_init().
#define NET_MTU 1500 |
Maximum transfer unit.
Referenced by winc_netif_low_level_init().
#define WINC_RX_BUF_SZ (PBUF_POOL_BUFSIZE - ETH_PAD_SIZE) |
#define WINC_TX_BUF_SIZE (1536) |
Referenced by winc_netif_tx().
void winc_fill_callback_info | ( | tstrEthInitParam * | info | ) |
Configure RX callback and buffer.
References tstrEthInitParam::au8ethRcvBuf, tstrEthInitParam::pfAppEthCb, rx_buf, tstrEthInitParam::u16ethRcvBufSize, tstrEthInitParam::u8EthernetEnable, and winc_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, winc_netif_low_level_init(), and winc_netif_tx().
Referenced by net_add_winc_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, and NETIF_FLAG_IGMP.
Referenced by winc_netif_init().
void winc_netif_rx_callback | ( | uint8 | msg_type, |
void * | msg, | ||
void * | ctrl_buf | ||
) |
Receive packets from the winc 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, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_POOL, PBUF_POOL_BUFSIZE, PBUF_RAW, rx_buf, pbuf::tot_len, tstrM2mIpCtrlBuf::u16DataSize, tstrM2mIpCtrlBuf::u16RemainingDataSize, and winc_netif_sta.
Referenced by winc_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, MSG_TX_AP, MSG_TX_STA, pbuf::next, NULL, os_hif_task_msg_post_counter, hif_msg_t::payload, pbuf::payload, hif_msg_t::payload_size, hif_msg_t::pbuf, pbuf_ref(), pbuf::tot_len, tx_buf, winc_netif_sta, WINC_TX_BUF_SIZE, and xQueueSend.
Referenced by winc_netif_init().
void winc_netif_tx_from_queue | ( | hif_msg_t * | msg | ) |
Send pending packets to the winc under HIF thread context.
References pbuf::len, M2M_SUCCESS, m2m_wifi_send_ethernet_pkt(), hif_msg_t::payload, pbuf::payload, hif_msg_t::payload_size, hif_msg_t::pbuf, pbuf_free(), and vTaskDelay().
Referenced by os_hif_task().
xQueueHandle hif_queue |
Queue used by HIF task.
uint32_t os_hif_task_msg_post_counter |
Referenced by os_hook_dispatch_no_wait(), os_hook_dispatch_wait(), os_hook_send_start(), and winc_netif_tx().
|
static |
Referenced by winc_fill_callback_info(), and winc_netif_rx_callback().
|
static |
|
static |
|
static |
Referenced by winc_netif_tx().
struct netif winc_netif_c_mode |
The netif for the winc1000 in concurrent (AP or WiFi Direct) mode.
Referenced by net_add_winc_netif(), net_interface_down_imp(), net_interface_up_imp(), and net_remove_winc_netif().
struct netif winc_netif_sta |
The netif for the winc1000 in station mode.
Referenced by net_add_winc_netif(), net_interface_down_imp(), net_interface_up_imp(), net_remove_winc_netif(), net_set_mode(), winc_netif_rx_callback(), and winc_netif_tx().