Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
EndianFree.h File Reference

Go to the source code of this file.

Macros

#define __MACHINE_LITTLE_ENDIAN   1234 /* LSB first: i386, vax */
 
#define __MACHINE_BIG_ENDIAN   4321 /* MSB first: 68000, ibm, net, ppc */
 
#define BYTE_ORDER   __MACHINE_LITTLE_ENDIAN
 
#define EF1Byte(_val)   ((u8)(_val))
 
#define EF2Byte(_val)   ((u16)(_val))
 
#define EF4Byte(_val)   ((u32)(_val))
 
#define ReadEF1Byte(_ptr)   EF1Byte(*((u8 *)(_ptr)))
 
#define ReadEF2Byte(_ptr)   EF2Byte(*((u16 *)(_ptr)))
 
#define ReadEF4Byte(_ptr)   EF4Byte(*((u32 *)(_ptr)))
 
#define WriteEF1Byte(_ptr, _val)   (*((u8 *)(_ptr)))=EF1Byte(_val)
 
#define WriteEF2Byte(_ptr, _val)   (*((u16 *)(_ptr)))=EF2Byte(_val)
 
#define WriteEF4Byte(_ptr, _val)   (*((u32 *)(_ptr)))=EF4Byte(_val)
 
#define H2N1BYTE(_val)   ((u8)(_val))
 
#define H2N2BYTE(_val)
 
#define H2N4BYTE(_val)
 
#define N2H1BYTE(_val)   ((u8)(_val))
 
#define N2H2BYTE(_val)
 
#define N2H4BYTE(_val)
 
#define BIT_LEN_MASK_32(__BitLen)   (0xFFFFFFFF >> (32 - (__BitLen)))
 
#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen)   (BIT_LEN_MASK_32(__BitLen) << (__BitOffset))
 
#define LE_P4BYTE_TO_HOST_4BYTE(__pStart)   (EF4Byte(*((u32 *)(__pStart))))
 
#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen)
 
#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen)
 
#define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value)
 
#define BIT_LEN_MASK_16(__BitLen)   (0xFFFF >> (16 - (__BitLen)))
 
#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen)   (BIT_LEN_MASK_16(__BitLen) << (__BitOffset))
 
#define LE_P2BYTE_TO_HOST_2BYTE(__pStart)   (EF2Byte(*((u16 *)(__pStart))))
 
#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen)
 
#define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen)
 
#define SET_BITS_TO_LE_2BYTE(__pStart, __BitOffset, __BitLen, __Value)
 
#define BIT_LEN_MASK_8(__BitLen)   (0xFF >> (8 - (__BitLen)))
 
#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen)   (BIT_LEN_MASK_8(__BitLen) << (__BitOffset))
 
#define LE_P1BYTE_TO_HOST_1BYTE(__pStart)   (EF1Byte(*((u8 *)(__pStart))))
 
#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen)
 
#define LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen)
 
#define SET_BITS_TO_LE_1BYTE(__pStart, __BitOffset, __BitLen, __Value)
 

Macro Definition Documentation

#define __MACHINE_BIG_ENDIAN   4321 /* MSB first: 68000, ibm, net, ppc */

Definition at line 12 of file EndianFree.h.

#define __MACHINE_LITTLE_ENDIAN   1234 /* LSB first: i386, vax */

Definition at line 11 of file EndianFree.h.

#define BIT_LEN_MASK_16 (   __BitLen)    (0xFFFF >> (16 - (__BitLen)))

Definition at line 132 of file EndianFree.h.

#define BIT_LEN_MASK_32 (   __BitLen)    (0xFFFFFFFF >> (32 - (__BitLen)))

Definition at line 80 of file EndianFree.h.

#define BIT_LEN_MASK_8 (   __BitLen)    (0xFF >> (8 - (__BitLen)))

Definition at line 163 of file EndianFree.h.

#define BIT_OFFSET_LEN_MASK_16 (   __BitOffset,
  __BitLen 
)    (BIT_LEN_MASK_16(__BitLen) << (__BitOffset))

Definition at line 135 of file EndianFree.h.

#define BIT_OFFSET_LEN_MASK_32 (   __BitOffset,
  __BitLen 
)    (BIT_LEN_MASK_32(__BitLen) << (__BitOffset))

Definition at line 86 of file EndianFree.h.

#define BIT_OFFSET_LEN_MASK_8 (   __BitOffset,
  __BitLen 
)    (BIT_LEN_MASK_8(__BitLen) << (__BitOffset))

Definition at line 166 of file EndianFree.h.

#define BYTE_ORDER   __MACHINE_LITTLE_ENDIAN

Definition at line 14 of file EndianFree.h.

#define EF1Byte (   _val)    ((u8)(_val))

Definition at line 18 of file EndianFree.h.

#define EF2Byte (   _val)    ((u16)(_val))

Definition at line 19 of file EndianFree.h.

#define EF4Byte (   _val)    ((u32)(_val))

Definition at line 20 of file EndianFree.h.

#define H2N1BYTE (   _val)    ((u8)(_val))

Definition at line 44 of file EndianFree.h.

#define H2N2BYTE (   _val)
Value:
(((((u16)(_val))&0x00ff)<<8)|\
((((u16)(_val))&0xff00)>>8))

Definition at line 45 of file EndianFree.h.

#define H2N4BYTE (   _val)
Value:
(((((u32)(_val))&0x000000ff)<<24)|\
((((u32)(_val))&0x0000ff00)<<8) |\
((((u32)(_val))&0x00ff0000)>>8) |\
((((u32)(_val))&0xff000000)>>24))

Definition at line 47 of file EndianFree.h.

#define LE_BITS_CLEARED_TO_1BYTE (   __pStart,
  __BitOffset,
  __BitLen 
)
Value:
( \
LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
& \
( ~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) ) \
)

Definition at line 179 of file EndianFree.h.

#define LE_BITS_CLEARED_TO_2BYTE (   __pStart,
  __BitOffset,
  __BitLen 
)
Value:
( \
LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
& \
( ~BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) ) \
)

Definition at line 148 of file EndianFree.h.

#define LE_BITS_CLEARED_TO_4BYTE (   __pStart,
  __BitOffset,
  __BitLen 
)
Value:
( \
LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
& \
( ~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) ) \
)

Definition at line 112 of file EndianFree.h.

#define LE_BITS_TO_1BYTE (   __pStart,
  __BitOffset,
  __BitLen 
)
Value:
( \
( LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset) ) \
& \
BIT_LEN_MASK_8(__BitLen) \
)

Definition at line 172 of file EndianFree.h.

#define LE_BITS_TO_2BYTE (   __pStart,
  __BitOffset,
  __BitLen 
)
Value:
( \
( LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset) ) \
& \
BIT_LEN_MASK_16(__BitLen) \
)

Definition at line 141 of file EndianFree.h.

#define LE_BITS_TO_4BYTE (   __pStart,
  __BitOffset,
  __BitLen 
)
Value:
( \
( LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset) ) \
& \
BIT_LEN_MASK_32(__BitLen) \
)

Definition at line 100 of file EndianFree.h.

#define LE_P1BYTE_TO_HOST_1BYTE (   __pStart)    (EF1Byte(*((u8 *)(__pStart))))

Definition at line 169 of file EndianFree.h.

#define LE_P2BYTE_TO_HOST_2BYTE (   __pStart)    (EF2Byte(*((u16 *)(__pStart))))

Definition at line 138 of file EndianFree.h.

#define LE_P4BYTE_TO_HOST_4BYTE (   __pStart)    (EF4Byte(*((u32 *)(__pStart))))

Definition at line 93 of file EndianFree.h.

#define N2H1BYTE (   _val)    ((u8)(_val))

Definition at line 60 of file EndianFree.h.

#define N2H2BYTE (   _val)
Value:
(((((u16)(_val))&0x00ff)<<8)|\
((((u16)(_val))&0xff00)>>8))

Definition at line 61 of file EndianFree.h.

#define N2H4BYTE (   _val)
Value:
(((((u32)(_val))&0x000000ff)<<24)|\
((((u32)(_val))&0x0000ff00)<<8) |\
((((u32)(_val))&0x00ff0000)>>8) |\
((((u32)(_val))&0xff000000)>>24))

Definition at line 63 of file EndianFree.h.

#define ReadEF1Byte (   _ptr)    EF1Byte(*((u8 *)(_ptr)))

Definition at line 33 of file EndianFree.h.

#define ReadEF2Byte (   _ptr)    EF2Byte(*((u16 *)(_ptr)))

Definition at line 34 of file EndianFree.h.

#define ReadEF4Byte (   _ptr)    EF4Byte(*((u32 *)(_ptr)))

Definition at line 35 of file EndianFree.h.

#define SET_BITS_TO_LE_1BYTE (   __pStart,
  __BitOffset,
  __BitLen,
  __Value 
)
Value:
*((u8 *)(__pStart)) = \
LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
| \
( (((u8)__Value) & BIT_LEN_MASK_8(__BitLen)) << (__BitOffset) ) \
);

Definition at line 186 of file EndianFree.h.

#define SET_BITS_TO_LE_2BYTE (   __pStart,
  __BitOffset,
  __BitLen,
  __Value 
)
Value:
*((u16 *)(__pStart)) = \
LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
| \
( (((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset) ) \
);

Definition at line 155 of file EndianFree.h.

#define SET_BITS_TO_LE_4BYTE (   __pStart,
  __BitOffset,
  __BitLen,
  __Value 
)
Value:
*((u32 *)(__pStart)) = \
LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
| \
( (((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset) ) \
);

Definition at line 123 of file EndianFree.h.

#define WriteEF1Byte (   _ptr,
  _val 
)    (*((u8 *)(_ptr)))=EF1Byte(_val)

Definition at line 38 of file EndianFree.h.

#define WriteEF2Byte (   _ptr,
  _val 
)    (*((u16 *)(_ptr)))=EF2Byte(_val)

Definition at line 39 of file EndianFree.h.

#define WriteEF4Byte (   _ptr,
  _val 
)    (*((u32 *)(_ptr)))=EF4Byte(_val)

Definition at line 40 of file EndianFree.h.