annotate packages/kernel/current/tests/thread_gdb.c @ 3043:6724f8254bcb

* tests/bin_sem2.cxx (PHILOSOPHERS): * tests/fptest.cx (TEST_NA): * tests/kmutex3.c (NTHREADS): * tests/kmutex4.c (NTHREADS): * tests/mutex3.cxx (NTHREADS): * tests/thread_gdb.c (NTHREADS): * tests/timeslice.c (NTHREADS_MAX): * tests/timeslice2.c (NTHREADS_MAX): * tests/tm_basic.cxx (NTEST_THREADS): Given a chance to compile and run more tests for low memory footprint targets. [ Bugzilla 1001253 ]
author sergeig
date Sun, 10 Jul 2011 16:01:36 +0000
parents 74dbf4c3f2e1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
2 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
3 // thread_gdb.c
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
4 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
5 // A test for thread support in GDB
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
6 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
7 //==========================================================================
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
8 // ####ECOSGPLCOPYRIGHTBEGIN####
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
9 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
10 // This file is part of eCos, the Embedded Configurable Operating System.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 66
diff changeset
12 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
13 // eCos is free software; you can redistribute it and/or modify it under
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
14 // the terms of the GNU General Public License as published by the Free
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
15 // Software Foundation; either version 2 or (at your option) any later
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
16 // version.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 66
diff changeset
17 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
18 // eCos is distributed in the hope that it will be useful, but WITHOUT
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
19 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
21 // for more details.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 66
diff changeset
22 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
23 // You should have received a copy of the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
24 // along with eCos; if not, write to the Free Software Foundation, Inc.,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 66
diff changeset
26 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
27 // As a special exception, if other files instantiate templates or use
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
28 // macros or inline functions from this file, or you compile this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
29 // and link it with other works to produce a work based on this file,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
30 // this file does not by itself cause the resulting work to be covered by
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
31 // the GNU General Public License. However the source code for this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
32 // must still be made available in accordance with section (3) of the GNU
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
33 // General Public License v2.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 66
diff changeset
34 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
35 // This exception does not invalidate any other reasons why a work based
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
36 // on this file might be covered by the GNU General Public License.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
37 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 210
diff changeset
38 // ####ECOSGPLCOPYRIGHTEND####
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
39 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
40 //#####DESCRIPTIONBEGIN####
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
41 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
42 // Author(s): nickg
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
43 // Contributors: nickg
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
44 // Date: 1998-09-21
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
45 // Description: GDB thread support test.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
46 //####DESCRIPTIONEND####
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
47 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
48
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
49 #include <cyg/kernel/kapi.h>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
50
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
51 #include <cyg/infra/cyg_ass.h>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
52
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
53 #include <cyg/infra/testcase.h>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
54
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
55 #if defined(CYGFUN_KERNEL_API_C) && defined(CYGSEM_KERNEL_SCHED_MLQUEUE) &&\
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
56 (CYGNUM_KERNEL_SCHED_PRIORITIES > 26)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
57
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
58 #include <cyg/hal/hal_arch.h> // for CYGNUM_HAL_STACK_SIZE_TYPICAL
3043
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
59 #include CYGHWR_MEMORY_LAYOUT_H
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
60
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
61 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
62
3043
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
63 #if (CYGMEM_REGION_ram_SIZE <= 32768)
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
64 # define THREADS 5
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
65 #elif (CYGMEM_REGION_ram_SIZE <= 49152)
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
66 # define THREADS 8
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
67 #else
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
68 # define THREADS 10
6724f8254bcb * tests/bin_sem2.cxx (PHILOSOPHERS):
sergeig
parents: 2729
diff changeset
69 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
70
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
71 #ifdef CYGNUM_HAL_STACK_SIZE_TYPICAL
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
72 #define STACKSIZE CYGNUM_HAL_STACK_SIZE_TYPICAL
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
73 #else
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
74 #define STACKSIZE (2*1024)
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
75 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
76
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
77 #define CONTROLLER_PRI_HI 0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
78 #define CONTROLLER_PRI_LO 25
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
79
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
80 #define WORKER_PRI 3
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
81 #define WORKER_PRI_RANGE 20
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
82
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
83
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
84 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
85
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
86 // array of stacks for threads
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
87 char thread_stack[THREADS][STACKSIZE];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
88
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
89 // array of threads.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
90 cyg_thread thread[THREADS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
91
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
92 cyg_handle_t thread_handle[THREADS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
93
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
94 volatile cyg_uint8 worker_state;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
95
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
96 #define WORKER_STATE_WAIT 1
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
97 #define WORKER_STATE_BREAK 2
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
98 #define WORKER_STATE_EXIT 9
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
99
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
100 cyg_mutex_t worker_mutex;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
101 cyg_cond_t worker_cv;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
102
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
103 cyg_count32 workers_asleep = 0;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
104
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
105 cyg_count32 thread_count[THREADS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
106
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
107 cyg_priority_t thread_pri[THREADS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
108
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
109
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
110
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
111 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
112
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
113 extern void breakme(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
114 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
115 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
116
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
117 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
118
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
119 void worker( cyg_addrword_t id )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
120 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
121 for(;;)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
122 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
123 thread_count[id]++;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
124 thread_pri[id] = cyg_thread_get_priority( cyg_thread_self() );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
125
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
126 switch( worker_state )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
127 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
128 case WORKER_STATE_BREAK:
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
129 if( 0 == (id % 4) )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
130 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
131
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
132 case WORKER_STATE_WAIT:
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
133 cyg_mutex_lock( &worker_mutex );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
134 workers_asleep++;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
135 cyg_cond_wait( &worker_cv );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
136 workers_asleep--;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
137 cyg_mutex_unlock( &worker_mutex );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
138 break;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
139
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
140 case WORKER_STATE_EXIT:
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
141 cyg_thread_exit();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
142
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
143 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
144 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
145 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
146
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
147 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
148
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
149 void controller( cyg_addrword_t id )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
150 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
151 cyg_priority_t pri;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
152 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
153
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
154 cyg_mutex_init( &worker_mutex );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
155 cyg_cond_init( &worker_cv, &worker_mutex );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
156
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
157 // 1 thread, it is running, it calls BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
158 // +++ Thread status returned:
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
159 // +++ 1 thread, running, is the current one
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
160
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
161 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
162
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
163 // Create N more threads; they are all suspended after creation. Adjust
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
164 // the priorities of all the threads to lower than the controlling thread.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
165 // Make them all be distinct priorities as far as possible. BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
166 // +++ 1 thread, running, + N suspended ones of different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
167
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
168 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
169 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
170 pri = CONTROLLER_PRI_HI + 1 + i % WORKER_PRI_RANGE;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
171
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
172 cyg_thread_create(pri, worker, (cyg_addrword_t)i, "worker",
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
173 (void *)(&thread_stack[i]), STACKSIZE,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
174 &thread_handle[i], &thread[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
175
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
176 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
177
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
178 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
179
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
180 // Adjust the priorities of all the threads to lower than the controlling
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
181 // thread. Make them all be THE SAME priority. BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
182 // +++ 1 thread, running, + N suspended ones of same prio.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
183
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
184 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
185 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
186 cyg_thread_set_priority( thread_handle[i], WORKER_PRI );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
187 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
188
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
189 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
190
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
191 // Release all the N threads, BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
192 // +++ 1 thread, running, + N ready ones of same prio.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
193
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
194 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
195 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
196 cyg_thread_resume( thread_handle[i] );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
197 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
198
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
199 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
200
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
201 // Adjust the priorities of all the threads, lower than the controlling
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
202 // thread. Make them all be distinct priorities as far as possible.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
203 // BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
204 // +++ 1 thread, running, + N ready ones of different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
205
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
206 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
207 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
208 pri = CONTROLLER_PRI_HI + 1 + i % WORKER_PRI_RANGE;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
209
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
210 cyg_thread_set_priority( thread_handle[i], pri );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
211 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
212
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
213 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
214
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
215 // Command all the N threads to sleep; switch my own priority to lower
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
216 // than theirs so that they all run and sleep, then I get back in and
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
217 // BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
218 // +++ 1 thread, running, + N sleeping ones of different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
219
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
220 worker_state = WORKER_STATE_WAIT;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
221
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
222 cyg_thread_set_priority( thread_handle[0], CONTROLLER_PRI_LO );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
223
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
224 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
225
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
226 // Make them all be THE SAME priority; BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
227 // +++ 1 thread, running, + N sleeping ones of same prio.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
228
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
229 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
230 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
231 cyg_thread_set_priority( thread_handle[i], WORKER_PRI );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
232 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
233
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
234 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
235
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
236 // Wake them all up, they'll loop once and sleep again; I get in and
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
237 // BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
238 // +++ 1 thread, running, + N sleeping ones of same prio.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
239
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
240 cyg_cond_broadcast( &worker_cv );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
241
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
242 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
243
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
244 // Adjust the priorities of all the threads, higher than the controlling
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
245 // thread. Make them all be distinct priorities as far as possible.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
246 // BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
247 // +++ 1 thread, running, + N sleeping ones of different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
248
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
249 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
250 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
251 pri = CONTROLLER_PRI_HI + 1 + i % WORKER_PRI_RANGE;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
252
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
253 cyg_thread_set_priority( thread_handle[i], pri );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
254 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
255
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
256 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
257
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
258 // Wake them all up, they'll loop once and sleep again; I get in and
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
259 // BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
260 // +++ 1 thread, running, + N sleeping ones of different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
261
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
262 cyg_cond_broadcast( &worker_cv );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
263
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
264 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
265
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
266 // Set them all the same prio, set me to the same prio, BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
267 // +++ 1 running, + N sleeping, *all* the same prio.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
268
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
269 for( i = 0; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
270 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
271 cyg_thread_set_priority( thread_handle[i], WORKER_PRI );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
272 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
273
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
274 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
275
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
276 // Wake them all up, they'll loop once and sleep again; I get in and
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
277 // BREAKME(); repeatedly until they have all slept again.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
278 // +++ 1 running, + some sleeping, some ready, *all* the same prio.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
279
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
280 cyg_cond_broadcast( &worker_cv );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
281
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
282 // cyg_thread_yield();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
283
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
284 do
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
285 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
286 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
287
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
288 } while( workers_asleep != THREADS-1 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
289
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
290 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
291
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
292 // Suspend some of the threads, BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
293 // +++ 1 running, + some sleeping, some suspended, *all* the same prio.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
294
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
295 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
296 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
297 // suspend every 3rd thread
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
298 if( 0 == (i % 3) ) cyg_thread_suspend( thread_handle[i] );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
299 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
300
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
301 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
302
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
303
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
304 // Change the prios all different, change my prio to highest , BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
305 // +++ 1 running, + some sleeping, some suspended, different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
306
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
307 cyg_thread_set_priority( thread_handle[0], CONTROLLER_PRI_HI );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
308
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
309 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
310 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
311 pri = CONTROLLER_PRI_HI + 1 + i % WORKER_PRI_RANGE;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
312
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
313 cyg_thread_set_priority( thread_handle[i], pri );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
314 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
315
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
316 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
317
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
318 // Wake up all the threads, BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
319 // +++ 1 running, + some ready, some suspended/ready, different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
320
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
321 cyg_cond_broadcast( &worker_cv );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
322
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
323 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
324
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
325
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
326 // Change my prio to lowest, let all the threads run, BREAKME().
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
327 // +++ 1 running + some sleeping, some suspended/ready, different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
328
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
329 cyg_thread_set_priority( thread_handle[0], CONTROLLER_PRI_LO );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
330
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
331 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
332
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
333 // Resume all the threads, BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
334 // +++ 1 running, + N ready, different prios.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
335
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
336 for( i = 1; i < THREADS; i++ )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
337 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
338 cyg_thread_resume( thread_handle[i] );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
339 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
340
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
341 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
342
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
343 // Command some of the N threads to call BREAKME(); themselves (then sleep
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
344 // again). Change my prio to low, so that they all get to run and hit the
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
345 // breakpoint.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
346 // +++ A different one running every time, others in a mixture of
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
347 // ready and sleeping states.
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
348
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
349 worker_state = WORKER_STATE_BREAK;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
350
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
351 cyg_cond_broadcast( &worker_cv );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
352
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
353 cyg_thread_set_priority( thread_handle[0], CONTROLLER_PRI_LO );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
354
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
355 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
356
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
357 // Command all the threads to exit; switch my own priority to lower
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
358 // than theirs so that they all run and exit, then I get back in and
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
359 // BREAKME();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
360 // +++ 1 thread, running, + N dormant ones.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
361
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
362 worker_state = WORKER_STATE_EXIT;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
363
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
364 cyg_cond_broadcast( &worker_cv );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
365
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
366 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
367
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
368 #if 0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
369
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
370 // Cannot do this yet...
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
371
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
372 // Destroy some of the N threads to invalidate their IDs. Re-create them
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
373 // with new IDs, so that we get IDs 1,2,4,6,8,11,12,13,14,15 in use instead
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
374 // of 1,2,3,4,5,6,7,8,9, if you see what I mean. Do all the above again.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
375 // Loop forever, or whatever...
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
376
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
377 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
378
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
379 breakme();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
380
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
381 CYG_TEST_PASS_FINISH("GDB Thread test OK");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
382
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
383 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
384
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
385 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
386
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
387 externC void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
388 cyg_start( void )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
389 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
390
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
391 CYG_TEST_INIT();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
392
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
393 cyg_thread_create(CONTROLLER_PRI_HI, controller, (cyg_addrword_t)0, "controller",
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
394 (void *)(&thread_stack[0]), STACKSIZE,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
395 &thread_handle[0], &thread[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
396
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
397 // resume it
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
398 cyg_thread_resume(thread_handle[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
399
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
400
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
401 // Get the world going
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
402 cyg_scheduler_start();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
403
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
404 CYG_TEST_FAIL_FINISH("Not reached");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
405
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
406 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
407
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
408 #else /* def CYGFUN_KERNEL_API_C */
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
409
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
410 externC void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
411 cyg_start( void )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
412 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
413 CYG_TEST_INIT();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
414 CYG_TEST_PASS_FINISH("Incorrect configuration for this test");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
415 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
416 #endif /* def CYGFUN_KERNEL_API_C && ... */
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
417
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
418 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
419 // EOF thread_gdb.c