gsm_print.c 4.8 KB

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