4 * Copyright (C) 2000 Karim Yaghmour (karym@opersys.com).
6 * This is distributed under GPL.
8 * Header for LTT-secific types.
11 * K.Y. 07/09/2001, Added David Schleef's architecture independent ltt_set_bit/ltt_clear_bit/ltt_test_bit
12 * JAL, 05/01/2001, Modified PPC bit manipulation functions for x86 compatibility.
13 * (andy_lowe@mvista.com)
14 * K.Y., 31/05/2000, Initial typing.
17 #ifndef __TRACE_TOOLKIT_TYPES_HEADER__
18 #define __TRACE_TOOLKIT_TYPES_HEADER__
20 #include <sys/types.h>
25 typedef unsigned char u_int8_t
;
26 typedef unsigned short u_int16_t
;
27 typedef unsigned int u_int32_t
;
29 typedef unsigned long u_int64_t
;
31 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
32 typedef unsigned long long u_int64_t
;
33 #endif /* __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) */
36 #endif /* defined(sun) */
38 extern __inline__
int ltt_set_bit(int nr
, void * addr
)
40 unsigned char *p
= addr
;
41 unsigned char mask
= 1 << (nr
&7);
48 return ((old
& mask
) != 0);
51 extern __inline__
int ltt_clear_bit(int nr
, void * addr
)
53 unsigned char *p
= addr
;
54 unsigned char mask
= 1 << (nr
&7);
61 return ((old
& mask
) != 0);
64 extern __inline__
int ltt_test_bit(int nr
,void *addr
)
66 unsigned char *p
= addr
;
67 unsigned char mask
= 1 << (nr
&7);
71 return ((*p
& mask
) != 0);
74 /* Big-endian/little-endian conversion macros for cross-development. */
76 /* For native development, these conversion macros aren't needed. */
80 #define RFT8(db,x) (x)
81 #define RFT16(db,x) (x)
82 #define RFT32(db,x) (x)
83 #define RFT64(db,x) (x)
85 /* Non-native development */
87 /* BREV16: byte-reverse a 16-bit integer */
88 #define BREV16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
89 /* BREV32: byte-reverse a 32-bit integer */
90 #define BREV32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \
91 | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
92 /* BREV64: byte-reverse a 64-bit integer */
93 #define BREV64(x) ((((x) & 0xff00000000000000) >> 56) \
94 | (((x) & 0x00ff000000000000) >> 40) \
95 | (((x) & 0x0000ff0000000000) >> 24) \
96 | (((x) & 0x000000ff00000000) >> 8) \
97 | (((x) & 0x00000000ff000000) << 8) \
98 | (((x) & 0x0000000000ff0000) << 24) \
99 | (((x) & 0x000000000000ff00) << 40) \
100 | (((x) & 0x00000000000000ff) << 56))
101 /* RFTn: Read From Trace
102 * Conditionally byte-reverse an 8-, 16-, 32-, or 64-bit integer
103 * based on the value of the ByteRev member of the trace database
104 * structure pointer passed as the first argument..
106 #define RFT8(db,x) (x)
107 #define RFT16(db,x) ((db)->ByteRev ? BREV16(x) : (x))
108 #define RFT32(db,x) ((db)->ByteRev ? BREV32(x) : (x))
109 #define RFT64(db,x) ((db)->ByteRev ? BREV64(x) : (x))
110 #endif /* TRACE_TARGET_NATIVE */
113 /* Some type corrections, just in case */
115 #define uint8_t u_int8_t
118 #define uint16_t u_int16_t
121 #define uint32_t u_int32_t
124 #define uint64_t u_int64_t
126 #endif /* !defined(sun) */
128 /* Structure packing */
129 #if LTT_UNPACKED_STRUCTS
130 #define LTT_PACKED_STRUCT
132 #define LTT_PACKED_STRUCT __attribute__ ((packed))
133 #endif /* UNPACKED_STRUCTS */
136 typedef uint64_t trace_event_mask
;
142 #endif /* __TRACE_TOOLKIT_TYPES_HEADER__ */
This page took 0.031223 seconds and 4 git commands to generate.