comparison src/aci2/aci/cmh_ras.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_RAS
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 module provides the set functions related to the
18 | protocol stack adapter for RA.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_RAS_C
23 #define CMH_RAS_C
24 #endif
25
26 #include "aci_all.h"
27 /*==== INCLUDES ===================================================*/
28 #include "aci_cmh.h"
29 #include "ati_cmd.h"
30 #include "aci_cmd.h"
31
32 #ifdef FAX_AND_DATA
33 #include "aci_fd.h"
34 #endif
35
36 #include "aci_io.h"
37
38 #include "psa.h"
39 #include "psa_ra.h"
40 #include "psa_cc.h"
41 #include "cmh.h"
42 #include "cmh_ra.h"
43
44 /*==== CONSTANTS ==================================================*/
45
46 /*==== EXPORT =====================================================*/
47
48 /*==== VARIABLES ==================================================*/
49
50 /*==== FUNCTIONS ==================================================*/
51
52 /*
53 +-------------------------------------------------------------------+
54 | PROJECT : GSM-PS (6147) MODULE : CMH_RAS |
55 | ROUTINE : cmhRA_Activate |
56 +-------------------------------------------------------------------+
57
58 PURPOSE : set all nescessary parameters and activate RA
59
60 */
61
62 GLOBAL T_ACI_RETURN cmhRA_Activate ( T_ACI_CMD_SRC srcId,
63 T_ACI_AT_CMD cmdId,
64 SHORT cId )
65 {
66 T_RA_SET_PRM * pRASetPrm; /* points to RA parameter set */
67 UBYTE prmTst; /* for parameter testing */
68
69 TRACE_FUNCTION ("cmhRA_Activate()");
70
71 /*
72 *-------------------------------------------------------------------
73 * check command source
74 *-------------------------------------------------------------------
75 */
76 if(!cmh_IsVldCmdSrc (srcId))
77
78 return( AT_FAIL );
79
80 pRASetPrm = &raShrdPrm.set_prm[srcId];
81
82 /*
83 *-------------------------------------------------------------------
84 * check entity status
85 *-------------------------------------------------------------------
86 */
87 if( raEntStat.curCmd NEQ AT_CMD_NONE )
88
89 return( AT_BUSY );
90
91 /*
92 *-------------------------------------------------------------------
93 * fill in activate parameters
94 *-------------------------------------------------------------------
95 */
96 pRASetPrm -> model = prmTst = cmhRA_SelTrfProt( cId );
97 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
98
99 pRASetPrm -> tra_rate = prmTst = cmhRA_SelChnRate();
100 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
101
102 pRASetPrm -> user_rate = prmTst = cmhRA_SelUsrRate( cId );
103 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
104
105 pRASetPrm -> ndb = prmTst = cmhRA_SelDataBits( cId );
106 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
107
108 pRASetPrm -> nsb = prmTst = cmhRA_SelStopBits( cId );
109 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
110
111 #ifdef FF_FAX
112 pRASetPrm -> bitord = prmTst = cmhRA_SelBitOrder( srcId );
113 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
114 #endif
115
116 raShrdPrm.cId = cId;
117 raEntStat.curCmd = cmdId;
118 raEntStat.entOwn = raShrdPrm.owner = srcId;
119
120 psaRA_Activate();
121
122 return( AT_EXCT );
123
124 }
125
126 /*
127 +-------------------------------------------------------------------+
128 | PROJECT : GSM-PS (6147) MODULE : CMH_RA |
129 | ROUTINE : cmhRA_Deactivate |
130 +-------------------------------------------------------------------+
131
132 PURPOSE : set all nescessary parameters and deactivate RA
133
134 */
135
136 GLOBAL T_ACI_RETURN cmhRA_Deactivate ( void )
137 {
138 TRACE_FUNCTION ("cmhRA_Deactivate()");
139
140
141 /* deactivate */
142 psaRA_Deactivate();
143 return( AT_EXCT );
144 }
145
146 /*
147 +-------------------------------------------------------------------+
148 | PROJECT : GSM-PS (6147) MODULE : CMH_RA |
149 | ROUTINE : cmhRA_Modify |
150 +-------------------------------------------------------------------+
151
152 PURPOSE : set all nescessary parameters and modify RA
153
154 */
155
156 GLOBAL T_ACI_RETURN cmhRA_Modify ( T_ACI_CMD_SRC srcId,
157 SHORT cId )
158 {
159 T_RA_SET_PRM * pRASetPrm; /* points to RA parameter set */
160 UBYTE prmTst; /* for parameter testing */
161
162 TRACE_FUNCTION ("cmhRA_Modify()");
163
164 /* check command source */
165 if(!cmh_IsVldCmdSrc (srcId))
166 {
167 return( AT_FAIL );
168 }
169
170 pRASetPrm = &raShrdPrm.set_prm[srcId];
171
172
173 pRASetPrm -> tra_rate = prmTst = cmhRA_SelChnRate();
174 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
175
176 pRASetPrm -> user_rate = prmTst = cmhRA_SelUsrRate( cId );
177 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL );
178
179 /* modify */
180 raShrdPrm.owner = srcId;
181 psaRA_Modify();
182 return( AT_EXCT );
183 }
184
185 /*
186 +-------------------------------------------------------------------+
187 | PROJECT : GSM-PS (6147) MODULE : CMH_RAR |
188 | ROUTINE : cmhRA_Escape |
189 +-------------------------------------------------------------------+
190
191 PURPOSE : Escape from data mode
192
193 */
194
195 GLOBAL T_ACI_RETURN cmhRA_Escape ( void )
196 {
197 T_OWN calOwn;
198
199 TRACE_FUNCTION ("cmhRA_Escape()");
200
201 /*
202 *-------------------------------------------------------------------
203 * return to command mode
204 *-------------------------------------------------------------------
205 */
206 /* io_setIoMode( IO_MODE_CMD, rCI_IoMode ); */
207
208 if (ccShrdPrm.ctb[raShrdPrm.cId] NEQ NULL)
209 calOwn = psaCC_ctb(raShrdPrm.cId)->calOwn;
210 else
211 calOwn = OWN_NONE;
212
213 R_AT( RAT_OK, calOwn )
214 ( AT_CMD_NONE );
215
216 return 0;
217 }
218
219 /*==== EOF ========================================================*/