1*8ec969ceSTreehugger Robot /* 2*8ec969ceSTreehugger Robot * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3*8ec969ceSTreehugger Robot * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4*8ec969ceSTreehugger Robot * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5*8ec969ceSTreehugger Robot */ 6*8ec969ceSTreehugger Robot 7*8ec969ceSTreehugger Robot /* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_print.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ 8*8ec969ceSTreehugger Robot 9*8ec969ceSTreehugger Robot #include <stdio.h> 10*8ec969ceSTreehugger Robot 11*8ec969ceSTreehugger Robot #include "private.h" 12*8ec969ceSTreehugger Robot 13*8ec969ceSTreehugger Robot #include "gsm.h" 14*8ec969ceSTreehugger Robot #include "proto.h" 15*8ec969ceSTreehugger Robot 16*8ec969ceSTreehugger Robot int gsm_print P3((f, s, c), FILE * f, gsm s, gsm_byte * c) 17*8ec969ceSTreehugger Robot { 18*8ec969ceSTreehugger Robot word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; 19*8ec969ceSTreehugger Robot 20*8ec969ceSTreehugger Robot /* GSM_MAGIC = (*c >> 4) & 0xF; */ 21*8ec969ceSTreehugger Robot 22*8ec969ceSTreehugger Robot if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1; 23*8ec969ceSTreehugger Robot 24*8ec969ceSTreehugger Robot LARc[0] = (*c++ & 0xF) << 2; /* 1 */ 25*8ec969ceSTreehugger Robot LARc[0] |= (*c >> 6) & 0x3; 26*8ec969ceSTreehugger Robot LARc[1] = *c++ & 0x3F; 27*8ec969ceSTreehugger Robot LARc[2] = (*c >> 3) & 0x1F; 28*8ec969ceSTreehugger Robot LARc[3] = (*c++ & 0x7) << 2; 29*8ec969ceSTreehugger Robot LARc[3] |= (*c >> 6) & 0x3; 30*8ec969ceSTreehugger Robot LARc[4] = (*c >> 2) & 0xF; 31*8ec969ceSTreehugger Robot LARc[5] = (*c++ & 0x3) << 2; 32*8ec969ceSTreehugger Robot LARc[5] |= (*c >> 6) & 0x3; 33*8ec969ceSTreehugger Robot LARc[6] = (*c >> 3) & 0x7; 34*8ec969ceSTreehugger Robot LARc[7] = *c++ & 0x7; 35*8ec969ceSTreehugger Robot 36*8ec969ceSTreehugger Robot 37*8ec969ceSTreehugger Robot Nc[0] = (*c >> 1) & 0x7F; 38*8ec969ceSTreehugger Robot bc[0] = (*c++ & 0x1) << 1; 39*8ec969ceSTreehugger Robot bc[0] |= (*c >> 7) & 0x1; 40*8ec969ceSTreehugger Robot Mc[0] = (*c >> 5) & 0x3; 41*8ec969ceSTreehugger Robot xmaxc[0] = (*c++ & 0x1F) << 1; 42*8ec969ceSTreehugger Robot xmaxc[0] |= (*c >> 7) & 0x1; 43*8ec969ceSTreehugger Robot xmc[0] = (*c >> 4) & 0x7; 44*8ec969ceSTreehugger Robot xmc[1] = (*c >> 1) & 0x7; 45*8ec969ceSTreehugger Robot xmc[2] = (*c++ & 0x1) << 2; 46*8ec969ceSTreehugger Robot xmc[2] |= (*c >> 6) & 0x3; 47*8ec969ceSTreehugger Robot xmc[3] = (*c >> 3) & 0x7; 48*8ec969ceSTreehugger Robot xmc[4] = *c++ & 0x7; 49*8ec969ceSTreehugger Robot xmc[5] = (*c >> 5) & 0x7; 50*8ec969ceSTreehugger Robot xmc[6] = (*c >> 2) & 0x7; 51*8ec969ceSTreehugger Robot xmc[7] = (*c++ & 0x3) << 1; /* 10 */ 52*8ec969ceSTreehugger Robot xmc[7] |= (*c >> 7) & 0x1; 53*8ec969ceSTreehugger Robot xmc[8] = (*c >> 4) & 0x7; 54*8ec969ceSTreehugger Robot xmc[9] = (*c >> 1) & 0x7; 55*8ec969ceSTreehugger Robot xmc[10] = (*c++ & 0x1) << 2; 56*8ec969ceSTreehugger Robot xmc[10] |= (*c >> 6) & 0x3; 57*8ec969ceSTreehugger Robot xmc[11] = (*c >> 3) & 0x7; 58*8ec969ceSTreehugger Robot xmc[12] = *c++ & 0x7; 59*8ec969ceSTreehugger Robot 60*8ec969ceSTreehugger Robot Nc[1] = (*c >> 1) & 0x7F; 61*8ec969ceSTreehugger Robot bc[1] = (*c++ & 0x1) << 1; 62*8ec969ceSTreehugger Robot bc[1] |= (*c >> 7) & 0x1; 63*8ec969ceSTreehugger Robot Mc[1] = (*c >> 5) & 0x3; 64*8ec969ceSTreehugger Robot xmaxc[1] = (*c++ & 0x1F) << 1; 65*8ec969ceSTreehugger Robot xmaxc[1] |= (*c >> 7) & 0x1; 66*8ec969ceSTreehugger Robot xmc[13] = (*c >> 4) & 0x7; 67*8ec969ceSTreehugger Robot xmc[14] = (*c >> 1) & 0x7; 68*8ec969ceSTreehugger Robot xmc[15] = (*c++ & 0x1) << 2; 69*8ec969ceSTreehugger Robot xmc[15] |= (*c >> 6) & 0x3; 70*8ec969ceSTreehugger Robot xmc[16] = (*c >> 3) & 0x7; 71*8ec969ceSTreehugger Robot xmc[17] = *c++ & 0x7; 72*8ec969ceSTreehugger Robot xmc[18] = (*c >> 5) & 0x7; 73*8ec969ceSTreehugger Robot xmc[19] = (*c >> 2) & 0x7; 74*8ec969ceSTreehugger Robot xmc[20] = (*c++ & 0x3) << 1; 75*8ec969ceSTreehugger Robot xmc[20] |= (*c >> 7) & 0x1; 76*8ec969ceSTreehugger Robot xmc[21] = (*c >> 4) & 0x7; 77*8ec969ceSTreehugger Robot xmc[22] = (*c >> 1) & 0x7; 78*8ec969ceSTreehugger Robot xmc[23] = (*c++ & 0x1) << 2; 79*8ec969ceSTreehugger Robot xmc[23] |= (*c >> 6) & 0x3; 80*8ec969ceSTreehugger Robot xmc[24] = (*c >> 3) & 0x7; 81*8ec969ceSTreehugger Robot xmc[25] = *c++ & 0x7; 82*8ec969ceSTreehugger Robot 83*8ec969ceSTreehugger Robot 84*8ec969ceSTreehugger Robot Nc[2] = (*c >> 1) & 0x7F; 85*8ec969ceSTreehugger Robot bc[2] = (*c++ & 0x1) << 1; /* 20 */ 86*8ec969ceSTreehugger Robot bc[2] |= (*c >> 7) & 0x1; 87*8ec969ceSTreehugger Robot Mc[2] = (*c >> 5) & 0x3; 88*8ec969ceSTreehugger Robot xmaxc[2] = (*c++ & 0x1F) << 1; 89*8ec969ceSTreehugger Robot xmaxc[2] |= (*c >> 7) & 0x1; 90*8ec969ceSTreehugger Robot xmc[26] = (*c >> 4) & 0x7; 91*8ec969ceSTreehugger Robot xmc[27] = (*c >> 1) & 0x7; 92*8ec969ceSTreehugger Robot xmc[28] = (*c++ & 0x1) << 2; 93*8ec969ceSTreehugger Robot xmc[28] |= (*c >> 6) & 0x3; 94*8ec969ceSTreehugger Robot xmc[29] = (*c >> 3) & 0x7; 95*8ec969ceSTreehugger Robot xmc[30] = *c++ & 0x7; 96*8ec969ceSTreehugger Robot xmc[31] = (*c >> 5) & 0x7; 97*8ec969ceSTreehugger Robot xmc[32] = (*c >> 2) & 0x7; 98*8ec969ceSTreehugger Robot xmc[33] = (*c++ & 0x3) << 1; 99*8ec969ceSTreehugger Robot xmc[33] |= (*c >> 7) & 0x1; 100*8ec969ceSTreehugger Robot xmc[34] = (*c >> 4) & 0x7; 101*8ec969ceSTreehugger Robot xmc[35] = (*c >> 1) & 0x7; 102*8ec969ceSTreehugger Robot xmc[36] = (*c++ & 0x1) << 2; 103*8ec969ceSTreehugger Robot xmc[36] |= (*c >> 6) & 0x3; 104*8ec969ceSTreehugger Robot xmc[37] = (*c >> 3) & 0x7; 105*8ec969ceSTreehugger Robot xmc[38] = *c++ & 0x7; 106*8ec969ceSTreehugger Robot 107*8ec969ceSTreehugger Robot Nc[3] = (*c >> 1) & 0x7F; 108*8ec969ceSTreehugger Robot bc[3] = (*c++ & 0x1) << 1; 109*8ec969ceSTreehugger Robot bc[3] |= (*c >> 7) & 0x1; 110*8ec969ceSTreehugger Robot Mc[3] = (*c >> 5) & 0x3; 111*8ec969ceSTreehugger Robot xmaxc[3] = (*c++ & 0x1F) << 1; 112*8ec969ceSTreehugger Robot xmaxc[3] |= (*c >> 7) & 0x1; 113*8ec969ceSTreehugger Robot 114*8ec969ceSTreehugger Robot xmc[39] = (*c >> 4) & 0x7; 115*8ec969ceSTreehugger Robot xmc[40] = (*c >> 1) & 0x7; 116*8ec969ceSTreehugger Robot xmc[41] = (*c++ & 0x1) << 2; 117*8ec969ceSTreehugger Robot xmc[41] |= (*c >> 6) & 0x3; 118*8ec969ceSTreehugger Robot xmc[42] = (*c >> 3) & 0x7; 119*8ec969ceSTreehugger Robot xmc[43] = *c++ & 0x7; /* 30 */ 120*8ec969ceSTreehugger Robot xmc[44] = (*c >> 5) & 0x7; 121*8ec969ceSTreehugger Robot xmc[45] = (*c >> 2) & 0x7; 122*8ec969ceSTreehugger Robot xmc[46] = (*c++ & 0x3) << 1; 123*8ec969ceSTreehugger Robot xmc[46] |= (*c >> 7) & 0x1; 124*8ec969ceSTreehugger Robot xmc[47] = (*c >> 4) & 0x7; 125*8ec969ceSTreehugger Robot xmc[48] = (*c >> 1) & 0x7; 126*8ec969ceSTreehugger Robot xmc[49] = (*c++ & 0x1) << 2; 127*8ec969ceSTreehugger Robot xmc[49] |= (*c >> 6) & 0x3; 128*8ec969ceSTreehugger Robot xmc[50] = (*c >> 3) & 0x7; 129*8ec969ceSTreehugger Robot xmc[51] = *c & 0x7; /* 33 */ 130*8ec969ceSTreehugger Robot 131*8ec969ceSTreehugger Robot fprintf(f, 132*8ec969ceSTreehugger Robot "LARc:\t%2.2d %2.2d %2.2d %2.2d %2.2d %2.2d %2.2d %2.2d\n", 133*8ec969ceSTreehugger Robot LARc[0],LARc[1],LARc[2],LARc[3],LARc[4],LARc[5],LARc[6],LARc[7]); 134*8ec969ceSTreehugger Robot 135*8ec969ceSTreehugger Robot fprintf(f, "#1: Nc %4.4d bc %d Mc %d xmaxc %d\n", 136*8ec969ceSTreehugger Robot Nc[0], bc[0], Mc[0], xmaxc[0]); 137*8ec969ceSTreehugger Robot fprintf(f, 138*8ec969ceSTreehugger Robot "\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", 139*8ec969ceSTreehugger Robot xmc[0],xmc[1],xmc[2],xmc[3],xmc[4],xmc[5],xmc[6], 140*8ec969ceSTreehugger Robot xmc[7],xmc[8],xmc[9],xmc[10],xmc[11],xmc[12] ); 141*8ec969ceSTreehugger Robot 142*8ec969ceSTreehugger Robot fprintf(f, "#2: Nc %4.4d bc %d Mc %d xmaxc %d\n", 143*8ec969ceSTreehugger Robot Nc[1], bc[1], Mc[1], xmaxc[1]); 144*8ec969ceSTreehugger Robot fprintf(f, 145*8ec969ceSTreehugger Robot "\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", 146*8ec969ceSTreehugger Robot xmc[13+0],xmc[13+1],xmc[13+2],xmc[13+3],xmc[13+4],xmc[13+5], 147*8ec969ceSTreehugger Robot xmc[13+6], xmc[13+7],xmc[13+8],xmc[13+9],xmc[13+10],xmc[13+11], 148*8ec969ceSTreehugger Robot xmc[13+12] ); 149*8ec969ceSTreehugger Robot 150*8ec969ceSTreehugger Robot fprintf(f, "#3: Nc %4.4d bc %d Mc %d xmaxc %d\n", 151*8ec969ceSTreehugger Robot Nc[2], bc[2], Mc[2], xmaxc[2]); 152*8ec969ceSTreehugger Robot fprintf(f, 153*8ec969ceSTreehugger Robot "\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", 154*8ec969ceSTreehugger Robot xmc[26+0],xmc[26+1],xmc[26+2],xmc[26+3],xmc[26+4],xmc[26+5], 155*8ec969ceSTreehugger Robot xmc[26+6], xmc[26+7],xmc[26+8],xmc[26+9],xmc[26+10],xmc[26+11], 156*8ec969ceSTreehugger Robot xmc[26+12] ); 157*8ec969ceSTreehugger Robot 158*8ec969ceSTreehugger Robot fprintf(f, "#4: Nc %4.4d bc %d Mc %d xmaxc %d\n", 159*8ec969ceSTreehugger Robot Nc[3], bc[3], Mc[3], xmaxc[3]); 160*8ec969ceSTreehugger Robot fprintf(f, 161*8ec969ceSTreehugger Robot "\t%.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d %.2d\n", 162*8ec969ceSTreehugger Robot xmc[39+0],xmc[39+1],xmc[39+2],xmc[39+3],xmc[39+4],xmc[39+5], 163*8ec969ceSTreehugger Robot xmc[39+6], xmc[39+7],xmc[39+8],xmc[39+9],xmc[39+10],xmc[39+11], 164*8ec969ceSTreehugger Robot xmc[39+12] ); 165*8ec969ceSTreehugger Robot 166*8ec969ceSTreehugger Robot return 0; 167*8ec969ceSTreehugger Robot } 168