comparison src/g23m-gsm/dl/dl_sacch0.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS
4 | Modul : DL_SACCH0
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Modul defines the functions for the slow associated
18 | control channel SACCH (only SAPI=0) of the component DL
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef DL_SACCH0_C
23 #define DL_SACCH0_C
24
25 #define ENTITY_DL
26
27 /*==== INCLUDES ===================================================*/
28
29 #include "typedefs.h"
30 #include <string.h>
31 #include "pconst.cdg"
32 #include "vsi.h"
33 #include "custom.h"
34 #include "gsm.h"
35 #include "mon_dl.h"
36 #include "prim.h"
37 #include "pei.h"
38 #include "tok.h"
39 #include "ccdapi.h"
40 #include "dl.h"
41 #include "dl_trc.h"
42
43 /*==== EXPORT =====================================================*/
44
45 /*==== PRIVAT =====================================================*/
46
47 /*==== VARIABLES ==================================================*/
48 GLOBAL const T_FRAME meas_report_no_nc =
49 {
50 N201_SACCH*8,
51 24,
52 {
53 0x00, 0x00, 0x00,
54 0x06, 0x15, 0x1E, 0x1E, 0x7E,
55 0x00, 0x00, 0x00, 0x00, 0x00,
56 0x00, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00
58 }
59 };
60 LOCAL const T_FRAME meas_report_invalid =
61 {
62 N201_SACCH*8,
63 24,
64 {
65 0x00, 0x00, 0x00,
66 0x06, 0x15, 0x00, 0x40, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x00, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00
70 }
71 };
72
73
74 /*==== FUNCTIONS ==================================================*/
75 /*
76 +--------------------------------------------------------------------+
77 | PROJECT : GSM-PS (6147) MODULE : DL_SACCH0 |
78 | STATE : code ROUTINE : sacch_init_dl_data |
79 +--------------------------------------------------------------------+
80
81 PURPOSE : Initialisation of SACCH data for an instance.
82
83 */
84
85 GLOBAL void sacch0_init_dl_data (void)
86 {
87 GET_INSTANCE_DATA;
88 T_CCH *pcch = &dl_data->cch[C_SACCH0];
89 TRACE_FUNCTION ("sacch_init_dl_data()");
90
91 memset (pcch, 0, sizeof (T_CCH));
92 pcch->ch_type = L2_CHANNEL_SACCH;
93
94 if (dl_data->dcch3_in_msg)
95 {
96 COM_FREE_POINTER (dl_data->dcch3_in_msg);
97 dl_data->dcch3_in_msg = NULL;
98 }
99
100 sacch0_reset_meas ();
101 }
102
103 /*
104 +--------------------------------------------------------------------+
105 | PROJECT : GSM-PS (6147) MODULE : DL_SACCH0 |
106 | STATE : code ROUTINE : sacch0_reset_meas |
107 +--------------------------------------------------------------------+
108
109 PURPOSE : Reset measurement reports and sacch_mode.
110
111 */
112
113 GLOBAL void sacch0_reset_meas (void)
114 {
115 GET_INSTANCE_DATA;
116 dl_data->sacch_act_buffer = meas_report_no_nc;
117 dl_data->sacch_last_buffer= meas_report_no_nc;
118 dl_data->sacch_mode = 2;
119 }
120
121 /*
122 +--------------------------------------------------------------------+
123 | PROJECT : GSM-PS (6147) MODULE : DL_SACCH0 |
124 | STATE : code ROUTINE : sacch_send_data |
125 +--------------------------------------------------------------------+
126
127 PURPOSE : Send unacknowledged data on SACCH, SAPI=0.
128
129 */
130
131 GLOBAL void sacch0_send_data (void)
132 {
133 GET_INSTANCE_DATA;
134 TRACE_FUNCTION ("sacch_send_data()");
135
136 TRACE_EVENT_WIN_P2 ("SACCH0 MODE = %d, %s", dl_data->sacch_mode,
137 (dl_data->rr_short_pd_buffer.l_buf AND
138 dl_data->rr_short_pd_ch_type EQ L2_CHANNEL_SACCH) ? "RR short PD" : "normal");
139
140 if (dl_data->rr_short_pd_buffer.l_buf AND
141 dl_data->rr_short_pd_ch_type EQ L2_CHANNEL_SACCH)
142 { /* RR message with short PD, short L2 header type 1, format Bter */
143 com_build_UI_Bter (L2_CHANNEL_SACCH);
144 }
145 else
146 { /* format A or B */
147 if (dl_data->sacch_mode EQ 2)
148 {
149 com_build_UI_command (L2_CHANNEL_SACCH, PS_SAPI_0, &meas_report_invalid);
150 }
151 else
152 {
153 if (dl_data->dl_active EQ FALSE)
154 dl_data->sacch_last_buffer = dl_data->sacch_act_buffer;
155
156 com_build_UI_command (L2_CHANNEL_SACCH, PS_SAPI_0, &dl_data->sacch_last_buffer);
157 }
158 if (dl_data->sacch_mode)
159 dl_data->sacch_mode--;
160 }
161 }
162
163 #endif
164