aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/lapdm_glue.c
blob: 6f3505a687045dc79e906bade97836fbeb1ac710 (plain)
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
/* (C) 2011 by Harald Welte <laforge@gnumonks.org>
 *
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <stdint.h>

#include <osmocom/gsm/prim.h>

#include <osmocom/bb/common/l1ctl.h>
#include <osmocom/bb/common/lapdm.h>

/* LAPDm wants to send a PH-* primitive to the physical layer (L1) */
int sysmol1_ph_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
{
	struct osmocom_ms *ms = ctx;
	struct osmo_phsap_prim *pp = (struct osmo_phsap_prim *) oph;
	int rc = 0;

	if (oph->sap != SAP_GSM_PH)
		return -ENODEV;

	if (oph->operation != PRIM_OP_REQUEST)
		return -EINVAL;

	switch (oph->primitive) {
	case PRIM_PH_RACH:
		/* A BTS never transmits RACH */
	case PRIM_PH_DATA:
		/* we use the LAPDm code in polling only, we should never
		 * get a PH-DATA.req */
	default:
		LOGP(DLAPDM, LOGL_ERROR, "LAPDm sends unknown prim %u\n",
			oph->primitive);
		rc = -EINVAL;
		break;
	}

	return rc;
}