annotate packages/kernel/current/tests/tm_basic.cxx @ 445:4bfb0d444b05

Add tests for kernel flag synchronizers (incomplete).
author gthomas
date Tue, 03 Dec 2002 14:25:22 +0000
parents 7ca632b46393
children b8e01d85e2d4
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 // tm_basic.cxx
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 // Basic timing test / scaffolding
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 //==========================================================================
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
8 //####ECOSGPLCOPYRIGHTBEGIN####
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
9 // -------------------------------------------
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
10 // This file is part of eCos, the Embedded Configurable Operating System.
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
12 // Copyright (C) 2002 Gary Thomas
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
13 //
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
14 // eCos is free software; you can redistribute it and/or modify it under
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
15 // the terms of the GNU General Public License as published by the Free
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
16 // Software Foundation; either version 2 or (at your option) any later version.
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
17 //
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
21 // for more details.
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
22 //
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
23 // You should have received a copy of the GNU General Public License along
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
26 //
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
27 // As a special exception, if other files instantiate templates or use macros
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
28 // or inline functions from this file, or you compile this file and link it
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
29 // with other works to produce a work based on this file, this file does not
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
30 // by itself cause the resulting work to be covered by the GNU General Public
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
31 // License. However the source code for this file must still be made available
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
32 // in accordance with section (3) of the GNU General Public License.
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
33 //
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
34 // This exception does not invalidate any other reasons why a work based on
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
35 // this file might be covered by the GNU General Public License.
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
36 //
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
37 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
210
d2c90368aeef Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents: 208
diff changeset
38 // at http://sources.redhat.com/ecos/ecos-license/
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
39 // -------------------------------------------
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 177
diff changeset
40 //####ECOSGPLCOPYRIGHTEND####
0
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 //#####DESCRIPTIONBEGIN####
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
43 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
44 // Author(s): gthomas
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
45 // Contributors: gthomas
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
46 // Date: 1998-10-19
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
47 // Description: Very simple kernel timing test
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
48 //####DESCRIPTIONEND####
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
49
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
50 #include <pkgconf/kernel.h>
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
51 #include <pkgconf/hal.h>
0
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/kernel/sched.hxx>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
54 #include <cyg/kernel/thread.hxx>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
55 #include <cyg/kernel/thread.inl>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
56 #include <cyg/kernel/mutex.hxx>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
57 #include <cyg/kernel/sema.hxx>
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
58 #include <cyg/kernel/flag.hxx>
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
59 #include <cyg/kernel/sched.inl>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
60 #include <cyg/kernel/clock.hxx>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
61 #include <cyg/kernel/clock.inl>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
62 #include <cyg/kernel/kapi.h>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
63
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
64 #include <cyg/infra/testcase.h>
394
7ca632b46393 * tests/tm_basic.cxx: Include infra/diag.h and removed the
asl
parents: 210
diff changeset
65 #include <cyg/infra/diag.h>
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
66
10
d3fbcdfa1b2f Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents: 8
diff changeset
67 #include <cyg/kernel/test/stackmon.h>
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
68 #include CYGHWR_MEMORY_LAYOUT_H
8
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
69
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
70 // Define this to see the statistics with the first sample datum removed.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
71 // This can expose the effects of caches on the speed of operations.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
72 #undef STATS_WITHOUT_FIRST_SAMPLE
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
73
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
74 #if defined(CYGFUN_KERNEL_API_C) && \
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
75 defined(CYGSEM_KERNEL_SCHED_MLQUEUE) && \
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
76 defined(CYGVAR_KERNEL_COUNTERS_CLOCK) && \
76
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
77 !defined(CYGDBG_INFRA_DIAG_USE_DEVICE) && \
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
78 (CYGNUM_KERNEL_SCHED_PRIORITIES > 12)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
79
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
80 #define NTHREADS 1
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
81 #include "testaux.hxx"
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 // Structure used to keep track of times
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
84 typedef struct fun_times {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
85 cyg_uint32 start;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
86 cyg_uint32 end;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
87 } fun_times;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
88
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
89 #define STACK_SIZE CYGNUM_HAL_STACK_SIZE_MINIMUM
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
90
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
91 #ifdef CYGMEM_REGION_ram_SIZE
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
92 #define CYG_THREAD_OVERHEAD (STACK_SIZE+sizeof(cyg_thread)+(sizeof(fun_times)*2))
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
93 #define NTEST_THREADS ((CYGMEM_REGION_ram_SIZE/16)/CYG_THREAD_OVERHEAD)
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
94 #define CYG_MUTEX_OVERHEAD (sizeof(cyg_mutex_t)+sizeof(fun_times))
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
95 #define NMUTEXES ((CYGMEM_REGION_ram_SIZE/16)/CYG_MUTEX_OVERHEAD)
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
96 #define CYG_MBOX_OVERHEAD (sizeof(cyg_mbox)+sizeof(fun_times))
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
97 #define NMBOXES ((CYGMEM_REGION_ram_SIZE/24)/CYG_MBOX_OVERHEAD)
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
98 #define CYG_SEMAPHORE_OVERHEAD (sizeof(cyg_sem_t)+sizeof(fun_times))
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
99 #define NSEMAPHORES ((CYGMEM_REGION_ram_SIZE/16)/CYG_SEMAPHORE_OVERHEAD)
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
100 #define CYG_COUNTER_OVERHEAD (sizeof(cyg_counter)+sizeof(fun_times))
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
101 #define NCOUNTERS ((CYGMEM_REGION_ram_SIZE/24)/CYG_COUNTER_OVERHEAD)
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
102 #define CYG_FLAG_OVERHEAD (sizeof(cyg_flag_t)+sizeof(fun_times))
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
103 #define NFLAGS ((CYGMEM_REGION_ram_SIZE/24)/CYG_FLAG_OVERHEAD)
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
104 #define CYG_ALARM_OVERHEAD (sizeof(cyg_alarm)+sizeof(fun_times))
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
105 #define NALARMS ((CYGMEM_REGION_ram_SIZE/16)/CYG_ALARM_OVERHEAD)
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
106 #else
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
107 // Defaults
4
1d7f19c9e4d1 Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents: 2
diff changeset
108 #define NTEST_THREADS 16
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
109 #define NMUTEXES 32
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
110 #define NMBOXES 32
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
111 #define NSEMAPHORES 32
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
112 #define NFLAGS 32
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
113 #define NCOUNTERS 32
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
114 #define NALARMS 32
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
115 #endif
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
116
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
117 #define NSAMPLES 32
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
118 #define NTHREAD_SWITCHES 128
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
119 #define NSCHEDS 128
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
120
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
121 #define NSAMPLES_SIM 2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
122 #define NTEST_THREADS_SIM 2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
123 #define NTHREAD_SWITCHES_SIM 4
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
124 #define NMUTEXES_SIM 2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
125 #define NMBOXES_SIM 2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
126 #define NSEMAPHORES_SIM 2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
127 #define NSCHEDS_SIM 4
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
128 #define NFLAGS_SIM 2
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
129 #define NCOUNTERS_SIM 2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
130 #define NALARMS_SIM 2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
131
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
132 static int nsamples;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
133 static int ntest_threads;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
134 static int nthread_switches;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
135 static int nmutexes;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
136 static int nmboxes;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
137 static int nsemaphores;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
138 static int nscheds;
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
139 static int nflags;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
140 static int ncounters;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
141 static int nalarms;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
142
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
143 static char stacks[NTEST_THREADS][STACK_SIZE];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
144 static cyg_thread test_threads[NTEST_THREADS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
145 static cyg_handle_t threads[NTEST_THREADS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
146 static int overhead;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
147 static cyg_sem_t synchro;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
148 static fun_times thread_ft[NTEST_THREADS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
149
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
150 static fun_times test2_ft[NTHREAD_SWITCHES];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
151
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
152 static cyg_mutex_t test_mutexes[NMUTEXES];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
153 static fun_times mutex_ft[NMUTEXES];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
154 static cyg_thread mutex_test_thread;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
155 static cyg_handle_t mutex_test_thread_handle;
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 static cyg_mbox test_mboxes[NMBOXES];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
158 static cyg_handle_t test_mbox_handles[NMBOXES];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
159 static fun_times mbox_ft[NMBOXES];
210
d2c90368aeef Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents: 208
diff changeset
160 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
161 static cyg_thread mbox_test_thread;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
162 static cyg_handle_t mbox_test_thread_handle;
210
d2c90368aeef Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents: 208
diff changeset
163 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
164
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
165 static cyg_sem_t test_semaphores[NSEMAPHORES];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
166 static fun_times semaphore_ft[NSEMAPHORES];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
167 static cyg_thread semaphore_test_thread;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
168 static cyg_handle_t semaphore_test_thread_handle;
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 static fun_times sched_ft[NSCHEDS];
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 static cyg_counter test_counters[NCOUNTERS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
173 static cyg_handle_t counters[NCOUNTERS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
174 static fun_times counter_ft[NCOUNTERS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
175
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
176 static cyg_flag_t test_flags[NFLAGS];
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
177 static fun_times flag_ft[NFLAGS];
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
178
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
179 static cyg_alarm test_alarms[NALARMS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
180 static cyg_handle_t alarms[NALARMS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
181 static fun_times alarm_ft[NALARMS];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
182
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
183 static long rtc_resolution[] = CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
184 static long ns_per_system_clock;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
185
210
d2c90368aeef Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents: 208
diff changeset
186 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY)
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
187 // Data kept by kernel real time clock measuring clock interrupt latency
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
188 extern cyg_tick_count total_clock_latency, total_clock_interrupts;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
189 extern cyg_int32 min_clock_latency, max_clock_latency;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
190 extern bool measure_clock_latency;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
191 #endif
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
192
210
d2c90368aeef Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents: 208
diff changeset
193 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY)
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
194 extern cyg_tick_count total_clock_dsr_latency, total_clock_dsr_calls;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
195 extern cyg_int32 min_clock_dsr_latency, max_clock_dsr_latency;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
196 extern bool measure_clock_latency;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
197 #endif
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
198
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
199 void run_sched_tests(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
200 void run_thread_tests(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
201 void run_thread_switch_test(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
202 void run_mutex_tests(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
203 void run_mutex_circuit_test(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
204 void run_mbox_tests(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
205 void run_mbox_circuit_test(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
206 void run_semaphore_tests(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
207 void run_semaphore_circuit_test(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
208 void run_counter_tests(void);
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
209 void run_flag_tests(void);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
210 void run_alarm_tests(void);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
211
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
212 #ifndef max
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
213 #define max(n,m) (m > n ? n : m)
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
214 #endif
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
215
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
216 // Wait until a clock tick [real time clock] has passed. This should keep it
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
217 // from happening again during a measurement, thus minimizing any fluctuations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
218 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
219 wait_for_tick(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
220 {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
221 cyg_tick_count_t tv0, tv1;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
222 tv0 = cyg_current_time();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
223 while (true) {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
224 tv1 = cyg_current_time();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
225 if (tv1 != tv0) break;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
226 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
227 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
228
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
229 // Display a number of ticks as microseconds
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
230 // Note: for improved calculation significance, values are kept in ticks*1000
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
231 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
232 show_ticks_in_us(cyg_uint32 ticks)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
233 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
234 long long ns;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
235 ns = (ns_per_system_clock * (long long)ticks) / CYGNUM_KERNEL_COUNTERS_RTC_PERIOD;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
236 ns += 5; // for rounding to .01us
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
237 diag_printf("%5d.%02d", (int)(ns/1000), (int)((ns%1000)/10));
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
238 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
239
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
240 //
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
241 // If the kernel is instrumented to measure clock interrupt latency, these
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
242 // measurements can be drastically perturbed by printing via "diag_printf()"
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
243 // since that code may run with interrupts disabled for long periods.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
244 //
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
245 // In order to get accurate/reasonable latency figures _for the kernel
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
246 // primitive functions beint tested_, the kernel's latency measurements
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
247 // are suspended while the printing actually takes place.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
248 //
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
249 // The measurements are reenabled after the printing, thus allowing for
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
250 // fair measurements of the kernel primitives, which are not distorted
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
251 // by the printing mechanisms.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
252
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
253 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY)
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
254 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
255 disable_clock_latency_measurement(void)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
256 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
257 wait_for_tick();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
258 measure_clock_latency = false;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
259 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
260
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
261 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
262 enable_clock_latency_measurement(void)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
263 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
264 wait_for_tick();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
265 measure_clock_latency = true;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
266 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
267
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
268 // Ensure that the measurements are reasonable (no startup anomalies)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
269 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
270 reset_clock_latency_measurement(void)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
271 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
272 disable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
273 total_clock_latency = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
274 total_clock_interrupts = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
275 min_clock_latency = 0x7FFFFFFF;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
276 max_clock_latency = 0;
210
d2c90368aeef Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents: 208
diff changeset
277 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY)
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
278 total_clock_dsr_latency = 0;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
279 total_clock_dsr_calls = 0;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
280 min_clock_dsr_latency = 0x7FFFFFFF;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
281 max_clock_dsr_latency = 0;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
282 #endif
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
283 enable_clock_latency_measurement();
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
284
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
285 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
286 #else
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
287 #define disable_clock_latency_measurement()
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
288 #define enable_clock_latency_measurement()
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
289 #define reset_clock_latency_measurement()
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
290 #endif
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
291
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
292 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
293 show_times_hdr(void)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
294 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
295 disable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
296 diag_printf("\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
297 diag_printf(" Confidence\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
298 diag_printf(" Ave Min Max Var Ave Min Function\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
299 diag_printf(" ====== ====== ====== ====== ========== ========\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
300 enable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
301 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
302
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
303 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
304 show_times_detail(fun_times ft[], int nsamples, char *title, bool ignore_first)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
305 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
306 int i, delta, min, max, con_ave, con_min, ave_dev;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
307 int start_sample, total_samples;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
308 cyg_int32 total, ave;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
309
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
310 if (ignore_first) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
311 start_sample = 1;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
312 total_samples = nsamples-1;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
313 } else {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
314 start_sample = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
315 total_samples = nsamples;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
316 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
317 total = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
318 min = 0x7FFFFFFF;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
319 max = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
320 for (i = start_sample; i < nsamples; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
321 if (ft[i].end < ft[i].start) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
322 // Clock wrapped around (timer tick)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
323 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
324 } else {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
325 delta = ft[i].end - ft[i].start;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
326 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
327 delta -= overhead;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
328 if (delta < 0) delta = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
329 delta *= 1000;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
330 total += delta;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
331 if (delta < min) min = delta;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
332 if (delta > max) max = delta;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
333 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
334 ave = total / total_samples;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
335 total = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
336 ave_dev = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
337 for (i = start_sample; i < nsamples; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
338 if (ft[i].end < ft[i].start) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
339 // Clock wrapped around (timer tick)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
340 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
341 } else {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
342 delta = ft[i].end - ft[i].start;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
343 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
344 delta -= overhead;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
345 if (delta < 0) delta = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
346 delta *= 1000;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
347 delta = delta - ave;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
348 if (delta < 0) delta = -delta;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
349 ave_dev += delta;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
350 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
351 ave_dev /= total_samples;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
352 con_ave = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
353 con_min = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
354 for (i = start_sample; i < nsamples; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
355 if (ft[i].end < ft[i].start) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
356 // Clock wrapped around (timer tick)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
357 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
358 } else {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
359 delta = ft[i].end - ft[i].start;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
360 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
361 delta -= overhead;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
362 if (delta < 0) delta = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
363 delta *= 1000;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
364 if ((delta <= (ave+ave_dev)) && (delta >= (ave-ave_dev))) con_ave++;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
365 if ((delta <= (min+ave_dev)) && (delta >= (min-ave_dev))) con_min++;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
366 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
367 con_ave = (con_ave * 100) / total_samples;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
368 con_min = (con_min * 100) / total_samples;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
369 show_ticks_in_us(ave);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
370 show_ticks_in_us(min);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
371 show_ticks_in_us(max);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
372 show_ticks_in_us(ave_dev);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
373 disable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
374 diag_printf(" %3d%% %3d%%", con_ave, con_min);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
375 diag_printf(" %s\n", title);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
376 enable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
377 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
378
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
379 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
380 show_times(fun_times ft[], int nsamples, char *title)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
381 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
382 show_times_detail(ft, nsamples, title, false);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
383 #ifdef STATS_WITHOUT_FIRST_SAMPLE
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
384 show_times_detail(ft, nsamples, "", true);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
385 #endif
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
386 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
387
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
388 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
389 show_test_parameters(void)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
390 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
391 disable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
392 diag_printf("\nTesting parameters:\n");
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
393 diag_printf(" Clock samples: %5d\n", nsamples);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
394 diag_printf(" Threads: %5d\n", ntest_threads);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
395 diag_printf(" Thread switches: %5d\n", nthread_switches);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
396 diag_printf(" Mutexes: %5d\n", nmutexes);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
397 diag_printf(" Mailboxes: %5d\n", nmboxes);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
398 diag_printf(" Semaphores: %5d\n", nsemaphores);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
399 diag_printf(" Scheduler operations: %5d\n", nscheds);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
400 diag_printf(" Counters: %5d\n", ncounters);
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
401 diag_printf(" Flags: %5d\n", nflags);
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
402 diag_printf(" Alarms: %5d\n", nalarms);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
403 diag_printf("\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
404 enable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
405 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
406
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
407 void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
408 end_of_test_group(void)
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
409 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
410 disable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
411 diag_printf("\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
412 enable_clock_latency_measurement();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
413 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
414
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
415 // Compute a name for a thread
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
416 char *
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
417 thread_name(char *basename, int indx) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
418 return "<<NULL>>"; // Not currently used
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
419 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
420
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
421 // test0 - null test, never executed
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
422 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
423 test0(cyg_uint32 indx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
424 {
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
425 #ifndef CYGPKG_KERNEL_SMP_SUPPORT
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
426 // In SMP, somw of these threads will execute
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
427 diag_printf("test0.%d executed?\n", indx);
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
428 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
429 cyg_thread_exit();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
430 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
431
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
432 // test1 - empty test, simply exit. Last thread signals parent.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
433 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
434 test1(cyg_uint32 indx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
435 {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
436 if (indx == (cyg_uint32)(ntest_threads-1)) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
437 cyg_semaphore_post(&synchro); // Signal that last thread is dying
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
438 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
439 cyg_thread_exit();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
440 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
441
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
442 // test2 - measure thread switch times
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
443 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
444 test2(cyg_uint32 indx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
445 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
446 int i;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
447 for (i = 0; i < nthread_switches; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
448 if (indx == 0) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
449 HAL_CLOCK_READ(&test2_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
450 } else {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
451 HAL_CLOCK_READ(&test2_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
452 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
453 cyg_thread_yield();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
454 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
455 if (indx == 1) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
456 cyg_semaphore_post(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
457 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
458 cyg_thread_exit();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
459 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
460
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
461 // Full-circuit mutex unlock/lock test
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
462 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
463 mutex_test(cyg_uint32 indx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
464 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
465 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
466 cyg_mutex_lock(&test_mutexes[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
467 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
468 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
469 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
470 HAL_CLOCK_READ(&mutex_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
471 cyg_mutex_unlock(&test_mutexes[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
472 cyg_mutex_lock(&test_mutexes[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
473 cyg_semaphore_post(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
474 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
475 cyg_thread_exit();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
476 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
477
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
478 // Full-circuit mbox put/get test
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
479 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
480 mbox_test(cyg_uint32 indx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
481 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
482 void *item;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
483 do {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
484 item = cyg_mbox_get(test_mbox_handles[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
485 HAL_CLOCK_READ(&mbox_ft[(int)item].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
486 cyg_semaphore_post(&synchro);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
487 } while ((int)item != (nmboxes-1));
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
488 cyg_thread_exit();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
489 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
490
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
491 // Full-circuit semaphore post/wait test
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
492 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
493 semaphore_test(cyg_uint32 indx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
494 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
495 int i;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
496 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
497 cyg_semaphore_wait(&test_semaphores[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
498 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
499 cyg_semaphore_post(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
500 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
501 cyg_thread_exit();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
502 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
503
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
504 //
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
505 // This set of tests is used to measure kernel primitives that deal with threads
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
506 //
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
507 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
508 run_thread_tests(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
509 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
510 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
511 cyg_priority_t prio;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
512
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
513 // Set my priority higher than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
514 cyg_thread_set_priority(cyg_thread_self(), 2);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
515
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
516 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
517 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
518 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
519 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
520 test0, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
521 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
522 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
523 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
524 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
525 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
526 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
527 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
528 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
529 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
530 show_times(thread_ft, ntest_threads, "Create thread");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
531
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
532 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
533 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
534 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
535 cyg_thread_yield();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
536 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
537 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
538 show_times(thread_ft, ntest_threads, "Yield thread [all suspended]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
539
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
540 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
541 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
542 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
543 cyg_thread_suspend(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
544 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
545 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
546 show_times(thread_ft, ntest_threads, "Suspend [suspended] thread");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
547
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
548 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
549 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
550 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
551 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
552 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
553 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
554 show_times(thread_ft, ntest_threads, "Resume thread");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
555
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
556 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
557 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
558 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
559 cyg_thread_set_priority(threads[i], 11);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
560 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
561 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
562 show_times(thread_ft, ntest_threads, "Set priority");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
563
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
564 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
565 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
566 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
567 prio = cyg_thread_get_priority(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
568 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
569 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
570 show_times(thread_ft, ntest_threads, "Get priority");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
571
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
572 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
573 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
574 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
575 cyg_thread_kill(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
576 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
577 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
578 show_times(thread_ft, ntest_threads, "Kill [suspended] thread");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
579
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
580 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
581 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
582 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
583 cyg_thread_yield();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
584 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
585 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
586 show_times(thread_ft, ntest_threads, "Yield [no other] thread");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
587
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
588 // Set my priority higher than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
589 cyg_thread_set_priority(cyg_thread_self(), 2);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
590
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
591 // Recreate the test set
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
592 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
593 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
594 test0, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
595 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
596 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
597 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
598 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
599 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
600 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
601 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
602 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
603
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
604 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
605 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
606 HAL_CLOCK_READ(&thread_ft[i].start);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
607 cyg_thread_resume(threads[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
608 HAL_CLOCK_READ(&thread_ft[i].end);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
609 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
610 show_times(thread_ft, ntest_threads, "Resume [suspended low prio] thread");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
611
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
612 wait_for_tick(); // Wait until the next clock tick to minimize aberations
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
613 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
614 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
615 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
616 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
617 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
618 show_times(thread_ft, ntest_threads, "Resume [runnable low prio] thread");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
619
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
620 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
621 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
622 HAL_CLOCK_READ(&thread_ft[i].start);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
623 cyg_thread_suspend(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
624 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
625 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
626 show_times(thread_ft, ntest_threads, "Suspend [runnable] thread");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
627
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
628
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
629 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
630 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
631 HAL_CLOCK_READ(&thread_ft[i].start);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
632 cyg_thread_yield();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
633 HAL_CLOCK_READ(&thread_ft[i].end);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
634 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
635 show_times(thread_ft, ntest_threads, "Yield [only low prio] thread");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
636
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
637 wait_for_tick(); // Wait until the next clock tick to minimize aberations
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
638 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
639 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
640 cyg_thread_suspend(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
641 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
642 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
643 show_times(thread_ft, ntest_threads, "Suspend [runnable->not runnable]");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
644 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
645 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
646 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
647
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
648 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
649 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
650 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
651 cyg_thread_kill(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
652 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
653 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
654 show_times(thread_ft, ntest_threads, "Kill [runnable] thread");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
655
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
656 wait_for_tick(); // Wait until the next clock tick to minimize aberations
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
657 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
658 HAL_CLOCK_READ(&thread_ft[i].start);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
659 cyg_thread_delete(threads[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
660 HAL_CLOCK_READ(&thread_ft[i].end);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
661 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
662 show_times(thread_ft, ntest_threads, "Destroy [dead] thread");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
663
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
664 // Recreate the test set
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
665 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
666 cyg_thread_create(10, // Priority - just a number
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
667 test0, // entry
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
668 i, // index
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
669 thread_name("thread", i), // Name
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
670 &stacks[i][0], // Stack
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
671 STACK_SIZE, // Size
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
672 &threads[i], // Handle
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
673 &test_threads[i] // Thread data structure
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
674 );
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
675 cyg_thread_resume(threads[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
676 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
677
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
678 wait_for_tick(); // Wait until the next clock tick to minimize aberations
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
679 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
680 HAL_CLOCK_READ(&thread_ft[i].start);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
681 cyg_thread_delete(threads[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
682 HAL_CLOCK_READ(&thread_ft[i].end);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
683 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
684 show_times(thread_ft, ntest_threads, "Destroy [runnable] thread");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
685
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
686 // Set my priority lower than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
687 cyg_thread_set_priority(cyg_thread_self(), 3);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
688
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
689 // Set up the end-of-threads synchronizer
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
690 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
691
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
692 // Recreate the test set
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
693 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
694 cyg_thread_create(2, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
695 test1, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
696 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
697 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
698 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
699 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
700 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
701 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
702 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
703 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
704
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
705 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
706 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
707 HAL_CLOCK_READ(&thread_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
708 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
709 HAL_CLOCK_READ(&thread_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
710 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
711 show_times(thread_ft, ntest_threads, "Resume [high priority] thread");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
712 cyg_semaphore_wait(&synchro); // Wait for all threads to finish
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
713 // Make sure they are all dead
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
714 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
715 cyg_thread_delete(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
716 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
717
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
718 run_thread_switch_test();
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
719 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
720 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
721
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
722 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
723 run_thread_switch_test(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
724 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
725 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
726
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
727 // Set up for thread context switch
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
728 for (i = 0; i < 2; i++) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
729 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
730 test2, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
731 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
732 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
733 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
734 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
735 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
736 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
737 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
738 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
739 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
740 // Set up the end-of-threads synchronizer
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
741 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
742 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
743 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
744 show_times(test2_ft, nthread_switches, "Thread switch");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
745 // Clean up
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
746 for (i = 0; i < 2; i++) {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
747 cyg_thread_delete(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
748 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
749 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
750
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
751 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
752 run_mutex_tests(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
753 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
754 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
755
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
756 // Mutex primitives
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
757 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
758 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
759 HAL_CLOCK_READ(&mutex_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
760 cyg_mutex_init(&test_mutexes[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
761 HAL_CLOCK_READ(&mutex_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
762 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
763 show_times(mutex_ft, nmutexes, "Init mutex");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
764
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
765 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
766 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
767 HAL_CLOCK_READ(&mutex_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
768 cyg_mutex_lock(&test_mutexes[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
769 HAL_CLOCK_READ(&mutex_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
770 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
771 show_times(mutex_ft, nmutexes, "Lock [unlocked] mutex");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
772
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
773 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
774 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
775 HAL_CLOCK_READ(&mutex_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
776 cyg_mutex_unlock(&test_mutexes[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
777 HAL_CLOCK_READ(&mutex_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
778 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
779 show_times(mutex_ft, nmutexes, "Unlock [locked] mutex");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
780
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
781 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
782 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
783 HAL_CLOCK_READ(&mutex_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
784 cyg_mutex_trylock(&test_mutexes[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
785 HAL_CLOCK_READ(&mutex_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
786 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
787 show_times(mutex_ft, nmutexes, "Trylock [unlocked] mutex");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
788
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
789 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
790 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
791 HAL_CLOCK_READ(&mutex_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
792 cyg_mutex_trylock(&test_mutexes[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
793 HAL_CLOCK_READ(&mutex_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
794 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
795 show_times(mutex_ft, nmutexes, "Trylock [locked] mutex");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
796
38
e7ba79f6d3a8 Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents: 34
diff changeset
797 // Must unlock mutices before destroying them.
e7ba79f6d3a8 Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents: 34
diff changeset
798 for (i = 0; i < nmutexes; i++) {
e7ba79f6d3a8 Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents: 34
diff changeset
799 cyg_mutex_unlock(&test_mutexes[i]);
e7ba79f6d3a8 Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents: 34
diff changeset
800 }
e7ba79f6d3a8 Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents: 34
diff changeset
801
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
802 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
803 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
804 HAL_CLOCK_READ(&mutex_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
805 cyg_mutex_destroy(&test_mutexes[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
806 HAL_CLOCK_READ(&mutex_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
807 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
808 show_times(mutex_ft, nmutexes, "Destroy mutex");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
809 run_mutex_circuit_test();
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
810 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
811 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
812
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
813 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
814 run_mutex_circuit_test(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
815 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
816 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
817 // Set my priority lower than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
818 cyg_thread_set_priority(cyg_thread_self(), 4);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
819 // Set up for full mutex unlock/lock test
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
820 cyg_mutex_init(&test_mutexes[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
821 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
822 cyg_thread_create(3, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
823 mutex_test, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
824 0, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
825 thread_name("thread", 0), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
826 &stacks[0][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
827 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
828 &mutex_test_thread_handle, // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
829 &mutex_test_thread // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
830 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
831 cyg_thread_resume(mutex_test_thread_handle);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
832 // Need to raise priority so that this thread will block on the "lock"
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
833 cyg_thread_set_priority(cyg_thread_self(), 2);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
834 for (i = 0; i < nmutexes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
835 cyg_semaphore_post(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
836 cyg_mutex_lock(&test_mutexes[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
837 HAL_CLOCK_READ(&mutex_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
838 cyg_mutex_unlock(&test_mutexes[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
839 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
840 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
841 cyg_thread_delete(mutex_test_thread_handle);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
842 show_times(mutex_ft, nmutexes, "Unlock/Lock mutex");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
843 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
844
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
845 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
846 run_mbox_tests(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
847 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
848 int i, cnt;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
849 void *item;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
850 // Mailbox primitives
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
851 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
852 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
853 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
854 cyg_mbox_create(&test_mbox_handles[i], &test_mboxes[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
855 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
856 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
857 show_times(mbox_ft, nmboxes, "Create mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
858
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
859 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
860 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
861 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
862 cnt = cyg_mbox_peek(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
863 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
864 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
865 show_times(mbox_ft, nmboxes, "Peek [empty] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
866
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
867 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
868 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
869 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
870 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
871 cyg_mbox_put(test_mbox_handles[i], (void *)i);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
872 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
873 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
874 show_times(mbox_ft, nmboxes, "Put [first] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
875
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
876 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
877 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
878 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
879 cnt = cyg_mbox_peek(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
880 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
881 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
882 show_times(mbox_ft, nmboxes, "Peek [1 msg] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
883
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
884 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
885 for (i = 0; i < nmboxes; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
886 HAL_CLOCK_READ(&mbox_ft[i].start);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
887 cyg_mbox_put(test_mbox_handles[i], (void *)i);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
888 HAL_CLOCK_READ(&mbox_ft[i].end);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
889 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
890 show_times(mbox_ft, nmboxes, "Put [second] mbox");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
891
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
892 wait_for_tick(); // Wait until the next clock tick to minimize aberations
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
893 for (i = 0; i < nmboxes; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
894 HAL_CLOCK_READ(&mbox_ft[i].start);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
895 cnt = cyg_mbox_peek(test_mbox_handles[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
896 HAL_CLOCK_READ(&mbox_ft[i].end);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
897 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
898 show_times(mbox_ft, nmboxes, "Peek [2 msgs] mbox");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
899
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
900 wait_for_tick(); // Wait until the next clock tick to minimize aberations
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
901 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
902 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
903 item = cyg_mbox_get(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
904 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
905 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
906 show_times(mbox_ft, nmboxes, "Get [first] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
907
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
908 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
909 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
910 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
911 item = cyg_mbox_get(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
912 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
913 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
914 show_times(mbox_ft, nmboxes, "Get [second] mbox");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
915 #endif // ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
916
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
917 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
918 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
919 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
920 cyg_mbox_tryput(test_mbox_handles[i], (void *)i);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
921 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
922 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
923 show_times(mbox_ft, nmboxes, "Tryput [first] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
924
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
925 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
926 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
927 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
928 item = cyg_mbox_peek_item(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
929 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
930 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
931 show_times(mbox_ft, nmboxes, "Peek item [non-empty] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
932
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
933 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
934 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
935 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
936 item = cyg_mbox_tryget(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
937 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
938 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
939 show_times(mbox_ft, nmboxes, "Tryget [non-empty] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
940
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
941 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
942 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
943 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
944 item = cyg_mbox_peek_item(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
945 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
946 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
947 show_times(mbox_ft, nmboxes, "Peek item [empty] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
948
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
949 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
950 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
951 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
952 item = cyg_mbox_tryget(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
953 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
954 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
955 show_times(mbox_ft, nmboxes, "Tryget [empty] mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
956
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
957 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
958 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
959 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
960 cyg_mbox_waiting_to_get(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
961 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
962 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
963 show_times(mbox_ft, nmboxes, "Waiting to get mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
964
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
965 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
966 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
967 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
968 cyg_mbox_waiting_to_put(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
969 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
970 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
971 show_times(mbox_ft, nmboxes, "Waiting to put mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
972
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
973 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
974 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
975 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
976 cyg_mbox_delete(test_mbox_handles[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
977 HAL_CLOCK_READ(&mbox_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
978 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
979 show_times(mbox_ft, nmboxes, "Delete mbox");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
980
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
981 run_mbox_circuit_test();
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
982 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
983 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
984
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
985 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
986 run_mbox_circuit_test(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
987 {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
988 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
989 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
990 // Set my priority lower than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
991 cyg_thread_set_priority(cyg_thread_self(), 3);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
992 // Set up for full mbox put/get test
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
993 cyg_mbox_create(&test_mbox_handles[0], &test_mboxes[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
994 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
995 cyg_thread_create(2, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
996 mbox_test, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
997 0, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
998 thread_name("thread", 0), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
999 &stacks[0][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1000 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1001 &mbox_test_thread_handle, // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1002 &mbox_test_thread // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1003 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1004 cyg_thread_resume(mbox_test_thread_handle);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1005 for (i = 0; i < nmboxes; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1006 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1007 HAL_CLOCK_READ(&mbox_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1008 cyg_mbox_put(test_mbox_handles[0], (void *)i);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1009 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1010 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1011 cyg_thread_delete(mbox_test_thread_handle);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1012 show_times(mbox_ft, nmboxes, "Put/Get mbox");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1013 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1014 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1015
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1016 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1017 run_semaphore_tests(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1018 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1019 int i;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1020 cyg_count32 sem_val;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1021 // Semaphore primitives
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1022 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1023 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1024 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1025 cyg_semaphore_init(&test_semaphores[i], 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1026 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1027 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1028 show_times(semaphore_ft, nsemaphores, "Init semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1029
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1030 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1031 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1032 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1033 cyg_semaphore_post(&test_semaphores[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1034 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1035 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1036 show_times(semaphore_ft, nsemaphores, "Post [0] semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1037
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1038 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1039 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1040 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1041 cyg_semaphore_wait(&test_semaphores[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1042 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1043 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1044 show_times(semaphore_ft, nsemaphores, "Wait [1] semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1045
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1046 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1047 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1048 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1049 cyg_semaphore_trywait(&test_semaphores[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1050 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1051 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1052 show_times(semaphore_ft, nsemaphores, "Trywait [0] semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1053
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1054 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1055 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1056 cyg_semaphore_post(&test_semaphores[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1057 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1058 cyg_semaphore_trywait(&test_semaphores[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1059 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1060 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1061 show_times(semaphore_ft, nsemaphores, "Trywait [1] semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1062
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1063 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1064 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1065 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1066 cyg_semaphore_peek(&test_semaphores[i], &sem_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1067 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1068 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1069 show_times(semaphore_ft, nsemaphores, "Peek semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1070
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1071 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1072 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1073 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1074 cyg_semaphore_destroy(&test_semaphores[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1075 HAL_CLOCK_READ(&semaphore_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1076 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1077 show_times(semaphore_ft, nsemaphores, "Destroy semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1078
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1079 run_semaphore_circuit_test();
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1080 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1081 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1082
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1083 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1084 run_semaphore_circuit_test(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1085 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1086 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1087 // Set my priority lower than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1088 cyg_thread_set_priority(cyg_thread_self(), 3);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1089 // Set up for full semaphore post/wait test
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1090 cyg_semaphore_init(&test_semaphores[0], 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1091 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1092 cyg_thread_create(2, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1093 semaphore_test, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1094 0, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1095 thread_name("thread", 0), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1096 &stacks[0][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1097 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1098 &semaphore_test_thread_handle, // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1099 &semaphore_test_thread // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1100 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1101 cyg_thread_resume(semaphore_test_thread_handle);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1102 for (i = 0; i < nsemaphores; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1103 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1104 HAL_CLOCK_READ(&semaphore_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1105 cyg_semaphore_post(&test_semaphores[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1106 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1107 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1108 cyg_thread_delete(semaphore_test_thread_handle);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1109 show_times(semaphore_ft, nsemaphores, "Post/Wait semaphore");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1110 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1111
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1112 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1113 run_counter_tests(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1114 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1115 int i;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1116 cyg_tick_count_t val=0;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1117
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1118 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1119 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1120 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1121 cyg_counter_create(&counters[i], &test_counters[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1122 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1123 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1124 show_times(counter_ft, ncounters, "Create counter");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1125
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1126 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1127 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1128 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1129 val = cyg_counter_current_value(counters[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1130 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1131 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1132 show_times(counter_ft, ncounters, "Get counter value");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1133
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1134 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1135 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1136 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1137 cyg_counter_set_value(counters[i], val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1138 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1139 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1140 show_times(counter_ft, ncounters, "Set counter value");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1141
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1142 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1143 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1144 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1145 cyg_counter_tick(counters[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1146 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1147 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1148 show_times(counter_ft, ncounters, "Tick counter");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1149
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1150 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1151 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1152 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1153 cyg_counter_delete(counters[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1154 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1155 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1156 show_times(counter_ft, ncounters, "Delete counter");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1157 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1158 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1159
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1160 void
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1161 run_flag_tests(void)
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1162 {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1163 int i;
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1164 cyg_flag_value_t val;
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1165
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1166 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1167 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1168 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1169 cyg_flag_init(&test_flags[i]);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1170 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1171 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1172 show_times(flag_ft, nflags, "Init flag");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1173
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1174 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1175 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1176 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1177 cyg_flag_destroy(&test_flags[i]);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1178 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1179 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1180 show_times(flag_ft, nflags, "Destroy flag");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1181
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1182 // Recreate the flags - reused in the remaining tests
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1183 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1184 cyg_flag_init(&test_flags[i]);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1185 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1186
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1187 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1188 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1189 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1190 cyg_flag_maskbits(&test_flags[i], 0);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1191 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1192 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1193 show_times(flag_ft, nflags, "Mask bits in flag");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1194
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1195 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1196 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1197 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1198 cyg_flag_setbits(&test_flags[i], 0x11);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1199 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1200 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1201 show_times(flag_ft, nflags, "Set bits in flag [no waiters]");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1202
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1203 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1204 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1205 cyg_flag_setbits(&test_flags[i], 0x11);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1206 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1207 cyg_flag_wait(&test_flags[i], 0x11, CYG_FLAG_WAITMODE_AND);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1208 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1209 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1210 show_times(flag_ft, nflags, "Wait for flag [AND]");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1211
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1212 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1213 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1214 cyg_flag_setbits(&test_flags[i], 0x11);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1215 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1216 cyg_flag_wait(&test_flags[i], 0x11, CYG_FLAG_WAITMODE_OR);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1217 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1218 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1219 show_times(flag_ft, nflags, "Wait for flag [OR]");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1220
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1221 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1222 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1223 cyg_flag_setbits(&test_flags[i], 0x11);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1224 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1225 cyg_flag_wait(&test_flags[i], 0x11, CYG_FLAG_WAITMODE_AND|CYG_FLAG_WAITMODE_CLR);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1226 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1227 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1228 show_times(flag_ft, nflags, "Wait for flag [AND/CLR]");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1229
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1230 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1231 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1232 cyg_flag_setbits(&test_flags[i], 0x11);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1233 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1234 cyg_flag_wait(&test_flags[i], 0x11, CYG_FLAG_WAITMODE_OR|CYG_FLAG_WAITMODE_CLR);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1235 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1236 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1237 show_times(flag_ft, nflags, "Wait for flag [OR/CLR]");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1238
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1239 wait_for_tick(); // Wait until the next clock tick to minimize aberations
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1240 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1241 cyg_flag_setbits(&test_flags[i], 0x11);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1242 HAL_CLOCK_READ(&flag_ft[i].start);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1243 val = cyg_flag_peek(&test_flags[i]);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1244 HAL_CLOCK_READ(&flag_ft[i].end);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1245 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1246 show_times(flag_ft, nflags, "Peek on flag");
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1247
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1248 // Destroy flags - no longer needed
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1249 for (i = 0; i < nflags; i++) {
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1250 cyg_flag_destroy(&test_flags[i]);
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1251 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1252 end_of_test_group();
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1253 }
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1254
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1255 // Alarm callback function
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1256 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1257 alarm_cb(cyg_handle_t alarm, cyg_addrword_t val)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1258 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1259 // empty call back
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1260 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1261
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1262 // Callback used to test determinancy
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1263 static volatile int alarm_cnt;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1264 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1265 alarm_cb2(cyg_handle_t alarm, cyg_addrword_t indx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1266 {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1267 if (alarm_cnt == nscheds) return;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1268 sched_ft[alarm_cnt].start = 0;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1269 HAL_CLOCK_READ(&sched_ft[alarm_cnt++].end);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1270 if (alarm_cnt == nscheds) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1271 cyg_semaphore_post(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1272 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1273 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1274
60
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1275 static void
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1276 alarm_cb3(cyg_handle_t alarm, cyg_addrword_t indx)
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1277 {
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1278 if (alarm_cnt == nscheds) {
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1279 cyg_semaphore_post(&synchro);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1280 } else {
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1281 sched_ft[alarm_cnt].start = 0;
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1282 cyg_thread_resume((cyg_handle_t)indx);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1283 }
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1284 }
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1285
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1286 // Null thread, used to keep scheduler busy
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1287 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1288 alarm_test(cyg_uint32 id)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1289 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1290 while (true) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1291 cyg_thread_yield();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1292 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1293 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1294
60
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1295 // Thread that suspends itself at the first opportunity
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1296 void
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1297 alarm_test2(cyg_uint32 id)
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1298 {
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1299 cyg_handle_t me = cyg_thread_self();
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1300 while (true) {
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1301 HAL_CLOCK_READ(&sched_ft[alarm_cnt++].end);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1302 cyg_thread_suspend(me);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1303 }
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1304 }
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1305
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1306 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1307 run_alarm_tests(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1308 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1309 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1310 cyg_tick_count_t init_val, step_val;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1311 cyg_handle_t rtc_handle;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1312
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1313 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1314 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1315 cyg_counter_create(&counters[i], &test_counters[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1316 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1317 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1318 HAL_CLOCK_READ(&alarm_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1319 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[i], &test_alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1320 HAL_CLOCK_READ(&alarm_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1321 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1322 show_times(alarm_ft, nalarms, "Create alarm");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1323
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1324 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1325 init_val = 0; step_val = 0;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1326 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1327 HAL_CLOCK_READ(&alarm_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1328 cyg_alarm_initialize(alarms[i], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1329 HAL_CLOCK_READ(&alarm_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1330 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1331 show_times(alarm_ft, nalarms, "Initialize alarm");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1332
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1333 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1334 init_val = 0; step_val = 0;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1335 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1336 HAL_CLOCK_READ(&alarm_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1337 cyg_alarm_disable(alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1338 HAL_CLOCK_READ(&alarm_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1339 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1340 show_times(alarm_ft, nalarms, "Disable alarm");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1341
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1342 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1343 init_val = 0; step_val = 0;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1344 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1345 HAL_CLOCK_READ(&alarm_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1346 cyg_alarm_enable(alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1347 HAL_CLOCK_READ(&alarm_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1348 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1349 show_times(alarm_ft, nalarms, "Enable alarm");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1350
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1351 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1352 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1353 HAL_CLOCK_READ(&alarm_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1354 cyg_alarm_delete(alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1355 HAL_CLOCK_READ(&alarm_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1356 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1357 show_times(alarm_ft, nalarms, "Delete alarm");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1358
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1359 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1360 cyg_counter_create(&counters[0], &test_counters[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1361 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[0], &test_alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1362 init_val = 9999; step_val = 9999;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1363 cyg_alarm_initialize(alarms[0], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1364 cyg_alarm_enable(alarms[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1365 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1366 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1367 cyg_counter_tick(counters[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1368 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1369 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1370 show_times(counter_ft, ncounters, "Tick counter [1 alarm]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1371
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1372 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1373 cyg_counter_create(&counters[0], &test_counters[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1374 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1375 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[i], &test_alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1376 init_val = 9999; step_val = 9999;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1377 cyg_alarm_initialize(alarms[i], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1378 cyg_alarm_enable(alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1379 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1380 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1381 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1382 cyg_counter_tick(counters[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1383 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1384 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1385 show_times(counter_ft, ncounters, "Tick counter [many alarms]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1386
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1387 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1388 cyg_counter_create(&counters[0], &test_counters[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1389 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[0], &test_alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1390 init_val = 1; step_val = 1;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1391 cyg_alarm_initialize(alarms[0], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1392 cyg_alarm_enable(alarms[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1393 for (i = 0; i < ncounters; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1394 HAL_CLOCK_READ(&counter_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1395 cyg_counter_tick(counters[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1396 HAL_CLOCK_READ(&counter_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1397 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1398 show_times(counter_ft, ncounters, "Tick & fire counter [1 alarm]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1399
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1400 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1401 cyg_counter_create(&counters[0], &test_counters[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1402 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1403 cyg_alarm_create(counters[0], alarm_cb, i, &alarms[i], &test_alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1404 init_val = 1; step_val = 1;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1405 cyg_alarm_initialize(alarms[i], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1406 cyg_alarm_enable(alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1407 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1408 for (i = 0; i < nalarms; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1409 HAL_CLOCK_READ(&alarm_ft[i].start);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1410 cyg_counter_tick(counters[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1411 HAL_CLOCK_READ(&alarm_ft[i].end);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1412 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1413 for (i = 0; i < nalarms; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1414 cyg_alarm_delete(alarms[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1415 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1416 show_times(alarm_ft, nalarms, "Tick & fire counters [>1 together]");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1417
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1418 wait_for_tick(); // Wait until the next clock tick to minimize aberations
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1419 cyg_counter_create(&counters[0], &test_counters[0]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1420 for (i = 0; i < nalarms; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1421 cyg_alarm_create(counters[0], alarm_cb, i, &alarms[i], &test_alarms[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1422 init_val = i+1; step_val = nalarms+1;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1423 cyg_alarm_initialize(alarms[i], init_val, step_val);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1424 cyg_alarm_enable(alarms[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1425 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1426 for (i = 0; i < nalarms; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1427 HAL_CLOCK_READ(&alarm_ft[i].start);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1428 cyg_counter_tick(counters[0]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1429 HAL_CLOCK_READ(&alarm_ft[i].end);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1430 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1431 for (i = 0; i < nalarms; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1432 cyg_alarm_delete(alarms[i]);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1433 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1434 show_times(alarm_ft, nalarms, "Tick & fire counters [>1 separately]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1435
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1436 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1437 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1438 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1439 init_val = 5; step_val = 5; alarm_cnt = 0;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1440 cyg_alarm_initialize(alarms[0], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1441 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1442 cyg_alarm_enable(alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1443 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1444 cyg_alarm_disable(alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1445 cyg_alarm_delete(alarms[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1446 show_times(sched_ft, nscheds, "Alarm latency [0 threads]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1447
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1448 // Set my priority higher than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1449 cyg_thread_set_priority(cyg_thread_self(), 2);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1450 for (i = 0; i < 2; i++) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1451 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1452 alarm_test, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1453 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1454 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1455 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1456 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1457 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1458 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1459 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1460 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1461 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1462 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1463 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1464 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1465 init_val = 5; step_val = 5; alarm_cnt = 0;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1466 cyg_alarm_initialize(alarms[0], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1467 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1468 cyg_alarm_enable(alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1469 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1470 cyg_alarm_disable(alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1471 cyg_alarm_delete(alarms[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1472 show_times(sched_ft, nscheds, "Alarm latency [2 threads]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1473 for (i = 0; i < 2; i++) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1474 cyg_thread_suspend(threads[i]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1475 cyg_thread_delete(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1476 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1477
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1478 // Set my priority higher than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1479 cyg_thread_set_priority(cyg_thread_self(), 2);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1480 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1481 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1482 alarm_test, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1483 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1484 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1485 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1486 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1487 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1488 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1489 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1490 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1491 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1492 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1493 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1494 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1495 init_val = 5; step_val = 5; alarm_cnt = 0;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1496 cyg_alarm_initialize(alarms[0], init_val, step_val);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1497 cyg_semaphore_init(&synchro, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1498 cyg_alarm_enable(alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1499 cyg_semaphore_wait(&synchro);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1500 cyg_alarm_disable(alarms[0]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1501 cyg_alarm_delete(alarms[0]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1502 show_times(sched_ft, nscheds, "Alarm latency [many threads]");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1503 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1504 cyg_thread_suspend(threads[i]);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1505 cyg_thread_delete(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1506 }
60
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1507
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1508 // Set my priority higher than any I plan to create
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1509 cyg_thread_set_priority(cyg_thread_self(), 2);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1510 cyg_thread_create(10, // Priority - just a number
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1511 alarm_test2, // entry
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1512 i, // index
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1513 thread_name("thread", 0), // Name
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1514 &stacks[0][0], // Stack
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1515 STACK_SIZE, // Size
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1516 &threads[0], // Handle
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1517 &test_threads[0] // Thread data structure
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1518 );
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1519 wait_for_tick(); // Wait until the next clock tick to minimize aberations
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1520 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1521 cyg_alarm_create(rtc_handle, alarm_cb3, threads[0], &alarms[0],
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1522 &test_alarms[0]);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1523 init_val = 5; step_val = 5; alarm_cnt = 0;
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1524 cyg_alarm_initialize(alarms[0], init_val, step_val);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1525 cyg_semaphore_init(&synchro, 0);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1526 cyg_alarm_enable(alarms[0]);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1527 cyg_semaphore_wait(&synchro);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1528 cyg_alarm_disable(alarms[0]);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1529 cyg_alarm_delete(alarms[0]);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1530 show_times(sched_ft, nscheds, "Alarm -> thread resume latency");
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1531 cyg_thread_suspend(threads[0]);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1532 cyg_thread_delete(threads[0]);
3836136e7743 Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents: 56
diff changeset
1533
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1534 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1535 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1536
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1537 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1538 run_sched_tests(void)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1539 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1540 int i;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1541
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1542 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1543 for (i = 0; i < nscheds; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1544 HAL_CLOCK_READ(&sched_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1545 cyg_scheduler_lock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1546 HAL_CLOCK_READ(&sched_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1547 cyg_scheduler_unlock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1548 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1549 show_times(sched_ft, nscheds, "Scheduler lock");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1550
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1551 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1552 for (i = 0; i < nscheds; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1553 cyg_scheduler_lock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1554 HAL_CLOCK_READ(&sched_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1555 cyg_scheduler_unlock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1556 HAL_CLOCK_READ(&sched_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1557 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1558 show_times(sched_ft, nscheds, "Scheduler unlock [0 threads]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1559
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1560 // Set my priority higher than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1561 cyg_thread_set_priority(cyg_thread_self(), 2);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1562 for (i = 0; i < 1; i++) {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1563 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1564 test0, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1565 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1566 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1567 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1568 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1569 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1570 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1571 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1572 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1573 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1574 for (i = 0; i < nscheds; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1575 cyg_scheduler_lock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1576 HAL_CLOCK_READ(&sched_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1577 cyg_scheduler_unlock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1578 HAL_CLOCK_READ(&sched_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1579 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1580 show_times(sched_ft, nscheds, "Scheduler unlock [1 suspended]");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1581 for (i = 0; i < 1; i++) {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1582 cyg_thread_delete(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1583 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1584
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1585 // Set my priority higher than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1586 cyg_thread_set_priority(cyg_thread_self(), 2);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1587 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1588 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1589 test0, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1590 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1591 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1592 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1593 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1594 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1595 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1596 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1597 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1598 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1599 for (i = 0; i < nscheds; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1600 cyg_scheduler_lock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1601 HAL_CLOCK_READ(&sched_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1602 cyg_scheduler_unlock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1603 HAL_CLOCK_READ(&sched_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1604 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1605 show_times(sched_ft, nscheds, "Scheduler unlock [many suspended]");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1606 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1607 cyg_thread_delete(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1608 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1609
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1610 // Set my priority higher than any I plan to create
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1611 cyg_thread_set_priority(cyg_thread_self(), 2);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1612 for (i = 0; i < ntest_threads; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1613 cyg_thread_create(10, // Priority - just a number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1614 test0, // entry
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1615 i, // index
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1616 thread_name("thread", i), // Name
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1617 &stacks[i][0], // Stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1618 STACK_SIZE, // Size
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1619 &threads[i], // Handle
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1620 &test_threads[i] // Thread data structure
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1621 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1622 cyg_thread_resume(threads[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1623 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1624 wait_for_tick(); // Wait until the next clock tick to minimize aberations
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1625 for (i = 0; i < nscheds; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1626 cyg_scheduler_lock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1627 HAL_CLOCK_READ(&sched_ft[i].start);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1628 cyg_scheduler_unlock();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1629 HAL_CLOCK_READ(&sched_ft[i].end);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1630 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1631 show_times(sched_ft, nscheds, "Scheduler unlock [many low prio]");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1632 for (i = 0; i < ntest_threads; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1633 cyg_thread_delete(threads[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1634 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1635 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1636 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1637
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1638 void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1639 run_all_tests(CYG_ADDRESS id)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1640 {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1641 int i, j;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1642 cyg_uint32 tv[nsamples], tv0, tv1;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1643 cyg_uint32 min_stack, max_stack, total_stack, actual_stack;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1644 cyg_tick_count_t ticks, tick0, tick1;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1645 #ifdef CYG_SCHEDULER_LOCK_TIMINGS
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1646 cyg_uint32 lock_ave, lock_max;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1647 #endif
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1648 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY)
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1649 cyg_int32 clock_ave;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1650 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1651
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1652 disable_clock_latency_measurement();
8
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1653
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
1654 #ifndef CYGPKG_KERNEL_SMP_SUPPORT
8
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1655 cyg_test_dump_thread_stack_stats( "Startup, main stack", thread[0] );
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1656 cyg_test_dump_interrupt_stack_stats( "Startup" );
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1657 cyg_test_dump_idlethread_stack_stats( "Startup" );
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1658 cyg_test_clear_interrupt_stack();
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
1659 #endif
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
1660
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1661 diag_printf("\neCos Kernel Timings\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1662 diag_printf("Notes: all times are in microseconds (.000001) unless otherwise stated\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1663 #ifdef STATS_WITHOUT_FIRST_SAMPLE
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1664 diag_printf(" second line of results have first sample removed\n");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1665 #endif
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1666
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1667 cyg_thread_delay(2); // Make sure the clock is actually running
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1668
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1669 ns_per_system_clock = 1000000/rtc_resolution[1];
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1670
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
1671 wait_for_tick();
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1672 for (i = 0; i < nsamples; i++) {
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1673 HAL_CLOCK_READ(&tv[i]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1674 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1675 tv0 = 0;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1676 for (i = 1; i < nsamples; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1677 tv0 += tv[i] - tv[i-1];
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1678 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1679 end_of_test_group();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1680
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1681 overhead = tv0 / (nsamples-1);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1682 diag_printf("Reading the hardware clock takes %d 'ticks' overhead\n", overhead);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1683 diag_printf("... this value will be factored out of all other measurements\n");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1684
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1685 // Try and measure how long the clock interrupt handling takes
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1686 for (i = 0; i < nsamples; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1687 tick0 = cyg_current_time();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1688 while (true) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1689 tick1 = cyg_current_time();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1690 if (tick0 != tick1) break;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1691 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1692 HAL_CLOCK_READ(&tv[i]);
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1693 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1694 tv1 = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1695 for (i = 0; i < nsamples; i++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1696 tv1 += tv[i] * 1000;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1697 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1698 tv1 = tv1 / nsamples;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1699 tv1 -= overhead; // Adjust out the cost of getting the timer value
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1700 diag_printf("Clock interrupt took");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1701 show_ticks_in_us(tv1);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1702 diag_printf(" microseconds (%d raw clock ticks)\n", tv1/1000);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1703 enable_clock_latency_measurement();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1704
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1705 ticks = cyg_current_time();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1706
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1707 show_test_parameters();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1708 show_times_hdr();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1709
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1710 reset_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1711
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1712 run_thread_tests();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1713 run_sched_tests();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1714 run_mutex_tests();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1715 run_mbox_tests();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1716 run_semaphore_tests();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1717 run_counter_tests();
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1718 run_flag_tests();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1719 run_alarm_tests();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1720
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1721 #ifdef CYG_SCHEDULER_LOCK_TIMINGS
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1722 Cyg_Scheduler::get_lock_times(&lock_ave, &lock_max);
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1723 diag_printf("\nMax lock:");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1724 show_ticks_in_us(lock_max);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1725 diag_printf(", Ave lock:");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1726 show_ticks_in_us(lock_ave);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1727 diag_printf("\n");
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1728 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1729
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1730 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY)
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1731 // Display latency figures in same format as all other numbers
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1732 disable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1733 clock_ave = (total_clock_latency*1000) / total_clock_interrupts;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1734 show_ticks_in_us(clock_ave);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1735 show_ticks_in_us(min_clock_latency*1000);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1736 show_ticks_in_us(max_clock_latency*1000);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1737 show_ticks_in_us(0);
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1738 diag_printf(" Clock/interrupt latency\n\n");
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1739 enable_clock_latency_measurement();
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1740 #endif
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1741
210
d2c90368aeef Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents: 208
diff changeset
1742 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY)
34
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1743 disable_clock_latency_measurement();
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1744 clock_ave = (total_clock_dsr_latency*1000) / total_clock_dsr_calls;
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1745 show_ticks_in_us(clock_ave);
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1746 show_ticks_in_us(min_clock_dsr_latency*1000);
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1747 show_ticks_in_us(max_clock_dsr_latency*1000);
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1748 show_ticks_in_us(0);
29bc183297e1 Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents: 10
diff changeset
1749 diag_printf(" Clock DSR latency\n\n");
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1750 enable_clock_latency_measurement();
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1751 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1752
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
1753 #ifndef CYGPKG_KERNEL_SMP_SUPPORT
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1754 disable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1755 min_stack = STACK_SIZE;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1756 max_stack = 0;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1757 total_stack = 0;
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1758 for (i = 0; i < (int)NTEST_THREADS; i++) {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1759 for (j = 0; j < STACK_SIZE; j++) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1760 if (stacks[i][j]) break;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1761 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1762 actual_stack = STACK_SIZE-j;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1763 if (actual_stack < min_stack) min_stack = actual_stack;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1764 if (actual_stack > max_stack) max_stack = actual_stack;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1765 total_stack += actual_stack;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1766 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1767 for (j = 0; j < STACKSIZE; j++) {
8
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1768 if (((char *)stack[0])[j]) break;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1769 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1770 diag_printf("%5d %5d %5d (main stack: %5d) Thread stack used (%d total)\n",
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1771 total_stack/NTEST_THREADS, min_stack, max_stack,
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1772 STACKSIZE - j, STACK_SIZE);
8
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1773
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1774 cyg_test_dump_thread_stack_stats( "All done, main stack", thread[0] );
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1775 cyg_test_dump_interrupt_stack_stats( "All done" );
ece80412419a Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents: 4
diff changeset
1776 cyg_test_dump_idlethread_stack_stats( "All done" );
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
1777 #endif
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 161
diff changeset
1778
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1779 enable_clock_latency_measurement();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1780
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1781 ticks = cyg_current_time();
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1782 diag_printf("\nTiming complete - %d ms total\n\n", (int)((ticks*ns_per_system_clock)/1000));
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1783
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1784 CYG_TEST_PASS_FINISH("Basic timing OK");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1785 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1786
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1787 void tm_basic_main( void )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1788 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1789 CYG_TEST_INIT();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1790
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1791 if (cyg_test_is_simulator) {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1792 nsamples = NSAMPLES_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1793 ntest_threads = NTEST_THREADS_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1794 nthread_switches = NTHREAD_SWITCHES_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1795 nmutexes = NMUTEXES_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1796 nmboxes = NMBOXES_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1797 nsemaphores = NSEMAPHORES_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1798 nscheds = NSCHEDS_SIM;
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1799 nflags = NFLAGS_SIM;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1800 ncounters = NCOUNTERS_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1801 nalarms = NALARMS_SIM;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1802 } else {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1803 nsamples = NSAMPLES;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1804 ntest_threads = NTEST_THREADS;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1805 nthread_switches = NTHREAD_SWITCHES;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1806 nmutexes = NMUTEXES;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1807 nmboxes = NMBOXES;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1808 nsemaphores = NSEMAPHORES;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1809 nscheds = NSCHEDS;
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1810 nflags = NFLAGS;
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1811 ncounters = NCOUNTERS;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1812 nalarms = NALARMS;
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1813 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1814
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1815 // Sanity
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1816 #ifdef WORKHORSE_TEST
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1817 ntest_threads = max(512, ntest_threads);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1818 nmutexes = max(1024, nmutexes);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1819 nsemaphores = max(1024, nsemaphores);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1820 nmboxes = max(1024, nmboxes);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1821 ncounters = max(1024, ncounters);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1822 nalarms = max(1024, nalarms);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1823 #else
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1824 ntest_threads = max(64, ntest_threads);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1825 nmutexes = max(32, nmutexes);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1826 nsemaphores = max(32, nsemaphores);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1827 nmboxes = max(32, nmboxes);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1828 ncounters = max(32, ncounters);
445
4bfb0d444b05 Add tests for kernel flag synchronizers (incomplete).
gthomas
parents: 394
diff changeset
1829 nflags = max(32, nflags);
56
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1830 nalarms = max(32, nalarms);
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1831 #endif
755351606154 Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents: 38
diff changeset
1832
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1833 new_thread(run_all_tests, 0);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1834
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1835 Cyg_Scheduler::scheduler.start();
4
1d7f19c9e4d1 Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents: 2
diff changeset
1836
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1837 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1838
130
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1839 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1840 externC void
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1841 cyg_hal_invoke_constructors();
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1842 #endif
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1843
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1844 externC void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1845 cyg_start( void )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1846 {
130
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1847 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1848 cyg_hal_invoke_constructors();
eb9fd8c04db3 Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents: 76
diff changeset
1849 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1850 tm_basic_main();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1851 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1852
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1853 #else // CYGFUN_KERNEL_API_C
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1854
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1855 externC void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1856 cyg_start( void )
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1857 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1858 CYG_TEST_INIT();
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
1859 CYG_TEST_NA("Timing tests require:\n"
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
1860 "CYGFUN_KERNEL_API_C && \n"
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
1861 "CYGSEM_KERNEL_SCHED_MLQUEUE &&\n"
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
1862 "CYGVAR_KERNEL_COUNTERS_CLOCK &&\n"
76
435cced73e2f eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents: 66
diff changeset
1863 "!CYGDBG_INFRA_DIAG_USE_DEVICE &&\n"
66
bf00f99aec69 Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents: 64
diff changeset
1864 "(CYGNUM_KERNEL_SCHED_PRIORITIES > 12)\n");
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1865 }
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1866 #endif // CYGFUN_KERNEL_API_C, etc.
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
1867
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1868 // EOF tm_basic.cxx