bfin: remove inline keyword
[xenomai-head.git] / include / rtdm / rttesting.h
blobe6aeede081507d898c748879a80faf79695d63cd
1 /**
2 * @file
3 * Real-Time Driver Model for Xenomai, testing device profile header
5 * @note Copyright (C) 2005 Jan Kiszka <jan.kiszka@web.de>
7 * Xenomai is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * Xenomai is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Xenomai; if not, write to the Free Software Foundation,
19 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * @ingroup rttesting
24 /*!
25 * @ingroup profiles
26 * @defgroup rttesting Testing Devices
28 * This group of devices is intended to provide in-kernel testing results.
29 * Feel free to comment on this profile via the Xenomai mailing list
30 * (xenomai@xenomai.org) or directly to the author (jan.kiszka@web.de).
32 * @b Profile @b Revision: 2
33 * @n
34 * @n
35 * @par Device Characteristics
36 * @ref rtdm_device.device_flags "Device Flags": @c RTDM_NAMED_DEVICE @n
37 * @n
38 * @ref rtdm_device.device_name "Device Name": @c "rttest[-<subclass>]<N>",
39 * N >= 0, optional subclass name to simplify device discovery @n
40 * @n
41 * @ref rtdm_device.device_class "Device Class": @c RTDM_CLASS_TESTING @n
42 * @n
44 * @par Supported Operations
45 * @b Open @n
46 * Environments: non-RT (RT optional, deprecated)@n
47 * Specific return values: none @n
48 * @n
49 * @b Close @n
50 * Environments: non-RT (RT optional, deprecated)@n
51 * Specific return values: none @n
52 * @n
53 * @b IOCTL @n
54 * Mandatory Environments: see @ref TSTIOCTLs below @n
55 * Specific return values: see @ref TSTIOCTLs below @n
57 * @{
60 #ifndef _RTTESTING_H
61 #define _RTTESTING_H
63 #include <rtdm/rtdm.h>
65 #define RTTST_PROFILE_VER 2
67 typedef struct rttst_bench_res {
68 long long avg;
69 long min;
70 long max;
71 long overruns;
72 long test_loops;
73 } rttst_bench_res_t;
75 typedef struct rttst_interm_bench_res {
76 struct rttst_bench_res last;
77 struct rttst_bench_res overall;
78 } rttst_interm_bench_res_t;
80 typedef struct rttst_overall_bench_res {
81 struct rttst_bench_res result;
82 long *histogram_avg;
83 long *histogram_min;
84 long *histogram_max;
85 void *__padding; /* align to dwords on 32-bit archs */
86 } rttst_overall_bench_res_t;
88 #define RTTST_TMBENCH_INVALID -1 /* internal use only */
89 #define RTTST_TMBENCH_TASK 0
90 #define RTTST_TMBENCH_HANDLER 1
92 typedef struct rttst_tmbench_config {
93 int mode;
94 int priority;
95 nanosecs_rel_t period;
96 int warmup_loops;
97 int histogram_size;
98 int histogram_bucketsize;
99 int freeze_max;
100 } rttst_tmbench_config_t;
102 #define RTTST_IRQBENCH_USER_TASK 0
103 #define RTTST_IRQBENCH_KERNEL_TASK 1
104 #define RTTST_IRQBENCH_HANDLER 2
105 #define RTTST_IRQBENCH_HARD_IRQ 3
107 #define RTTST_IRQBENCH_SERPORT 0
108 #define RTTST_IRQBENCH_PARPORT 1
110 typedef struct rttst_irqbench_config {
111 int mode;
112 int priority;
113 int calibration_loops;
114 unsigned int port_type;
115 unsigned long port_ioaddr;
116 unsigned int port_irq;
117 } rttst_irqbench_config_t;
119 typedef struct rttst_irqbench_stats {
120 unsigned long long irqs_received;
121 unsigned long long irqs_acknowledged;
122 } rttst_irqbench_stats_t;
124 struct rttst_swtest_task {
125 unsigned index;
126 unsigned flags;
129 /* Possible values for struct rttst_swtest_task::flags. */
130 #define RTTST_SWTEST_FPU 0x1
131 #define RTTST_SWTEST_USE_FPU 0x2 /* Only for kernel-space tasks. */
132 #define RTTST_SWTEST_FREEZE 0x4 /* Only for kernel-space tasks. */
134 struct rttst_swtest_dir {
135 unsigned from;
136 unsigned to;
139 struct rttst_swtest_error {
140 struct rttst_swtest_dir last_switch;
141 unsigned fp_val;
144 #define RTTST_RTDM_NORMAL_CLOSE 0
145 #define RTTST_RTDM_DEFER_CLOSE_HANDLER 1
146 #define RTTST_RTDM_DEFER_CLOSE_CONTEXT 2
148 #define RTIOC_TYPE_TESTING RTDM_CLASS_TESTING
151 * @name Sub-Classes of RTDM_CLASS_TESTING
152 * @{ */
153 /** subclass name: "timerbench" */
154 #define RTDM_SUBCLASS_TIMERBENCH 0
155 /** subclass name: "irqbench" */
156 #define RTDM_SUBCLASS_IRQBENCH 1
157 /** subclass name: "switchtest" */
158 #define RTDM_SUBCLASS_SWITCHTEST 2
159 /** subclase name: "rtdm" */
160 #define RTDM_SUBCLASS_RTDMTEST 3
161 /** @} */
164 * @anchor TSTIOCTLs @name IOCTLs
165 * Testing device IOCTLs
166 * @{ */
167 #define RTTST_RTIOC_INTERM_BENCH_RES \
168 _IOWR(RTIOC_TYPE_TESTING, 0x00, struct rttst_interm_bench_res)
170 #define RTTST_RTIOC_TMBENCH_START \
171 _IOW(RTIOC_TYPE_TESTING, 0x10, struct rttst_tmbench_config)
173 #define RTTST_RTIOC_TMBENCH_STOP \
174 _IOWR(RTIOC_TYPE_TESTING, 0x11, struct rttst_overall_bench_res)
176 #define RTTST_RTIOC_IRQBENCH_START \
177 _IOW(RTIOC_TYPE_TESTING, 0x20, struct rttst_irqbench_config)
179 #define RTTST_RTIOC_IRQBENCH_STOP \
180 _IO(RTIOC_TYPE_TESTING, 0x21)
182 #define RTTST_RTIOC_IRQBENCH_GET_STATS \
183 _IOR(RTIOC_TYPE_TESTING, 0x22, struct rttst_irqbench_stats)
185 #define RTTST_RTIOC_IRQBENCH_WAIT_IRQ \
186 _IO(RTIOC_TYPE_TESTING, 0x23)
188 #define RTTST_RTIOC_IRQBENCH_REPLY_IRQ \
189 _IO(RTIOC_TYPE_TESTING, 0x24)
191 #define RTTST_RTIOC_SWTEST_SET_TASKS_COUNT \
192 _IOW(RTIOC_TYPE_TESTING, 0x30, unsigned long)
194 #define RTTST_RTIOC_SWTEST_SET_CPU \
195 _IOW(RTIOC_TYPE_TESTING, 0x31, unsigned long)
197 #define RTTST_RTIOC_SWTEST_REGISTER_UTASK \
198 _IOW(RTIOC_TYPE_TESTING, 0x32, struct rttst_swtest_task)
200 #define RTTST_RTIOC_SWTEST_CREATE_KTASK \
201 _IOWR(RTIOC_TYPE_TESTING, 0x33, struct rttst_swtest_task)
203 #define RTTST_RTIOC_SWTEST_PEND \
204 _IOR(RTIOC_TYPE_TESTING, 0x34, struct rttst_swtest_task)
206 #define RTTST_RTIOC_SWTEST_SWITCH_TO \
207 _IOR(RTIOC_TYPE_TESTING, 0x35, struct rttst_swtest_dir)
209 #define RTTST_RTIOC_SWTEST_GET_SWITCHES_COUNT \
210 _IOR(RTIOC_TYPE_TESTING, 0x36, unsigned long)
212 #define RTTST_RTIOC_SWTEST_GET_LAST_ERROR \
213 _IOR(RTIOC_TYPE_TESTING, 0x37, struct rttst_swtest_error)
215 #define RTTST_RTIOC_SWTEST_SET_PAUSE \
216 _IOW(RTIOC_TYPE_TESTING, 0x38, unsigned long)
218 #define RTTST_RTIOC_RTDM_DEFER_CLOSE \
219 _IOW(RTIOC_TYPE_TESTING, 0x40, unsigned long)
220 /** @} */
222 /** @} */
224 #endif /* _RTTESTING_H */