~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/rpmsg/byteorder.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Follows implementation found in linux/virtio_byteorder.h
  4  */
  5 #ifndef _LINUX_RPMSG_BYTEORDER_H
  6 #define _LINUX_RPMSG_BYTEORDER_H
  7 #include <linux/types.h>
  8 #include <uapi/linux/rpmsg_types.h>
  9 
 10 static inline bool rpmsg_is_little_endian(void)
 11 {
 12 #ifdef __LITTLE_ENDIAN
 13         return true;
 14 #else
 15         return false;
 16 #endif
 17 }
 18 
 19 static inline u16 __rpmsg16_to_cpu(bool little_endian, __rpmsg16 val)
 20 {
 21         if (little_endian)
 22                 return le16_to_cpu((__force __le16)val);
 23         else
 24                 return be16_to_cpu((__force __be16)val);
 25 }
 26 
 27 static inline __rpmsg16 __cpu_to_rpmsg16(bool little_endian, u16 val)
 28 {
 29         if (little_endian)
 30                 return (__force __rpmsg16)cpu_to_le16(val);
 31         else
 32                 return (__force __rpmsg16)cpu_to_be16(val);
 33 }
 34 
 35 static inline u32 __rpmsg32_to_cpu(bool little_endian, __rpmsg32 val)
 36 {
 37         if (little_endian)
 38                 return le32_to_cpu((__force __le32)val);
 39         else
 40                 return be32_to_cpu((__force __be32)val);
 41 }
 42 
 43 static inline __rpmsg32 __cpu_to_rpmsg32(bool little_endian, u32 val)
 44 {
 45         if (little_endian)
 46                 return (__force __rpmsg32)cpu_to_le32(val);
 47         else
 48                 return (__force __rpmsg32)cpu_to_be32(val);
 49 }
 50 
 51 static inline u64 __rpmsg64_to_cpu(bool little_endian, __rpmsg64 val)
 52 {
 53         if (little_endian)
 54                 return le64_to_cpu((__force __le64)val);
 55         else
 56                 return be64_to_cpu((__force __be64)val);
 57 }
 58 
 59 static inline __rpmsg64 __cpu_to_rpmsg64(bool little_endian, u64 val)
 60 {
 61         if (little_endian)
 62                 return (__force __rpmsg64)cpu_to_le64(val);
 63         else
 64                 return (__force __rpmsg64)cpu_to_be64(val);
 65 }
 66 
 67 #endif /* _LINUX_RPMSG_BYTEORDER_H */
 68 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php