Neels Hofmeyr | a34ddc5 | 2016-06-02 01:18:02 +0200 | [diff] [blame] | 1 | /* Dynamic PDCH initialisation implementation shared across NM and RSL */ |
| 2 | |
| 3 | /* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> |
| 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 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 |
| 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 |
| 14 | * GNU Affero General Public License for more details. |
| 15 | * |
| 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/>. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <osmocom/core/logging.h> |
| 22 | #include <openbsc/debug.h> |
| 23 | #include <openbsc/gsm_data.h> |
| 24 | #include <openbsc/abis_rsl.h> |
| 25 | |
| 26 | void dyn_pdch_init(struct gsm_bts_trx_ts *ts) |
| 27 | { |
| 28 | int rc; |
| 29 | |
Neels Hofmeyr | d2fc36a | 2016-07-06 14:38:20 +0200 | [diff] [blame] | 30 | /* Clear all dyn PDCH flags */ |
Neels Hofmeyr | 811052a | 2016-06-16 04:18:07 +0200 | [diff] [blame] | 31 | ts->flags &= ~(TS_F_PDCH_PENDING_MASK | TS_F_PDCH_ACTIVE); |
| 32 | |
Neels Hofmeyr | d2fc36a | 2016-07-06 14:38:20 +0200 | [diff] [blame] | 33 | /* Nothing to do if not a dynamic channel. */ |
| 34 | if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) |
| 35 | return; |
| 36 | |
Neels Hofmeyr | 31b2630 | 2016-07-06 14:39:04 +0200 | [diff] [blame] | 37 | if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) { |
Neels Hofmeyr | 8b784fe | 2016-07-23 20:06:27 +0200 | [diff] [blame] | 38 | LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':" |
Neels Hofmeyr | 31b2630 | 2016-07-06 14:39:04 +0200 | [diff] [blame] | 39 | " not activating PDCH.\n", |
Neels Hofmeyr | 8b784fe | 2016-07-23 20:06:27 +0200 | [diff] [blame] | 40 | gsm_ts_and_pchan_name(ts)); |
Neels Hofmeyr | 31b2630 | 2016-07-06 14:39:04 +0200 | [diff] [blame] | 41 | return; |
| 42 | } |
| 43 | |
Neels Hofmeyr | 8b784fe | 2016-07-23 20:06:27 +0200 | [diff] [blame] | 44 | LOGP(DRSL, LOGL_DEBUG, "%s: trying to PDCH ACT\n", |
| 45 | gsm_ts_and_pchan_name(ts)); |
Neels Hofmeyr | d2fc36a | 2016-07-06 14:38:20 +0200 | [diff] [blame] | 46 | |
| 47 | rc = rsl_ipacc_pdch_activate(ts, 1); |
| 48 | if (rc != 0) |
| 49 | LOGP(DRSL, LOGL_ERROR, "%s %s: PDCH ACT failed\n", |
| 50 | gsm_ts_name(ts), gsm_pchan_name(ts->pchan)); |
Neels Hofmeyr | a34ddc5 | 2016-06-02 01:18:02 +0200 | [diff] [blame] | 51 | } |