summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/transceiver_ms/main.c
blob: 1598ab22cc8f25018f9b0ea1acd2a6ce9860fc6f (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * main.c
 *
 * MS-side Transceiver main program
 *
 * Copyright (C) 2014  Sylvain Munaut <tnt@246tNt.com>
 *
 * 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 Affero 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 <stdio.h>
#include <string.h>

#include <osmocom/core/talloc.h>

#include <osmocom/bb/common/logging.h>

#include "app.h"
#include "l1ctl.h"
#include "l1ctl_link.h"
#include "trx.h"


void *l23_ctx = NULL;


int main(int argc, char *argv[])
{
	struct app_state _as, *as = &_as;
	int rv;

	/* Options */

	/* App state init */
	memset(as, 0x00, sizeof(struct app_state));

	/* Init talloc */
	l23_ctx = talloc_named_const(NULL, 1, "l23 app context");

	/* Init logging */
	log_init(&log_info, l23_ctx);

	as->stderr_target = log_target_create_stderr();

	log_add_target(as->stderr_target);
	log_set_all_filter(as->stderr_target, 1);
	log_set_log_level(as->stderr_target, LOGL_DEBUG);

	/* Init TRX interface */
	as->trx = trx_alloc("127.0.0.1", 5700);
	if (!as->trx)
		exit(-1);

	/* Start L1CTL server */
	l1l_start_server(&as->l1s, "/tmp/osmocom_l2", l1ctl_new_cb, as);

	/* Main loop */
	while (1) {
		osmo_select_main(0);
	}

	return 0;
}