Xenomai API
2.5.6.1
|
00001 00023 #ifndef _XENO_NUCLEUS_BUFD_H 00024 #define _XENO_NUCLEUS_BUFD_H 00025 00029 #include <nucleus/types.h> 00030 00031 #ifdef CONFIG_XENO_OPT_PERVASIVE 00032 00033 struct mm_struct; 00034 00035 struct xnbufd { 00036 caddr_t b_ptr; /* src/dst buffer address */ 00037 size_t b_len; /* total length of buffer */ 00038 off_t b_off; /* # of bytes read/written */ 00039 struct mm_struct *b_mm; /* src/dst address space */ 00040 caddr_t b_carry; /* pointer to carry over area */ 00041 char b_buf[64]; /* fast carry over area */ 00042 }; 00043 00044 void xnbufd_map_umem(struct xnbufd *bufd, 00045 void __user *ptr, size_t len); 00046 00047 static inline void xnbufd_map_uread(struct xnbufd *bufd, 00048 const void __user *ptr, size_t len) 00049 { 00050 xnbufd_map_umem(bufd, (void __user *)ptr, len); 00051 } 00052 00053 static inline void xnbufd_map_uwrite(struct xnbufd *bufd, 00054 void __user *ptr, size_t len) 00055 { 00056 xnbufd_map_umem(bufd, ptr, len); 00057 } 00058 00059 ssize_t xnbufd_unmap_uread(struct xnbufd *bufd); 00060 00061 ssize_t xnbufd_unmap_uwrite(struct xnbufd *bufd); 00062 00063 #else /* !CONFIG_XENO_OPT_PERVASIVE */ 00064 00065 struct xnbufd { 00066 caddr_t b_ptr; /* src/dst buffer address */ 00067 size_t b_len; /* total length of buffer */ 00068 off_t b_off; /* # of bytes read/written */ 00069 }; 00070 00071 #endif /* !CONFIG_XENO_OPT_PERVASIVE */ 00072 00073 void xnbufd_map_kmem(struct xnbufd *bufd, 00074 void *ptr, size_t len); 00075 00076 static inline void xnbufd_map_kread(struct xnbufd *bufd, 00077 const void *ptr, size_t len) 00078 { 00079 xnbufd_map_kmem(bufd, (void *)ptr, len); 00080 } 00081 00082 static inline void xnbufd_map_kwrite(struct xnbufd *bufd, 00083 void *ptr, size_t len) 00084 { 00085 xnbufd_map_kmem(bufd, ptr, len); 00086 } 00087 00088 ssize_t xnbufd_unmap_kread(struct xnbufd *bufd); 00089 00090 ssize_t xnbufd_unmap_kwrite(struct xnbufd *bufd); 00091 00092 ssize_t xnbufd_copy_to_kmem(void *ptr, 00093 struct xnbufd *bufd, size_t len); 00094 00095 ssize_t xnbufd_copy_from_kmem(struct xnbufd *bufd, 00096 void *from, size_t len); 00097 00098 void xnbufd_invalidate(struct xnbufd *bufd); 00099 00100 static inline void xnbufd_reset(struct xnbufd *bufd) 00101 { 00102 bufd->b_off = 0; 00103 } 00104 00107 #endif /* !_XENO_NUCLEUS_BUFD_H */