OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [ppp/] [current/] [tests/] [tcp_echo.c] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      tests/tcp_echo.c
4
//
5
//      Simple TCP throughput test - echo component
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 2003 Free Software Foundation, Inc.                        
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
// ####BSDALTCOPYRIGHTBEGIN####                                             
40
// -------------------------------------------                              
41
// Portions of this software may have been derived from FreeBSD, OpenBSD,   
42
// or other sources, and if so are covered by the appropriate copyright     
43
// and license included herein.                                             
44
// -------------------------------------------                              
45
// ####BSDALTCOPYRIGHTEND####                                               
46
//==========================================================================
47
//#####DESCRIPTIONBEGIN####
48
//
49
// Author(s):    gthomas, nickg
50
// Contributors: gthomas, nickg
51
// Date:         2000-01-10
52
// Purpose:      
53
// Description:  This is the middle part of a three part test.  The idea is
54
//   to test the throughput of box in a configuration like this:
55
//
56
//      +------+   port   +----+     port    +----+
57
//      |SOURCE|=========>|ECHO|============>|SINK|
58
//      +------+   9990   +----+     9991    +----+
59
// 
60
//
61
//####DESCRIPTIONEND####
62
//
63
//==========================================================================
64
 
65
#include <pkgconf/system.h>
66
#include <pkgconf/net.h>
67
 
68
#include <cyg/io/io.h>
69
#include <cyg/io/serialio.h>
70
 
71
#include <cyg/ppp/ppp.h>
72
 
73
#include <cyg/infra/testcase.h>
74
 
75
#include "ppp_test_support.inl"
76
 
77
 
78
// Network throughput test code
79
 
80
#include <network.h>
81
 
82
static __inline__ unsigned int
83
max(unsigned int m, unsigned int n)
84
{
85
    return m > n ? m : n;
86
}
87
 
88
#define SOURCE_PORT 9990
89
#define SINK_PORT   9991
90
 
91
#define MAX_BUF 8192
92
static unsigned char data_buf[MAX_BUF];
93
 
94
struct test_params {
95
    long nbufs;
96
    long bufsize;
97
    long load;
98
};
99
 
100
struct test_status {
101
    long ok;
102
};
103
 
104
#ifndef CYGPKG_LIBC_STDIO
105
#define perror(s) diag_printf(#s ": %s\n", strerror(errno))
106
#endif
107
 
108
#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000)
109
static char stack[STACK_SIZE];
110
static cyg_thread thread_data;
111
static cyg_handle_t thread_handle;
112
 
113
// Background load stuff
114
#define NUM_LOAD_THREADS         20 // Get 5% granularity
115
#define IDLE_THREAD_PRIORITY     CYGNUM_PPP_PPPD_THREAD_PRIORITY+3
116
#define LOAD_THREAD_PRIORITY     CYGPKG_NET_THREAD_PRIORITY-3
117
#define MAIN_THREAD_PRIORITY     CYGPKG_NET_THREAD_PRIORITY-4
118
#define DESIRED_BACKGROUND_LOAD  50 // should be accurate enough over range
119
 
120
// starting points for load calculation
121
#define MAX_LOAD_THREAD_LEVEL    100
122
#define MIN_LOAD_THREAD_LEVEL    0
123
 
124
static char         idle_thread_stack[STACK_SIZE];
125
static cyg_thread   idle_thread_data;
126
static cyg_handle_t idle_thread_handle;
127
static cyg_sem_t    idle_thread_sem;
128
volatile static long long    idle_thread_count;
129
static char         load_thread_stack[NUM_LOAD_THREADS][STACK_SIZE];
130
static cyg_thread   load_thread_data[NUM_LOAD_THREADS];
131
static cyg_handle_t load_thread_handle[NUM_LOAD_THREADS];
132
static cyg_sem_t    load_thread_sem[NUM_LOAD_THREADS];
133
static long         load_thread_level;
134
static void calibrate_load(int load);
135
static void start_load(int load);
136
static void do_some_random_computation(int p,int id);
137
#define abs(n) ((n) < 0 ? -(n) : (n))
138
 
139
static long long no_load_idle_count_1_second;
140
 
141
extern void
142
cyg_test_exit(void);
143
 
144
void
145
pexit(char *s)
146
{
147
    perror(s);
148
    cyg_test_exit();
149
}
150
 
151
int
152
do_read(int s, void *_buf, int len)
153
{
154
    int total, slen, rlen;
155
    unsigned char *buf = (unsigned char *)_buf;
156
    total = 0;
157
    rlen = len;
158
    while (total < len) {
159
        slen = read(s, buf, rlen);
160
        if (slen != rlen) {
161
            if (slen < 0) {
162
                diag_printf("Error after reading %d bytes\n", total);
163
                return -1;
164
            }
165
            rlen -= slen;
166
            buf += slen;
167
        }
168
        total += slen;
169
    }
170
    return total;
171
}
172
 
173
int
174
do_write(int s, void *_buf, int len)
175
{
176
    int total, slen, rlen;
177
    unsigned char *buf = (unsigned char *)_buf;
178
    total = 0;
179
    rlen = len;
180
    while (total < len) {
181
        slen = write(s, buf, rlen);
182
        if (slen != rlen) {
183
            if (slen < 0) {
184
                diag_printf("Error after writing %d bytes\n", total);
185
                return -1;
186
            }
187
            rlen -= slen;
188
            buf += slen;
189
        }
190
        total += slen;
191
    }
192
    return total;
193
}
194
 
195
//
196
// This function is called to calibrate the "background load" which can be
197
// applied during testing.  It will be called before any commands from the
198
// host are managed.
199
//
200
static void
201
calibrate_load(int desired_load)
202
{
203
    long long no_load_idle, load_idle;
204
    int percent_load;
205
    int high, low;
206
 
207
    // Set limits
208
    high = MAX_LOAD_THREAD_LEVEL;
209
    low = MIN_LOAD_THREAD_LEVEL;
210
 
211
    // Compute the "no load" idle value
212
    idle_thread_count = 0;
213
    cyg_semaphore_post(&idle_thread_sem);  // Start idle thread
214
    cyg_thread_delay(1*100);               // Pause for one second
215
    cyg_semaphore_wait(&idle_thread_sem);  // Stop idle thread
216
    no_load_idle = idle_thread_count;
217
    diag_printf("No load = %d\n", (int)idle_thread_count);
218
 
219
    // First ensure that the HIGH level is indeed higher
220
    while (true) {
221
        load_thread_level = high;
222
        start_load(desired_load);              // Start up a given load
223
        idle_thread_count = 0;
224
        cyg_semaphore_post(&idle_thread_sem);  // Start idle thread
225
        cyg_thread_delay(1*100);               // Pause for one second
226
        cyg_semaphore_wait(&idle_thread_sem);  // Stop idle thread
227
        load_idle = idle_thread_count;
228
        start_load(0);                         // Shut down background load
229
        percent_load = 100 - ((load_idle * 100) / no_load_idle);
230
        diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level,
231
                    (int)idle_thread_count, percent_load);
232
        if ( percent_load > desired_load )
233
            break; // HIGH level is indeed higher
234
        low = load_thread_level; // known to be lower
235
        high *= 2; // else double it and try again
236
    }
237
 
238
    // Now chop down to the level required
239
    while (true) {
240
        load_thread_level = (high + low) / 2;
241
        start_load(desired_load);              // Start up a given load
242
        idle_thread_count = 0;
243
        cyg_semaphore_post(&idle_thread_sem);  // Start idle thread
244
        cyg_thread_delay(1*100);               // Pause for one second
245
        cyg_semaphore_wait(&idle_thread_sem);  // Stop idle thread
246
        load_idle = idle_thread_count;
247
        start_load(0);                         // Shut down background load
248
        percent_load = 100 - ((load_idle * 100) / no_load_idle);
249
        diag_printf("Load[%d] = %d => %d%%\n", load_thread_level,
250
                    (int)idle_thread_count, percent_load);
251
        if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break;
252
        if (percent_load < desired_load) {
253
            low = load_thread_level;
254
        } else {
255
            high = load_thread_level;
256
        }
257
    }
258
 
259
    // Now we are within a few percent of the target; scale the load
260
    // factor to get a better fit, and test it, print the answer.
261
    load_thread_level *= desired_load;
262
    load_thread_level /= percent_load;
263
    start_load(desired_load);              // Start up a given load
264
    idle_thread_count = 0;
265
    cyg_semaphore_post(&idle_thread_sem);  // Start idle thread
266
    cyg_thread_delay(1*100);               // Pause for one second
267
    cyg_semaphore_wait(&idle_thread_sem);  // Stop idle thread
268
    load_idle = idle_thread_count;
269
    start_load(0);                         // Shut down background load
270
    percent_load = 100 - ((load_idle * 100) / no_load_idle);
271
    diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level,
272
                (int)idle_thread_count, percent_load);
273
    no_load_idle_count_1_second = no_load_idle;
274
}
275
 
276
//
277
// This function is called to set up a load level of 'load' percent (given
278
// as a whole number, e.g. start_load(20) would mean initiate a background
279
// load of 20%, leaving the cpu 80% idle).
280
//
281
static void
282
start_load(int load)
283
{
284
    static int prev_load = 0;
285
    int i;
286
    if (load == 0) {
287
        diag_printf("Set no background load\n");
288
        if (prev_load == 0) return;  // Nothing out there to stop
289
        for (i = 0;  i < prev_load * NUM_LOAD_THREADS/100;  i++) {
290
            cyg_semaphore_wait(&load_thread_sem[i]);
291
        }
292
        prev_load = 0;
293
    } else {
294
        diag_printf("Set background load = %d%% starting %d threads\n",
295
                    load, load * NUM_LOAD_THREADS/100 );
296
        for (i = 0;  i < load * NUM_LOAD_THREADS/100;  i++) {
297
            cyg_semaphore_post(&load_thread_sem[i]);
298
        }
299
        prev_load = load;
300
    }
301
}
302
 
303
//
304
// These thread(s) do some amount of "background" computing.  This is used
305
// to simulate a given load level.  They need to be run at a higher priority 
306
// than the network code itself.
307
//
308
// Like the "idle" thread, they run as long as their "switch" (aka semaphore)
309
// is enabled.
310
//
311
void
312
net_load(cyg_addrword_t who)
313
{
314
    int i;
315
    while (true) {
316
        cyg_semaphore_wait(&load_thread_sem[who]);
317
        for (i = 0;  i < load_thread_level;  i++) {
318
            do_some_random_computation(i,who);
319
        }
320
        cyg_thread_delay(1);  // Wait until the next 'tick'
321
        cyg_semaphore_post(&load_thread_sem[who]);
322
    }
323
}
324
 
325
//
326
// Some arbitrary computation, designed to use up the CPU and cause associated
327
// cache "thrash" behaviour - part of background load modelling.
328
//
329
static void
330
do_some_random_computation(int p,int id)
331
{
332
    // Just something that might be "hard"
333
#if 0
334
    {
335
        volatile double x;
336
        x = ((p * 10) * 3.14159) / 180.0;  // radians
337
    }
338
#endif
339
#if 1
340
    {
341
        static int footle[0x10001];
342
        static int counter = 0;
343
        register int i;
344
 
345
        i = (p << 8) + id + counter++;
346
        i &= 0xffff;
347
        footle[ i+1 ] += footle[ i ] + 1;
348
    }
349
#endif
350
}
351
 
352
//
353
// This thread does nothing but count.  It will be allowed to count
354
// as long as the semaphore is "free".  
355
//
356
void
357
net_idle(cyg_addrword_t param)
358
{
359
    while (true) {
360
        cyg_semaphore_wait(&idle_thread_sem);
361
        idle_thread_count++;
362
        cyg_semaphore_post(&idle_thread_sem);
363
    }
364
}
365
 
366
static void
367
echo_test(cyg_addrword_t p)
368
{
369
    int s_source, s_sink, e_source, e_sink;
370
    struct sockaddr_in e_source_addr, e_sink_addr, local;
371
    int one = 1;
372
    fd_set in_fds;
373
    int i, num, len;
374
    struct test_params params,nparams;
375
    struct test_status status,nstatus;
376
 
377
    cyg_tick_count_t starttime, stoptime;
378
 
379
    s_source = socket(AF_INET, SOCK_STREAM, 0);
380
    if (s_source < 0) {
381
        pexit("stream socket");
382
    }
383
    if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) {
384
        pexit("setsockopt /source/ SO_REUSEADDR");
385
    }
386
    if (setsockopt(s_source, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) {
387
        pexit("setsockopt /source/ SO_REUSEPORT");
388
    }
389
    memset(&local, 0, sizeof(local));
390
    local.sin_family = AF_INET;
391
    local.sin_len = sizeof(local);
392
    local.sin_port = ntohs(SOURCE_PORT);
393
    local.sin_addr.s_addr = INADDR_ANY;
394
    if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) {
395
        pexit("bind /source/ error");
396
    }
397
    listen(s_source, SOMAXCONN);
398
 
399
    s_sink = socket(AF_INET, SOCK_STREAM, 0);
400
    if (s_sink < 0) {
401
        pexit("stream socket");
402
    }
403
    memset(&local, 0, sizeof(local));
404
    local.sin_family = AF_INET;
405
    local.sin_len = sizeof(local);
406
    local.sin_port = ntohs(SINK_PORT);
407
    local.sin_addr.s_addr = INADDR_ANY;
408
    if(bind(s_sink, (struct sockaddr *) &local, sizeof(local)) < 0) {
409
        pexit("bind /sink/ error");
410
    }
411
    if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) {
412
        pexit("setsockopt /sink/ SO_REUSEADDR");
413
    }
414
    if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) {
415
        pexit("setsockopt /sink/ SO_REUSEPORT");
416
    }
417
    listen(s_sink, SOMAXCONN);
418
 
419
    e_source = 0;  e_sink = 0;
420
    while (true) {
421
        // Wait for a connection on either of the ports
422
        FD_ZERO(&in_fds);
423
        FD_SET(s_source, &in_fds);
424
        FD_SET(s_sink, &in_fds);
425
        num = select(max(s_sink,s_source)+1, &in_fds, 0, 0, 0);
426
        if (FD_ISSET(s_source, &in_fds)) {
427
            len = sizeof(e_source_addr);
428
            if ((e_source = accept(s_source, (struct sockaddr *)&e_source_addr, &len)) < 0) {
429
                pexit("accept /source/");
430
            }
431
            diag_printf("SOURCE connection from %s:%d\n",
432
                        inet_ntoa(e_source_addr.sin_addr), ntohs(e_source_addr.sin_port));
433
        }
434
        if (FD_ISSET(s_sink, &in_fds)) {
435
            len = sizeof(e_sink_addr);
436
            if ((e_sink = accept(s_sink, (struct sockaddr *)&e_sink_addr, &len)) < 0) {
437
                pexit("accept /sink/");
438
            }
439
            diag_printf("SINK connection from %s:%d\n",
440
                        inet_ntoa(e_sink_addr.sin_addr), ntohs(e_sink_addr.sin_port));
441
        }
442
        // Continue with test once a connection is established in both directions
443
        if ((e_source != 0) && (e_sink != 0)) {
444
            break;
445
        }
446
    }
447
 
448
    // Wait for "source" to tell us the testing paramters
449
    if (do_read(e_source, &nparams, sizeof(nparams)) != sizeof(nparams)) {
450
        pexit("Can't read initialization parameters");
451
    }
452
 
453
    params.nbufs = ntohl(nparams.nbufs);
454
    params.bufsize = ntohl(nparams.bufsize);
455
    params.load = ntohl(nparams.load);
456
 
457
    diag_printf("Using %d buffers of %d bytes each, %d%% background load\n",
458
                params.nbufs, params.bufsize, params.load);
459
 
460
    // Tell the sink what the parameters are
461
    if (do_write(e_sink, &nparams, sizeof(nparams)) != sizeof(nparams)) {
462
        pexit("Can't write initialization parameters");
463
    }
464
 
465
    status.ok = 1;
466
    nstatus.ok = htonl(status.ok);
467
 
468
    // Tell the "source" to start - we're all connected and ready to go!
469
    if (do_write(e_source, &nstatus, sizeof(nstatus)) != sizeof(nstatus)) {
470
        pexit("Can't send ACK to 'source' host");
471
    }
472
 
473
    idle_thread_count = 0;
474
    cyg_semaphore_post(&idle_thread_sem);  // Start idle thread
475
    starttime = cyg_current_time();
476
    start_load(params.load);
477
 
478
    // Echo the data from the source to the sink hosts
479
    for (i = 0;  i < params.nbufs;  i++) {
480
        if ((len = do_read(e_source, data_buf, params.bufsize)) != params.bufsize) {
481
            diag_printf("Can't read buf #%d: ", i+1);
482
            if (len < 0) {
483
                perror("I/O error");
484
            } else {
485
                diag_printf("short read - only %d bytes\n", len);
486
            }
487
        }
488
//        else diag_printf("Got %d bytes\n",len);        
489
        if ((len = do_write(e_sink, data_buf, params.bufsize)) != params.bufsize) {
490
            diag_printf("Can't write buf #%d: ", i+1);
491
            if (len < 0) {
492
                perror("I/O error");
493
            } else {
494
                diag_printf("short write - only %d bytes\n", len);
495
            }
496
        }
497
//        else diag_printf("Sent %d bytes\n",len);        
498
    }
499
 
500
    // Wait for the data to drain and the "sink" to tell us all is OK.
501
    if (do_read(e_sink, &status, sizeof(status)) != sizeof(status)) {
502
        pexit("Can't receive ACK from 'sink' host");
503
    }
504
 
505
    start_load(0);
506
    cyg_semaphore_wait(&idle_thread_sem);  // Stop idle thread
507
    stoptime = cyg_current_time();
508
    stoptime -= starttime; // time taken in cS
509
    // expected idle loops in that time period for an idle system:
510
    starttime = no_load_idle_count_1_second * stoptime / 100;
511
    diag_printf( "%d ticks elapsed, %d kloops predicted for an idle system\n",
512
                 (int)stoptime, (int)(starttime/1000) );
513
    diag_printf( "actual kloops %d, CPU was %d%% idle during transfer\n",
514
                 (int)(idle_thread_count/1000),
515
                 (int)(idle_thread_count * 100 / starttime) );
516
 
517
    // Now examine how close that loading actually was:
518
    start_load(params.load);              // Start up a given load
519
    idle_thread_count = 0;
520
    cyg_semaphore_post(&idle_thread_sem);  // Start idle thread
521
    cyg_thread_delay(1*100);               // Pause for one second
522
    cyg_semaphore_wait(&idle_thread_sem);  // Stop idle thread
523
    start_load(0);                         // Shut down background load
524
    i = 100 - ((idle_thread_count * 100) / no_load_idle_count_1_second );
525
    diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level,
526
                (int)idle_thread_count, i);
527
 
528
//#ifdef CYGDBG_USE_ASSERTS
529
#ifdef CYGDBG_NET_TIMING_STATS 
530
    {
531
        extern void show_net_times(void);
532
        show_net_times();
533
    }
534
#endif
535
//#endif
536
}
537
 
538
//==========================================================================
539
 
540
void
541
net_test(cyg_addrword_t param)
542
{
543
    cyg_serial_baud_rate_t old;
544
    cyg_ppp_options_t options;
545
    cyg_ppp_handle_t ppp_handle;
546
 
547
    CYG_TEST_INIT();
548
 
549
    diag_printf("Start TCP test - ECHO mode\n");
550
    init_all_network_interfaces();
551
    calibrate_load(DESIRED_BACKGROUND_LOAD);
552
#ifdef CYGPKG_SNMPAGENT
553
    {
554
        extern void cyg_net_snmp_init(void);
555
        cyg_net_snmp_init();
556
    }
557
#endif
558
 
559
    old = ppp_test_set_baud( CYGNUM_SERIAL_BAUD_115200 );
560
 
561
    ppp_test_announce( "TCP_ECHO" );
562
 
563
    cyg_ppp_options_init( &options );
564
 
565
//    options.debug = 1;
566
//    options.kdebugflag = 1;
567
//    options.flowctl = CYG_PPP_FLOWCTL_SOFTWARE;
568
 
569
    ppp_handle = cyg_ppp_up( CYGPKG_PPP_TEST_DEVICE, &options );
570
 
571
    CYG_TEST_INFO( "Waiting for PPP to come up");
572
 
573
    cyg_ppp_wait_up( ppp_handle );
574
 
575
    echo_test(param);
576
 
577
    CYG_TEST_INFO( "Bringing PPP down");
578
 
579
    cyg_ppp_down( ppp_handle );
580
 
581
    CYG_TEST_INFO( "Waiting for PPP to go down");
582
 
583
    cyg_ppp_wait_down( ppp_handle );
584
 
585
    cyg_thread_delay( 200 );
586
 
587
    ppp_test_set_baud( old );
588
 
589
    ppp_test_finish();
590
 
591
    CYG_TEST_PASS_FINISH("TCP ECHO test OK");
592
}
593
 
594
void
595
cyg_start(void)
596
{
597
    int i;
598
    // Create a main thread which actually runs the test
599
    cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority
600
                      net_test,             // entry
601
                      0,                    // entry parameter
602
                      "Network test",       // Name
603
                      &stack[0],            // Stack
604
                      STACK_SIZE,           // Size
605
                      &thread_handle,       // Handle
606
                      &thread_data          // Thread data structure
607
            );
608
    cyg_thread_resume(thread_handle);  // Start it
609
    // Create the idle thread environment
610
    cyg_semaphore_init(&idle_thread_sem, 0);
611
    cyg_thread_create(IDLE_THREAD_PRIORITY,     // Priority
612
                      net_idle,                 // entry
613
                      0,                        // entry parameter
614
                      "Network idle",           // Name
615
                      &idle_thread_stack[0],    // Stack
616
                      STACK_SIZE,               // Size
617
                      &idle_thread_handle,      // Handle
618
                      &idle_thread_data         // Thread data structure
619
            );
620
    cyg_thread_resume(idle_thread_handle);      // Start it
621
    // Create the load threads and their environment(s)
622
    for (i = 0;  i < NUM_LOAD_THREADS;  i++) {
623
        cyg_semaphore_init(&load_thread_sem[i], 0);
624
        cyg_thread_create(LOAD_THREAD_PRIORITY,     // Priority
625
                          net_load,                 // entry
626
                          i,                        // entry parameter
627
                          "Background load",        // Name
628
                          &load_thread_stack[i][0], // Stack
629
                          STACK_SIZE,               // Size
630
                          &load_thread_handle[i],   // Handle
631
                          &load_thread_data[i]      // Thread data structure
632
            );
633
        cyg_thread_resume(load_thread_handle[i]);   // Start it
634
    }
635
    cyg_scheduler_start();
636
}
637
 
638
// EOF tcp_echo.c

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.