#include "nc_test_framework.h"
-#include <cyg/error/errno.h>
-#include <cyg/error/codes.h>
-#include <cyg/error/strerror.h>
#include <cyg/infra/diag.h>
#include <lwip/inet.h>
#include <lwip/arch.h>
-#define LWIP_TIMEVAL_PRIVATE
+#include <lwip/sys.h>
+#define LWIP_TIMEVAL_PRIVATE 1
#include <lwip/sockets.h>
+#include <cyg/infra/testcase.h>
#ifndef CYGPKG_LIBC_STDIO
+#include <cyg/error/errno.h>
#define perror(s) diag_printf(#s ": %s\n", strerror(errno))
+#else
+#include <stdio.h>
#endif
#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000)
#define MAX_LOAD_THREAD_LEVEL 20
#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-2
#define DESIRED_BACKGROUND_LOAD 20
#define CYGHWR_NET_DRIVERS 1
+
+#if SO_REUSE
+#ifdef CYGPKG_LWIP_TCP
+#ifdef CYGPKG_LWIP_UDP
+
+
+#if 0
static char main_thread_stack[CYGHWR_NET_DRIVERS][STACK_SIZE];
static cyg_thread main_thread_data[CYGHWR_NET_DRIVERS];
static cyg_handle_t main_thread_handle[CYGHWR_NET_DRIVERS];
+#endif
+
+
static char idle_thread_stack[STACK_SIZE];
static cyg_thread idle_thread_data;
static cyg_handle_t idle_thread_handle;
seq_errors++;
}
} else {
- test_printf("Bad data packet - key: %x/%x, seq: %d\n",
+ test_printf("Bad data packet - key: %lx/%lx, seq: %d\n",
ntohl(tdp->key1), ntohl(tdp->key2),
ntohl(tdp->seq));
}
seq_errors++;
}
} else {
- test_printf("Bad data packet - key: %x/%x, seq: %d\n",
+ test_printf("Bad data packet - key: %lx/%lx, seq: %d\n",
ntohl(tdp->key1), ntohl(tdp->key2),
ntohl(tdp->seq));
}
}
void
-net_test(test_param_t param)
+net_test(void *arg)
{
+ test_param_t param = (test_param_t)arg;
// int i;
if (param == 0) {
test_printf("Start Network Characterization - SLAVE\n");
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("High Load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
if ( percent_load > desired_load )
break; // HIGH level is indeed higher
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("Load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("Load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break;
if (percent_load < desired_load) {
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("Final load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
// no_load_idle_count_1_second = no_load_idle;
}
static cyg_handle_t thread_handle;
void
-cyg_user_start(void)
+nc_slave_main(void)
{
int i;
+
+ CYG_TEST_INIT();
// Create the idle thread environment
cyg_semaphore_init(&idle_thread_sem, 0);
cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority
&thread_data // Thread data structure
);
cyg_thread_resume(thread_handle); // Start it
+ cyg_scheduler_start();
+ CYG_TEST_FAIL_FINISH("Not reached");
+}
+
+
+externC void
+cyg_start( void )
+{
+ nc_slave_main();
+}
+
+#else // def CYGPKG_LWIP_UDP
+#define N_A_MSG "UDP support disabled"
+#endif // def CYGPKG_LWIP_UDP
+#else // def CYGPKG_LWIP_TCP
+#define N_A_MSG "TCP support disabled"
+#endif // def CYGPKG_LWIP_TCP
+#else // SO_REUSE
+#define N_A_MSG "SO_REUSE currently unavailable"
+#endif // SO_REUSE
+
+#ifdef N_A_MSG
+externC void
+cyg_start( void )
+{
+ CYG_TEST_INIT();
+ CYG_TEST_NA(N_A_MSG);
}
+#endif // N_A_MSG