FreeCalypso > hg > freecalypso-tools
comparison rvinterf/lowlevel/tchhide.c @ 899:a1065c17429c
rvinterf: implement TCH hiding mode and -v option for verbose
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 12 Dec 2022 22:15:25 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
898:203c025e71ab | 899:a1065c17429c |
---|---|
1 /* | |
2 * One of several FreeCalypso extensions to RVTMUX is TCH bit access | |
3 * logical channel, and we would like to handle it specially in rvinterf | |
4 * because it's extremely chatty, sending a frame every 20 ms. If we | |
5 * were to output every TCH frame in our regular log, that log output | |
6 * becomes useless as everything else is drowned out. Therefore, we | |
7 * implement a hiding mode by default: we only count how many TCH packets | |
8 * were exchanged in between other messages of interest, and report these | |
9 * counts. | |
10 */ | |
11 | |
12 #include <stdio.h> | |
13 | |
14 extern void (*output_hook)(); | |
15 | |
16 unsigned tch_rx_count, tch_tx_count; | |
17 | |
18 static void | |
19 tch_report_hook() | |
20 { | |
21 char msgbuf[80]; | |
22 | |
23 output_hook = 0; | |
24 if (tch_rx_count) { | |
25 sprintf(msgbuf, "TCH: received %u packet%s", tch_rx_count, | |
26 tch_rx_count != 1 ? "s" : ""); | |
27 output_line(msgbuf); | |
28 tch_rx_count = 0; | |
29 } | |
30 if (tch_tx_count) { | |
31 sprintf(msgbuf, "TCH: sent %u packet%s", tch_tx_count, | |
32 tch_tx_count != 1 ? "s" : ""); | |
33 output_line(msgbuf); | |
34 tch_tx_count = 0; | |
35 } | |
36 } | |
37 | |
38 void | |
39 tch_inc_count_rx() | |
40 { | |
41 tch_rx_count++; | |
42 output_hook = tch_report_hook; | |
43 } | |
44 | |
45 void | |
46 tch_inc_count_tx() | |
47 { | |
48 tch_tx_count++; | |
49 output_hook = tch_report_hook; | |
50 } |