import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / ieee1394 / ieee1394_types.h
1
2 #ifndef _IEEE1394_TYPES_H
3 #define _IEEE1394_TYPES_H
4
5 #include <linux/kernel.h>
6 #include <linux/types.h>
7 #include <linux/version.h>
8 #include <linux/list.h>
9 #include <linux/init.h>
10 #include <asm/byteorder.h>
11
12
13 /* The great kdev_t changeover in 2.5.x */
14 #include <linux/kdev_t.h>
15 #ifndef minor
16 #define minor(dev) MINOR(dev)
17 #endif
18
19 #ifndef __devexit_p
20 #define __devexit_p(x) x
21 #endif
22
23 #include <linux/spinlock.h>
24
25 #ifndef list_for_each_safe
26 #define list_for_each_safe(pos, n, head) \
27         for (pos = (head)->next, n = pos->next; pos != (head); \
28                 pos = n, n = pos->next)
29
30 #endif
31
32 #define pte_offset_kernel pte_offset
33
34 #ifndef MIN
35 #define MIN(a,b) ((a) < (b) ? (a) : (b))
36 #endif
37
38 #ifndef MAX
39 #define MAX(a,b) ((a) > (b) ? (a) : (b))
40 #endif
41
42
43 /* Use task queue */
44 #include <linux/tqueue.h>
45 #define hpsb_queue_struct tq_struct
46 #define hpsb_queue_list list
47 #define hpsb_schedule_work(x) schedule_task(x)
48 #define HPSB_INIT_WORK(x,y,z) INIT_TQUEUE(x,y,z)
49 #define HPSB_PREPARE_WORK(x,y,z) PREPARE_TQUEUE(x,y,z)
50
51
52 typedef u32 quadlet_t;
53 typedef u64 octlet_t;
54 typedef u16 nodeid_t;
55
56 typedef u8  byte_t;
57 typedef u64 nodeaddr_t;
58 typedef u16 arm_length_t;
59
60 #define BUS_MASK  0xffc0
61 #define NODE_MASK 0x003f
62 #define LOCAL_BUS 0xffc0
63 #define ALL_NODES 0x003f
64
65 /* Can be used to consistently print a node/bus ID. */
66 #define NODE_BUS_FMT    "%02d:%04d"
67 #define NODE_BUS_ARGS(nodeid) \
68         (nodeid & NODE_MASK), ((nodeid & BUS_MASK) >> 6)
69
70 #define HPSB_PRINT(level, fmt, args...) printk(level "ieee1394: " fmt "\n" , ## args)
71
72 #define HPSB_DEBUG(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args)
73 #define HPSB_INFO(fmt, args...) HPSB_PRINT(KERN_INFO, fmt , ## args)
74 #define HPSB_NOTICE(fmt, args...) HPSB_PRINT(KERN_NOTICE, fmt , ## args)
75 #define HPSB_WARN(fmt, args...) HPSB_PRINT(KERN_WARNING, fmt , ## args)
76 #define HPSB_ERR(fmt, args...) HPSB_PRINT(KERN_ERR, fmt , ## args)
77
78 #define HPSB_PANIC(fmt, args...) panic("ieee1394: " fmt "\n" , ## args)
79
80 #define HPSB_TRACE() HPSB_PRINT(KERN_INFO, "TRACE - %s, %s(), line %d", __FILE__, __FUNCTION__, __LINE__)
81
82
83 #ifdef __BIG_ENDIAN
84
85 static __inline__ void *memcpy_le32(u32 *dest, const u32 *__src, size_t count)
86 {
87         void *tmp = dest;
88         u32 *src = (u32 *)__src;
89
90         count /= 4;
91
92         while (count--) {
93                 *dest++ = swab32p(src++);
94         }
95
96         return tmp;
97 }
98
99 #else
100
101 static __inline__ void *memcpy_le32(u32 *dest, const u32 *src, size_t count)
102 {
103         return memcpy(dest, src, count);
104 }
105
106 #endif /* __BIG_ENDIAN */
107
108 #endif /* _IEEE1394_TYPES_H */