/[dtapublic]/to_be_filed/uculib01/autotest/stm8/cosmic/modsl0/group_a/main.c
ViewVC logotype

Contents of /to_be_filed/uculib01/autotest/stm8/cosmic/modsl0/group_a/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 30 - (show annotations) (download)
Sat Oct 8 07:22:17 2016 UTC (8 years, 2 months ago) by dashley
File MIME type: text/plain
File size: 11690 byte(s)
Initial commit.
1 //-------------------------------------------------------------------------------
2 //$Header: /home/dashley/cvsrep/uculib01/uculib01/autotest/stm8/cosmic/modsl0/group_a/main.c,v 1.28 2010/02/17 23:01:14 dashley Exp $
3 //-------------------------------------------------------------------------------
4 //Copyright (c)2010 David T. Ashley
5 //
6 //Permission is hereby granted, free of charge, to any person obtaining a copy
7 //of this software source code and associated documentation files (the
8 //"Software"), to deal in the Software without restriction, including without
9 //limitation the rights to use, copy, modify, merge, publish, distribute,
10 //sublicense, and/or sell copies of the Software, and to permit persons to whom
11 //the Software is furnished to do so, subject to the following conditions:
12 //
13 //The above copyright notice and this permission notice shall be included in
14 //all copies or substantial portions of the Software.
15 //
16 //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 //THE SOFTWARE.
23 //-------------------------------------------------------------------------------
24 #include <stddef.h>
25
26 #include "\uculib01\include\stm8\cosmic\c\uculib.h"
27 #include "\uculib01\src\stm8\cosmic\modxx\atu8sqrtfrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_atu8sqrtfrxx.h"
28 #include "\uculib01\src\stm8\cosmic\modxx\atu16sqrtfrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_atu16sqrtfrxx.h"
29 #include "\uculib01\src\stm8\cosmic\modxx\atu16sqrtx10frxx\unittest\ut_project\stm8\cosmic\modx0\utfu_atu16sqrtx10frxx.h"
30 #include "\uculib01\src\stm8\cosmic\modxx\atu16cmpdiffabsgtrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_atu16cmpdiffabsgtrxx.h"
31 #include "\uculib01\src\stm8\cosmic\modxx\atu16lsczyifaxdaxrrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_atu16lsczyifaxdaxrrxx.h"
32 #include "\uculib01\src\stm8\cosmic\modxx\atu16lsczyiraxdaxrrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_atu16lsczyiraxdaxrrxx.h"
33 #include "\uculib01\src\stm8\cosmic\modxx\atu16ratadjrrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_atu16ratadjrrxx.h"
34 #include "\uculib01\src\stm8\cosmic\modxx\btu8bytecardnibplut\unittest\ut_project\stm8\cosmic\modx0\utfu_btu8bytecardnibplut.h"
35 #include "\uculib01\src\stm8\cosmic\modxx\btu32rmasklut\unittest\ut_project\stm8\cosmic\modx0\utfu_btu32rmasklut.h"
36 #include "\uculib01\src\stm8\cosmic\modxx\btu32bitbyindexlut\unittest\ut_project\stm8\cosmic\modx0\utfu_btu32bitbyindexlut.h"
37 #include "\uculib01\src\stm8\cosmic\modxx\btu8bitcardrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_btu8bitcardrxx.h"
38 #include "\uculib01\src\stm8\cosmic\modxx\btu16bitcardrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_btu16bitcardrxx.h"
39 #include "\uculib01\src\stm8\cosmic\modxx\btu32bitcardrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_btu32bitcardrxx.h"
40 #include "\uculib01\src\stm8\cosmic\modxx\btu32bitcardrnrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_btu32bitcardrnrxx.h"
41 #include "\uculib01\src\stm8\cosmic\modxx\amu8adnbzu16nrxn\unittest\ut_project\stm8\cosmic\modx0\utfu_amu8adnbzu16nrxn.h"
42 #include "\uculib01\src\stm8\cosmic\modxx\amu16adnbzu16nrxn\unittest\ut_project\stm8\cosmic\modx0\utfu_amu16adnbzu16nrxn.h"
43 #include "\uculib01\src\stm8\cosmic\modxx\amu32adnbzu16nrxn\unittest\ut_project\stm8\cosmic\modx0\utfu_amu32adnbzu16nrxn.h"
44 #include "\uculib01\src\common\common\mflibvermajrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_mflibvermajrxx.h"
45 #include "\uculib01\src\common\common\mflibverminmicrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_mflibverminmicrxx.h"
46 #include "\uculib01\src\common\common\mflibvercpurxx\unittest\ut_project\stm8\cosmic\modx0\utfu_mflibvercpurxx.h"
47 #include "\uculib01\src\common\common\mflibvercmprxx\unittest\ut_project\stm8\cosmic\modx0\utfu_mflibvercmprxx.h"
48 #include "\uculib01\src\stm8\cosmic\modx0\mfcpuccrgetrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_mfcpuccrgetrxx.h"
49 #include "\uculib01\src\stm8\cosmic\modx0\mfcpusptrpcgetrxx\unittest\ut_project\stm8\cosmic\modx0\utfu_mfcpusptrpcgetrxx.h"
50
51
52 //Test vector set for one particular library function.
53 typedef struct
54 {
55 const char *func_name;
56 UCU_BOOLEAN (*ut_ptr)(void); //Unit test, UCU_TRUE means passed.
57 UCU_UINT32 (*st_enum_ptr)(void); //Returns the number of speed test vectors available.
58 void (*st_ptr)(UCU_UINT32 test_no, //Performs a speed test for the passed test_no, with
59 void (*start_pointer)(void), //callbacks to get more accurate timing.
60 void (*end_pointer)(void));
61 } AUTOTEST_POINTER_VECTOR;
62
63
64 //Table of function pointers to perform unit tests and speed tests.
65 AUTOTEST_POINTER_VECTOR autotest_ptrs[] =
66 {
67 //Function UcuAtU8SqrtFRxx().
68 {
69 "UcuAtU8SqrtFRxx()",
70 UtfuAtU8SqrtFRxx,
71 UtsnAtU8SqrtFRxx,
72 UtspAtU8SqrtFRxx
73 },
74 //Function UcuAtU16SqrtFRxx().
75 {
76 "UcuAtU16SqrtFRxx()",
77 UtfuAtU16SqrtFRxx,
78 UtsnAtU16SqrtFRxx,
79 UtspAtU16SqrtFRxx
80 },
81 //Function UcuAtU16SqrtX10FRxx().
82 {
83 "UcuAtU16SqrtX10FRxx()",
84 UtfuAtU16SqrtX10FRxx,
85 UtsnAtU16SqrtX10FRxx,
86 UtspAtU16SqrtX10FRxx
87 },
88 //Function UcuAtU16CmpDiffAbsGtRxx().
89 {
90 "UcuAtU16CmpDiffAbsGtRxx()",
91 UtfuAtU16CmpDiffAbsGtRxx,
92 UtsnAtU16CmpDiffAbsGtRxx,
93 UtspAtU16CmpDiffAbsGtRxx
94 },
95 //Function UcuAtU16LscZyiFAxdAxrRxx().
96 {
97 "UcuAtU16LscZyiFAxdAxrRxx()",
98 UtfuAtU16LscZyiFAxdAxrRxx,
99 UtsnAtU16LscZyiFAxdAxrRxx,
100 UtspAtU16LscZyiFAxdAxrRxx
101 },
102 //Function UcuAtU16LscZyiRAxdAxrRxx().
103 {
104 "UcuAtU16LscZyiRAxdAxrRxx()",
105 UtfuAtU16LscZyiRAxdAxrRxx,
106 UtsnAtU16LscZyiRAxdAxrRxx,
107 UtspAtU16LscZyiRAxdAxrRxx
108 },
109 //Function UcuAtU16RatAdjRRxx().
110 {
111 "UcuAtU16RatAdjRRxx()",
112 UtfuAtU16RatAdjRRxx,
113 UtsnAtU16RatAdjRRxx,
114 UtspAtU16RatAdjRRxx
115 },
116 //Lookup Table UcuBtU8ByteCardNibpLut[].
117 {
118 "UcuBtU8ByteCardNibpLut[]",
119 UtfuBtU8ByteCardNibpLut,
120 NULL,
121 NULL
122 },
123 //Lookup Table UcuBtU32RmaskLut[].
124 {
125 "UcuUcuBtU32RmaskLut[]",
126 UtfuBtU32RmaskLut,
127 NULL,
128 NULL
129 },
130 //Lookup Table UcuBtU32BitByIndexLut[].
131 {
132 "UcuUcuBtU32BitByIndexLut[]",
133 UtfuBtU32BitByIndexLut,
134 NULL,
135 NULL
136 },
137 //Function UcuBtU8BitCardRxx().
138 {
139 "UcuBtU8BitCardRxx()",
140 UtfuBtU8BitCardRxx,
141 UtsnBtU8BitCardRxx,
142 UtspBtU8BitCardRxx
143 },
144 //Function UcuBtU16BitCardRxx().
145 {
146 "UcuBtU16BitCardRxx()",
147 UtfuBtU16BitCardRxx,
148 UtsnBtU16BitCardRxx,
149 UtspBtU16BitCardRxx
150 },
151 //Function UcuBtU32BitCardRxx().
152 {
153 "UcuBtU32BitCardRxx()",
154 UtfuBtU32BitCardRxx,
155 UtsnBtU32BitCardRxx,
156 UtspBtU32BitCardRxx
157 },
158 //Function UcuBtU32BitCardRnRxx().
159 {
160 "UcuBtU32BitCardRnRxx()",
161 UtfuBtU32BitCardRnRxx,
162 UtsnBtU32BitCardRnRxx,
163 UtspBtU32BitCardRnRxx
164 },
165 //Function UcuAmU8aDnbzU16nRxn().
166 {
167 "UcuAmU8aDnbzU16nRxn()",
168 UtfuAmU8aDnbzU16nRxn,
169 NULL,
170 NULL
171 },
172 //Function UcuAmU16aDnbzU16nRxn().
173 {
174 "UcuAmU16aDnbzU16nRxn()",
175 UtfuAmU16aDnbzU16nRxn,
176 NULL,
177 NULL
178 },
179 //Function UcuAmU32aDnbzU16nRxn().
180 {
181 "UcuAmU32aDnbzU16nRxn()",
182 UtfuAmU32aDnbzU16nRxn,
183 NULL,
184 NULL
185 },
186 //Function UcuMfLibVerMajRxx().
187 {
188 "UcuMfLibVerMajRxx()",
189 UtfuMfLibVerMajRxx,
190 UtsnMfLibVerMajRxx,
191 UtspMfLibVerMajRxx
192 },
193 //Function UcuMfLibVerMinMicRxx().
194 {
195 "UcuMfLibVerMinMicRxx()",
196 UtfuMfLibVerMinMicRxx,
197 UtsnMfLibVerMinMicRxx,
198 UtspMfLibVerMinMicRxx
199 },
200 //Function UcuMfLibVerCpuRxx().
201 {
202 "UcuMfLibVerCpuRxx()",
203 UtfuMfLibVerCpuRxx,
204 UtsnMfLibVerCpuRxx,
205 UtspMfLibVerCpuRxx
206 },
207 //Function UcuMfLibVerCmpRxx().
208 {
209 "UcuMfLibVerCmpRxx()",
210 UtfuMfLibVerCmpRxx,
211 UtsnMfLibVerCmpRxx,
212 UtspMfLibVerCmpRxx
213 },
214 //Function UcuMfCpuCcrGetRxx().
215 {
216 "UcuMfCpuCcrGetRxx()",
217 UtfuMfCpuCcrGetRxx,
218 UtsnMfCpuCcrGetRxx,
219 UtspMfCpuCcrGetRxx
220 },
221 //Function UcuMfCpuSptrPcGetRxx().
222 {
223 "UcuMfCpuSptrPcGetRxx()",
224 UtfuMfCpuSptrPcGetRxx,
225 UtsnMfCpuSptrPcGetRxx,
226 UtspMfCpuSptrPcGetRxx
227 },
228 };
229
230
231 void start_timer_func(void)
232 {
233 }
234
235
236 void stop_timer_func(void)
237 {
238 }
239
240
241 volatile UCU_UINT8 dummy_volatile_variable;
242 volatile UCU_BOOLEAN regression_tests_passed;
243
244
245 main(void)
246 {
247 UCU_UINT16 i;
248 UCU_UINT32 j, k;
249
250 //First do the regression correctness test. This may take a large amount of compute time.
251 regression_tests_passed = UCU_TRUE;
252 for (i=0; i<(sizeof(autotest_ptrs)/sizeof(autotest_ptrs[0])); i++)
253 {
254 if (autotest_ptrs[i].ut_ptr) //Don't dare run a NULL pointer.
255 {
256 if (! (*autotest_ptrs[i].ut_ptr)())
257 {
258 regression_tests_passed = UCU_FALSE;
259 }
260 else
261 {
262 //No logical function, just a breakpoint to stop on.
263 dummy_volatile_variable = 0x01;
264 }
265 }
266
267 //No logical function, just a breakpoint to stop on.
268 dummy_volatile_variable = 0x02;
269 }
270
271 //No logical function, just a breakpoint to stop on.
272 dummy_volatile_variable = 0x03;
273
274 //Now do the speed tests. This is just a compile test--don't know how this will be implemented.
275 for (i=0; i<(sizeof(autotest_ptrs)/sizeof(autotest_ptrs[0])); i++)
276 {
277 if ((autotest_ptrs[i].st_enum_ptr) && (autotest_ptrs[i].st_ptr))
278 {
279 k = (*autotest_ptrs[i].st_enum_ptr)();
280
281 for (j=0; j<k; j++)
282 {
283 (*autotest_ptrs[i].st_ptr)(j, start_timer_func, stop_timer_func);
284 }
285 }
286 }
287
288 //Pause at the end so can have a breakpoint to stop on with the debugger.
289 while(UCU_TRUE)
290 {
291 dummy_volatile_variable = 0x04;
292 }
293 }
294
295
296 //-------------------------------------------------------------------------------
297 //$Log: main.c,v $
298 //Revision 1.28 2010/02/17 23:01:14 dashley
299 //Function added.
300 //
301 //Revision 1.27 2010/02/17 21:25:36 dashley
302 //Function added.
303 //
304 //Revision 1.26 2010/02/17 18:58:57 dashley
305 //Function added.
306 //
307 //Revision 1.25 2010/02/15 22:14:09 dashley
308 //One unit test failing.
309 //
310 //Revision 1.24 2010/02/15 17:43:34 dashley
311 //Unit test passed.
312 //
313 //Revision 1.23 2010/02/15 01:47:55 dashley
314 //Function added.
315 //
316 //Revision 1.22 2010/02/14 22:58:29 dashley
317 //Functions added.
318 //
319 //Revision 1.21 2010/02/14 18:23:15 dashley
320 //Function added.
321 //
322 //Revision 1.20 2010/02/14 00:41:16 dashley
323 //Function added.
324 //-------------------------------------------------------------------------------
325 //End of $RCSfile: main.c,v $
326 //-------------------------------------------------------------------------------

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25