layer23: Pre-rework of the Makefile.am
[osmocom-bb.git] / src / host / layer23 / src / app_phone.c
1 /* "Application" code of the layer2/3 stack */
2
3 /* (C) 2010 by Holger Hans Peter Freyther
4  * (C) 2010 by Harald Welte <laforge@gnumonks.org>
5  *
6  * All Rights Reserved
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  */
23
24 #include <osmocom/osmocom_data.h>
25 #include <osmocom/l1ctl.h>
26 #include <osmocom/layer3.h>
27 #include <osmocom/lapdm.h>
28 #include <osmocom/logging.h>
29
30 #include <osmocore/msgb.h>
31 #include <osmocore/talloc.h>
32 #include <osmocore/select.h>
33 #include <osmocore/signal.h>
34
35 static int signal_cb(unsigned int subsys, unsigned int signal,
36                      void *handler_data, void *signal_data)
37 {
38         struct osmocom_ms *ms;
39
40         if (subsys != SS_L1CTL)
41                 return 0;
42
43         switch (signal) {
44         case S_L1CTL_RESET:
45                 ms = signal_data;
46                 return l1ctl_tx_fbsb_req(ms, ms->test_arfcn,
47                                          L1CTL_FBSB_F_FB01SB, 100, 0,
48                                          CCCH_MODE_NONE);
49                 break;
50         }
51         return 0;
52 }
53
54
55 int l23_app_init(struct osmocom_ms *ms)
56 {
57         register_signal_handler(SS_L1CTL, &signal_cb, NULL);
58         return layer3_init(ms);
59 }