annotate packages/kernel/current/tests/tm_basic.cxx @ 3292:7f8e529b4d82 default tip

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