Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[wrt350n-kernel.git] / drivers / ieee1394 / ieee1394_types.h
blob9803aaa15be04431994e8a8a764fd887bd42456c
1 #ifndef _IEEE1394_TYPES_H
2 #define _IEEE1394_TYPES_H
4 #include <linux/kernel.h>
5 #include <linux/string.h>
6 #include <linux/types.h>
7 #include <asm/byteorder.h>
9 typedef u32 quadlet_t;
10 typedef u64 octlet_t;
11 typedef u16 nodeid_t;
13 typedef u8 byte_t;
14 typedef u64 nodeaddr_t;
15 typedef u16 arm_length_t;
17 #define BUS_MASK 0xffc0
18 #define BUS_SHIFT 6
19 #define NODE_MASK 0x003f
20 #define LOCAL_BUS 0xffc0
21 #define ALL_NODES 0x003f
23 #define NODEID_TO_BUS(nodeid) ((nodeid & BUS_MASK) >> BUS_SHIFT)
24 #define NODEID_TO_NODE(nodeid) (nodeid & NODE_MASK)
26 /* Can be used to consistently print a node/bus ID. */
27 #define NODE_BUS_FMT "%d-%02d:%04d"
28 #define NODE_BUS_ARGS(__host, __nodeid) \
29 __host->id, NODEID_TO_NODE(__nodeid), NODEID_TO_BUS(__nodeid)
31 #define HPSB_PRINT(level, fmt, args...) \
32 printk(level "ieee1394: " fmt "\n" , ## args)
34 #define HPSB_DEBUG(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args)
35 #define HPSB_INFO(fmt, args...) HPSB_PRINT(KERN_INFO, fmt , ## args)
36 #define HPSB_NOTICE(fmt, args...) HPSB_PRINT(KERN_NOTICE, fmt , ## args)
37 #define HPSB_WARN(fmt, args...) HPSB_PRINT(KERN_WARNING, fmt , ## args)
38 #define HPSB_ERR(fmt, args...) HPSB_PRINT(KERN_ERR, fmt , ## args)
40 #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
41 #define HPSB_VERBOSE(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args)
42 #define HPSB_DEBUG_TLABELS
43 #else
44 #define HPSB_VERBOSE(fmt, args...) do {} while (0)
45 #endif
47 #ifdef __BIG_ENDIAN
49 static inline void *memcpy_le32(u32 *dest, const u32 *__src, size_t count)
51 void *tmp = dest;
52 u32 *src = (u32 *)__src;
54 count /= 4;
55 while (count--)
56 *dest++ = swab32p(src++);
57 return tmp;
60 #else
62 static __inline__ void *memcpy_le32(u32 *dest, const u32 *src, size_t count)
64 return memcpy(dest, src, count);
67 #endif /* __BIG_ENDIAN */
69 #endif /* _IEEE1394_TYPES_H */