annotate src/g23m-gsm/dl/dl_trc.c @ 104:27a4235405c6

src/g23m-gsm: import from LoCosto source
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 04 Oct 2016 18:24:05 +0000
parents
children 4b7e0dba42f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Project : GSM-PS
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | Modul : DL_TRC
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | All rights reserved.
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 |
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | Instruments Berlin, AG
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | Purpose : This Modul defines functions for tracing (only simulation)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 +-----------------------------------------------------------------------------
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #ifndef DL_TRC_C
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #define DL_TRC_C
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #define ENTITY_DL
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /*==== INCLUDES ===================================================*/
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #if defined (NEW_FRAME)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include <stdio.h>
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include <stdarg.h>
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include <string.h>
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "typedefs.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "pconst.cdg"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #include "vsi.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "custom.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #include "gsm.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "mon_dl.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "prim.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #include "pei.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #include "tok.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 #include "ccdapi.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 #include "dl.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 #include <stdio.h>
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 #include <stdarg.h>
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 #include <string.h>
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 #include "stddefs.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 #include "pconst.cdg"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 #include "custom.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 #include "gsm.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 #include "mon_dl.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 #include "prim.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 #include "vsi.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 #include "pei.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 #include "tok.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #include "ccdapi.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #include "dl.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #endif
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 #include "DL_trc.h"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 #if defined(DL_TRACE_WIN32)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 #define DL_TRC_DELAY() /* vsi_t_sleep (VSI_CALLER 1) */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 #define MY_ENTER_CRITICAL_SECTION(s) dl_trc_enter_critical_section(s)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 #define MY_LEAVE_CRITICAL_SECTION(s) dl_trc_leave_critical_section(s)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 LOCAL char local_buffer[300];
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 LOCAL int idx;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 #if defined (NEW_FRAME)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 LOCAL T_HANDLE sem_buf_acces;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 #else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 LOCAL T_VSI_SHANDLE sem_buf_acces;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 #endif
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 LOCAL const char * const FrameName[] =
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 "I", /* 0 I */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 "RR", /* 1 S */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 "RNR", /* 2 S */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 "REJ", /* 3 S */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 "SABM", /* 4 U */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 "DM", /* 5 U */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 "UI", /* 6 U */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 "DISC", /* 7 U */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 "UA", /* 8 U */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 "unknown"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 };
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 LOCAL const char * const ChannelType[] =
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 "?<", "SA", "SD", "FH", "FF", "?>"
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 };
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 enum frame_type_e
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 FT_I,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 FT_RR,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 FT_RNR,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 FT_REJ,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 FT_SABM,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 FT_DM,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 FT_UI,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 FT_DISC,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 FT_UA,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 FT_UNKNOWN
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 };
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 #if defined (NEW_FRAME)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 GLOBAL int dl_trc_enter_critical_section (T_HANDLE sem)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 #else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 GLOBAL int dl_trc_enter_critical_section (T_VSI_SHANDLE sem)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 #endif /* NEW_FRAME */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 idx++;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 if (idx > 1)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 sprintf (local_buffer, "idx=%d!", idx);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 TRACE_EVENT (local_buffer);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 vsi_t_sleep (VSI_CALLER 50);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 if (vsi_s_get (VSI_CALLER sem) NEQ VSI_OK)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 TRACE_EVENT ("dl_trc_enter_critical_section() semaphore error");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 return -1;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 /*
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 vsi_t_sleep (VSI_CALLER 1);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 TRACE_EVENT ("dl_trc_enter_critical_section()");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 return 0;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 }/* endfunc dl_trc_enter_critical_section */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 #if defined (NEW_FRAME)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 GLOBAL int dl_trc_leave_critical_section (T_HANDLE sem)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 #else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 GLOBAL int dl_trc_leave_critical_section (T_VSI_SHANDLE sem)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 #endif /* NEW_FRAME */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 idx--;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 if (vsi_s_release (VSI_CALLER sem) NEQ VSI_OK)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 TRACE_EVENT ("dl_trc_leave_critical_section() semaphore error");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 return -1;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 /*
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 vsi_t_sleep (VSI_CALLER 1);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 TRACE_EVENT ("dl_trc_leave_critical_section()");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 return 0;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 }/* endfunc dl_trc_leave_critical_section */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 GLOBAL void dl_trc_init ()
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 TRACE_FUNCTION ("dl_trc_init()");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 idx = 0;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 #ifdef NEW_FRAME
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 sem_buf_acces = vsi_s_open (VSI_CALLER "DL_TRC",1);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 #else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 sem_buf_acces = vsi_s_open (VSI_CALLER "DL_TRC");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 #endif /* NEW_FRAME */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 if (sem_buf_acces EQ VSI_ERROR)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 TRACE_FUNCTION ("open semaphore error \"sem_buf_acces\"");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 #if 1
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 else if (!MY_ENTER_CRITICAL_SECTION (sem_buf_acces))
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 TRACE_FUNCTION ("open semaphore \"sem_buf_acces\"");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 MY_LEAVE_CRITICAL_SECTION (sem_buf_acces);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 #endif /* 0|1 */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 }/* endfunc dl_trc_init */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 GLOBAL void dl_trc_exit ()
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 TRACE_FUNCTION ("dl_trc_exit()");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 vsi_s_close (VSI_CALLER sem_buf_acces);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 }/* endfunc dl_trc_exit */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 GLOBAL void dl_trc_printf (char *fmt, ...)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 if (!MY_ENTER_CRITICAL_SECTION (sem_buf_acces))
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 va_list vl;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 char *buf = local_buffer;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 va_start( vl, fmt ); /* Initialize variable arguments. */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 vsprintf (buf, fmt, vl);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 va_end ( vl ); /* Reset variable arguments. */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 DL_TRC_DELAY ();
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 TRACE_FUNCTION (buf);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 DL_TRC_DELAY ();
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 MY_LEAVE_CRITICAL_SECTION (sem_buf_acces);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 GLOBAL void dl_trc_print_array(unsigned char *pArray, int nLength)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 if (!MY_ENTER_CRITICAL_SECTION (sem_buf_acces))
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 int n, o;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 char *buf = local_buffer;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 for (n = 0, o = 0; (n < nLength) AND (o < ((int)sizeof (local_buffer)) - 7); n++)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 o += sprintf (buf + o, "%02X ", *(pArray + n));
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 if (n < nLength)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 o += sprintf (buf + o, "...");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 DL_TRC_DELAY ();
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 TRACE_FUNCTION (buf);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 DL_TRC_DELAY ();
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 MY_LEAVE_CRITICAL_SECTION (sem_buf_acces);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 GLOBAL void dl_trc_frame(unsigned char ch_type, unsigned char *pFrame, int direction)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 /* direction 0: down, 1: up */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 if (!MY_ENTER_CRITICAL_SECTION (sem_buf_acces))
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 int o = 0, n, l, m;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 int frametype;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 int cmd = 0;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 int pf = ((*(pFrame + 1)) & 0x10) >> 4;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 char *buf = local_buffer;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 if (ch_type >= 5)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 ch_type = 5;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 if (((*pFrame) & (BTER_FORMAT_MASK)) EQ (SHORT_L2_HEADER_TYPE_1))
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 int len = ch_type EQ L2_CHANNEL_SACCH ? DL_N201_SACCH_Bter : DL_N201_DCCH_Bter;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 /* format type Bter */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 o += sprintf (buf+o, "--- %2s short PD: SAPI 0 ",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 ChannelType[ch_type]);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 o += sprintf (buf+o, "%2s %s %2s",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 direction ? " " : "<-", FrameName[FT_UI], direction ? "->" : " ");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 while (o < 60)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 buf[o++] = 0x20;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 o += sprintf (buf+o, " l=%-2u ", len);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 for (n = 0; n < len; n++)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 o += sprintf (buf+o, " %02X", *(pFrame + n));
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 /* address field */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 cmd = ((*pFrame)&0x02) ? direction ? 0 : 1
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 : direction ? 1 : 0;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 o += sprintf (buf+o, "--- %2s %02X %02X %02X: SAPI %u %s ",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 ChannelType[ch_type],
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 *(pFrame + 0), *(pFrame + 1), *(pFrame + 2),
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 /*direction?"UL->":"<-DL",*/
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 ((*pFrame)&0x1f)>>2,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 cmd ? "cmd" : "rsp");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 /* control field */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 if ((*(pFrame + 1)) & 0x01)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 if (((*(pFrame + 1)) & 0x03) EQ 0x03)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 switch ((*(pFrame + 1)) & 0xef) /* unnumbered */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 case 0x2f: frametype = FT_SABM; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 case 0x0f: frametype = FT_DM; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 case 0x03: frametype = FT_UI; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 case 0x43: frametype = FT_DISC; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 case 0x63: frametype = FT_UA; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 default: frametype = FT_UNKNOWN; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 o += sprintf (buf+o, "%c %14s",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 pf ? (cmd ? 'P' : 'F') : ' ', "");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 switch ((*(pFrame + 1)) & 0x0f) /* supervisory */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 case 0x01: frametype = FT_RR; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 case 0x05: frametype = FT_RNR; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 case 0x09: frametype = FT_REJ; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 default: frametype = FT_UNKNOWN; break;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 o += sprintf (buf+o, "%c %s=%u %7s",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 pf ? (cmd ? 'P' : 'F') : ' ',
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 direction ? "N(R)" : "n(r)",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 ((*(pFrame + 1)) & 0xe0) >> 5,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 "");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 else
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 frametype = FT_I;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 o += sprintf (buf+o, "%c %s=%u %s=%u ",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 pf ? (cmd ? 'P' : 'F') : ' ',
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 direction ? "N(R)" : "n(r)",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 ((*(pFrame + 1)) & 0xe0) >> 5,
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 direction ? "N(S)" : "n(s)",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 ((*(pFrame + 1)) & 0x0e) >> 1);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 o += sprintf (buf+o, "%2s %s %2s",
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 direction ? " " : "<-", FrameName[frametype], direction ? "->" : " ");
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 /* length field */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 l = (*(pFrame + 2)) >> 2;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 m = (*(pFrame + 2)) & 0x02;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 if (l OR m)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 {
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 while (o < 60)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 buf[o++] = 0x20;
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 o += sprintf (buf+o, "%c l=%-2u ", m ? 'M':' ', l);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 for (n = 0; (n < l) AND (n < 20); n++)
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 o += sprintf (buf+o, " %02X", *(pFrame + 3 + n));
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337 DL_TRC_DELAY ();
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 TRACE_FUNCTION (buf);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 DL_TRC_DELAY ();
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 MY_LEAVE_CRITICAL_SECTION (sem_buf_acces);
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 }
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 }/* endfunc dl_trc_frame */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 #endif /* DL_TRACE_WIN32 */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 #endif /* DL_TRC_C */
27a4235405c6 src/g23m-gsm: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346