mbgtools-lx  4.2.8
mbgioctl.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: mbgioctl.h 1.34 2019/04/03 12:28:11 martin TRASH $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions used with device driver IOCTL.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: mbgioctl.h $
13  * Revision 1.34 2019/04/03 12:28:11 martin
14  * Removed obsolete definition PCPS_SPIN_BUFFER.
15  * Revision 1.33 2019/02/08 16:06:52 martin
16  * Moved the Windows GUID stuff elsewhere.
17  * Revision 1.32 2018/11/22 15:01:44 martin
18  * Refactored structure IOCTL_GENERIC_REQ using fixed size integer
19  * types only to avoid pointer size problems in a mixed 32/64 bit
20  * Linux environment.
21  * Revision 1.31 2018/11/06 17:20:25 martin
22  * Updated function prototypes and a comment.
23  * Revision 1.30 2018/08/24 10:03:46Z martin
24  * Removed code that was commented out.
25  * Added a comment.
26  * Revision 1.29 2018/08/08 15:36:50Z martin
27  * Renamed a local macro for clarity.
28  * Revision 1.28 2018/07/05 09:02:29Z martin
29  * Always use DMA-capable buffers as required by Linux kernels 4.9+.
30  * Moved definition of PCPS_IO_BUFFER and some related
31  * types to new header file pcpsiobf.h.
32  * Common, OS-specific definitions for IOCTL return codes.
33  * Updated function prototypes.
34  * Revision 1.27 2017/07/05 09:37:18 martin
35  * Definitions to support GPIO ports and XMR.
36  * Support new way to check if specific feature supported.
37  * Moved some IOCTL-related definitions from pcpsdev.h here.
38  * Added some doxygen comments.
39  * Revision 1.26 2013/09/26 08:27:04Z martin
40  * Support GNSS API.
41  * Revision 1.25 2012/10/02 18:45:55 martin
42  * There are some g++ versions which fail to compile source code using
43  * the macros provided by Linux to define IOCTL codes. If only the API
44  * functions are called by an application then the IOCTL codes aren't
45  * required anyway, so we just avoid inclusion of mbgioctl.h.
46  * However, some IOCTL related definitions are required anyway, so
47  * they have been moved to pcpsdev.h which is always included.
48  * Support on-board event logs.
49  * Support debug status.
50  * Conditionally use older IOCTL request buffer structures.
51  * Modified generic IOCTL handling such that for calls requiring variable sizes
52  * a fixed request block containing input and output buffer pointers and sizes is
53  * passed down to the kernel driver. This simplifies implementation under *BSD
54  * and also works for other target systems.
55  * Support reading CORR_INFO, and reading/writing TR_DISTANCE.
56  * New code IOCTL_DEV_HAS_PZF.
57  * Support PTP unicast configuration.
58  * Changed the names of a few IOCTL codes to follow general naming conventions.
59  * Added definitions to support privilege level requirements for IOCTLs.
60  * Use native alignment to avoid problems on Sparc and IA64.
61  * Added definitions to set up a table of all known
62  * IOCTL codes and names.
63  * Use MBG_TGT_KERNEL instead of _KDD_.
64  * Use IOTYPE 'Z' under *BSD since this means passthrough on NetBSD.
65  * Revision 1.24 2009/12/15 15:34:59Z daniel
66  * Support reading the raw IRIG data bits for firmware versions
67  * which support this feature.
68  * Revision 1.23 2009/09/29 15:08:41Z martin
69  * Support retrieving time discipline info.
70  * Revision 1.22 2009/08/17 13:48:17 martin
71  * Moved specific definition of symbol _HAVE_IOCTL_WITH_SIZE from
72  * mbgdevio.c here and renamed it to _MBG_SUPP_VAR_ACC_SIZE.
73  * Revision 1.21 2009/06/19 12:18:53 martin
74  * Added PCPS_GIVE_IRIG_TIME command and associated definitions.
75  * Fixed a declaration which might have led to syntax errors.
76  * Revision 1.20 2009/06/09 10:02:36Z daniel
77  * Support PTP configuration and state.
78  * Support simple LAN interface configuration.
79  * Revision 1.19 2009/03/19 15:17:59 martin
80  * Support reading MM timestamps without cycles.
81  * Support UTC parms and configurable time scales.
82  * For consistent naming renamed IOCTL_GET_FAST_HR_TIMESTAMP
83  * to IOCTL_GET_FAST_HR_TIMESTAMP_CYCLES.
84  * Added IOCTL_DEV_HAS_IRIG_CTRL_BITS and IOCTL_GET_IRIG_CTRL_BITS.
85  * Revision 1.18 2008/12/11 10:32:56Z martin
86  * Added _cmd_from_ioctl_code() macro for Linux.
87  * Added IOCTL codes for .._has_asic_version() and .._has_asic_features().
88  * Added IOCTL codes for ..._is_msf(), .._is_lwr(), .._is_wwvb().
89  * Added IOCTL codes IOCTL_GET_IRQ_STAT_INFO, IOCTL_GET_CYCLES_FREQUENCY,
90  * IOCTL_HAS_FAST_HR_TIMESTAMP, and IOCTL_GET_FAST_HR_TIMESTAMP.
91  * Revision 1.17 2008/01/17 09:35:15 daniel
92  * Added ioctl calls IOCTL_GET_MAPPED_MEM_ADDR and
93  * IOCTL_UNMAP_MAPPED_MEM.
94  * Cleanup for PCI ASIC version and features.
95  * Revision 1.16 2007/09/25 10:37:04Z martin
96  * Added macro _cmd_from_ioctl_code() for Windows.
97  * Revision 1.15 2007/05/21 15:00:01Z martin
98  * Unified naming convention for symbols related to ref_offs.
99  * Revision 1.14 2007/03/02 10:27:03 martin
100  * Preliminary support for *BSD.
101  * Preliminary _cmd_from_ioctl().
102  * Revision 1.13 2006/03/10 10:36:54 martin
103  * Added support for programmable pulse outputs.
104  * Revision 1.12 2005/06/02 10:22:05Z martin
105  * Added IOCTL code IOCTL_GET_SYNTH_STATE.
106  * Added IOCTL codes IOCTL_DEV_HAS_GENERIC_IO,
107  * IOCTL_PCPS_GENERIC_IO, and IOCTL_GET_SYNTH_STATE.
108  * Revision 1.11 2005/01/14 10:21:11Z martin
109  * Added IOCTLs which query device features.
110  * Revision 1.10 2004/12/09 11:03:36Z martin
111  * Support configuration of on-board frequency synthesizer.
112  * Revision 1.9 2004/11/09 12:49:41Z martin
113  * Modifications were required in order to be able to configure IRIG
114  * settings of cards which provide both IRIG input and output.
115  * The existing codes have been renamed with .._RX.. and are used to
116  * configure the IRIG receiver (input). New codes have been defined
117  * used to configure the IRIG transmitter.
118  * Renamed IOCTL_GET_GPS_STAT to IOCTL_GET_GPS_BVAR_STAT.
119  * Use more specific data types than generic types.
120  * Modified IOCTL codes used for hardware debugging.
121  * Revision 1.8 2004/09/06 15:46:04Z martin
122  * Changed definition of IOCTL codes to support syntax used
123  * with Linux kernel 2.6.x.
124  * Account for renamed symbols.
125  * Revision 1.7 2004/04/07 10:08:11 martin
126  * Added IOCTL codes used to trigger hardware debug events.
127  * Revision 1.6 2003/12/22 15:37:18Z martin
128  * Added codes to read ASIC version, and read times
129  * with associated cycle counter values.
130  * Revision 1.5 2003/06/19 09:02:30Z martin
131  * New codes IOCTL_GET_PCPS_UCAP_ENTRIES and IOCTL_GET_PCPS_UCAP_EVENT.
132  * Renamed IOCTL_PCPS_CLR_CAP_BUFF to IOCTL_PCPS_CLR_UCAP_BUFF.
133  * Cleaned up IOCTL code names related to PCPS_TZDL.
134  * Reordered upper IOCTL code numbers again.
135  * Revision 1.4 2003/04/09 13:50:39Z martin
136  * Re-organized IOCTL codes.
137  * Supports Win32.
138  * Added missing pragma pack().
139  * Revision 1.3 2003/02/14 13:20:08Z martin
140  * Include mbggeo.h instead of mygeo.h.
141  * Revision 1.2 2001/11/30 09:52:48 martin
142  * Added support for event_time which, however, requires
143  * a custom GPS firmware.
144  * Revision 1.1 2001/03/05 16:34:22 MARTIN
145  * Initial revision
146  *
147  **************************************************************************/
148 
149 #ifndef _MBGIOCTL_H
150 #define _MBGIOCTL_H
151 
152 
153 /* Other headers to be included */
154 
155 #include <mbg_tgt.h>
156 #include <cfg_hlp.h>
157 #include <mbgerror.h>
158 #include <mbggeo.h>
159 #include <pcpsdev.h>
160 #include <pci_asic.h>
161 #include <pcpsiobf.h>
162 
163 #if defined( MBG_TGT_LINUX )
164  #include <linux/ioctl.h>
165 #endif
166 
167 #if defined( MBG_TGT_BSD )
168  #include <sys/ioccom.h>
169 #endif
170 
171 #if defined( MBG_TGT_WIN32 )
172 
173  #if !defined( MBG_TGT_KERNEL )
174  #include <winioctl.h>
175  #endif
176 
177 #endif
178 
179 
180 
181 /* Start of header body */
182 
183 // We have to use native alignment here!
184 
185 #ifdef __cplusplus
186 extern "C" {
187 #endif
188 
189 
190 #if defined( MBG_ARCH_X86 ) && defined( DEBUG ) && DEBUG
191  #define USE_DEBUG_PORT 1
192 #else
193  #define USE_DEBUG_PORT 0
194 #endif
195 
196 
197 #if defined( MBG_TGT_POSIX ) && !defined( MBG_TGT_QNX_NTO )
198  #define MBG_HAS_POSIX_IOCTL 1
199 #endif
200 
201 
202 // A kernel driver's IOCTL handler should return some system-specific
203 // error code in case of failure.
204 // We define the most appropriate return codes for specific error
205 // conditions here, and the IOCTL caller has to map them back to
206 // one of the @ref MBG_ERROR_CODES.
207 
208 #if defined( MBG_TGT_WIN32 ) && defined( MBG_TGT_KERNEL )
209 
210 #if _USE_WIN32_PRIVATE_STATUS_CODES
211 
212  // We let the kernel driver's IOCTL handler return private error
213  // codes in NTSTATUS format, so the DeviceIoControl() function in
214  // user space fails, and the error code returned by a subsequent
215  // GetLastError() returns the original custom error code. This
216  // seems to work well but is an undocumented feature. Also, it
217  // looks like it's not possible to return a non-error custom
218  // status code since in case of of success the DeviceIoControl()
219  // function just returns a BOOL indicating success.
220  // TODO Test this, and eventually move it to mbgerror.h.
221  #define _mbg_krn_errno_to_os( _n ) \
222  ( ( (_n) == MBG_SUCCESS ) ? STATUS_SUCCESS : \
223  ( (NTSTATUS) ( STATUS_SEVERITY_ERROR | STATUS_CUSTOM_FLAG | ( (-(_n)) & 0xFFFF ) ) ) )
224 
225 #else
226 
227  // We let the kernel driver's IOCTL handler return system error
228  // codes in NTSTATUS format, so the DeviceIoControl() function
229  // in user space fails, and a standard Win32 error code is
230  // returned by a subsequent GetLastError() call.
231  //
232  // ::mbg_errno_to_os in kernel mode uses ::mbg_ioctl_to_ntstatus_table
233  // to lookup a system NTSTATUS code which is passed up to user space.
234  //
235  // The Windows kernel maps that NTSTATUS code to some Win32 error code
236  // which can be retrieved by calling GetLastError() if DeviceIoControl()
237  // has failed.
238  //
239  // ::mbg_get_last_error in user space calls GetLastError() and
240  // uses ::win32_error_table to lookup one of the @ref MBG_ERROR_CODES
241  // associated with the retrieved Win32 error.
242  // Ideally, this should correspond to the Meinberg error code
243  // that has been used in kernel mode to lookup the NTSTATUS code.
244  #define _mbg_krn_errno_to_os( _n ) \
245  mbg_errno_to_os( _n )
246 
247 #endif // _USE_WIN32_PRIVATE_STATUS_CODES
248 
249 #endif // defined( MBG_TGT_WIN32 ) && defined( MBG_TGT_KERNEL )
250 
251 
252 
253 #if defined( MBG_TGT_KERNEL )
254 
255 #define IOCTL_RC_SUCCESS MBG_SYS_RC_SUCCESS
256 
257 #if defined( MBG_TGT_LINUX )
258 
259  // super user rights required
260  #define IOCTL_RC_ERR_PERM -EPERM // MBG_ERR_PERM
261 
262  #define IOCTL_RC_ERR_UNSUPP_IOCTL -ENODEV // MBG_ERR_INV_DEV_REQUEST ##
263 
264  #define IOCTL_RC_ERR_INVAL_PARAM -EINVAL // MBG_ERR_INV_PARM
265 
266  #define IOCTL_RC_ERR_NOT_SUPP_BY_DEV -ENOTTY // MBG_ERR_NOT_SUPP_BY_DEV
267 
268  #define IOCTL_RC_ERR_NO_MEM -ENOMEM // MBG_ERR_NO_MEM
269 
270  #define IOCTL_RC_ERR_BUSY_IRQ_UNSAFE -EBUSY // MBG_ERR_BUSY, MBG_ERR_IRQ_UNSAFE
271 
272  #define IOCTL_RC_ERR_DEV_ACCESS -EIO // rc from low level routine
273 
274  // Linux-specific codes
275  #define IOCTL_RC_ERR_COPY_TO_USER -EFAULT // MBG_ERR_COPY_TO_USER
276  #define IOCTL_RC_ERR_COPY_FROM_USER -EFAULT // MBG_ERR_COPY_FROM_USER
277 
278 #elif defined( MBG_TGT_BSD ) // FIXME specific
279 
280  // super user rights required
281  #define IOCTL_RC_ERR_PERM EPERM // MBG_ERR_PERM
282 
283  #if defined( ENOIOCTL ) // E.g. FreeBSD, ...
284  #define IOCTL_RC_ERR_UNSUPP_IOCTL ENOIOCTL // TODO or ENODEV? MBG_ERR_INV_DEV_REQUEST
285  #else
286  #define IOCTL_RC_ERR_UNSUPP_IOCTL ENODEV // MBG_ERR_INV_DEV_REQUEST
287  #endif
288 
289  #define IOCTL_RC_ERR_INVAL_PARAM EINVAL // MBG_ERR_INV_PARM
290 
291  #define IOCTL_RC_ERR_NOT_SUPP_BY_DEV ENOTTY // MBG_ERR_NOT_SUPP_BY_DEV
292 
293  #define IOCTL_RC_ERR_NO_MEM ENOMEM // MBG_ERR_NO_MEM
294 
295  #define IOCTL_RC_ERR_BUSY_IRQ_UNSAFE EBUSY // MBG_ERR_BUSY, MBG_ERR_IRQ_UNSAFE
296 
297  #define IOCTL_RC_ERR_DEV_ACCESS EIO // TODO or EFAULT? rc from low level routine
298 
299 #elif defined( MBG_TGT_WIN32 )
300 
301  #define IOCTL_RC_ERR_PERM _mbg_krn_errno_to_os( MBG_ERR_PERM )
302 
303  #define IOCTL_RC_ERR_UNSUPP_IOCTL _mbg_krn_errno_to_os( MBG_ERR_INV_DEV_REQUEST )
304 
305  #define IOCTL_RC_ERR_INVAL_PARAM _mbg_krn_errno_to_os( MBG_ERR_INV_PARM )
306 
307  #define IOCTL_RC_ERR_NOT_SUPP_BY_DEV _mbg_krn_errno_to_os( MBG_ERR_NOT_SUPP_BY_DEV )
308 
309  #define IOCTL_RC_ERR_NO_MEM _mbg_krn_errno_to_os( MBG_ERR_NO_MEM )
310 
311  #define IOCTL_RC_ERR_BUSY_IRQ_UNSAFE _mbg_krn_errno_to_os( MBG_ERR_IRQ_UNSAFE )
312 
313  #define IOCTL_RC_ERR_DEV_ACCESS _mbg_krn_errno_to_os( rc )
314 
315 #endif
316 
317 #endif // defined( MBG_TGT_KERNEL )
318 
319 
320 
321 #if defined( MBG_TGT_LINUX )
322 
323  // a magic number used to generate IOCTL cmd codes
324  #define IOTYPE 'M'
325 
326  #define _MBG_IO _IO
327  #define _MBG_IOR _IOR
328  #define _MBG_IOW _IOW
329 
330  #define _cmd_from_ioctl_code( _ioc ) \
331  _IOC_NR( _ioc )
332 
333 #elif defined( MBG_TGT_BSD )
334 
335  // Under NetBSD 'Z' marks passthrough IOCTLs, under FreeBSD the code
336  // does not seem to matter, so we use 'Z' anyway.
337  #define IOTYPE 'Z'
338 
339  #define _MBG_IO _IO
340  #define _MBG_IOR _IOR
341  #define _MBG_IOW _IOW
342 
343 #elif defined( MBG_TGT_WIN32 )
344 
345  #if !defined( _MBG_SUPP_VAR_ACC_SIZE )
346  // Windows supports IOCTL commands where the sizes of
347  // input and output buffer can be specified dynamically.
348  #define _MBG_SUPP_VAR_ACC_SIZE 1
349  #endif
350 
351  // Device type in the "User Defined" range."
352  #define PCPS_TYPE 40000
353 
354  // IOCTL function codes from 0x800 to 0xFFF are for customer use.
355  #define _MBG_IOCTL_BIAS 0x930
356 
357  #define _MBG_IO( _t, _n ) \
358  CTL_CODE( PCPS_TYPE, _MBG_IOCTL_BIAS + _n, METHOD_BUFFERED, FILE_READ_ACCESS )
359 
360  #define _MBG_IOR( _t, _n, _sz ) \
361  _MBG_IO( _t, _n )
362 
363  #define _MBG_IOW _MBG_IOR
364 
365  #define _cmd_from_ioctl_code( _ioc ) \
366  ( ( ( (_ioc) >> 2 ) & 0x0FFF ) - _MBG_IOCTL_BIAS )
367 
368 #endif
369 
370 
371 #if !defined( _MBG_SUPP_VAR_ACC_SIZE )
372  // Many operating systems don't support specifying the sizes of IOCTL
373  // input and output buffers dynamically, so we disable this by default.
374  #define _MBG_SUPP_VAR_ACC_SIZE 0
375 #endif
376 
377 
378 
379 // The structure below is used by the IOCTL_PCPS_GENERIC_... calls.
380 
381 #if defined( MBG_TGT_LINUX )
382  #if defined( MBG_ARCH_ARM ) || defined( MBG_ARCH_SPARC )
383  #define USE_IOCTL_GENERIC_REQ 0
384  #endif
385 #endif
386 
387 #if defined( MBG_TGT_WIN32 )
388  // required for 32bit/64 bit compatibility
389  #define USE_IOCTL_GENERIC_REQ 0
390 #endif
391 
392 #if !defined( USE_IOCTL_GENERIC_REQ )
393  #define USE_IOCTL_GENERIC_REQ 1
394 #endif
395 
396 
397 #if USE_IOCTL_GENERIC_REQ
398 
417 typedef struct
418 {
421  uint32_t in_sz;
422  uint32_t out_sz;
423  uint32_t info;
424  uint32_t reserved;
425 
427 
428 #define _MBG_IOG( _t, _n, _s ) _MBG_IOW( _t, _n, _s )
429 
430 #else
431 
440 typedef struct
441 {
442  uint32_t info;
443  uint32_t data_size_in;
444  uint32_t data_size_out;
445 
446 } IOCTL_GENERIC_CTL;
447 
448 
457 typedef struct
458 {
459  IOCTL_GENERIC_CTL ctl;
460  uint8_t data[1];
461 
462 } IOCTL_GENERIC_BUFFER;
463 
464 #define _MBG_IOG( _t, _n, _s ) _MBG_IO( _t, _n )
465 
466 #endif
467 
468 
469 
473 typedef struct
474 {
475  uint32_t feat_type;
476  uint32_t feat_num;
477 
479 
480 
481 
482 typedef union
483 {
485 
487 
488  #if USE_IOCTL_GENERIC_REQ
490  #else
491  IOCTL_GENERIC_CTL ctl;
492  #endif
493 
494  int i;
495 
496 } IOCTL_BUFFER;
497 
498 
499 
509 // read general driver info, device info, and status port
510 #define IOCTL_GET_PCPS_DRVR_INFO _MBG_IOR( IOTYPE, 0x00, PCPS_DRVR_INFO )
511 #define IOCTL_GET_PCPS_DEV _MBG_IOR( IOTYPE, 0x01, PCPS_DEV )
512 #define IOCTL_GET_PCPS_STATUS_PORT _MBG_IOR( IOTYPE, 0x02, PCPS_STATUS_PORT )
513 
514 // Generic read/write operations. We define _MBG_IOW codes since these calls
515 // eventually pass a generic request structure IOCTL_GENERIC_REQ to the driver.
516 #define IOCTL_PCPS_GENERIC_READ _MBG_IOG( IOTYPE, 0x03, IOCTL_GENERIC_REQ )
517 #define IOCTL_PCPS_GENERIC_WRITE _MBG_IOG( IOTYPE, 0x04, IOCTL_GENERIC_REQ )
518 #define IOCTL_PCPS_GENERIC_READ_GPS _MBG_IOG( IOTYPE, 0x05, IOCTL_GENERIC_REQ )
519 #define IOCTL_PCPS_GENERIC_WRITE_GPS _MBG_IOG( IOTYPE, 0x06, IOCTL_GENERIC_REQ )
520 
521 // normal direct read/write operations
522 #define IOCTL_GET_PCPS_TIME _MBG_IOR( IOTYPE, 0x10, PCPS_TIME )
523 #define IOCTL_SET_PCPS_TIME _MBG_IOW( IOTYPE, 0x11, PCPS_STIME )
524 
525 #define IOCTL_GET_PCPS_SYNC_TIME _MBG_IOR( IOTYPE, 0x12, PCPS_TIME )
526 
527 #define IOCTL_GET_PCPS_TIME_SEC_CHANGE _MBG_IOR( IOTYPE, 0x13, PCPS_TIME )
528 
529 #define IOCTL_GET_PCPS_HR_TIME _MBG_IOR( IOTYPE, 0x14, PCPS_HR_TIME )
530 
531 // the next one is supported with custom GPS firmware only:
532 #define IOCTL_SET_PCPS_EVENT_TIME _MBG_IOW( IOTYPE, 0x15, PCPS_TIME_STAMP )
533 
534 #define IOCTL_GET_PCPS_SERIAL _MBG_IOR( IOTYPE, 0x16, PCPS_SERIAL )
535 #define IOCTL_SET_PCPS_SERIAL _MBG_IOW( IOTYPE, 0x17, PCPS_SERIAL )
536 
537 #define IOCTL_GET_PCPS_TZCODE _MBG_IOR( IOTYPE, 0x18, PCPS_TZCODE )
538 #define IOCTL_SET_PCPS_TZCODE _MBG_IOW( IOTYPE, 0x19, PCPS_TZCODE )
539 
540 #define IOCTL_GET_PCPS_TZDL _MBG_IOR( IOTYPE, 0x1A, PCPS_TZDL )
541 #define IOCTL_SET_PCPS_TZDL _MBG_IOW( IOTYPE, 0x1B, PCPS_TZDL )
542 
543 #define IOCTL_GET_REF_OFFS _MBG_IOR( IOTYPE, 0x1C, MBG_REF_OFFS )
544 #define IOCTL_SET_REF_OFFS _MBG_IOW( IOTYPE, 0x1D, MBG_REF_OFFS )
545 
546 #define IOCTL_GET_MBG_OPT_INFO _MBG_IOR( IOTYPE, 0x1E, MBG_OPT_INFO )
547 #define IOCTL_SET_MBG_OPT_SETTINGS _MBG_IOW( IOTYPE, 0x1F, MBG_OPT_SETTINGS )
548 
549 #define IOCTL_GET_PCPS_IRIG_RX_INFO _MBG_IOR( IOTYPE, 0x20, IRIG_INFO )
550 #define IOCTL_SET_PCPS_IRIG_RX_SETTINGS _MBG_IOW( IOTYPE, 0x21, IRIG_SETTINGS )
551 
552 #define IOCTL_PCPS_CLR_UCAP_BUFF _MBG_IO( IOTYPE, 0x22 )
553 #define IOCTL_GET_PCPS_UCAP_ENTRIES _MBG_IOR( IOTYPE, 0x23, PCPS_UCAP_ENTRIES )
554 #define IOCTL_GET_PCPS_UCAP_EVENT _MBG_IOR( IOTYPE, 0x24, PCPS_HR_TIME )
555 
556 
557 #define IOCTL_GET_GPS_TZDL _MBG_IOR( IOTYPE, 0x25, TZDL )
558 #define IOCTL_SET_GPS_TZDL _MBG_IOW( IOTYPE, 0x26, TZDL )
559 
560 #define IOCTL_GET_GPS_SW_REV _MBG_IOR( IOTYPE, 0x27, SW_REV )
561 
562 #define IOCTL_GET_GPS_BVAR_STAT _MBG_IOR( IOTYPE, 0x28, BVAR_STAT )
563 
564 #define IOCTL_GET_GPS_TIME _MBG_IOR( IOTYPE, 0x29, TTM )
565 #define IOCTL_SET_GPS_TIME _MBG_IOW( IOTYPE, 0x2A, TTM )
566 
567 #define IOCTL_GET_GPS_PORT_PARM _MBG_IOR( IOTYPE, 0x2B, PORT_PARM )
568 #define IOCTL_SET_GPS_PORT_PARM _MBG_IOW( IOTYPE, 0x2C, PORT_PARM )
569 
570 #define IOCTL_GET_GPS_ANT_INFO _MBG_IOR( IOTYPE, 0x2D, ANT_INFO )
571 
572 #define IOCTL_GET_GPS_UCAP _MBG_IOR( IOTYPE, 0x2E, TTM )
573 
574 #define IOCTL_GET_GPS_ENABLE_FLAGS _MBG_IOR( IOTYPE, 0x2F, ENABLE_FLAGS )
575 #define IOCTL_SET_GPS_ENABLE_FLAGS _MBG_IOW( IOTYPE, 0x30, ENABLE_FLAGS )
576 
577 #define IOCTL_GET_GPS_STAT_INFO _MBG_IOR( IOTYPE, 0x31, STAT_INFO )
578 
579 #define IOCTL_SET_GPS_CMD _MBG_IOW( IOTYPE, 0x32, GPS_CMD )
580 
581 #define IOCTL_GET_GPS_IDENT _MBG_IOR( IOTYPE, 0x33, IDENT )
582 
583 #define IOCTL_GET_GPS_POS _MBG_IOR( IOTYPE, 0x34, POS )
584 #define IOCTL_SET_GPS_POS_XYZ _MBG_IOW( IOTYPE, 0x35, XYZ )
585 #define IOCTL_SET_GPS_POS_LLA _MBG_IOW( IOTYPE, 0x36, LLA )
586 
587 #define IOCTL_GET_GPS_ANT_CABLE_LEN _MBG_IOR( IOTYPE, 0x37, ANT_CABLE_LEN )
588 #define IOCTL_SET_GPS_ANT_CABLE_LEN _MBG_IOW( IOTYPE, 0x38, ANT_CABLE_LEN )
589 
590 #define IOCTL_GET_GPS_RECEIVER_INFO _MBG_IOR( IOTYPE, 0x39, RECEIVER_INFO )
591 #define IOCTL_GET_GPS_ALL_STR_TYPE_INFO _MBG_IOG( IOTYPE, 0x3A, IOCTL_GENERIC_REQ ) // variable size
592 #define IOCTL_GET_GPS_ALL_PORT_INFO _MBG_IOG( IOTYPE, 0x3B, IOCTL_GENERIC_REQ ) // variable size
593 
594 #define IOCTL_SET_GPS_PORT_SETTINGS_IDX _MBG_IOW( IOTYPE, 0x3C, PORT_SETTINGS_IDX )
595 
596 #define IOCTL_GET_PCI_ASIC_VERSION _MBG_IOR( IOTYPE, 0x3D, PCI_ASIC_VERSION )
597 
598 #define IOCTL_GET_PCPS_TIME_CYCLES _MBG_IOR( IOTYPE, 0x3E, PCPS_TIME_CYCLES )
599 #define IOCTL_GET_PCPS_HR_TIME_CYCLES _MBG_IOR( IOTYPE, 0x3F, PCPS_HR_TIME_CYCLES )
600 
601 #define IOCTL_GET_PCPS_IRIG_TX_INFO _MBG_IOR( IOTYPE, 0x40, IRIG_INFO )
602 #define IOCTL_SET_PCPS_IRIG_TX_SETTINGS _MBG_IOW( IOTYPE, 0x41, IRIG_SETTINGS )
603 
604 #define IOCTL_GET_SYNTH _MBG_IOR( IOTYPE, 0x42, SYNTH )
605 #define IOCTL_SET_SYNTH _MBG_IOW( IOTYPE, 0x43, SYNTH )
606 
607 
608 #define IOCTL_DEV_IS_GPS _MBG_IOR( IOTYPE, 0x44, int )
609 #define IOCTL_DEV_IS_DCF _MBG_IOR( IOTYPE, 0x45, int )
610 #define IOCTL_DEV_IS_IRIG_RX _MBG_IOR( IOTYPE, 0x46, int )
611 
612 #define IOCTL_DEV_HAS_HR_TIME _MBG_IOR( IOTYPE, 0x47, int )
613 #define IOCTL_DEV_HAS_CAB_LEN _MBG_IOR( IOTYPE, 0x48, int )
614 #define IOCTL_DEV_HAS_TZDL _MBG_IOR( IOTYPE, 0x49, int )
615 #define IOCTL_DEV_HAS_PCPS_TZDL _MBG_IOR( IOTYPE, 0x4A, int )
616 #define IOCTL_DEV_HAS_TZCODE _MBG_IOR( IOTYPE, 0x4B, int )
617 #define IOCTL_DEV_HAS_TZ _MBG_IOR( IOTYPE, 0x4C, int )
618 #define IOCTL_DEV_HAS_EVENT_TIME _MBG_IOR( IOTYPE, 0x4D, int )
619 #define IOCTL_DEV_HAS_RECEIVER_INFO _MBG_IOR( IOTYPE, 0x4E, int )
620 #define IOCTL_DEV_CAN_CLR_UCAP_BUFF _MBG_IOR( IOTYPE, 0x4F, int )
621 #define IOCTL_DEV_HAS_UCAP _MBG_IOR( IOTYPE, 0x50, int )
622 #define IOCTL_DEV_HAS_IRIG_TX _MBG_IOR( IOTYPE, 0x51, int )
623 #define IOCTL_DEV_HAS_SERIAL_HS _MBG_IOR( IOTYPE, 0x52, int )
624 #define IOCTL_DEV_HAS_SIGNAL _MBG_IOR( IOTYPE, 0x53, int )
625 #define IOCTL_DEV_HAS_MOD _MBG_IOR( IOTYPE, 0x54, int )
626 #define IOCTL_DEV_HAS_IRIG _MBG_IOR( IOTYPE, 0x55, int )
627 #define IOCTL_DEV_HAS_REF_OFFS _MBG_IOR( IOTYPE, 0x56, int )
628 #define IOCTL_DEV_HAS_OPT_FLAGS _MBG_IOR( IOTYPE, 0x57, int )
629 #define IOCTL_DEV_HAS_GPS_DATA _MBG_IOR( IOTYPE, 0x58, int )
630 #define IOCTL_DEV_HAS_SYNTH _MBG_IOR( IOTYPE, 0x59, int )
631 #define IOCTL_DEV_HAS_GENERIC_IO _MBG_IOR( IOTYPE, 0x5A, int )
632 
633 #define IOCTL_PCPS_GENERIC_IO _MBG_IOG( IOTYPE, 0x5B, IOCTL_GENERIC_REQ )
634 
635 #define IOCTL_GET_SYNTH_STATE _MBG_IOR( IOTYPE, 0x5C, SYNTH_STATE )
636 
637 #define IOCTL_GET_GPS_ALL_POUT_INFO _MBG_IOG( IOTYPE, 0x5D, IOCTL_GENERIC_REQ ) // variable size
638 #define IOCTL_SET_GPS_POUT_SETTINGS_IDX _MBG_IOW( IOTYPE, 0x5E, POUT_SETTINGS_IDX )
639 
640 #define IOCTL_GET_MAPPED_MEM_ADDR _MBG_IOR( IOTYPE, 0x5F, PCPS_MAPPED_MEM )
641 #define IOCTL_UNMAP_MAPPED_MEM _MBG_IOR( IOTYPE, 0x60, PCPS_MAPPED_MEM )
642 
643 #define IOCTL_GET_PCI_ASIC_FEATURES _MBG_IOR( IOTYPE, 0x61, PCI_ASIC_FEATURES )
644 
645 #define IOCTL_DEV_HAS_PCI_ASIC_FEATURES _MBG_IOR( IOTYPE, 0x62, int )
646 #define IOCTL_DEV_HAS_PCI_ASIC_VERSION _MBG_IOR( IOTYPE, 0x63, int )
647 
648 #define IOCTL_DEV_IS_MSF _MBG_IOR( IOTYPE, 0x64, int )
649 #define IOCTL_DEV_IS_LWR _MBG_IOR( IOTYPE, 0x65, int )
650 #define IOCTL_DEV_IS_WWVB _MBG_IOR( IOTYPE, 0x66, int )
651 
652 #define IOCTL_GET_IRQ_STAT_INFO _MBG_IOR( IOTYPE, 0x67, PCPS_IRQ_STAT_INFO )
653 #define IOCTL_GET_CYCLES_FREQUENCY _MBG_IOR( IOTYPE, 0x68, MBG_PC_CYCLES_FREQUENCY )
654 
655 #define IOCTL_DEV_HAS_FAST_HR_TIMESTAMP _MBG_IOR( IOTYPE, 0x69, int )
656 #define IOCTL_GET_FAST_HR_TIMESTAMP_CYCLES _MBG_IOR( IOTYPE, 0x6A, PCPS_TIME_STAMP_CYCLES )
657 #define IOCTL_GET_FAST_HR_TIMESTAMP _MBG_IOR( IOTYPE, 0x6B, PCPS_TIME_STAMP )
658 
659 #define IOCTL_DEV_HAS_GPS_TIME_SCALE _MBG_IOR( IOTYPE, 0x6C, int )
660 #define IOCTL_GET_GPS_TIME_SCALE_INFO _MBG_IOR( IOTYPE, 0x6D, MBG_TIME_SCALE_INFO )
661 #define IOCTL_SET_GPS_TIME_SCALE_SETTINGS _MBG_IOW( IOTYPE, 0x6E, MBG_TIME_SCALE_SETTINGS )
662 
663 #define IOCTL_DEV_HAS_GPS_UTC_PARM _MBG_IOR( IOTYPE, 0x6F, int )
664 #define IOCTL_GET_GPS_UTC_PARM _MBG_IOR( IOTYPE, 0x70, UTC )
665 #define IOCTL_SET_GPS_UTC_PARM _MBG_IOW( IOTYPE, 0x71, UTC )
666 
667 #define IOCTL_DEV_HAS_IRIG_CTRL_BITS _MBG_IOR( IOTYPE, 0x72, int )
668 #define IOCTL_GET_IRIG_CTRL_BITS _MBG_IOR( IOTYPE, 0x73, MBG_IRIG_CTRL_BITS )
669 
670 #define IOCTL_DEV_HAS_LAN_INTF _MBG_IOR( IOTYPE, 0x74, int )
671 #define IOCTL_GET_LAN_IF_INFO _MBG_IOR( IOTYPE, 0x75, LAN_IF_INFO )
672 #define IOCTL_GET_IP4_STATE _MBG_IOR( IOTYPE, 0x76, IP4_SETTINGS )
673 #define IOCTL_GET_IP4_SETTINGS _MBG_IOR( IOTYPE, 0x77, IP4_SETTINGS )
674 #define IOCTL_SET_IP4_SETTINGS _MBG_IOW( IOTYPE, 0x78, IP4_SETTINGS )
675 
676 #define IOCTL_DEV_IS_PTP _MBG_IOR( IOTYPE, 0x79, int )
677 #define IOCTL_DEV_HAS_PTP _MBG_IOR( IOTYPE, 0x7A, int )
678 #define IOCTL_GET_PTP_STATE _MBG_IOR( IOTYPE, 0x7B, PTP_STATE )
679 #define IOCTL_GET_PTP_CFG_INFO _MBG_IOR( IOTYPE, 0x7C, PTP_CFG_INFO )
680 #define IOCTL_SET_PTP_CFG_SETTINGS _MBG_IOW( IOTYPE, 0x7D, PTP_CFG_SETTINGS )
681 
682 #define IOCTL_DEV_HAS_IRIG_TIME _MBG_IOR( IOTYPE, 0x7E, int )
683 #define IOCTL_GET_IRIG_TIME _MBG_IOR( IOTYPE, 0x7F, PCPS_IRIG_TIME )
684 
685 #define IOCTL_GET_TIME_INFO_HRT _MBG_IOR( IOTYPE, 0x80, MBG_TIME_INFO_HRT )
686 #define IOCTL_GET_TIME_INFO_TSTAMP _MBG_IOR( IOTYPE, 0x81, MBG_TIME_INFO_TSTAMP )
687 
688 #define IOCTL_DEV_HAS_RAW_IRIG_DATA _MBG_IOR( IOTYPE, 0x82, int )
689 #define IOCTL_GET_RAW_IRIG_DATA _MBG_IOR( IOTYPE, 0x83, MBG_RAW_IRIG_DATA )
690 
691 #define IOCTL_DEV_HAS_PTP_UNICAST _MBG_IOR( IOTYPE, 0x84, int )
692 #define IOCTL_PTP_UC_MASTER_CFG_LIMITS _MBG_IOR( IOTYPE, 0x85, PTP_UC_MASTER_CFG_LIMITS )
693 #define IOCTL_GET_ALL_PTP_UC_MASTER_INFO _MBG_IOG( IOTYPE, 0x86, IOCTL_GENERIC_REQ ) // variable size
694 #define IOCTL_SET_PTP_UC_MASTER_SETTINGS_IDX _MBG_IOW( IOTYPE, 0x87, PTP_UC_MASTER_SETTINGS_IDX )
695 
696 #define IOCTL_DEV_HAS_PZF _MBG_IOR( IOTYPE, 0x88, int )
697 #define IOCTL_DEV_HAS_CORR_INFO _MBG_IOR( IOTYPE, 0x89, int )
698 #define IOCTL_DEV_HAS_TR_DISTANCE _MBG_IOR( IOTYPE, 0x8A, int )
699 #define IOCTL_GET_CORR_INFO _MBG_IOR( IOTYPE, 0x8B, CORR_INFO )
700 #define IOCTL_GET_TR_DISTANCE _MBG_IOR( IOTYPE, 0x8C, TR_DISTANCE )
701 #define IOCTL_SET_TR_DISTANCE _MBG_IOW( IOTYPE, 0x8D, TR_DISTANCE )
702 
703 #define IOCTL_DEV_HAS_DEBUG_STATUS _MBG_IOR( IOTYPE, 0x8E, int )
704 #define IOCTL_GET_DEBUG_STATUS _MBG_IOR( IOTYPE, 0x8F, MBG_DEBUG_STATUS )
705 
706 #define IOCTL_DEV_HAS_EVT_LOG _MBG_IOR( IOTYPE, 0x90, int )
707 #define IOCTL_CLR_EVT_LOG _MBG_IO( IOTYPE, 0x91 )
708 #define IOCTL_GET_NUM_EVT_LOG_ENTRIES _MBG_IOR( IOTYPE, 0x92, MBG_NUM_EVT_LOG_ENTRIES )
709 #define IOCTL_GET_FIRST_EVT_LOG_ENTRY _MBG_IOR( IOTYPE, 0x93, MBG_EVT_LOG_ENTRY )
710 #define IOCTL_GET_NEXT_EVT_LOG_ENTRY _MBG_IOR( IOTYPE, 0x94, MBG_EVT_LOG_ENTRY )
711 
712 #define IOCTL_DEV_IS_GNSS _MBG_IOR( IOTYPE, 0x95, int )
713 #define IOCTL_GET_GNSS_MODE_INFO _MBG_IOR( IOTYPE, 0x96, MBG_GNSS_MODE_INFO )
714 #define IOCTL_SET_GNSS_MODE_SETTINGS _MBG_IOW( IOTYPE, 0x97, MBG_GNSS_MODE_SETTINGS )
715 #define IOCTL_GET_ALL_GNSS_SAT_INFO _MBG_IOG( IOTYPE, 0x98, IOCTL_GENERIC_REQ ) // variable size
716 
717 #define IOCTL_DEV_HAS_GPIO _MBG_IOR( IOTYPE, 0x99, int )
718 #define IOCTL_GET_GPIO_CFG_LIMITS _MBG_IOR( IOTYPE, 0x9A, MBG_GPIO_CFG_LIMITS )
719 #define IOCTL_GET_ALL_GPIO_INFO _MBG_IOG( IOTYPE, 0x9B, IOCTL_GENERIC_REQ ) // variable size
720 #define IOCTL_SET_GPIO_SETTINGS_IDX _MBG_IOW( IOTYPE, 0x9C, MBG_GPIO_SETTINGS_IDX )
721 
722 #define IOCTL_DEV_HAS_XMR _MBG_IOR( IOTYPE, 0x9D, int )
723 #define IOCTL_GET_XMR_INSTANCES _MBG_IOR( IOTYPE, 0x9E, XMULTI_REF_INSTANCES )
724 #define IOCTL_GET_ALL_XMR_INFO _MBG_IOG( IOTYPE, 0x9F, IOCTL_GENERIC_REQ ) // variable size
725 #define IOCTL_SET_XMR_SETTINGS_IDX _MBG_IOW( IOTYPE, 0xA0, XMULTI_REF_SETTINGS_IDX )
726 #define IOCTL_GET_ALL_XMR_STATUS _MBG_IOG( IOTYPE, 0xA1, IOCTL_GENERIC_REQ ) // variable size
727 #define IOCTL_GET_XMR_HOLDOVER_STATUS _MBG_IOR( IOTYPE, 0xA2, XMR_HOLDOVER_STATUS )
728 
729 #define IOCTL_GET_ALL_GPIO_STATUS _MBG_IOG( IOTYPE, 0xA3, IOCTL_GENERIC_REQ ) // variable size
730 #define IOCTL_CHK_DEV_FEAT _MBG_IOW( IOTYPE, 0xA4, IOCTL_DEV_FEAT_REQ )
731 
732 // The codes below are subject to changes without notice. They may be supported
733 // by some kernel drivers, but usage is restricted to Meinberg software development.
734 // Unrestricted usage may cause system malfunction !!
735 #define IOCTL_MBG_DBG_GET_PORT_ADDR _MBG_IOR( IOTYPE, 0xF0, uint16_t )
736 #define IOCTL_MBG_DBG_SET_PORT_ADDR _MBG_IOW( IOTYPE, 0xF1, uint16_t )
737 #define IOCTL_MBG_DBG_SET_BIT _MBG_IOW( IOTYPE, 0xF2, uint8_t )
738 #define IOCTL_MBG_DBG_CLR_BIT _MBG_IOW( IOTYPE, 0xF3, uint8_t )
739 #define IOCTL_MBG_DBG_CLR_ALL _MBG_IO( IOTYPE, 0xF4 )
740 
753 #define IOCTL_CODES_TABLE \
754 { \
755  _mbg_cn_table_entry( IOCTL_GET_PCPS_DRVR_INFO ), \
756  _mbg_cn_table_entry( IOCTL_GET_PCPS_DEV ), \
757  _mbg_cn_table_entry( IOCTL_GET_PCPS_STATUS_PORT ), \
758  _mbg_cn_table_entry( IOCTL_PCPS_GENERIC_READ ), \
759  _mbg_cn_table_entry( IOCTL_PCPS_GENERIC_WRITE ), \
760  _mbg_cn_table_entry( IOCTL_PCPS_GENERIC_READ_GPS ), \
761  _mbg_cn_table_entry( IOCTL_PCPS_GENERIC_WRITE_GPS ), \
762  _mbg_cn_table_entry( IOCTL_GET_PCPS_TIME ), \
763  _mbg_cn_table_entry( IOCTL_SET_PCPS_TIME ), \
764  _mbg_cn_table_entry( IOCTL_GET_PCPS_SYNC_TIME ), \
765  _mbg_cn_table_entry( IOCTL_GET_PCPS_TIME_SEC_CHANGE ), \
766  _mbg_cn_table_entry( IOCTL_GET_PCPS_HR_TIME ), \
767  _mbg_cn_table_entry( IOCTL_SET_PCPS_EVENT_TIME ), \
768  _mbg_cn_table_entry( IOCTL_GET_PCPS_SERIAL ), \
769  _mbg_cn_table_entry( IOCTL_SET_PCPS_SERIAL ), \
770  _mbg_cn_table_entry( IOCTL_GET_PCPS_TZCODE ), \
771  _mbg_cn_table_entry( IOCTL_SET_PCPS_TZCODE ), \
772  _mbg_cn_table_entry( IOCTL_GET_PCPS_TZDL ), \
773  _mbg_cn_table_entry( IOCTL_SET_PCPS_TZDL ), \
774  _mbg_cn_table_entry( IOCTL_GET_REF_OFFS ), \
775  _mbg_cn_table_entry( IOCTL_SET_REF_OFFS ), \
776  _mbg_cn_table_entry( IOCTL_GET_MBG_OPT_INFO ), \
777  _mbg_cn_table_entry( IOCTL_SET_MBG_OPT_SETTINGS ), \
778  _mbg_cn_table_entry( IOCTL_GET_PCPS_IRIG_RX_INFO ), \
779  _mbg_cn_table_entry( IOCTL_SET_PCPS_IRIG_RX_SETTINGS ), \
780  _mbg_cn_table_entry( IOCTL_PCPS_CLR_UCAP_BUFF ), \
781  _mbg_cn_table_entry( IOCTL_GET_PCPS_UCAP_ENTRIES ), \
782  _mbg_cn_table_entry( IOCTL_GET_PCPS_UCAP_EVENT ), \
783  _mbg_cn_table_entry( IOCTL_GET_GPS_TZDL ), \
784  _mbg_cn_table_entry( IOCTL_SET_GPS_TZDL ), \
785  _mbg_cn_table_entry( IOCTL_GET_GPS_SW_REV ), \
786  _mbg_cn_table_entry( IOCTL_GET_GPS_BVAR_STAT ), \
787  _mbg_cn_table_entry( IOCTL_GET_GPS_TIME ), \
788  _mbg_cn_table_entry( IOCTL_SET_GPS_TIME ), \
789  _mbg_cn_table_entry( IOCTL_GET_GPS_PORT_PARM ), \
790  _mbg_cn_table_entry( IOCTL_SET_GPS_PORT_PARM ), \
791  _mbg_cn_table_entry( IOCTL_GET_GPS_ANT_INFO ), \
792  _mbg_cn_table_entry( IOCTL_GET_GPS_UCAP ), \
793  _mbg_cn_table_entry( IOCTL_GET_GPS_ENABLE_FLAGS ), \
794  _mbg_cn_table_entry( IOCTL_SET_GPS_ENABLE_FLAGS ), \
795  _mbg_cn_table_entry( IOCTL_GET_GPS_STAT_INFO ), \
796  _mbg_cn_table_entry( IOCTL_SET_GPS_CMD ), \
797  _mbg_cn_table_entry( IOCTL_GET_GPS_IDENT ), \
798  _mbg_cn_table_entry( IOCTL_GET_GPS_POS ), \
799  _mbg_cn_table_entry( IOCTL_SET_GPS_POS_XYZ ), \
800  _mbg_cn_table_entry( IOCTL_SET_GPS_POS_LLA ), \
801  _mbg_cn_table_entry( IOCTL_GET_GPS_ANT_CABLE_LEN ), \
802  _mbg_cn_table_entry( IOCTL_SET_GPS_ANT_CABLE_LEN ), \
803  _mbg_cn_table_entry( IOCTL_GET_GPS_RECEIVER_INFO ), \
804  _mbg_cn_table_entry( IOCTL_GET_GPS_ALL_STR_TYPE_INFO ), \
805  _mbg_cn_table_entry( IOCTL_GET_GPS_ALL_PORT_INFO ), \
806  _mbg_cn_table_entry( IOCTL_SET_GPS_PORT_SETTINGS_IDX ), \
807  _mbg_cn_table_entry( IOCTL_GET_PCI_ASIC_VERSION ), \
808  _mbg_cn_table_entry( IOCTL_GET_PCPS_TIME_CYCLES ), \
809  _mbg_cn_table_entry( IOCTL_GET_PCPS_HR_TIME_CYCLES ), \
810  _mbg_cn_table_entry( IOCTL_GET_PCPS_IRIG_TX_INFO ), \
811  _mbg_cn_table_entry( IOCTL_SET_PCPS_IRIG_TX_SETTINGS ), \
812  _mbg_cn_table_entry( IOCTL_GET_SYNTH ), \
813  _mbg_cn_table_entry( IOCTL_SET_SYNTH ), \
814  _mbg_cn_table_entry( IOCTL_DEV_IS_GPS ), \
815  _mbg_cn_table_entry( IOCTL_DEV_IS_DCF ), \
816  _mbg_cn_table_entry( IOCTL_DEV_IS_IRIG_RX ), \
817  _mbg_cn_table_entry( IOCTL_DEV_HAS_HR_TIME ), \
818  _mbg_cn_table_entry( IOCTL_DEV_HAS_CAB_LEN ), \
819  _mbg_cn_table_entry( IOCTL_DEV_HAS_TZDL ), \
820  _mbg_cn_table_entry( IOCTL_DEV_HAS_PCPS_TZDL ), \
821  _mbg_cn_table_entry( IOCTL_DEV_HAS_TZCODE ), \
822  _mbg_cn_table_entry( IOCTL_DEV_HAS_TZ ), \
823  _mbg_cn_table_entry( IOCTL_DEV_HAS_EVENT_TIME ), \
824  _mbg_cn_table_entry( IOCTL_DEV_HAS_RECEIVER_INFO ), \
825  _mbg_cn_table_entry( IOCTL_DEV_CAN_CLR_UCAP_BUFF ), \
826  _mbg_cn_table_entry( IOCTL_DEV_HAS_UCAP ), \
827  _mbg_cn_table_entry( IOCTL_DEV_HAS_IRIG_TX ), \
828  _mbg_cn_table_entry( IOCTL_DEV_HAS_SERIAL_HS ), \
829  _mbg_cn_table_entry( IOCTL_DEV_HAS_SIGNAL ), \
830  _mbg_cn_table_entry( IOCTL_DEV_HAS_MOD ), \
831  _mbg_cn_table_entry( IOCTL_DEV_HAS_IRIG ), \
832  _mbg_cn_table_entry( IOCTL_DEV_HAS_REF_OFFS ), \
833  _mbg_cn_table_entry( IOCTL_DEV_HAS_OPT_FLAGS ), \
834  _mbg_cn_table_entry( IOCTL_DEV_HAS_GPS_DATA ), \
835  _mbg_cn_table_entry( IOCTL_DEV_HAS_SYNTH ), \
836  _mbg_cn_table_entry( IOCTL_DEV_HAS_GENERIC_IO ), \
837  _mbg_cn_table_entry( IOCTL_PCPS_GENERIC_IO ), \
838  _mbg_cn_table_entry( IOCTL_GET_SYNTH_STATE ), \
839  _mbg_cn_table_entry( IOCTL_GET_GPS_ALL_POUT_INFO ), \
840  _mbg_cn_table_entry( IOCTL_SET_GPS_POUT_SETTINGS_IDX ), \
841  _mbg_cn_table_entry( IOCTL_GET_MAPPED_MEM_ADDR ), \
842  _mbg_cn_table_entry( IOCTL_UNMAP_MAPPED_MEM ), \
843  _mbg_cn_table_entry( IOCTL_GET_PCI_ASIC_FEATURES ), \
844  _mbg_cn_table_entry( IOCTL_DEV_HAS_PCI_ASIC_FEATURES ), \
845  _mbg_cn_table_entry( IOCTL_DEV_HAS_PCI_ASIC_VERSION ), \
846  _mbg_cn_table_entry( IOCTL_DEV_IS_MSF ), \
847  _mbg_cn_table_entry( IOCTL_DEV_IS_LWR ), \
848  _mbg_cn_table_entry( IOCTL_DEV_IS_WWVB ), \
849  _mbg_cn_table_entry( IOCTL_GET_IRQ_STAT_INFO ), \
850  _mbg_cn_table_entry( IOCTL_GET_CYCLES_FREQUENCY ), \
851  _mbg_cn_table_entry( IOCTL_DEV_HAS_FAST_HR_TIMESTAMP ), \
852  _mbg_cn_table_entry( IOCTL_GET_FAST_HR_TIMESTAMP_CYCLES ), \
853  _mbg_cn_table_entry( IOCTL_GET_FAST_HR_TIMESTAMP ), \
854  _mbg_cn_table_entry( IOCTL_DEV_HAS_GPS_TIME_SCALE ), \
855  _mbg_cn_table_entry( IOCTL_GET_GPS_TIME_SCALE_INFO ), \
856  _mbg_cn_table_entry( IOCTL_SET_GPS_TIME_SCALE_SETTINGS ), \
857  _mbg_cn_table_entry( IOCTL_DEV_HAS_GPS_UTC_PARM ), \
858  _mbg_cn_table_entry( IOCTL_GET_GPS_UTC_PARM ), \
859  _mbg_cn_table_entry( IOCTL_SET_GPS_UTC_PARM ), \
860  _mbg_cn_table_entry( IOCTL_DEV_HAS_IRIG_CTRL_BITS ), \
861  _mbg_cn_table_entry( IOCTL_GET_IRIG_CTRL_BITS ), \
862  _mbg_cn_table_entry( IOCTL_DEV_HAS_LAN_INTF ), \
863  _mbg_cn_table_entry( IOCTL_GET_LAN_IF_INFO ), \
864  _mbg_cn_table_entry( IOCTL_GET_IP4_STATE ), \
865  _mbg_cn_table_entry( IOCTL_GET_IP4_SETTINGS ), \
866  _mbg_cn_table_entry( IOCTL_SET_IP4_SETTINGS ), \
867  _mbg_cn_table_entry( IOCTL_DEV_IS_PTP ), \
868  _mbg_cn_table_entry( IOCTL_DEV_HAS_PTP ), \
869  _mbg_cn_table_entry( IOCTL_GET_PTP_STATE ), \
870  _mbg_cn_table_entry( IOCTL_GET_PTP_CFG_INFO ), \
871  _mbg_cn_table_entry( IOCTL_SET_PTP_CFG_SETTINGS ), \
872  _mbg_cn_table_entry( IOCTL_DEV_HAS_IRIG_TIME ), \
873  _mbg_cn_table_entry( IOCTL_GET_IRIG_TIME ), \
874  _mbg_cn_table_entry( IOCTL_GET_TIME_INFO_HRT ), \
875  _mbg_cn_table_entry( IOCTL_GET_TIME_INFO_TSTAMP ), \
876  _mbg_cn_table_entry( IOCTL_DEV_HAS_RAW_IRIG_DATA ), \
877  _mbg_cn_table_entry( IOCTL_GET_RAW_IRIG_DATA ), \
878  _mbg_cn_table_entry( IOCTL_DEV_HAS_PTP_UNICAST ), \
879  _mbg_cn_table_entry( IOCTL_PTP_UC_MASTER_CFG_LIMITS ), \
880  _mbg_cn_table_entry( IOCTL_GET_ALL_PTP_UC_MASTER_INFO ), \
881  _mbg_cn_table_entry( IOCTL_SET_PTP_UC_MASTER_SETTINGS_IDX ), \
882  _mbg_cn_table_entry( IOCTL_DEV_HAS_PZF ), \
883  _mbg_cn_table_entry( IOCTL_DEV_HAS_CORR_INFO ), \
884  _mbg_cn_table_entry( IOCTL_DEV_HAS_TR_DISTANCE ), \
885  _mbg_cn_table_entry( IOCTL_GET_CORR_INFO ), \
886  _mbg_cn_table_entry( IOCTL_GET_TR_DISTANCE ), \
887  _mbg_cn_table_entry( IOCTL_SET_TR_DISTANCE ), \
888  _mbg_cn_table_entry( IOCTL_DEV_HAS_DEBUG_STATUS ), \
889  _mbg_cn_table_entry( IOCTL_GET_DEBUG_STATUS ), \
890  _mbg_cn_table_entry( IOCTL_DEV_HAS_EVT_LOG ), \
891  _mbg_cn_table_entry( IOCTL_CLR_EVT_LOG ), \
892  _mbg_cn_table_entry( IOCTL_GET_NUM_EVT_LOG_ENTRIES ), \
893  _mbg_cn_table_entry( IOCTL_GET_FIRST_EVT_LOG_ENTRY ), \
894  _mbg_cn_table_entry( IOCTL_GET_NEXT_EVT_LOG_ENTRY ), \
895  _mbg_cn_table_entry( IOCTL_DEV_IS_GNSS ), \
896  _mbg_cn_table_entry( IOCTL_GET_GNSS_MODE_INFO ), \
897  _mbg_cn_table_entry( IOCTL_SET_GNSS_MODE_SETTINGS ), \
898  _mbg_cn_table_entry( IOCTL_GET_ALL_GNSS_SAT_INFO ), \
899  _mbg_cn_table_entry( IOCTL_DEV_HAS_GPIO ), \
900  _mbg_cn_table_entry( IOCTL_GET_GPIO_CFG_LIMITS ), \
901  _mbg_cn_table_entry( IOCTL_GET_ALL_GPIO_INFO ), \
902  _mbg_cn_table_entry( IOCTL_SET_GPIO_SETTINGS_IDX ), \
903  _mbg_cn_table_entry( IOCTL_DEV_HAS_XMR ), \
904  _mbg_cn_table_entry( IOCTL_GET_XMR_INSTANCES ), \
905  _mbg_cn_table_entry( IOCTL_GET_ALL_XMR_INFO ), \
906  _mbg_cn_table_entry( IOCTL_SET_XMR_SETTINGS_IDX ), \
907  _mbg_cn_table_entry( IOCTL_GET_ALL_XMR_STATUS ), \
908  _mbg_cn_table_entry( IOCTL_GET_XMR_HOLDOVER_STATUS ), \
909  _mbg_cn_table_entry( IOCTL_GET_ALL_GPIO_STATUS ), \
910  _mbg_cn_table_entry( IOCTL_CHK_DEV_FEAT ), \
911  \
912  _mbg_cn_table_entry( IOCTL_MBG_DBG_GET_PORT_ADDR ), \
913  _mbg_cn_table_entry( IOCTL_MBG_DBG_SET_PORT_ADDR ), \
914  _mbg_cn_table_entry( IOCTL_MBG_DBG_SET_BIT ), \
915  _mbg_cn_table_entry( IOCTL_MBG_DBG_CLR_BIT ), \
916  _mbg_cn_table_entry( IOCTL_MBG_DBG_CLR_ALL ), \
917  \
918  _mbg_cn_table_end() \
919 }
920 
921 
922 #if !defined( _cmd_from_ioctl_code )
923  #define _cmd_from_ioctl_code( _ioctl_code ) _ioctl_code
924 #endif
925 
926 
927 
948 {
949  MBG_REQ_PRIVL_NONE, //< e.g. read date/time/sync status
950  MBG_REQ_PRIVL_EXT_STATUS, //< e.g. read receiver position
951  MBG_REQ_PRIVL_CFG_READ, //< read device config data
952  MBG_REQ_PRIVL_CFG_WRITE, //< write config data to the device
953  MBG_REQ_PRIVL_SYSTEM, //< operations which may affect system operation
954  N_MBG_REQ_PRIVL //< the number of supported privilege levels
955 };
956 
957 
958 #if defined( __GNUC__ )
959 // Avoid "no previous prototype" with some gcc versions.
960 static __mbg_inline
961 int ioctl_get_required_privilege( ulong ioctl_code ) __attribute__((always_inline));
962 #endif
963 
972 static __mbg_inline
974 {
975  // To provide best maintainability the sequence of cases in ioctl_switch()
976  // should match the sequence of the cases here, which also makes sure
977  // commands requiring lowest latency are handled first.
978 
979  switch ( ioctl_code )
980  {
981  // Commands requiring lowest latency:
987  // Other low latency commands:
988  case IOCTL_GET_PCPS_TIME:
992  case IOCTL_GET_GPS_TIME:
993  case IOCTL_GET_GPS_UCAP:
996  return MBG_REQ_PRIVL_NONE;
997 
998  // Commands returning public status information:
1000  case IOCTL_GET_PCPS_DEV:
1002  case IOCTL_GET_GPS_SW_REV:
1006  case IOCTL_GET_GPS_IDENT:
1009  case IOCTL_GET_SYNTH_STATE:
1015  case IOCTL_GET_IP4_STATE:
1016  case IOCTL_GET_PTP_STATE:
1017  case IOCTL_GET_CORR_INFO:
1022  #if _MBG_SUPP_VAR_ACC_SIZE
1024  #endif
1025  return MBG_REQ_PRIVL_NONE;
1026 
1027  // Commands returning device capabilities and features:
1028  case IOCTL_DEV_IS_GPS:
1029  case IOCTL_DEV_IS_DCF:
1030  case IOCTL_DEV_IS_MSF:
1031  case IOCTL_DEV_IS_WWVB:
1032  case IOCTL_DEV_IS_LWR:
1033  case IOCTL_DEV_IS_GNSS:
1034  case IOCTL_DEV_IS_IRIG_RX:
1035  case IOCTL_DEV_HAS_HR_TIME:
1036  case IOCTL_DEV_HAS_CAB_LEN:
1037  case IOCTL_DEV_HAS_TZDL:
1039  case IOCTL_DEV_HAS_TZCODE:
1040  case IOCTL_DEV_HAS_TZ:
1044  case IOCTL_DEV_HAS_UCAP:
1045  case IOCTL_DEV_HAS_IRIG_TX:
1047  case IOCTL_DEV_HAS_SIGNAL:
1048  case IOCTL_DEV_HAS_MOD:
1049  case IOCTL_DEV_HAS_IRIG:
1053  case IOCTL_DEV_HAS_SYNTH:
1062  case IOCTL_DEV_IS_PTP:
1063  case IOCTL_DEV_HAS_PTP:
1067  case IOCTL_DEV_HAS_PZF:
1071  case IOCTL_DEV_HAS_EVT_LOG:
1072  case IOCTL_DEV_HAS_GPIO:
1073  case IOCTL_DEV_HAS_XMR:
1074  case IOCTL_CHK_DEV_FEAT:
1075  return MBG_REQ_PRIVL_NONE;
1076 
1077  // The next codes are somewhat special since they change something
1078  // on the board but do not affect basic operation:
1080  case IOCTL_SET_PCPS_EVENT_TIME: // supported by some customized firmware only
1081  case IOCTL_CLR_EVT_LOG:
1082  return MBG_REQ_PRIVL_NONE;
1083 
1084  // Status information which may not be available for everybody:
1085  case IOCTL_GET_GPS_POS:
1086  return MBG_REQ_PRIVL_EXT_STATUS;
1087 
1088  // Reading device configuration:
1089  case IOCTL_GET_PCPS_SERIAL:
1090  case IOCTL_GET_PCPS_TZCODE:
1091  case IOCTL_GET_PCPS_TZDL:
1092  case IOCTL_GET_REF_OFFS:
1095  case IOCTL_GET_GPS_TZDL:
1100  case IOCTL_GET_SYNTH:
1103  case IOCTL_GET_LAN_IF_INFO:
1106  case IOCTL_GET_IRIG_TIME:
1109  case IOCTL_GET_TR_DISTANCE:
1110  // generic read functions
1113  #if _MBG_SUPP_VAR_ACC_SIZE
1114  // These codes are only supported on target systems where a variable size of
1115  // the IOCTL buffer can be specified in the IOCTL call. On other systems the
1116  // generic IOCTL functions are used instead.
1125  #endif
1130  return MBG_REQ_PRIVL_CFG_READ;
1131 
1132  // Writing device configuration:
1133  case IOCTL_SET_PCPS_SERIAL:
1134  case IOCTL_SET_PCPS_TZCODE:
1135  case IOCTL_SET_PCPS_TZDL:
1136  case IOCTL_SET_REF_OFFS:
1139  case IOCTL_SET_GPS_TZDL:
1145  case IOCTL_SET_SYNTH:
1150  case IOCTL_SET_TR_DISTANCE:
1153  return MBG_REQ_PRIVL_CFG_WRITE;
1154 
1155  // Operations which may severely affect system operation:
1156  case IOCTL_SET_PCPS_TIME:
1157  case IOCTL_SET_GPS_TIME:
1158  case IOCTL_SET_GPS_POS_XYZ:
1159  case IOCTL_SET_GPS_POS_LLA:
1162  case IOCTL_SET_GPS_CMD:
1164  // generic write operations can do anything
1167  case IOCTL_PCPS_GENERIC_IO:
1168  return MBG_REQ_PRIVL_SYSTEM;
1169 
1170  // The next codes are somewhat special and normally
1171  // not used by the driver software:
1174  return MBG_REQ_PRIVL_SYSTEM;
1175 
1176  #if USE_DEBUG_PORT
1177  // The codes below are used for debugging only.
1178  // Unrestricted usage may cause system malfunction !!
1181  case IOCTL_MBG_DBG_SET_BIT:
1182  case IOCTL_MBG_DBG_CLR_BIT:
1183  case IOCTL_MBG_DBG_CLR_ALL:
1184  return MBG_REQ_PRIVL_SYSTEM;
1185  #endif
1186 
1187  } // switch
1188 
1189  return -1; // unsupported code, should always be denied
1190 
1191 } // ioctl_get_required_privilege
1192 
1193 
1194 
1195 /* ----- function prototypes begin ----- */
1196 
1197 /* This section was generated automatically */
1198 /* by MAKEHDR, do not remove the comments. */
1199 
1200  int mbgioctl_rc_to_mbg_errno( int sys_errno ) ;
1201  const char *mbgioctl_get_name( long code ) ;
1202 
1203 /* ----- function prototypes end ----- */
1204 
1205 #ifdef __cplusplus
1206 }
1207 #endif
1208 
1209 
1210 /* End of header body */
1211 
1212 #undef _ext
1213 #undef _DO_INIT
1214 
1215 #endif /* _MBGIOCTL_H */
#define IOCTL_GET_PCPS_TZCODE
Definition: mbgioctl.h:537
#define IOCTL_DEV_HAS_RAW_IRIG_DATA
Definition: mbgioctl.h:688
#define IOCTL_GET_FAST_HR_TIMESTAMP_CYCLES
Definition: mbgioctl.h:656
#define IOCTL_GET_SYNTH
Definition: mbgioctl.h:604
#define IOCTL_DEV_HAS_PCI_ASIC_VERSION
Definition: mbgioctl.h:646
#define IOCTL_DEV_CAN_CLR_UCAP_BUFF
Definition: mbgioctl.h:620
#define IOCTL_GET_GPS_ALL_PORT_INFO
Definition: mbgioctl.h:592
#define IOCTL_DEV_HAS_LAN_INTF
Definition: mbgioctl.h:670
#define IOCTL_SET_GPS_POS_LLA
Definition: mbgioctl.h:585
uint32_t info
E.g. cmd code for the device.
Definition: mbgioctl.h:423
#define IOCTL_GET_MBG_OPT_INFO
Definition: mbgioctl.h:546
const char * mbgioctl_get_name(long code)
#define IOCTL_MBG_DBG_SET_BIT
Definition: mbgioctl.h:737
#define IOCTL_DEV_HAS_SYNTH
Definition: mbgioctl.h:630
uint32_t in_sz
Size of the input buffer.
Definition: mbgioctl.h:421
#define IOCTL_SET_GPS_POS_XYZ
Definition: mbgioctl.h:584
#define IOCTL_SET_GPS_UTC_PARM
Definition: mbgioctl.h:665
#define IOCTL_GET_GPS_POS
Definition: mbgioctl.h:583
#define IOCTL_DEV_HAS_IRIG_TX
Definition: mbgioctl.h:622
#define IOCTL_DEV_HAS_OPT_FLAGS
Definition: mbgioctl.h:628
uint64_t in_p
Address of the input buffer.
Definition: mbgioctl.h:419
#define IOCTL_DEV_HAS_FAST_HR_TIMESTAMP
Definition: mbgioctl.h:655
#define IOCTL_SET_PCPS_TIME
Definition: mbgioctl.h:523
#define IOCTL_GET_PCPS_UCAP_EVENT
Definition: mbgioctl.h:554
#define IOCTL_SET_GPS_ENABLE_FLAGS
Definition: mbgioctl.h:575
#define IOCTL_UNMAP_MAPPED_MEM
Definition: mbgioctl.h:641
A structure used to retrieve an address to be mapped into user space.
Definition: pcpsdev.h:564
#define IOCTL_GET_PCPS_DEV
Definition: mbgioctl.h:511
#define IOCTL_GET_IRIG_CTRL_BITS
Definition: mbgioctl.h:668
#define IOCTL_GET_PCPS_IRIG_RX_INFO
Definition: mbgioctl.h:549
#define IOCTL_SET_GPS_CMD
Definition: mbgioctl.h:579
#define IOCTL_DEV_HAS_HR_TIME
Definition: mbgioctl.h:612
#define IOCTL_GET_FAST_HR_TIMESTAMP
Definition: mbgioctl.h:657
#define IOCTL_GET_CYCLES_FREQUENCY
Definition: mbgioctl.h:653
MBG_REQ_PRIVL
Privilege levels for IOCTL codes.
Definition: mbgioctl.h:947
#define IOCTL_GET_XMR_HOLDOVER_STATUS
Definition: mbgioctl.h:727
#define IOCTL_DEV_HAS_GPS_DATA
Definition: mbgioctl.h:629
#define IOCTL_GET_GPS_TZDL
Definition: mbgioctl.h:557
#define IOCTL_SET_PCPS_IRIG_RX_SETTINGS
Definition: mbgioctl.h:550
#define IOCTL_DEV_HAS_DEBUG_STATUS
Definition: mbgioctl.h:703
#define IOCTL_DEV_IS_GNSS
Definition: mbgioctl.h:712
#define IOCTL_GET_GPS_STAT_INFO
Definition: mbgioctl.h:577
#define IOCTL_GET_ALL_XMR_INFO
Definition: mbgioctl.h:724
#define IOCTL_SET_GPS_PORT_PARM
Definition: mbgioctl.h:568
#define IOCTL_DEV_IS_GPS
Definition: mbgioctl.h:608
#define IOCTL_GET_PCPS_STATUS_PORT
Definition: mbgioctl.h:512
#define IOCTL_SET_REF_OFFS
Definition: mbgioctl.h:544
#define IOCTL_SET_IP4_SETTINGS
Definition: mbgioctl.h:674
#define IOCTL_GET_GPS_ANT_CABLE_LEN
Definition: mbgioctl.h:587
#define IOCTL_SET_GNSS_MODE_SETTINGS
Definition: mbgioctl.h:714
#define IOCTL_CLR_EVT_LOG
Definition: mbgioctl.h:707
#define IOCTL_DEV_HAS_IRIG_TIME
Definition: mbgioctl.h:682
#define IOCTL_DEV_HAS_TZ
Definition: mbgioctl.h:617
#define IOCTL_DEV_HAS_EVT_LOG
Definition: mbgioctl.h:706
#define IOCTL_CHK_DEV_FEAT
Definition: mbgioctl.h:730
#define IOCTL_GET_DEBUG_STATUS
Definition: mbgioctl.h:704
#define IOCTL_PCPS_GENERIC_READ
Definition: mbgioctl.h:516
#define IOCTL_GET_PTP_CFG_INFO
Definition: mbgioctl.h:679
A structure used to pass generic IOCTL requests to the kernel driver.
Definition: mbgioctl.h:417
#define IOCTL_GET_ALL_GNSS_SAT_INFO
Definition: mbgioctl.h:715
#define IOCTL_GET_PCPS_TIME_SEC_CHANGE
Definition: mbgioctl.h:527
#define IOCTL_GET_GPS_ENABLE_FLAGS
Definition: mbgioctl.h:574
#define IOCTL_SET_PCPS_SERIAL
Definition: mbgioctl.h:535
#define IOCTL_GET_IRIG_TIME
Definition: mbgioctl.h:683
#define IOCTL_GET_TIME_INFO_TSTAMP
Definition: mbgioctl.h:686
#define IOCTL_PCPS_GENERIC_IO
Definition: mbgioctl.h:633
uint64_t out_p
Address of the output buffer.
Definition: mbgioctl.h:420
#define IOCTL_GET_GPS_ANT_INFO
Definition: mbgioctl.h:570
#define IOCTL_SET_PTP_CFG_SETTINGS
Definition: mbgioctl.h:680
#define IOCTL_DEV_HAS_UCAP
Definition: mbgioctl.h:621
#define IOCTL_GET_REF_OFFS
Definition: mbgioctl.h:543
#define IOCTL_PCPS_CLR_UCAP_BUFF
Definition: mbgioctl.h:552
#define IOCTL_GET_CORR_INFO
Definition: mbgioctl.h:699
#define IOCTL_GET_PCPS_UCAP_ENTRIES
Definition: mbgioctl.h:553
#define IOCTL_DEV_IS_WWVB
Definition: mbgioctl.h:650
#define IOCTL_GET_PCI_ASIC_VERSION
Definition: mbgioctl.h:596
#define IOCTL_DEV_IS_PTP
Definition: mbgioctl.h:676
#define IOCTL_DEV_HAS_GPS_UTC_PARM
Definition: mbgioctl.h:663
#define IOCTL_SET_GPS_TZDL
Definition: mbgioctl.h:558
#define IOCTL_MBG_DBG_CLR_BIT
Definition: mbgioctl.h:738
static __mbg_inline int ioctl_get_required_privilege(ulong ioctl_code)
Determine the privilege level required to execute a specific IOCTL command.
Definition: mbgioctl.h:973
#define IOCTL_GET_PCPS_SYNC_TIME
Definition: mbgioctl.h:525
#define IOCTL_DEV_HAS_SIGNAL
Definition: mbgioctl.h:624
#define IOCTL_DEV_HAS_IRIG
Definition: mbgioctl.h:626
#define IOCTL_GET_GPIO_CFG_LIMITS
Definition: mbgioctl.h:718
#define IOCTL_DEV_HAS_MOD
Definition: mbgioctl.h:625
#define IOCTL_GET_GPS_BVAR_STAT
Definition: mbgioctl.h:562
#define IOCTL_MBG_DBG_SET_PORT_ADDR
Definition: mbgioctl.h:736
PCPS_MAPPED_MEM mapped_mem
Definition: mbgioctl.h:486
Request buffer used to query a device feature.
Definition: mbgioctl.h:473
#define IOCTL_GET_SYNTH_STATE
Definition: mbgioctl.h:635
#define IOCTL_SET_GPS_POUT_SETTINGS_IDX
Definition: mbgioctl.h:638
unsigned char uint8_t
Definition: words.h:210
#define IOCTL_GET_ALL_PTP_UC_MASTER_INFO
Definition: mbgioctl.h:693
#define IOCTL_DEV_HAS_CAB_LEN
Definition: mbgioctl.h:613
#define IOCTL_GET_GNSS_MODE_INFO
Definition: mbgioctl.h:713
#define IOCTL_DEV_IS_LWR
Definition: mbgioctl.h:649
#define IOCTL_DEV_IS_MSF
Definition: mbgioctl.h:648
#define IOCTL_GET_GPS_TIME
Definition: mbgioctl.h:564
#define IOCTL_DEV_HAS_CORR_INFO
Definition: mbgioctl.h:697
#define IOCTL_SET_GPIO_SETTINGS_IDX
Definition: mbgioctl.h:720
#define IOCTL_GET_PCI_ASIC_FEATURES
Definition: mbgioctl.h:643
#define IOCTL_PCPS_GENERIC_READ_GPS
Definition: mbgioctl.h:518
#define IOCTL_GET_GPS_IDENT
Definition: mbgioctl.h:581
#define IOCTL_GET_PCPS_IRIG_TX_INFO
Definition: mbgioctl.h:601
#define IOCTL_DEV_IS_IRIG_RX
Definition: mbgioctl.h:610
#define IOCTL_SET_PTP_UC_MASTER_SETTINGS_IDX
Definition: mbgioctl.h:694
#define IOCTL_DEV_HAS_PTP
Definition: mbgioctl.h:677
#define IOCTL_DEV_HAS_GPIO
Definition: mbgioctl.h:717
IOCTL_GENERIC_REQ req
Definition: mbgioctl.h:489
#define IOCTL_GET_ALL_GPIO_INFO
Definition: mbgioctl.h:719
#define IOCTL_PCPS_GENERIC_WRITE_GPS
Definition: mbgioctl.h:519
#define IOCTL_SET_GPS_ANT_CABLE_LEN
Definition: mbgioctl.h:588
#define IOCTL_DEV_HAS_REF_OFFS
Definition: mbgioctl.h:627
#define IOCTL_GET_IP4_STATE
Definition: mbgioctl.h:672
#define IOCTL_DEV_HAS_IRIG_CTRL_BITS
Definition: mbgioctl.h:667
#define IOCTL_DEV_HAS_PZF
Definition: mbgioctl.h:696
#define IOCTL_GET_PCPS_HR_TIME
Definition: mbgioctl.h:529
#define IOCTL_GET_XMR_INSTANCES
Definition: mbgioctl.h:723
#define IOCTL_SET_TR_DISTANCE
Definition: mbgioctl.h:701
#define IOCTL_SET_SYNTH
Definition: mbgioctl.h:605
#define IOCTL_SET_GPS_TIME_SCALE_SETTINGS
Definition: mbgioctl.h:661
uint32_t reserved
Reserved, yet not used.
Definition: mbgioctl.h:424
#define IOCTL_DEV_HAS_PCPS_TZDL
Definition: mbgioctl.h:615
#define IOCTL_SET_PCPS_TZCODE
Definition: mbgioctl.h:538
#define IOCTL_GET_GPS_ALL_POUT_INFO
Definition: mbgioctl.h:637
#define IOCTL_GET_GPS_RECEIVER_INFO
Definition: mbgioctl.h:590
#define IOCTL_MBG_DBG_CLR_ALL
Definition: mbgioctl.h:739
#define IOCTL_DEV_HAS_TZCODE
Definition: mbgioctl.h:616
#define IOCTL_GET_PCPS_TIME
Definition: mbgioctl.h:522
#define IOCTL_DEV_HAS_GPS_TIME_SCALE
Definition: mbgioctl.h:659
#define IOCTL_GET_IRQ_STAT_INFO
Definition: mbgioctl.h:652
#define IOCTL_GET_IP4_SETTINGS
Definition: mbgioctl.h:673
#define IOCTL_DEV_HAS_GENERIC_IO
Definition: mbgioctl.h:631
#define IOCTL_SET_GPS_TIME
Definition: mbgioctl.h:565
#define IOCTL_SET_XMR_SETTINGS_IDX
Definition: mbgioctl.h:725
#define IOCTL_GET_GPS_UTC_PARM
Definition: mbgioctl.h:664
#define IOCTL_GET_PCPS_TZDL
Definition: mbgioctl.h:540
#define IOCTL_DEV_HAS_RECEIVER_INFO
Definition: mbgioctl.h:619
#define IOCTL_DEV_HAS_PTP_UNICAST
Definition: mbgioctl.h:691
#define IOCTL_DEV_HAS_XMR
Definition: mbgioctl.h:722
#define IOCTL_DEV_IS_DCF
Definition: mbgioctl.h:609
#define IOCTL_GET_TIME_INFO_HRT
Definition: mbgioctl.h:685
#define IOCTL_GET_ALL_GPIO_STATUS
Definition: mbgioctl.h:729
#define IOCTL_GET_MAPPED_MEM_ADDR
Definition: mbgioctl.h:640
int mbgioctl_rc_to_mbg_errno(int sys_errno)
#define IOCTL_SET_GPS_PORT_SETTINGS_IDX
Definition: mbgioctl.h:594
#define IOCTL_MBG_DBG_GET_PORT_ADDR
Definition: mbgioctl.h:735
#define IOCTL_GET_GPS_PORT_PARM
Definition: mbgioctl.h:567
uint32_t out_sz
Size of the output buffer.
Definition: mbgioctl.h:422
#define IOCTL_PCPS_GENERIC_WRITE
Definition: mbgioctl.h:517
#define IOCTL_DEV_HAS_TZDL
Definition: mbgioctl.h:614
#define IOCTL_GET_NUM_EVT_LOG_ENTRIES
Definition: mbgioctl.h:708
#define IOCTL_GET_ALL_XMR_STATUS
Definition: mbgioctl.h:726
#define IOCTL_SET_PCPS_IRIG_TX_SETTINGS
Definition: mbgioctl.h:602
#define IOCTL_GET_FIRST_EVT_LOG_ENTRY
Definition: mbgioctl.h:709
#define IOCTL_GET_TR_DISTANCE
Definition: mbgioctl.h:700
unsigned __int64 uint64_t
Definition: words.h:250
IOCTL_DEV_FEAT_REQ dev_feat_req
Definition: mbgioctl.h:484
#define IOCTL_GET_PCPS_DRVR_INFO
Definition: mbgioctl.h:510
#define IOCTL_DEV_HAS_EVENT_TIME
Definition: mbgioctl.h:618
#define IOCTL_GET_GPS_TIME_SCALE_INFO
Definition: mbgioctl.h:660
#define IOCTL_SET_MBG_OPT_SETTINGS
Definition: mbgioctl.h:547
#define IOCTL_GET_GPS_ALL_STR_TYPE_INFO
Definition: mbgioctl.h:591
unsigned long ulong
Definition: words.h:292
#define IOCTL_GET_LAN_IF_INFO
Definition: mbgioctl.h:671
#define IOCTL_GET_PCPS_TIME_CYCLES
Definition: mbgioctl.h:598
#define IOCTL_GET_GPS_SW_REV
Definition: mbgioctl.h:560
#define IOCTL_SET_PCPS_TZDL
Definition: mbgioctl.h:541
#define IOCTL_GET_RAW_IRIG_DATA
Definition: mbgioctl.h:689
uint32_t feat_num
Number and range depending on IOCTL_DEV_FEAT_REQ::feat_type value.
Definition: mbgioctl.h:476
#define IOCTL_DEV_HAS_TR_DISTANCE
Definition: mbgioctl.h:698
#define IOCTL_DEV_HAS_PCI_ASIC_FEATURES
Definition: mbgioctl.h:645
#define IOCTL_GET_GPS_UCAP
Definition: mbgioctl.h:572
#define IOCTL_PTP_UC_MASTER_CFG_LIMITS
Definition: mbgioctl.h:692
#define IOCTL_GET_PCPS_SERIAL
Definition: mbgioctl.h:534
#define IOCTL_GET_NEXT_EVT_LOG_ENTRY
Definition: mbgioctl.h:710
uint32_t feat_type
See DEV_FEAT_TYPES.
Definition: mbgioctl.h:475
#define IOCTL_GET_PTP_STATE
Definition: mbgioctl.h:678
#define IOCTL_GET_PCPS_HR_TIME_CYCLES
Definition: mbgioctl.h:599
#define IOCTL_SET_PCPS_EVENT_TIME
Definition: mbgioctl.h:532
#define IOCTL_DEV_HAS_SERIAL_HS
Definition: mbgioctl.h:623