aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/tidspbridge/include/dspbridge/gb.h
blob: fda783aa160ca557b51b952d647e62bd2d83b7ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * gb.h
 *
 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
 *
 * Generic bitmap manager.
 *
 * Copyright (C) 2005-2006 Texas Instruments, Inc.
 *
 * This package is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef GB_
#define GB_

#define GB_NOBITS (~0)
#include <dspbridge/host_os.h>

struct gb_t_map;

/*
 *  ======== gb_clear ========
 *  Clear the bit in position bitn in the bitmap map.  Bit positions are
 *  zero based.
 */

extern void gb_clear(struct gb_t_map *map, u32 bitn);

/*
 *  ======== gb_create ========
 *  Create a bit map with len bits.  Initially all bits are cleared.
 */

extern struct gb_t_map *gb_create(u32 len);

/*
 *  ======== gb_delete ========
 *  Delete previously created bit map
 */

extern void gb_delete(struct gb_t_map *map);

/*
 *  ======== gb_findandset ========
 *  Finds a clear bit, sets it, and returns the position
 */

extern u32 gb_findandset(struct gb_t_map *map);

/*
 *  ======== gb_minclear ========
 *  gb_minclear returns the minimum clear bit position.  If no bit is
 *  clear, gb_minclear returns -1.
 */
extern u32 gb_minclear(struct gb_t_map *map);

/*
 *  ======== gb_set ========
 *  Set the bit in position bitn in the bitmap map.  Bit positions are
 *  zero based.
 */

extern void gb_set(struct gb_t_map *map, u32 bitn);

/*
 *  ======== gb_test ========
 *  Returns TRUE if the bit in position bitn is set in map; otherwise
 *  gb_test returns FALSE.  Bit positions are zero based.
 */

extern bool gb_test(struct gb_t_map *map, u32 bitn);

#endif /*GB_ */