WINC3400 Iperf Server Example.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include <string.h>
#include "common/include/nm_common.h"
#include "driver/include/m2m_wifi.h"
#include "socket/include/socket.h"
#include "iperf.h"
Data Structures | |
struct | s_msg_wifi_product |
Message format definitions. More... | |
Macros | |
#define | STRING_EOL "\r\n" |
#define | STRING_HEADER |
Typedefs | |
typedef struct s_msg_wifi_product | t_msg_wifi_product |
Message format definitions. More... | |
Functions | |
static void | configure_console (void) |
Configure UART console. More... | |
static void | iperf_wifi_cb (uint8_t u8MsgType, void *pvMsg) |
Callback to get the Wi-Fi status update. More... | |
int | main (void) |
Main application function. More... | |
void | SysTick_Handler (void) |
Variables | |
static struct usart_module | cdc_uart_module |
UART module for debug. More... | |
uint32 | clientIPAddress |
uint32 | gu32IPAddress |
app_status | iperf_app_stat = {0,0,0,0} |
volatile uint32_t | ms_ticks = 0 |
SysTick counter to avoid busy wait delay. More... | |
SOCKET | tcp_client_sock = -1 |
uint32_t | tcp_serv_pack_recv = 0 |
uint32_t | udp_serv_pack_recv = 0 |
SOCKET | udp_server_sock = -1 |
static volatile uint8_t | wifi_connected |
Wi-Fi connection state. More... | |
#define STRING_EOL "\r\n" |
Referenced by main().
#define STRING_HEADER |
Referenced by main().
typedef struct s_msg_wifi_product t_msg_wifi_product |
Message format definitions.
|
static |
Configure UART console.
References usart_config::baudrate, cdc_uart_module, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), and usart_get_config_defaults().
|
static |
Callback to get the Wi-Fi status update.
[in] | u8MsgType | type of Wi-Fi notification. Possible types are:
|
[in] | pvMsg | A pointer to a buffer containing the notification parameters (if any). It should be casted to the correct data type corresponding to the notification type. Existing types are:
|
References gu32IPAddress, IPERF_WIFI_M2M_WLAN_AUTH, IPERF_WIFI_M2M_WLAN_PSK, IPERF_WIFI_M2M_WLAN_SSID, M2M_WIFI_CH_ALL, m2m_wifi_connect(), M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, M2M_WIFI_REQ_DHCP_CONF, M2M_WIFI_RESP_CON_STATE_CHANGED, MODE_INIT, printf, app_status::tcp_server, tstrM2MIPConfig::u32StaticIP, tstrM2mWifiStateChanged::u8CurrState, app_status::udp_server, and wifi_connected.
Referenced by main().
int main | ( | void | ) |
Main application function.
Initialize system, UART console, network then test function of TCP client.
References clientIPAddress, configure_console(), tstrIperfInit::ip, IPERF_TX_BUFFER_SIZE, iperf_wifi_cb(), IPERF_WIFI_M2M_SERVER_PORT, IPERF_WIFI_M2M_WLAN_AUTH, IPERF_WIFI_M2M_WLAN_PSK, IPERF_WIFI_M2M_WLAN_SSID, IperfCreate(), IperfInit(), IperfSocketClose(), IperfSocketEventHandler(), IperfTCP_Client_SendTestPacket(), IperfUpdate(), M2M_ERR, M2M_SUCCESS, M2M_WIFI_CH_ALL, m2m_wifi_connect(), m2m_wifi_handle_events(), m2m_wifi_init(), MODE_FINISHED, MODE_INIT, MODE_INIT_DONE, MODE_RUN, MODE_START, MODE_STOP, MODE_TCP_CLIENT, MODE_TCP_SERVER, MODE_UDP_CLIENT, MODE_UDP_SERVER, MODE_WAIT, nm_bsp_app_init(), nm_bsp_init(), NULL, tstrIperfInit::operating_mode, tstrIperfInit::packet_len, tstrIperfInit::packets_to_send, tstrWifiInitParam::pfAppWifiCb, tstrIperfInit::port, printf, registerSocketCallback(), ret, in_addr::s_addr, sockaddr_in::sin_addr, socketInit(), STRING_EOL, STRING_HEADER, system_init(), app_status::tcp_client, tcp_serv_pack_recv, app_status::tcp_server, tstrIperfInit::tls, app_status::udp_client, udp_client_addr, udp_serv_pack_recv, app_status::udp_server, and udp_server_sock.
void SysTick_Handler | ( | void | ) |
References ms_ticks.
|
static |
UART module for debug.
uint32 clientIPAddress |
Referenced by IperfSocketEventHandler(), and main().
uint32 gu32IPAddress |
app_status iperf_app_stat = {0,0,0,0} |
volatile uint32_t ms_ticks = 0 |
SysTick counter to avoid busy wait delay.
TLS read functionality.
SysTick counter for non busy wait delay.
SOCKET tcp_client_sock = -1 |
Referenced by IperfTCP_Client_SendTestPacket(), and IperfTCP_ClientStart().
uint32_t tcp_serv_pack_recv = 0 |
Referenced by IperfPrintStats(), and main().
uint32_t udp_serv_pack_recv = 0 |
Referenced by IperfPrintUdpServerStats(), and main().
SOCKET udp_server_sock = -1 |
Referenced by IperfSocketEventHandler(), and main().
|
static |
Wi-Fi connection state.
Referenced by iperf_wifi_cb().