FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/cmh_ras.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
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 = (UBYTE)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 raShrdPrm.owner = (UBYTE)srcId; | |
119 raEntStat.entOwn = srcId; | |
120 | |
121 psaRA_Activate(); | |
122 | |
123 return( AT_EXCT ); | |
124 | |
125 } | |
126 | |
127 /* | |
128 +-------------------------------------------------------------------+ | |
129 | PROJECT : GSM-PS (6147) MODULE : CMH_RA | | |
130 | ROUTINE : cmhRA_Deactivate | | |
131 +-------------------------------------------------------------------+ | |
132 | |
133 PURPOSE : set all nescessary parameters and deactivate RA | |
134 | |
135 */ | |
136 | |
137 GLOBAL T_ACI_RETURN cmhRA_Deactivate ( void ) | |
138 { | |
139 TRACE_FUNCTION ("cmhRA_Deactivate()"); | |
140 | |
141 | |
142 /* deactivate */ | |
143 psaRA_Deactivate(); | |
144 return( AT_EXCT ); | |
145 } | |
146 | |
147 /* | |
148 +-------------------------------------------------------------------+ | |
149 | PROJECT : GSM-PS (6147) MODULE : CMH_RA | | |
150 | ROUTINE : cmhRA_Modify | | |
151 +-------------------------------------------------------------------+ | |
152 | |
153 PURPOSE : set all nescessary parameters and modify RA | |
154 | |
155 */ | |
156 | |
157 GLOBAL T_ACI_RETURN cmhRA_Modify ( T_ACI_CMD_SRC srcId, | |
158 SHORT cId ) | |
159 { | |
160 T_RA_SET_PRM * pRASetPrm; /* points to RA parameter set */ | |
161 UBYTE prmTst; /* for parameter testing */ | |
162 | |
163 TRACE_FUNCTION ("cmhRA_Modify()"); | |
164 | |
165 /* check command source */ | |
166 if(!cmh_IsVldCmdSrc (srcId)) | |
167 { | |
168 return( AT_FAIL ); | |
169 } | |
170 | |
171 pRASetPrm = &raShrdPrm.set_prm[srcId]; | |
172 | |
173 | |
174 pRASetPrm -> tra_rate = prmTst = (UBYTE)cmhRA_SelChnRate(); | |
175 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL ); | |
176 | |
177 pRASetPrm -> user_rate = prmTst = cmhRA_SelUsrRate( cId ); | |
178 if( prmTst EQ NOT_PRESENT_8BIT ) return( AT_FAIL ); | |
179 | |
180 /* modify */ | |
181 raShrdPrm.owner = srcId; | |
182 psaRA_Modify(); | |
183 return( AT_EXCT ); | |
184 } | |
185 | |
186 /* | |
187 +-------------------------------------------------------------------+ | |
188 | PROJECT : GSM-PS (6147) MODULE : CMH_RAR | | |
189 | ROUTINE : cmhRA_Escape | | |
190 +-------------------------------------------------------------------+ | |
191 | |
192 PURPOSE : Escape from data mode | |
193 | |
194 */ | |
195 | |
196 GLOBAL T_ACI_RETURN cmhRA_Escape ( void ) | |
197 { | |
198 T_OWN calOwn; | |
199 | |
200 TRACE_FUNCTION ("cmhRA_Escape()"); | |
201 | |
202 /* | |
203 *------------------------------------------------------------------- | |
204 * return to command mode | |
205 *------------------------------------------------------------------- | |
206 */ | |
207 /* io_setIoMode( IO_MODE_CMD, rCI_IoMode ); */ | |
208 | |
209 if (ccShrdPrm.ctb[raShrdPrm.cId] NEQ NULL) | |
210 calOwn = psaCC_ctb(raShrdPrm.cId)->calOwn; | |
211 else | |
212 calOwn = (T_OWN)CMD_SRC_NONE; | |
213 | |
214 R_AT( RAT_OK, (T_ACI_CMD_SRC)calOwn ) | |
215 ( AT_CMD_NONE ); | |
216 | |
217 return(AT_CMPL); | |
218 } | |
219 | |
220 /*==== EOF ========================================================*/ |