blob: 3e4d401b4e45978a9cad899495d11a05efa07437 [file] [log] [blame]
Cornelia Huck9d92a7e2008-07-14 09:59:05 +02001#ifndef ASM_SCHID_H
2#define ASM_SCHID_H
Cornelia Hucka8237fc2006-01-06 00:19:21 -08003
Heiko Carstens0680ba02009-01-09 12:14:52 +01004#include <linux/types.h>
5
Cornelia Hucka8237fc2006-01-06 00:19:21 -08006struct subchannel_id {
Cornelia Huck9d92a7e2008-07-14 09:59:05 +02007 __u32 cssid : 8;
8 __u32 : 4;
9 __u32 m : 1;
10 __u32 ssid : 2;
11 __u32 one : 1;
12 __u32 sch_no : 16;
13} __attribute__ ((packed, aligned(4)));
Cornelia Hucka8237fc2006-01-06 00:19:21 -080014
Adrian Bunk626f3112008-07-17 17:16:42 +020015#ifdef __KERNEL__
Cornelia Huck1378ee92008-08-01 16:39:21 +020016#include <linux/string.h>
Cornelia Hucka8237fc2006-01-06 00:19:21 -080017
18/* Helper function for sane state of pre-allocated subchannel_id. */
19static inline void
20init_subchannel_id(struct subchannel_id *schid)
21{
22 memset(schid, 0, sizeof(struct subchannel_id));
23 schid->one = 1;
24}
25
26static inline int
27schid_equal(struct subchannel_id *schid1, struct subchannel_id *schid2)
28{
29 return !memcmp(schid1, schid2, sizeof(struct subchannel_id));
30}
31
Adrian Bunk626f3112008-07-17 17:16:42 +020032#endif /* __KERNEL__ */
33
Cornelia Huck9d92a7e2008-07-14 09:59:05 +020034#endif /* ASM_SCHID_H */