FreeCalypso > hg > freecalypso-citrine
comparison g23m-gsm/dl/dl_sacch0.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
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 #include "config.h" | |
26 #include "fixedconf.h" | |
27 #include "condat-features.h" | |
28 | |
29 #define ENTITY_DL | |
30 | |
31 /*==== INCLUDES ===================================================*/ | |
32 | |
33 #include "typedefs.h" | |
34 #include <string.h> | |
35 #include "pconst.cdg" | |
36 #include "vsi.h" | |
37 #include "custom.h" | |
38 #include "gsm.h" | |
39 #include "mon_dl.h" | |
40 #include "prim.h" | |
41 #include "pei.h" | |
42 #include "tok.h" | |
43 #include "ccdapi.h" | |
44 #include "dl.h" | |
45 #include "dl_trc.h" | |
46 | |
47 /*==== EXPORT =====================================================*/ | |
48 | |
49 /*==== PRIVAT =====================================================*/ | |
50 | |
51 /*==== VARIABLES ==================================================*/ | |
52 GLOBAL const T_FRAME meas_report_no_nc = | |
53 { | |
54 N201_SACCH*8, | |
55 24, | |
56 { | |
57 0x00, 0x00, 0x00, | |
58 0x06, 0x15, 0x1E, 0x1E, 0x7E, | |
59 0x00, 0x00, 0x00, 0x00, 0x00, | |
60 0x00, 0x00, 0x00, 0x00, 0x00, | |
61 0x00, 0x00, 0x00, 0x00, 0x00 | |
62 } | |
63 }; | |
64 LOCAL const T_FRAME meas_report_invalid = | |
65 { | |
66 N201_SACCH*8, | |
67 24, | |
68 { | |
69 0x00, 0x00, 0x00, | |
70 0x06, 0x15, 0x00, 0x40, 0x00, | |
71 0x00, 0x00, 0x00, 0x00, 0x00, | |
72 0x00, 0x00, 0x00, 0x00, 0x00, | |
73 0x00, 0x00, 0x00, 0x00, 0x00 | |
74 } | |
75 }; | |
76 | |
77 | |
78 /*==== FUNCTIONS ==================================================*/ | |
79 /* | |
80 +--------------------------------------------------------------------+ | |
81 | PROJECT : GSM-PS (6147) MODULE : DL_SACCH0 | | |
82 | STATE : code ROUTINE : sacch_init_dl_data | | |
83 +--------------------------------------------------------------------+ | |
84 | |
85 PURPOSE : Initialisation of SACCH data for an instance. | |
86 | |
87 */ | |
88 | |
89 GLOBAL void sacch0_init_dl_data (void) | |
90 { | |
91 GET_INSTANCE_DATA; | |
92 T_CCH *pcch = &dl_data->cch[C_SACCH0]; | |
93 TRACE_FUNCTION ("sacch_init_dl_data()"); | |
94 | |
95 memset (pcch, 0, sizeof (T_CCH)); | |
96 pcch->ch_type = L2_CHANNEL_SACCH; | |
97 | |
98 if (dl_data->dcch3_in_msg) | |
99 { | |
100 COM_FREE_POINTER (dl_data->dcch3_in_msg); | |
101 dl_data->dcch3_in_msg = NULL; | |
102 } | |
103 | |
104 sacch0_reset_meas (); | |
105 } | |
106 | |
107 /* | |
108 +--------------------------------------------------------------------+ | |
109 | PROJECT : GSM-PS (6147) MODULE : DL_SACCH0 | | |
110 | STATE : code ROUTINE : sacch0_reset_meas | | |
111 +--------------------------------------------------------------------+ | |
112 | |
113 PURPOSE : Reset measurement reports and sacch_mode. | |
114 | |
115 */ | |
116 | |
117 GLOBAL void sacch0_reset_meas (void) | |
118 { | |
119 GET_INSTANCE_DATA; | |
120 dl_data->sacch_act_buffer = meas_report_no_nc; | |
121 dl_data->sacch_last_buffer= meas_report_no_nc; | |
122 dl_data->sacch_mode = 2; | |
123 } | |
124 | |
125 /* | |
126 +--------------------------------------------------------------------+ | |
127 | PROJECT : GSM-PS (6147) MODULE : DL_SACCH0 | | |
128 | STATE : code ROUTINE : sacch_send_data | | |
129 +--------------------------------------------------------------------+ | |
130 | |
131 PURPOSE : Send unacknowledged data on SACCH, SAPI=0. | |
132 | |
133 */ | |
134 | |
135 GLOBAL void sacch0_send_data (void) | |
136 { | |
137 GET_INSTANCE_DATA; | |
138 TRACE_FUNCTION ("sacch_send_data()"); | |
139 | |
140 TRACE_EVENT_WIN_P2 ("SACCH0 MODE = %d, %s", dl_data->sacch_mode, | |
141 (dl_data->rr_short_pd_buffer.l_buf AND | |
142 dl_data->rr_short_pd_ch_type EQ L2_CHANNEL_SACCH) ? "RR short PD" : "normal"); | |
143 | |
144 if (dl_data->rr_short_pd_buffer.l_buf AND | |
145 dl_data->rr_short_pd_ch_type EQ L2_CHANNEL_SACCH) | |
146 { /* RR message with short PD, short L2 header type 1, format Bter */ | |
147 com_build_UI_Bter (L2_CHANNEL_SACCH); | |
148 } | |
149 else | |
150 { /* format A or B */ | |
151 if (dl_data->sacch_mode EQ 2) | |
152 { | |
153 com_build_UI_command (L2_CHANNEL_SACCH, PS_SAPI_0, &meas_report_invalid); | |
154 } | |
155 else | |
156 { | |
157 if (dl_data->dl_active EQ FALSE) | |
158 dl_data->sacch_last_buffer = dl_data->sacch_act_buffer; | |
159 | |
160 com_build_UI_command (L2_CHANNEL_SACCH, PS_SAPI_0, &dl_data->sacch_last_buffer); | |
161 } | |
162 if (dl_data->sacch_mode) | |
163 dl_data->sacch_mode--; | |
164 } | |
165 } | |
166 | |
167 #endif |