Holger Freyther | d0e38c3 | 2009-01-04 03:48:30 +0000 | [diff] [blame] | 1 | /* Management functions to allocate/release struct gsm_lchan */ |
| 2 | /* (C) 2008 by Harald Welte <laforge@gnumonks.org> |
| 3 | * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 7 | * it under the terms of the GNU Affero General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
Holger Freyther | d0e38c3 | 2009-01-04 03:48:30 +0000 | [diff] [blame] | 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 14 | * GNU Affero General Public License for more details. |
Holger Freyther | d0e38c3 | 2009-01-04 03:48:30 +0000 | [diff] [blame] | 15 | * |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Holger Freyther | d0e38c3 | 2009-01-04 03:48:30 +0000 | [diff] [blame] | 18 | * |
| 19 | */ |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 20 | #ifndef _CHAN_ALLOC_H |
| 21 | #define _CHAN_ALLOC_H |
| 22 | |
Holger Hans Peter Freyther | 3547045 | 2010-12-22 18:13:00 +0100 | [diff] [blame] | 23 | #include "gsm_data.h" |
Holger Freyther | d0e38c3 | 2009-01-04 03:48:30 +0000 | [diff] [blame] | 24 | |
Holger Hans Peter Freyther | b2be195 | 2010-06-16 13:23:55 +0800 | [diff] [blame] | 25 | struct gsm_subscriber_connection; |
| 26 | |
Andreas Eversberg | df65c9a | 2013-05-30 10:29:36 +0200 | [diff] [blame] | 27 | /* Count number of free TS of given pchan type */ |
| 28 | int bts_count_free_ts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan); |
| 29 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 30 | /* Allocate a logical channel (SDCCH, TCH, ...) */ |
Holger Hans Peter Freyther | 457c2a8 | 2010-09-06 08:58:42 +0800 | [diff] [blame] | 31 | struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 32 | |
| 33 | /* Free a logical channel (SDCCH, TCH, ...) */ |
| 34 | void lchan_free(struct gsm_lchan *lchan); |
Holger Hans Peter Freyther | 135f797 | 2010-04-15 11:21:02 +0200 | [diff] [blame] | 35 | void lchan_reset(struct gsm_lchan *lchan); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 36 | |
Holger Hans Peter Freyther | 4049455 | 2010-06-28 17:09:29 +0800 | [diff] [blame] | 37 | /* Release the given lchan */ |
Holger Hans Peter Freyther | 5ca825e | 2012-12-06 12:01:38 +0100 | [diff] [blame] | 38 | int lchan_release(struct gsm_lchan *lchan, int sacch_deact, enum rsl_rel_mode release_mode); |
Holger Freyther | 67b4b9a | 2009-01-01 03:46:11 +0000 | [diff] [blame] | 39 | |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 40 | struct pchan_load { |
Daniel Willmann | 979ac86 | 2014-12-30 12:15:08 +0100 | [diff] [blame] | 41 | struct load_counter pchan[_GSM_PCHAN_MAX]; |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 42 | }; |
| 43 | |
Neels Hofmeyr | 2afffd5 | 2016-09-25 17:01:20 +0200 | [diff] [blame] | 44 | void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts); |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 45 | void network_chan_load(struct pchan_load *pl, struct gsm_network *net); |
Stefan Sperling | 6cee893 | 2018-01-30 18:14:22 +0100 | [diff] [blame] | 46 | void bts_update_t3122_chan_load(struct gsm_bts *bts); |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 47 | |
Max | d0ff694 | 2017-11-29 12:45:34 +0100 | [diff] [blame] | 48 | bool trx_is_usable(const struct gsm_bts_trx *trx); |
Andreas Eversberg | 7c41cd1 | 2013-06-02 10:36:53 +0200 | [diff] [blame] | 49 | bool ts_is_usable(const struct gsm_bts_trx_ts *ts); |
Harald Welte (local) | 82ff397 | 2009-12-28 16:36:28 +0100 | [diff] [blame] | 50 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 51 | #endif /* _CHAN_ALLOC_H */ |