WINC3400 Iperf Server Example.
Copyright (c) 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 "driver/include/m2m_periph.h"
#include "socket/include/socket.h"
#include "iperf.h"
#include "conf_board.h"
#include "bus_wrapper/include/nm_bus_wrapper.h"
#include "driver/source/nmasic.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 | disable_pullups (void) |
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... | |
Variables | |
uint32 | clientIPAddress |
uint32 | gu32IPAddress |
app_status | iperf_app_stat = {0,0,0,0} |
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 uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
|
static |
|
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, 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 board_init(), 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(), m2m_wifi_init_hold(), 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, registerSocketCallback(), in_addr::s_addr, sockaddr_in::sin_addr, socketInit(), STRING_EOL, STRING_HEADER, sysclk_get_cpu_hz(), sysclk_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.
uint32 clientIPAddress |
Referenced by IperfSocketEventHandler(), and main().
uint32 gu32IPAddress |
app_status iperf_app_stat = {0,0,0,0} |
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().