annotate gsm-fw/ccd/gsm5_v.c @ 924:aac4d4b15d2f

gsm-fw: static DSP patch download enabled by default
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Mon, 19 Oct 2015 18:14:23 +0000
parents 970d6199f2c5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
648
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 | Project :
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 | Modul : gsm5_v.c
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 | All rights reserved.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 |
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 | Instruments Berlin, AG
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 | Purpose : Definition of encoding and decoding functions for GSM5_V elements
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 +-----------------------------------------------------------------------------
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 * standard definitions like GLOBAL, UCHAR, ERROR etc.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 #include "typedefs.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 #include "header.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 * Prototypes of ccd (USE_DRIVER EQ undef) for prototypes only
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 * look at ccdapi.h
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 #undef USE_DRIVER
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 #include "ccdapi.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 * Types and functions for bit access and manipulation
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 #include "ccd_globs.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 #include "bitfun.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 * Prototypes of ccd internal functions
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 #include "ccd.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 * Declaration of coder/decoder tables
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 #include "ccdtable.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 #include "ccddata.h"
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 #ifndef RUN_INT_RAM
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 +--------------------------------------------------------------------+
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 | PROJECT : CCD (6144) MODULE : CDC_GSM |
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 | STATE : code ROUTINE : cdc_gsm5v_decode |
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 +--------------------------------------------------------------------+
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 PURPOSE : Decoding of the GSM Type 5V element. This element
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 consists of the not decoded bits of the bitstream.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 In the target C-structure this element is a bitbuffer
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 (T_xxx_BUF) in wich the bitstream content are written.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 SHORT cdc_gsm5v_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 #ifdef DEBUG_CCD
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 #ifndef CCD_SYMBOLS
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 TRACE_CCD (globs, "cdc_gsm5v_decode()");
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 #else
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 TRACE_CCD (globs, "cdc_gsm5v_decode() %s", ccddata_get_alias((USHORT) e_ref, 1));
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 #endif
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 #endif
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 if (globs->bitpos >= globs->buflen)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 return 1;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 else
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 ULONG cix_ref;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 cix_ref = melem[e_ref].calcIdxRef;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 * if this element is conditional, check the condition
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 if (calcidx[cix_ref].numCondCalcs NEQ 0
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 AND ! ccd_conditionOK (e_ref, globs))
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 return 1;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 else
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 ULONG bits_to_read;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 ULONG num_prolog_steps, prolog_step_ref;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 num_prolog_steps = calcidx[cix_ref].numPrologSteps;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 prolog_step_ref = calcidx[cix_ref].prologStepRef;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 /* If there is a prologue given for this element, process it. */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 if (num_prolog_steps)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 ccd_performOperations (num_prolog_steps, prolog_step_ref, globs);
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 * Setup the offset into the C-structure for this element
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 globs->pstructOffs = melem[e_ref].structOffs;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 if (melem[e_ref].optional)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 * for optional elements set the valid-flag in the C-struct.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 globs->pstruct[globs->pstructOffs++] = TRUE;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 if (globs->maxBitpos < globs->buflen - 16*globs->numEOCPending)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 ccd_recordFault (globs, ERR_LEN_MISMATCH, CONTINUE, (USHORT) e_ref,
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 globs->pstruct + globs->pstructOffs);
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 bits_to_read = (ULONG)(globs->buflen - globs->bitpos - 16*globs->numEOCPending);
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 bf_readBitChunk (bits_to_read, globs);
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 return 1;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 #endif /* !RUN_INT_RAM */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 #ifndef RUN_INT_RAM
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 +--------------------------------------------------------------------+
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 | PROJECT : CCD (6144) MODULE : CDC_GSM |
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 | STATE : code ROUTINE : cdc_gsm5v_encode |
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 +--------------------------------------------------------------------+
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 PURPOSE : Encoding of the GSM Type 5V element. This element
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 consists of the not decoded bits of the bitstream.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 In the target C-structure this element is a bitbuffer
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 (T_xxx_BUF) from wich the bitstream content is read.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 SHORT cdc_gsm5v_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 ULONG cix_ref, num_prolog_steps, prolog_step_ref;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 #ifdef DEBUG_CCD
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 #ifndef CCD_SYMBOLS
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 TRACE_CCD (globs, "cdc_gsm5v_encode()");
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 #else
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 TRACE_CCD (globs, "cdc_gsm5v_encode() %s", ccddata_get_alias((USHORT) e_ref, 1));
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 #endif
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 #endif
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 cix_ref = melem[e_ref].calcIdxRef;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 num_prolog_steps = calcidx[cix_ref].numPrologSteps;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 prolog_step_ref = calcidx[cix_ref].prologStepRef;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 * if this element is conditional, check the condition
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 if (calcidx[cix_ref].numCondCalcs NEQ 0
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 AND ! ccd_conditionOK (e_ref, globs))
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 return 1;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 * if this element have a defined Prolog
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 * we have to process it before decoding the bitstream
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 if (num_prolog_steps)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 ccd_performOperations (num_prolog_steps, prolog_step_ref, globs);
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 * Setup the offset into the C-structure for this element
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 globs->pstructOffs = melem[e_ref].structOffs;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 if (melem[e_ref].optional)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 /*
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 * for optional elements check the valid-flag in the C-struct.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 * Spare elements does not have a corresponding valid flag.
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 */
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 if (globs->pstruct[globs->pstructOffs++] == FALSE)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 return 1;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 #ifdef DEBUG_CCD
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198 else if (globs->pstruct [melem[e_ref].structOffs] != TRUE)
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 {
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200 TRACE_CCD (globs, "Ambiguous value for valid flag!\n...assumed 1 for ccdID=%d",
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 e_ref);
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203 #endif
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206 bf_writeBitChunk (mvar[melem[e_ref].elemRef].bSize, globs);
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 return 1;
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 }
970d6199f2c5 gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210 #endif /* !RUN_INT_RAM */