1 /* syskernel.h */
2 
3 /*
4  * Copyright (c) 1997-2010, 2014 Wind River Systems, Inc.
5  *
6  *SPDX-License-Identifier: Apache-2.0
7  */
8 
9 #ifndef SYSKERNEK_H
10 #define SYSKERNEK_H
11 
12 #include <timestamp.h>
13 
14 #include <stdio.h>
15 #include <toolchain.h>
16 
17 #define STACK_SIZE 2048
18 #if CONFIG_SRAM_SIZE <= 32
19 #define NUMBER_OF_LOOPS 100
20 #else
21 #define NUMBER_OF_LOOPS 1000
22 #endif
23 
24 
25 extern K_THREAD_STACK_DEFINE(thread_stack1, STACK_SIZE);
26 extern K_THREAD_STACK_DEFINE(thread_stack2, STACK_SIZE);
27 extern struct k_thread thread_data1;
28 extern struct k_thread thread_data2;
29 
30 extern FILE *output_file;
31 
32 extern const char sz_success[];
33 extern const char sz_partial[];
34 extern const char sz_fail[];
35 
36 extern uint32_t number_of_loops;
37 
38 #define sz_module_title_fmt	"\nMODULE: %s"
39 #define sz_module_result_fmt	"\n\nPROJECT EXECUTION %s\n"
40 #define sz_module_end_fmt	"\nEND MODULE"
41 
42 #define sz_date_fmt		"\nBUILD_DATE: %s %s"
43 #define sz_kernel_ver_fmt	"\nKERNEL VERSION: 0x%x"
44 #define sz_description		"\nTEST COVERAGE: %s"
45 
46 #define sz_test_case_fmt	"\n\nTEST CASE: %s"
47 #define sz_test_start_fmt	"\nStarting test. Please wait..."
48 #define sz_case_result_fmt	"\nTEST RESULT: %s"
49 #define sz_case_details_fmt	"\nDETAILS: %s"
50 #define sz_case_end_fmt		"\nEND TEST CASE"
51 #define sz_case_timing_fmt	"%u nSec"
52 
53 int check_result(int i, uint32_t ticks);
54 
55 int sema_test(void);
56 int lifo_test(void);
57 int fifo_test(void);
58 int stack_test(void);
59 int mem_slab_test(void);
60 void begin_test(void);
61 
BENCH_START(void)62 static inline uint32_t BENCH_START(void)
63 {
64 	uint32_t et;
65 
66 	begin_test();
67 	et = TIME_STAMP_DELTA_GET(0);
68 	return et;
69 }
70 
71 #endif /* SYSKERNEK_H */
72