#include "cmd_emac.h"
#include "cmd_echoserver.h"
#include "cmd_ping.h"
+#include "cmd_iperf.h"
#ifdef TARGET_TMS570_RPP
#include "cmd_dac.h"
CMD_DES_INCLUDE_SUBLIST(cmd_list_es),
CMD_DES_INCLUDE_SUBLIST(cmd_list_netstats),
CMD_DES_INCLUDE_SUBLIST(cmd_list_ping),
+ CMD_DES_INCLUDE_SUBLIST(cmd_list_iperf),
#ifdef TARGET_TMS570_RPP
CMD_DES_INCLUDE_SUBLIST(cmd_list_dac),
CMD_DES_INCLUDE_SUBLIST(cmd_list_din),
--- /dev/null
+/*
+ * Copyright (C) 2012-2019 Czech Technical University in Prague
+ *
+ * Created on: 25.3.2019
+ *
+ * Authors:
+ * - Jakub Nejedly
+ *
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
+ *
+ * File : cmd_iperf.c
+ *
+ * Abstract:
+ *
+ *
+ */
+
+#include "cmd_iperf.h"
+
+#ifndef DOCGEN
+
+
+#include "cmdproc_freertos.h"
+#include "rpp/rpp.h"
+
+#include "lwip/opt.h"
+#include "lwip/tcp.h"
+
+
+
+static err_t lwiperf_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err){
+
+ LWIP_UNUSED_ARG(arg);
+
+ if (err == ERR_OK && p != NULL) {
+ tcp_recved(pcb, p->tot_len);
+ pbuf_free(p);
+
+ } else if (err != ERR_OK && p != NULL) {
+ pbuf_free(p);
+
+ }
+
+ if (err == ERR_OK && p == NULL) {
+ tcp_arg(pcb, NULL);
+ tcp_sent(pcb, NULL);
+ tcp_recv(pcb, NULL);
+ tcp_close(pcb);
+ }
+ return ERR_OK;
+}
+
+static err_t lwiperf_accept(void *arg, struct tcp_pcb *pcb, err_t err){
+
+ LWIP_UNUSED_ARG(arg);
+ LWIP_UNUSED_ARG(err);
+
+ tcp_arg(pcb, NULL);
+ tcp_sent(pcb, NULL);
+ tcp_recv(pcb, lwiperf_recv);
+ return ERR_OK;
+}
+
+
+
+
+int cmd_do_eth_lwiperf(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]){
+
+ // test ethinit
+ if (!isPostInitialized()) {
+ rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+ return FAILURE;
+ }
+
+ //err_t err = ERR_OK;
+
+ struct tcp_pcb *pcb;
+
+ pcb = tcp_new();
+ tcp_bind(pcb, IP_ADDR_ANY, 5001); // bind to iperf port
+ pcb = tcp_listen(pcb);
+ tcp_accept(pcb, lwiperf_accept);
+
+ rpp_sci_printf("Iperf initialized \r\n");
+
+
+ return ERR_OK;
+}
+
+
+
+#endif /* DOCGEN */
+
+cmd_des_t const cmd_des_ethiperf = {
+ 0, 0,
+ "ethiperf","Command to test IP Bandwidth",
+ "### Command syntax ###\n"
+ "\n"
+ " ethiperf \n"
+ "\n"
+ "### Description ###\n"
+ "Command start iperf server on platform. To test internet bandwidth run iperf -c [board_IP] at testing computer."
+ "\n"
+ "### Example ###\n"
+ "\n"
+ " --> ethiperf\n"
+ "At testing computer\n"
+ " --> ethiperf -c 10.35.95.25\n",
+ CMD_HANDLER(cmd_do_eth_lwiperf), (void *)&cmd_list_iperf
+};
+
+/** List of commands for adc, defined as external */
+cmd_des_t const *cmd_list_iperf[] = {
+ &cmd_des_ethiperf,
+ NULL
+};
+