@@ -30,11 +30,6 @@ const int CHANNEL_LIST_SIZE_IN_BITS = 8*32;
30
30
static bool channel_list_bit_test32 (uint32_t word , int_fast8_t bit_number );
31
31
static bool channel_list_bit_test (const uint32_t * list , int bit_number );
32
32
33
- #if 0
34
- static void channel_list_bit_set32 (uint32_t * word , int_fast8_t bit_number );
35
- static void channel_list_bit_set (uint32_t * list , int bit_number );
36
- #endif
37
-
38
33
// test bit by number
39
34
static bool channel_list_bit_test32 (uint32_t word , int_fast8_t bit_number )
40
35
{
@@ -55,78 +50,7 @@ static bool channel_list_bit_test(const uint32_t* list, int bit_number)
55
50
56
51
return channel_list_bit_test32 (list [word_index ], bit_index );
57
52
}
58
- #if 0
59
- // set bit by number
60
- static void channel_list_bit_set32 (uint32_t * word , int_fast8_t bit_number )
61
- {
62
- * word |= ((uint32_t ) 1 << bit_number );
63
- }
64
-
65
- static void channel_list_bit_set (uint32_t * list , int bit_number )
66
- {
67
- const int_fast8_t word_index = bit_number / 32 ;
68
- const int_fast8_t bit_index = bit_number % 32 ;
69
-
70
- channel_list_bit_set32 (& (list [word_index ]), bit_index );
71
- }
72
-
73
-
74
- void channel_list_print (uint8_t dlevel , const char * grp , const uint32_t * list )
75
- {
76
-
77
- int temp_channel = 0 ;
78
-
79
- #define CHANNELS_PER_LINE 32
80
-
81
- uint8_t channels [CHANNELS_PER_LINE ];
82
-
83
- for (int line_index = 0 ; line_index < (CHANNEL_LIST_SIZE_IN_BITS /CHANNELS_PER_LINE ); line_index ++ ) {
84
-
85
- int channels_found = 0 ;
86
-
87
- for (int row_index = 0 ; row_index < CHANNELS_PER_LINE ; row_index ++ ) {
88
-
89
- if (channel_list_bit_test (list , temp_channel )) {
90
-
91
- channels [channels_found ] = temp_channel ;
92
- channels_found ++ ;
93
- }
94
-
95
- temp_channel ++ ;
96
- }
97
-
98
- tr_info ("arr[%d]: %s" , line_index , trace_array (channels , channels_found ));
99
- }
100
- }
101
-
102
- // this just avoids mistakes/copypaste on client side
103
- void channel_list_clear_mask (uint32_t * list )
104
- {
105
- const int mask_size = (sizeof (list ));
106
-
107
- memset (list , 0 , mask_size );
108
- }
109
-
110
- static int channel_list_search_in_range (const uint32_t * list , int start_index , int end_index )
111
- {
112
- int found_index = -1 ;
113
- for (int index = start_index ; index <= end_index ; index ++ ) {
114
-
115
- if (channel_list_bit_test (list , index )) {
116
- found_index = index ;
117
- break ;
118
- }
119
- }
120
- return found_index ;
121
- }
122
-
123
- // utility for getting the first channel
124
- int channel_list_get_first (const uint32_t * list )
125
- {
126
53
127
- return channel_list_get_next (list , 0xff );
128
- }
129
- #endif
130
54
static uint8_t channel_list_search (const uint32_t * list , int index )
131
55
{
132
56
uint8_t channel = 0 ;
@@ -163,58 +87,7 @@ uint8_t channel_list_get_channel(const uint32_t* list, int current_index)
163
87
164
88
return found_index ;
165
89
}
166
- #if 0
167
- int channel_list_get_next (const uint32_t * list , int current_index )
168
- {
169
- int found_index ;
170
-
171
- current_index ++ ;
172
-
173
- if (current_index >= CHANNEL_LIST_SIZE_IN_BITS ) {
174
-
175
- current_index = 0 ;
176
- }
177
-
178
- // One could use a optimization here to avoid looping through masks 1..7
179
- // if page is not 9 or 10. But is it really worth it?
180
- found_index = channel_list_search_in_range (list , current_index , CHANNEL_LIST_SIZE_IN_BITS - 1 );
181
-
182
- if ((found_index < 0 ) && (current_index > 0 )) {
183
-
184
- found_index = channel_list_search_in_range (list , 0 , current_index - 1 );
185
- }
186
-
187
- return found_index ;
188
- }
189
-
190
- int channel_list_get_next_broadcast (const uint32_t * list , int broadcast_channel_count , int current_index )
191
- {
192
-
193
- // XXX: all these could/should be pre-calculated on configuration time.
194
- const int first_broadcast = channel_list_get_first (list );
195
- const int total_channel_count = channel_list_count_channels (list );
196
- int channels_to_loop = total_channel_count / broadcast_channel_count ; // crash if broadcast is configured to zero
197
-
198
- int next_broadcast = -1 ;
199
-
200
- // If there are more than one broadcast channels and we're not yet at the last channel,
201
- // iteratively search for next broadcast channel.
202
- if ((channels_to_loop > 1 ) && (current_index < (CHANNEL_LIST_SIZE_IN_BITS - 1 ))) {
203
90
204
- while (channels_to_loop > 0 ) {
205
-
206
- current_index = channel_list_get_next (list , current_index );
207
- channels_to_loop -- ;
208
- }
209
- next_broadcast = current_index ;
210
- }
211
- else {
212
- next_broadcast = first_broadcast ;
213
- }
214
-
215
- return next_broadcast ;
216
- }
217
- #endif
218
91
// count the amount of channels enabled in a list
219
92
int channel_list_count_channels (const uint32_t * list )
220
93
{
@@ -230,30 +103,3 @@ int channel_list_count_channels(const uint32_t* list)
230
103
231
104
return channel_count ;
232
105
}
233
- #if 0
234
- int channel_list_enable_channel (uint32_t * list , int channel_number )
235
- {
236
- int ret_val = -1 ;
237
-
238
- if ((channel_number >= 0 ) && (channel_number < CHANNEL_LIST_SIZE_IN_BITS )) {
239
-
240
- channel_list_bit_set (list , channel_number );
241
-
242
- ret_val = 0 ;
243
- }
244
-
245
- return ret_val ;
246
- }
247
-
248
- bool channel_list_is_channel_enabled (const uint32_t * list , int channel_number ) {
249
-
250
- int ret_val = false;
251
-
252
- if ((channel_number >= 0 ) && (channel_number < CHANNEL_LIST_SIZE_IN_BITS )) {
253
-
254
- ret_val = channel_list_bit_test (list , channel_number );
255
- }
256
-
257
- return ret_val ;
258
- }
259
- #endif
0 commit comments