comparison src/g23m-fad/t30/t30_bcss.c @ 174:90eb61ecd093

src/g23m-fad: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2016 05:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
173:bf64d785238a 174:90eb61ecd093
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-F&D (8411)
4 | Modul : t30_bcss
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 processing
18 | of incomming signals for the component T30
19 | of the mobile station
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef T30_BCSS_C
24 #define T30_BCSS_C
25 #endif
26
27 #define ENTITY_T30
28
29 /*==== INCLUDES ===================================================*/
30
31 #include <string.h>
32 #include <stdlib.h>
33 #include <stddef.h>
34 #include "typedefs.h"
35 #include "pcm.h"
36 #include "vsi.h"
37 #include "macdef.h"
38 #include "pconst.cdg"
39 #include "mconst.cdg"
40 #include "message.h"
41 #include "ccdapi.h"
42 #include "custom.h"
43 #include "gsm.h"
44 #include "prim.h"
45 #include "cnf_t30.h"
46 #include "mon_t30.h"
47 #include "pei.h"
48 #include "tok.h"
49 #include "dti.h" /* functionality of the dti library */
50 #include "t30.h"
51
52 /*==== CONST =======================================================*/
53
54 /*==== TYPES =======================================================*/
55
56 /*==== VAR EXPORT ==================================================*/
57
58 /*==== VAR LOCAL ===================================================*/
59
60 /*==== FUNCTIONS ===================================================*/
61
62 /*
63 +--------------------------------------------------------------------+
64 | PROJECT : GSM-F&D (8411) MODULE : T30_BCSF |
65 | STATE : code ROUTINE : bcs_encode |
66 +--------------------------------------------------------------------+
67
68 PURPOSE : This function encodes an HDLC frame.
69 */
70
71 LOCAL UBYTE bcs_encode(void)
72 {
73 SHORT ret;
74 T_sdu *BCI_stream = (T_sdu*)t30_data->BCI_stream;
75
76 BCI_stream->o_buf = 16;
77 BCI_stream->l_buf = BIT_STREAM_LEN_BYT * 8;
78
79 ret = ccd_codeMsg(CCDENT_T30, UPLINK, (T_MSGBUF*)BCI_stream, _decodedMsg, HDLC_ADDR);
80
81 if (ret EQ ccdError)
82 {
83 TRACE_EVENT ("ERROR: ccd_encode") ;
84 }
85
86 #ifdef _SIMULATION_ /* show contents of buffer */
87 if (t30_data->test_mode & TST_BUF)
88 {
89 if (ret EQ ccdOK)
90 {
91 ker_debug("ccd_encode", &BCI_stream->buf[3], (USHORT)(BCI_stream->l_buf >> 3));
92 }
93 }
94 #endif
95
96 return ((ret EQ ccdError) ? CCD_ERR : CCD_OK);
97 }
98
99 /*
100 +--------------------------------------------------------------------+
101 | PROJECT : GSM-F&D (8411) MODULE : T30_BCSS |
102 | STATE : code ROUTINE : sig_ker_bcs_bdat_req|
103 +--------------------------------------------------------------------+
104
105 PURPOSE : Process signal BDAT_REQ received from process KER.
106 The received bcs_data is encoded and collected.
107 */
108
109 GLOBAL void sig_ker_bcs_bdat_req (UBYTE final)
110 {
111 T_FAD_DATA_REQ *fad_data_req_fin;
112
113 TRACE_FUNCTION ("sig_ker_bcs_bdat_req()");
114
115 if (t30_data->fad_data_req EQ NULL)
116 {
117 PALLOC_SDU (fad_data_req, FAD_DATA_REQ, BCS_FRM_SIZE_BITS);
118 memset (fad_data_req, 0, sizeof (T_FAD_DATA_REQ));
119 t30_data->fad_data_req = fad_data_req;
120 t30_data->stuff_bits = 8;
121 }
122 else
123 bcs_bcs_encode(CTL_C0, FINAL_NO);
124
125 switch (bcs_encode())
126 {
127 case CCD_OK:
128 if (!final)
129 return;
130
131 bcs_bcs_encode (CTL_C8, FINAL_YES);
132 fad_data_req_fin = t30_data->fad_data_req;
133 t30_data->fad_data_req = NULL;
134 fad_data_req_fin->final = TRUE;
135 fad_data_req_fin->trans_rate = R_BCS;
136 sig_bcs_mux_bcs_req(fad_data_req_fin);
137 break;
138
139 case CCD_ERR:
140 PFREE (t30_data->fad_data_req);
141 t30_data->fad_data_req = NULL;
142 snd_error_ind(ERR_CCD_ENC);
143 break;
144 }
145 }
146
147 /*
148 +--------------------------------------------------------------------+
149 | PROJECT : GSM-F&D (8411) MODULE : T30_BCSS |
150 | STATE : code ROUTINE : sig_mux_bcs_bcs_ind |
151 +--------------------------------------------------------------------+
152
153 PURPOSE : Process signal BCS_IND received from process MUX.
154 The received bcs_data is collected, destuffed and
155 decoded. The decoded data is sent to the kernel.
156 */
157
158 GLOBAL void sig_mux_bcs_bcs_ind (T_FAD_DATA_IND *fad_data_ind)
159 {
160 TRACE_FUNCTION ("sig_mux_bcs_bcs_ind()");
161
162 switch (bcs_fill_bcs_frm(fad_data_ind))
163 {
164 case BCS_FRM_FILLING:
165 return;
166
167 case BCS_FRM_FILLED:
168 bcs_bcs_decode();
169 break;
170
171 case BCS_FRM_FULL:
172 sig_bcs_ker_err_ind(ERR_BUF_FULL);
173 break;
174 }
175
176 memset (t30_data->bcs_frm, 0, BCS_FRM_SIZE);
177 }
178
179