comparison gsm-fw/g23m-gsm/ss/ss.h @ 673:2f7df7a314f8

gsm-fw/g23m-gsm subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 28 Sep 2014 23:20:04 +0000
parents
children
comparison
equal deleted inserted replaced
672:0dc6f9e8e980 673:2f7df7a314f8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : SS
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 : Definitions for the Protocol Stack Entity
18 | Supplementary Services.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef SS_H
23 #define SS_H
24
25 #include <stdlib.h>
26 #include <stdio.h>
27 #if defined (TI_PS_HCOMM_CHANGE)
28 #include "cl_hComm_handle.h"
29 #endif
30 /*
31 * Definition whether a shared CCD buffer shall be used
32 */
33 #define SHARED_CCD_BUF
34
35 /* #define SS_TEST */ /* set for T() debug outputs */
36
37 #define ENCODE_OFFSET 24
38 #define PD_SS 11
39
40 #ifdef SS_TEST
41 #define T(f,v) sprintf ((char*)trc, f, v); TRACE_FUNCTION ((char*)trc)
42 #else
43 #define T(f,v) ;
44 #endif
45
46 /*
47 * Macros (common for SS and CC)
48 */
49
50 #define GET_SS_STATE(s,t) ((s>>(2*t)) & 0x03)
51 #define SET_SS_STATE(s,t,STATE) (s=(s & (~(((ULONG)0x03)<<(2*t)))) |(STATE<<(2*t)))
52
53
54 #ifdef FRAME_OFFSET_ZERO
55
56 #define GET_PD(s,p) p = s.buf[3] & 0x0F
57 #define GET_TI(s,t) t = (s.buf[3] & 0xF0) >> 4
58 #define SET_PD(s,p) s.buf[3] = (s.buf[3] & 0xF0) + p
59 #define SET_TI(s,t) s.buf[3] = (s.buf[3] & 0x0F) + (t << 4)
60
61 #else
62
63 #define GET_PD(s,p) ccd_decodeByte(s.buf, (USHORT)(s.o_buf + 4), 4, &p)
64 #define GET_TI(s,t) ccd_decodeByte(s.buf, s.o_buf, 4, &t)
65 #define SET_PD(s,p) ccd_codeByte(s.buf, (USHORT)(s.o_buf - 4), 4, p)
66 #define SET_TI(s,t) ccd_codeByte(s.buf, (USHORT)(s.o_buf - 8), 4, t)
67
68 #endif
69
70 /*
71 * States of the Suppl. Services
72 */
73 #define SS_IDLE 0
74 #define SS_CONNECTION_PENDING 1
75 #define SS_CONNECTED 2
76
77 /*
78 * limits
79 */
80 #define MAX_INST 16
81 #define MAX_SIZE_SS_MESSAGE 256
82
83 /*
84 * Length of uplink messages
85 * These are comprised of the minimum 'safe' air i/f message length
86 * according to the SS message catalogue
87 */
88 #define LEN_U_SS_REGISTER (7*8)
89 #define LEN_U_SS_RELEASE_COMPLETE (7*8)
90 #define LEN_U_SS_FACILITY (7*8)
91
92
93
94
95 /*==== TYPES ======================================================*/
96
97 typedef struct
98 {
99 BOOL est_flag;
100
101 UBYTE pd;
102 ULONG ss_state;
103 T_PRIM * prim [MAX_INST];
104 UBYTE ti;
105 UINT error;
106 } T_SS_DATA;
107
108 EXTERN T_SS_DATA ss_data_base;
109 #define GET_INSTANCE_DATA register T_SS_DATA * ss_data = &ss_data_base
110
111 /*==== EXPORT =====================================================*/
112
113
114 /*
115 * Prototypes Customer Specific Functions
116 */
117
118 /*
119 * Prototypes SS
120 */
121
122
123 /*
124 * SS Suppl. Services
125 */
126
127 /*
128 * suppl. services primitives
129 */
130
131 EXTERN void ss_init_ss_data (void);
132 EXTERN void ss_mmss_error_ind (T_MMSS_ERROR_IND *mmss_error_ind);
133 EXTERN void ss_mmss_establish_cnf (T_MMSS_ESTABLISH_CNF*mmss_establish_cnf);
134 EXTERN void ss_mmss_release_ind (T_MMSS_RELEASE_IND *mmss_release_ind);
135 EXTERN void ss_mnss_begin_req (T_MNSS_BEGIN_REQ *mnss_begin_req);
136 EXTERN void ss_mnss_end_req (T_MNSS_END_REQ *mnss_end_req);
137 EXTERN void ss_mnss_facility_req (T_MNSS_FACILITY_REQ *mnss_facility_req);
138
139
140
141 /*
142 * suppl. services signalling
143 */
144 EXTERN void ss_b_ss_rel_comp (void);
145 EXTERN void ss_d_ss_facility (void);
146 EXTERN void ss_d_ss_register (void);
147
148 /*
149 * suppl. services procedures
150 */
151 EXTERN void ss_init (void);
152 EXTERN void send_rel_comp (U8 cause);
153
154 EXTERN BOOL ss_check_critical_error(UINT ccd_err);
155 /*
156 * Formatter
157 */
158
159 /*
160 * formatter primitives
161 */
162 EXTERN void for_init_ss_data (void);
163 EXTERN void for_mmss_establish_ind (T_MMSS_ESTABLISH_IND *mmss_establish_ind);
164 EXTERN void for_mmss_data_ind (T_MMSS_DATA_IND *mmss_data_ind);
165
166 /*
167 * formatter signalling
168 */
169 EXTERN void ss_for_data_req (USHORT bit_size_message);
170
171
172 /*
173 * If all entities are linked into one module this definitions
174 * prefixes the global data with the enity name
175 */
176 #if defined (TI_PS_HCOMM_CHANGE)
177 #if defined (NEW_FRAME)
178 EXTERN T_HANDLE ss_handle;
179 #endif
180 #else /* (TI_PS_HCOMM_CHANGE) */
181 #ifdef OPTION_MULTITHREAD
182 #define hCommMM _ENTITY_PREFIXED(hCommMM)
183 #define hCommMMI _ENTITY_PREFIXED(hCommMMI)
184 #endif
185 #if defined (NEW_FRAME)
186 EXTERN T_HANDLE hCommMMI; /* MM Communication */
187 EXTERN T_HANDLE hCommMM; /* MM Communication */
188 EXTERN T_HANDLE ss_handle;
189 #else
190 EXTERN T_VSI_CHANDLE hCommMMI; /* MM Communication */
191 EXTERN T_VSI_CHANDLE hCommMM; /* MM Communication */
192 #endif
193 #endif /* (TI_PS_HCOMM_CHANGE) */
194 /*
195 * If all entities are linked into one module this definitions
196 * prefixes the global data with the enity name
197 */
198 #ifdef OPTION_MULTITHREAD
199 #define _decodedMsg _ENTITY_PREFIXED(_decodedMsg)
200 #endif
201
202 #if !defined SHARED_CCD_BUF
203 #define CCD_START
204 #define CCD_END
205 EXTERN UBYTE _decodedMsg [];
206 #else
207 EXTERN UBYTE * _decodedMsg;
208 #define CCD_START _decodedMsg = ccd_begin();
209 #define CCD_END ccd_end();
210 #endif
211
212
213
214 #endif