Xenomai API  2.5.6.1
include/native/misc.h
Go to the documentation of this file.
00001 
00022 #ifndef _XENO_MISC_H
00023 #define _XENO_MISC_H
00024 
00025 #include <native/types.h>
00026 
00027 #define IORN_IOPORT     0x1
00028 #define IORN_IOMEM      0x2
00029 
00030 typedef struct rt_ioregion_placeholder {
00031         xnhandle_t opaque;
00032 } RT_IOREGION_PLACEHOLDER;
00033 
00034 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00035 
00036 #include <native/ppd.h>
00037 
00038 #define XENO_IOREGION_MAGIC 0x55550b0b
00039 
00040 typedef struct rt_ioregion {
00041 
00042         unsigned magic;         /* !< Magic code - must be first */
00043 
00044         xnhandle_t handle;      /* !< Handle in registry -- must be registered. */
00045 
00046         uint64_t start;         /* !< Start of I/O region. */
00047 
00048         uint64_t len;           /* !< Length of I/O region. */
00049 
00050         char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00051 
00052         int flags;              /* !< Operation flags. */
00053 
00054         pid_t cpid;             /* !< Creator's pid. */
00055 
00056         xnholder_t rlink;       /* !< Link in resource queue. */
00057 
00058 #define rlink2ioregion(ln)      container_of(ln, RT_IOREGION, rlink)
00059 
00060         xnqueue_t *rqueue;     /* !< Backpointer to resource queue. */
00061 
00062 } RT_IOREGION;
00063 
00064 int rt_ioregion_delete(RT_IOREGION *iorn);
00065 
00066 static inline void __native_ioregion_flush_rq(xnqueue_t *rq)
00067 {
00068 #ifdef CONFIG_XENO_OPT_PERVASIVE
00069         xeno_flush_rq(RT_IOREGION, rq, ioregion);
00070 #endif
00071 }
00072 
00073 static inline int __native_misc_pkg_init(void)
00074 {
00075         return 0;
00076 }
00077 
00078 static inline void __native_misc_pkg_cleanup(void)
00079 {
00080 #ifdef CONFIG_XENO_OPT_PERVASIVE
00081         __native_ioregion_flush_rq(&__native_global_rholder.ioregionq);
00082 #endif
00083 }
00084 
00085 #else /* !(__KERNEL__ && __XENO_SIM__) */
00086 
00087 typedef RT_IOREGION_PLACEHOLDER RT_IOREGION;
00088 
00089 #ifdef __cplusplus
00090 extern "C" {
00091 #endif
00092 
00093 /* Public interface. */
00094 
00095 int rt_io_get_region(RT_IOREGION *iorn,
00096                      const char *name,
00097                      uint64_t start,
00098                      uint64_t len,
00099                      int flags);
00100 
00101 int rt_io_put_region(RT_IOREGION *iorn);
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 
00107 #endif /* !(__KERNEL__ || __XENO_SIM__) */
00108 
00109 #endif /* !_XENO_MISC_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines