Xenomai  3.0-rc7
rtmac.h
1 /***
2  *
3  * include/rtmac.h
4  *
5  * rtmac - real-time networking media access control subsystem
6  * Copyright (C) 2004-2006 Jan Kiszka <Jan.Kiszka@web.de>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * As a special exception to the GNU General Public license, the RTnet
23  * project allows you to use this header file in unmodified form to produce
24  * application programs executing in user-space which use RTnet services by
25  * normal system calls. The resulting executable will not be covered by the
26  * GNU General Public License merely as a result of this header file use.
27  * Instead, this header file use will be considered normal use of RTnet and
28  * not a "derived work" in the sense of the GNU General Public License.
29  *
30  * This exception does not apply when the application code is built as a
31  * static or dynamically loadable portion of the Linux kernel nor does the
32  * exception override other reasons justifying application of the GNU General
33  * Public License.
34  *
35  * This exception applies only to the code released by the RTnet project
36  * under the name RTnet and bearing this exception notice. If you copy code
37  * from other sources into a copy of RTnet, the exception does not apply to
38  * the code that you add in this way.
39  *
40  */
41 
42 #ifndef __RTMAC_H_
43 #define __RTMAC_H_
44 
45 #include <rtdm/rtdm.h>
46 
47 #include <rtnet.h> /* for nanosecs wrapping */
48 
49 
50 /* sub-classes: RTDM_CLASS_RTMAC */
51 #define RTDM_SUBCLASS_TDMA 0
52 #define RTDM_SUBCLASS_UNMANAGED 1
53 
54 #define RTIOC_TYPE_RTMAC RTDM_CLASS_RTMAC
55 
56 
57 /* ** Common Cycle Event Types ** */
58 /* standard event, wake up once per cycle */
59 #define RTMAC_WAIT_ON_DEFAULT 0x00
60 /* wake up on media access of the station, may trigger multiple times per
61  cycle */
62 #define RTMAC_WAIT_ON_XMIT 0x01
63 
64 /* ** TDMA-specific Cycle Event Types ** */
65 /* tigger on on SYNC frame reception/transmission */
66 #define TDMA_WAIT_ON_SYNC RTMAC_WAIT_ON_DEFAULT
67 #define TDMA_WAIT_ON_SOF TDMA_WAIT_ON_SYNC /* legacy support */
68 
69 
70 /* RTMAC_RTIOC_WAITONCYCLE_EX control and status data */
71 struct rtmac_waitinfo {
73  unsigned int type;
74 
76  size_t size;
77 
80  unsigned long cycle_no;
81 
84  nanosecs_abs_t cycle_start;
85 
88  nanosecs_rel_t clock_offset;
89 };
90 
91 
92 /* RTmac Discipline IOCTLs */
93 #define RTMAC_RTIOC_TIMEOFFSET _IOR(RTIOC_TYPE_RTMAC, 0x00, int64_t)
94 #define RTMAC_RTIOC_WAITONCYCLE _IOW(RTIOC_TYPE_RTMAC, 0x01, unsigned int)
95 #define RTMAC_RTIOC_WAITONCYCLE_EX _IOWR(RTIOC_TYPE_RTMAC, 0x02, \
96  struct rtmac_waitinfo)
97 
98 #endif /* __RTMAC_H_ */
int64_t nanosecs_rel_t
RTDM type for representing relative intervals.
Definition: rtdm.h:49
uint64_t nanosecs_abs_t
RTDM type for representing absolute dates.
Definition: rtdm.h:43