Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

μC/IPerf is designed to get the best throughput and no results are displayed in main test task. So, you have to create your own application to query anddisplay and display test results. However, μC/IPerf comes with a basic reporter application as an example to display standard result before, during and after a run test. This reporter is based on a terminal used, so if you implement a terminal application you can use this reporter directly.

Example of application code is given in listing 3-1, and The following example was written to illustrate the capabilities of the μC/IPerf module with the basic reporter. That code is a task which simply initializes μC/IPerf and creates a terminal I/O to queued test and start the basic reporter.

Code Block
languagemicrium
static void App_TaskTerminal (void *p_arg)
{
	CPU_CHAR 		cmd_str[TASK_TERMINAL_CMD_STR_MAX_LEN];
	CPU_INT16S 		cmp_str;
	CPU_SIZE_T 		cmd_len;
	IPERF_TEST_ID 	test_id_iperf;
	IPERF_ERR 		err_iperf;
	
 
	IPerf_Init(&err_iperf); 														(1)
	APP_TEST_FAULT(err_iperf, IPERF_ERR_NONE); 										(2)
	printf("\n\rTerminal I/O\n\r\n\r");
	
	while (DEF_ON) {
		printf("\n\r> ");
		BSP_Ser_RdStr((CPU_CHAR *)&cmd_str[0],TASK_TERMINAL_CMD_STR_MAX_LEN);    				(3)
				      (CPU_INT16U) TASK_TERMINAL_CMD_STR_MAX_LEN);
		cmp_str = Str_Cmp_N((CPU_CHAR *)&cmd_str[0], "iperf", (45)
;								(CPU_CHAR *)"iperf",4)					
							(CPU_SIZE_T) 5);
		cmd_len = Str_Len(&cmd_str[0]);
		if (cmp_str == 0) {
			printf("\n\r\n\r");
			test_id_iperf = IPerf_TestStart((CPU_CHAR 	    *)&cmd_str[0], 							(5)
											(IPERF_OUT_FNCT  )&App_OutputFnct,
										    (IPERF_OUT_PARAM ) 0,
											(IPERF_ERR      *)&err_iperf);
			if ((err_iperf     == IPERF_ERR_NONE    ) &&
				(test_id_iperf != IPERF_TEST_ID_NONE)) {
				 IPerf_Reporter((IPERF_TEST_ID    ) test_id_iperf, 					(6)
								(IPERF_OUT_FNCT   )&App_OutputFnct,
							    (IPERF_OUT_PARAM *) 0);
				 printf("\n\r");
			}
		} else if (cmd_len > 1u) {
				printf("Command is not recognized.");
		}
	}
}