Xenomai  3.0.5
features.h
1 /*
2  * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18 #ifndef _COBALT_UAPI_ASM_GENERIC_FEATURES_H
19 #define _COBALT_UAPI_ASM_GENERIC_FEATURES_H
20 
21 #include <linux/types.h>
22 
23 #define XNFEAT_STRING_LEN 64
24 
25 struct cobalt_featinfo {
27  __u64 clock_freq;
29  __u32 vdso_offset;
31  __u32 feat_abirev;
33  __u32 feat_all;
35  __u32 feat_man;
37  __u32 feat_req;
39  __u32 feat_mis;
40  char feat_all_s[XNFEAT_STRING_LEN];
41  char feat_man_s[XNFEAT_STRING_LEN];
42  char feat_req_s[XNFEAT_STRING_LEN];
43  char feat_mis_s[XNFEAT_STRING_LEN];
44  /* Architecture-specific features. */
45  struct cobalt_featinfo_archdep feat_arch;
46 };
47 
48 #define __xn_feat_smp 0x80000000
49 #define __xn_feat_nosmp 0x40000000
50 #define __xn_feat_fastsynch 0x20000000
51 #define __xn_feat_nofastsynch 0x10000000
52 #define __xn_feat_control 0x08000000
53 
54 #ifdef CONFIG_SMP
55 #define __xn_feat_smp_mask __xn_feat_smp
56 #else
57 #define __xn_feat_smp_mask __xn_feat_nosmp
58 #endif
59 
60 #define __xn_feat_fastsynch_mask __xn_feat_fastsynch
61 
62 /* List of generic features kernel or userland may support */
63 #define __xn_feat_generic_mask \
64  (__xn_feat_smp_mask | __xn_feat_fastsynch_mask)
65 
66 /*
67  * List of features both sides have to agree on: If userland supports
68  * it, the kernel has to provide it, too.
69  */
70 #define __xn_feat_generic_man_mask \
71  (__xn_feat_fastsynch | __xn_feat_nofastsynch | __xn_feat_nosmp)
72 
73 static inline
74 const char *get_generic_feature_label(unsigned int feature)
75 {
76  switch (feature) {
77  case __xn_feat_smp:
78  return "smp";
79  case __xn_feat_nosmp:
80  return "nosmp";
81  case __xn_feat_fastsynch:
82  return "fastsynch";
83  case __xn_feat_nofastsynch:
84  return "nofastsynch";
85  case __xn_feat_control:
86  return "control";
87  default:
88  return 0;
89  }
90 }
91 
92 static inline int check_abi_revision(unsigned long abirev)
93 {
94  return abirev == XENOMAI_ABI_REV;
95 }
96 
97 #endif /* !_COBALT_UAPI_ASM_GENERIC_FEATURES_H */