upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / staging / tidspbridge / include / dspbridge / gb.h
1 /*
2  * gb.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * Generic bitmap manager.
7  *
8  * Copyright (C) 2005-2006 Texas Instruments, Inc.
9  *
10  * This package is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  *
14  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  */
18
19 #ifndef GB_
20 #define GB_
21
22 #define GB_NOBITS (~0)
23 #include <dspbridge/host_os.h>
24
25 struct gb_t_map;
26
27 /*
28  *  ======== gb_clear ========
29  *  Clear the bit in position bitn in the bitmap map.  Bit positions are
30  *  zero based.
31  */
32
33 extern void gb_clear(struct gb_t_map *map, u32 bitn);
34
35 /*
36  *  ======== gb_create ========
37  *  Create a bit map with len bits.  Initially all bits are cleared.
38  */
39
40 extern struct gb_t_map *gb_create(u32 len);
41
42 /*
43  *  ======== gb_delete ========
44  *  Delete previously created bit map
45  */
46
47 extern void gb_delete(struct gb_t_map *map);
48
49 /*
50  *  ======== gb_findandset ========
51  *  Finds a clear bit, sets it, and returns the position
52  */
53
54 extern u32 gb_findandset(struct gb_t_map *map);
55
56 /*
57  *  ======== gb_minclear ========
58  *  gb_minclear returns the minimum clear bit position.  If no bit is
59  *  clear, gb_minclear returns -1.
60  */
61 extern u32 gb_minclear(struct gb_t_map *map);
62
63 /*
64  *  ======== gb_set ========
65  *  Set the bit in position bitn in the bitmap map.  Bit positions are
66  *  zero based.
67  */
68
69 extern void gb_set(struct gb_t_map *map, u32 bitn);
70
71 /*
72  *  ======== gb_test ========
73  *  Returns TRUE if the bit in position bitn is set in map; otherwise
74  *  gb_test returns FALSE.  Bit positions are zero based.
75  */
76
77 extern bool gb_test(struct gb_t_map *map, u32 bitn);
78
79 #endif /*GB_ */