Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 1 | /* |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 2 | * OsmocomBB <-> SDR connection bridge |
| 3 | * |
| 4 | * (C) 2016-2017 by Vadim Yanitskiy <axilirator@gmail.com> |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 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 | */ |
| 19 | |
| 20 | #include <osmocom/core/application.h> |
| 21 | #include <osmocom/core/logging.h> |
| 22 | #include <osmocom/core/utils.h> |
| 23 | |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 24 | #include <osmocom/bb/trxcon/trxcon.h> |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 25 | #include <osmocom/bb/trxcon/logging.h> |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 26 | |
| 27 | static struct log_info_cat trxcon_log_info_cat[] = { |
| 28 | [DAPP] = { |
| 29 | .name = "DAPP", |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 30 | .description = "Application", |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 31 | .color = "\033[1;35m", |
| 32 | .enabled = 1, .loglevel = LOGL_NOTICE, |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 33 | }, |
| 34 | [DL1C] = { |
| 35 | .name = "DL1C", |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 36 | .description = "Layer 1 control interface", |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 37 | .color = "\033[1;31m", |
| 38 | .enabled = 1, .loglevel = LOGL_NOTICE, |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 39 | }, |
| 40 | [DL1D] = { |
| 41 | .name = "DL1D", |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 42 | .description = "Layer 1 data", |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 43 | .color = "\033[1;31m", |
| 44 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 45 | }, |
| 46 | [DTRXC] = { |
| 47 | .name = "DTRXC", |
| 48 | .description = "Transceiver control interface", |
| 49 | .color = "\033[1;33m", |
| 50 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 51 | }, |
| 52 | [DTRXD] = { |
| 53 | .name = "DTRXD", |
| 54 | .description = "Transceiver data interface", |
| 55 | .color = "\033[1;33m", |
| 56 | .enabled = 1, .loglevel = LOGL_NOTICE, |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 57 | }, |
| 58 | [DSCH] = { |
| 59 | .name = "DSCH", |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 60 | .description = "Scheduler management", |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 61 | .color = "\033[1;36m", |
| 62 | .enabled = 1, .loglevel = LOGL_NOTICE, |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 63 | }, |
| 64 | [DSCHD] = { |
| 65 | .name = "DSCHD", |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 66 | .description = "Scheduler data", |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 67 | .color = "\033[1;36m", |
| 68 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 69 | }, |
| 70 | [DGPRS] = { |
| 71 | .name = "DGPRS", |
| 72 | .description = "L1 GPRS (MAC layer)", |
| 73 | .color = "\033[1;36m", |
| 74 | .enabled = 1, .loglevel = LOGL_NOTICE, |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 75 | }, |
| 76 | }; |
| 77 | |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 78 | static const struct log_info trxcon_log_info = { |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 79 | .cat = trxcon_log_info_cat, |
| 80 | .num_cat = ARRAY_SIZE(trxcon_log_info_cat), |
| 81 | }; |
| 82 | |
| 83 | static const int trxcon_log_cfg[] = { |
| 84 | [TRXCON_LOGC_FSM] = DAPP, |
| 85 | [TRXCON_LOGC_L1C] = DL1C, |
| 86 | [TRXCON_LOGC_L1D] = DL1D, |
| 87 | [TRXCON_LOGC_SCHC] = DSCH, |
| 88 | [TRXCON_LOGC_SCHD] = DSCHD, |
Eric | 1499f03 | 2023-07-25 18:42:48 +0200 | [diff] [blame^] | 89 | [TRXCON_LOGC_GPRS] = DGPRS, |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | void trxc_log_init(void *tallctx) |
| 93 | { |
| 94 | osmo_init_logging2(tallctx, &trxcon_log_info); |
Eric | 7d5c165 | 2023-06-21 16:40:29 +0200 | [diff] [blame] | 95 | log_target_file_switch_to_wqueue(osmo_stderr_target); |
Eric | b7253c6 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 96 | |
| 97 | trxcon_set_log_cfg(&trxcon_log_cfg[0], ARRAY_SIZE(trxcon_log_cfg)); |
| 98 | } |