comparison intercom/gsm/gsm_deco.c @ 2:13be24d74cd2

import intercom-0.4.1
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 09:57:52 +0200
parents
children
comparison
equal deleted inserted replaced
1:9cadc470e3da 2:13be24d74cd2
1 /*
2 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
3 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
4 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
5 */
6
7 /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_decode.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */
8
9 #include "private.h"
10
11 #include "gsm.h"
12 #include "proto.h"
13
14 int gsm_decode P3((s, c, target), gsm s, gsm_byte * c,
15 gsm_signal * target)
16 {
17 word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13 * 4];
18
19 /* GSM_MAGIC = (*c >> 4) & 0xF; */
20
21 if (((*c >> 4) & 0x0F) != GSM_MAGIC)
22 return -1;
23
24 LARc[0] = (*c++ & 0xF) << 2; /* 1 */
25 LARc[0] |= (*c >> 6) & 0x3;
26 LARc[1] = *c++ & 0x3F;
27 LARc[2] = (*c >> 3) & 0x1F;
28 LARc[3] = (*c++ & 0x7) << 2;
29 LARc[3] |= (*c >> 6) & 0x3;
30 LARc[4] = (*c >> 2) & 0xF;
31 LARc[5] = (*c++ & 0x3) << 2;
32 LARc[5] |= (*c >> 6) & 0x3;
33 LARc[6] = (*c >> 3) & 0x7;
34 LARc[7] = *c++ & 0x7;
35 Nc[0] = (*c >> 1) & 0x7F;
36 bc[0] = (*c++ & 0x1) << 1;
37 bc[0] |= (*c >> 7) & 0x1;
38 Mc[0] = (*c >> 5) & 0x3;
39 xmaxc[0] = (*c++ & 0x1F) << 1;
40 xmaxc[0] |= (*c >> 7) & 0x1;
41 xmc[0] = (*c >> 4) & 0x7;
42 xmc[1] = (*c >> 1) & 0x7;
43 xmc[2] = (*c++ & 0x1) << 2;
44 xmc[2] |= (*c >> 6) & 0x3;
45 xmc[3] = (*c >> 3) & 0x7;
46 xmc[4] = *c++ & 0x7;
47 xmc[5] = (*c >> 5) & 0x7;
48 xmc[6] = (*c >> 2) & 0x7;
49 xmc[7] = (*c++ & 0x3) << 1; /* 10 */
50 xmc[7] |= (*c >> 7) & 0x1;
51 xmc[8] = (*c >> 4) & 0x7;
52 xmc[9] = (*c >> 1) & 0x7;
53 xmc[10] = (*c++ & 0x1) << 2;
54 xmc[10] |= (*c >> 6) & 0x3;
55 xmc[11] = (*c >> 3) & 0x7;
56 xmc[12] = *c++ & 0x7;
57 Nc[1] = (*c >> 1) & 0x7F;
58 bc[1] = (*c++ & 0x1) << 1;
59 bc[1] |= (*c >> 7) & 0x1;
60 Mc[1] = (*c >> 5) & 0x3;
61 xmaxc[1] = (*c++ & 0x1F) << 1;
62 xmaxc[1] |= (*c >> 7) & 0x1;
63 xmc[13] = (*c >> 4) & 0x7;
64 xmc[14] = (*c >> 1) & 0x7;
65 xmc[15] = (*c++ & 0x1) << 2;
66 xmc[15] |= (*c >> 6) & 0x3;
67 xmc[16] = (*c >> 3) & 0x7;
68 xmc[17] = *c++ & 0x7;
69 xmc[18] = (*c >> 5) & 0x7;
70 xmc[19] = (*c >> 2) & 0x7;
71 xmc[20] = (*c++ & 0x3) << 1;
72 xmc[20] |= (*c >> 7) & 0x1;
73 xmc[21] = (*c >> 4) & 0x7;
74 xmc[22] = (*c >> 1) & 0x7;
75 xmc[23] = (*c++ & 0x1) << 2;
76 xmc[23] |= (*c >> 6) & 0x3;
77 xmc[24] = (*c >> 3) & 0x7;
78 xmc[25] = *c++ & 0x7;
79 Nc[2] = (*c >> 1) & 0x7F;
80 bc[2] = (*c++ & 0x1) << 1; /* 20 */
81 bc[2] |= (*c >> 7) & 0x1;
82 Mc[2] = (*c >> 5) & 0x3;
83 xmaxc[2] = (*c++ & 0x1F) << 1;
84 xmaxc[2] |= (*c >> 7) & 0x1;
85 xmc[26] = (*c >> 4) & 0x7;
86 xmc[27] = (*c >> 1) & 0x7;
87 xmc[28] = (*c++ & 0x1) << 2;
88 xmc[28] |= (*c >> 6) & 0x3;
89 xmc[29] = (*c >> 3) & 0x7;
90 xmc[30] = *c++ & 0x7;
91 xmc[31] = (*c >> 5) & 0x7;
92 xmc[32] = (*c >> 2) & 0x7;
93 xmc[33] = (*c++ & 0x3) << 1;
94 xmc[33] |= (*c >> 7) & 0x1;
95 xmc[34] = (*c >> 4) & 0x7;
96 xmc[35] = (*c >> 1) & 0x7;
97 xmc[36] = (*c++ & 0x1) << 2;
98 xmc[36] |= (*c >> 6) & 0x3;
99 xmc[37] = (*c >> 3) & 0x7;
100 xmc[38] = *c++ & 0x7;
101 Nc[3] = (*c >> 1) & 0x7F;
102 bc[3] = (*c++ & 0x1) << 1;
103 bc[3] |= (*c >> 7) & 0x1;
104 Mc[3] = (*c >> 5) & 0x3;
105 xmaxc[3] = (*c++ & 0x1F) << 1;
106 xmaxc[3] |= (*c >> 7) & 0x1;
107 xmc[39] = (*c >> 4) & 0x7;
108 xmc[40] = (*c >> 1) & 0x7;
109 xmc[41] = (*c++ & 0x1) << 2;
110 xmc[41] |= (*c >> 6) & 0x3;
111 xmc[42] = (*c >> 3) & 0x7;
112 xmc[43] = *c++ & 0x7; /* 30 */
113 xmc[44] = (*c >> 5) & 0x7;
114 xmc[45] = (*c >> 2) & 0x7;
115 xmc[46] = (*c++ & 0x3) << 1;
116 xmc[46] |= (*c >> 7) & 0x1;
117 xmc[47] = (*c >> 4) & 0x7;
118 xmc[48] = (*c >> 1) & 0x7;
119 xmc[49] = (*c++ & 0x1) << 2;
120 xmc[49] |= (*c >> 6) & 0x3;
121 xmc[50] = (*c >> 3) & 0x7;
122 xmc[51] = *c & 0x7; /* 33 */
123
124 Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target);
125
126 return 0;
127 }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.