From c6b4c87e5d57b91b29894835e7ac8e42f6e67f32 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 27 Jun 2011 11:25:35 +0200 Subject: re-work original osmo-bts with support for sysmocom femtobts This code re-works osmo-bts to add support for the upcoming sysmocom BTS. It also tries to add some level of abstraction between the generic part of a BTS (A-bis, RSL, OML, data structures, paging scheduling, BCCH/AGCH scheduling, etc.) and the actual hardware-specific bits. The hardware-specific bits are currently only implemented for the sysmocom femtobts, but should be (re-)added for osmocom-bb, as well as a virtual BTS for simulation purpose later. The sysmocom bts specific parts require hardware-specific header files which are (at least currently) not publicly distributed. --- src/common/logging.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/common/logging.c (limited to 'src/common/logging.c') diff --git a/src/common/logging.c b/src/common/logging.c new file mode 100644 index 00000000..362e30cd --- /dev/null +++ b/src/common/logging.c @@ -0,0 +1,122 @@ +/* libosmocore logging support */ + +/* (C) 2011 by Andreas Eversberg + * (C) 2011 by Harald Welte + * + * 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 . + * + */ + + +#include + +#include +#include +#include + +#include +#include + +static const struct log_info_cat bts_log_info_cat[] = { + [DRSL] = { + .name = "DRSL", + .description = "A-bis Radio Siganlling Link (RSL)", + .color = "\033[1;35m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, + [DOML] = { + .name = "DOML", + .description = "A-bis Network Management / O&M (NM/OML)", + .color = "\033[1;36m", + .enabled = 1, .loglevel = LOGL_INFO, + }, + [DRLL] = { + .name = "DRLL", + .description = "A-bis Radio Link Layer (RLL)", + .color = "\033[1;31m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, + [DRR] = { + .name = "DRR", + .description = "Layer3 Radio Resource (RR)", + .color = "\033[1;34m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, + [DMEAS] = { + .name = "DMEAS", + .description = "Radio Measurement Processing", + .enabled = 0, .loglevel = LOGL_NOTICE, + }, + [DPAG] = { + .name = "DPAG", + .description = "Paging Subsystem", + .color = "\033[1;38m", + .enabled = 1, .loglevel = LOGL_INFO, + }, + [DL1C] = { + .name = "DL1C", + .description = "Layer 1", + .loglevel = LOGL_DEBUG, + .enabled = 1, + }, + [DL1P] = { + .name = "DL1P", + .description = "Layer 1 Primitives", + .loglevel = LOGL_DEBUG, + .enabled = 0, + }, + [DABIS] = { + .name = "DABIS", + .description = "A-bis Intput Subsystem", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, +#if 0 + [DNS] = { + .name = "DNS", + .description = "GPRS Network Service (NS)", + .enabled = 1, .loglevel = LOGL_INFO, + }, + [DBSSGP] = { + .name = "DBSSGP", + .description = "GPRS BSS Gateway Protocol (BSSGP)", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, + [DLLC] = { + .name = "DLLC", + .description = "GPRS Logical Link Control Protocol (LLC)", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, +#endif +}; + +const struct log_info bts_log_info = { + .cat = bts_log_info_cat, + .num_cat = ARRAY_SIZE(bts_log_info_cat), +}; + +#define DEFAULT_MASK "DL1C:DOML:DRSL:DPAG" + +int bts_log_init(const char *category_mask) +{ + if (!category_mask) + category_mask = DEFAULT_MASK; + + osmo_init_logging(&bts_log_info); + + log_parse_category_mask(osmo_stderr_target, category_mask); + + return 0; +} -- cgit v1.2.3