diff options
-rw-r--r-- | drivers/staging/tidspbridge/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/gen/gb.c | 165 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/include/dspbridge/gb.h | 79 |
3 files changed, 1 insertions, 245 deletions
diff --git a/drivers/staging/tidspbridge/Makefile b/drivers/staging/tidspbridge/Makefile index 648e392ce7a..fd6a2761cc3 100644 --- a/drivers/staging/tidspbridge/Makefile +++ b/drivers/staging/tidspbridge/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | obj-$(CONFIG_TIDSPBRIDGE) += bridgedriver.o | 1 | obj-$(CONFIG_TIDSPBRIDGE) += bridgedriver.o |
2 | 2 | ||
3 | libgen = gen/gb.o gen/gh.o gen/uuidutil.o | 3 | libgen = gen/gh.o gen/uuidutil.o |
4 | libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \ | 4 | libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \ |
5 | core/tiomap3430_pwr.o core/tiomap_io.o \ | 5 | core/tiomap3430_pwr.o core/tiomap_io.o \ |
6 | core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o | 6 | core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o |
diff --git a/drivers/staging/tidspbridge/gen/gb.c b/drivers/staging/tidspbridge/gen/gb.c deleted file mode 100644 index 3c0e04cc2b0..00000000000 --- a/drivers/staging/tidspbridge/gen/gb.c +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /* | ||
2 | * gb.c | ||
3 | * | ||
4 | * DSP-BIOS Bridge driver support functions for TI OMAP processors. | ||
5 | * | ||
6 | * Generic bitmap operations. | ||
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 | /* ----------------------------------- DSP/BIOS Bridge */ | ||
20 | #include <linux/types.h> | ||
21 | /* ----------------------------------- This */ | ||
22 | #include <dspbridge/gb.h> | ||
23 | |||
24 | struct gb_t_map { | ||
25 | u32 len; | ||
26 | u32 wcnt; | ||
27 | u32 *words; | ||
28 | }; | ||
29 | |||
30 | /* | ||
31 | * ======== gb_clear ======== | ||
32 | * purpose: | ||
33 | * Clears a bit in the bit map. | ||
34 | */ | ||
35 | |||
36 | void gb_clear(struct gb_t_map *map, u32 bitn) | ||
37 | { | ||
38 | u32 mask; | ||
39 | |||
40 | mask = 1L << (bitn % BITS_PER_LONG); | ||
41 | map->words[bitn / BITS_PER_LONG] &= ~mask; | ||
42 | } | ||
43 | |||
44 | /* | ||
45 | * ======== gb_create ======== | ||
46 | * purpose: | ||
47 | * Creates a bit map. | ||
48 | */ | ||
49 | |||
50 | struct gb_t_map *gb_create(u32 len) | ||
51 | { | ||
52 | struct gb_t_map *map; | ||
53 | u32 i; | ||
54 | map = kzalloc(sizeof(struct gb_t_map), GFP_KERNEL); | ||
55 | if (map != NULL) { | ||
56 | map->len = len; | ||
57 | map->wcnt = len / BITS_PER_LONG + 1; | ||
58 | map->words = kzalloc(map->wcnt * sizeof(u32), GFP_KERNEL); | ||
59 | if (map->words != NULL) { | ||
60 | for (i = 0; i < map->wcnt; i++) | ||
61 | map->words[i] = 0L; | ||
62 | |||
63 | } else { | ||
64 | kfree(map); | ||
65 | map = NULL; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | return map; | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | * ======== gb_delete ======== | ||
74 | * purpose: | ||
75 | * Frees a bit map. | ||
76 | */ | ||
77 | |||
78 | void gb_delete(struct gb_t_map *map) | ||
79 | { | ||
80 | kfree(map->words); | ||
81 | kfree(map); | ||
82 | } | ||
83 | |||
84 | /* | ||
85 | * ======== gb_findandset ======== | ||
86 | * purpose: | ||
87 | * Finds a free bit and sets it. | ||
88 | */ | ||
89 | u32 gb_findandset(struct gb_t_map *map) | ||
90 | { | ||
91 | u32 bitn; | ||
92 | |||
93 | bitn = gb_minclear(map); | ||
94 | |||
95 | if (bitn != GB_NOBITS) | ||
96 | gb_set(map, bitn); | ||
97 | |||
98 | return bitn; | ||
99 | } | ||
100 | |||
101 | /* | ||
102 | * ======== gb_minclear ======== | ||
103 | * purpose: | ||
104 | * returns the location of the first unset bit in the bit map. | ||
105 | */ | ||
106 | u32 gb_minclear(struct gb_t_map *map) | ||
107 | { | ||
108 | u32 bit_location = 0; | ||
109 | u32 bit_acc = 0; | ||
110 | u32 i; | ||
111 | u32 bit; | ||
112 | u32 *word; | ||
113 | |||
114 | for (word = map->words, i = 0; i < map->wcnt; word++, i++) { | ||
115 | if (~*word) { | ||
116 | for (bit = 0; bit < BITS_PER_LONG; bit++, bit_acc++) { | ||
117 | if (bit_acc == map->len) | ||
118 | return GB_NOBITS; | ||
119 | |||
120 | if (~*word & (1L << bit)) { | ||
121 | bit_location = i * BITS_PER_LONG + bit; | ||
122 | return bit_location; | ||
123 | } | ||
124 | |||
125 | } | ||
126 | } else { | ||
127 | bit_acc += BITS_PER_LONG; | ||
128 | } | ||
129 | } | ||
130 | |||
131 | return GB_NOBITS; | ||
132 | } | ||
133 | |||
134 | /* | ||
135 | * ======== gb_set ======== | ||
136 | * purpose: | ||
137 | * Sets a bit in the bit map. | ||
138 | */ | ||
139 | |||
140 | void gb_set(struct gb_t_map *map, u32 bitn) | ||
141 | { | ||
142 | u32 mask; | ||
143 | |||
144 | mask = 1L << (bitn % BITS_PER_LONG); | ||
145 | map->words[bitn / BITS_PER_LONG] |= mask; | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | * ======== gb_test ======== | ||
150 | * purpose: | ||
151 | * Returns true if the bit is set in the specified location. | ||
152 | */ | ||
153 | |||
154 | bool gb_test(struct gb_t_map *map, u32 bitn) | ||
155 | { | ||
156 | bool state; | ||
157 | u32 mask; | ||
158 | u32 word; | ||
159 | |||
160 | mask = 1L << (bitn % BITS_PER_LONG); | ||
161 | word = map->words[bitn / BITS_PER_LONG]; | ||
162 | state = word & mask ? true : false; | ||
163 | |||
164 | return state; | ||
165 | } | ||
diff --git a/drivers/staging/tidspbridge/include/dspbridge/gb.h b/drivers/staging/tidspbridge/include/dspbridge/gb.h deleted file mode 100644 index fda783aa160..00000000000 --- a/drivers/staging/tidspbridge/include/dspbridge/gb.h +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
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_ */ | ||