astyle --recursive --indent=spaces=2 --style=kr --indent-col1-comments --break-blocks --convert-tabs --max-code-length=200

This is done for better merging branch/LG_PRE_RELEASE_0.3 into trunk (same process is applied on this branch)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7073 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Lionel Gauthier
2015-04-09 09:29:12 +00:00
parent f0a8a0b3b5
commit 059a0a3fdc
2044 changed files with 1182666 additions and 1145123 deletions
+105 -85
View File
@@ -1,5 +1,5 @@
/*******************************************************************************
OpenAirInterface
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
@@ -14,28 +14,28 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/* file: ccoding_byte.c
purpose: Encoding routines for implementing 802.11 convolutionally-coded waveforms
purpose: Encoding routines for implementing 802.11 convolutionally-coded waveforms
author: raymond.knopp@eurecom.fr, based on similar code for 3GPP convolutional code (UMTS) by P. Humblet (2000)
date: 10.2004
date: 10.2004
*/
#include "defs.h"
unsigned short gdot11[] = { 0133, 0171 }; // {A,B}
unsigned short gdot11_rev[] = { 0155, 0117 }; // {A,B}
unsigned short gdot11_rev[] = { 0155, 0117 }; // {A,B}
unsigned char ccodedot11_table[128];
unsigned char ccodedot11_table_rev[128];
@@ -51,10 +51,10 @@ unsigned char ccodedot11_table_rev[128];
void
ccodedot11_encode (unsigned int numbytes,
unsigned char *inPtr,
unsigned char *outPtr,
unsigned char puncturing)
ccodedot11_encode (unsigned int numbytes,
unsigned char *inPtr,
unsigned char *outPtr,
unsigned char puncturing)
{
unsigned int state;
@@ -70,13 +70,14 @@ ccodedot11_encode (unsigned int numbytes,
/* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */
state = 0;
#ifdef DEBUG_CCODE
dummy = 0;
#endif //DEBUG_CCODE
/* Do not increment inPtr until we read the next octet */
bit_index=0;
while (numbytes-- > 0) {
c = *inPtr++;
#ifdef DEBUG_CCODE
@@ -84,94 +85,106 @@ ccodedot11_encode (unsigned int numbytes,
#endif //DEBUG_CCODE
switch (puncturing) {
case 0: //rate 1/2
for (shiftbit = 0; shiftbit<8;shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0){
state |= 64;
}
out = ccodedot11_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
case 0: //rate 1/2
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodedot11_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
#endif //DEBUG_CCODE
}
break;
case 1: // rate 3/4
for (shiftbit = 0; shiftbit<8;shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0){
state |= 64;
}
out = ccodedot11_table[state];
if (bit_index<2)
*outPtr++ = out & 1;
if (bit_index!=1)
*outPtr++ = (out>>1)&1;
}
break;
case 1: // rate 3/4
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodedot11_table[state];
if (bit_index<2)
*outPtr++ = out & 1;
if (bit_index!=1)
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
#endif //DEBUG_CCODE
bit_index=(bit_index==2)?0:(bit_index+1);
}
break;
case 2: // rate 2/3
for (shiftbit = 0; shiftbit<8;shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0){
state |= 64;
}
out = ccodedot11_table[state];
*outPtr++ = out & 1;
if (bit_index==0)
*outPtr++ = (out>>1)&1;
bit_index=(bit_index==2)?0:(bit_index+1);
}
break;
case 2: // rate 2/3
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodedot11_table[state];
*outPtr++ = out & 1;
if (bit_index==0)
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
#endif //DEBUG_CCODE
bit_index=(bit_index==0)?1:0;
}
break;
default:
break;
bit_index=(bit_index==0)?1:0;
}
break;
default:
break;
}
}
/*
// Termination - Add one NULL byte to terminate trellis
#ifdef DEBUG_CCODE
// Termination - Add one NULL byte to terminate trellis
#ifdef DEBUG_CCODE
printf("Termination\n");
#endif //DEBUG_CCODE
#endif //DEBUG_CCODE
for (shiftbit = 0; shiftbit<8;shiftbit++) {
state >>= 1;
out = ccodedot11_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE
#ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
#endif //DEBUG_CCODE
#endif //DEBUG_CCODE
printf("%d -> %d (%d)\n",state,out,ccodedot11_table[state]);
}
*/
@@ -182,7 +195,7 @@ ccodedot11_encode (unsigned int numbytes,
/*************************************************************************
Functions to initialize the code tables
*************************************************************************/
@@ -197,12 +210,15 @@ void ccodedot11_init(void)
for (i = 0; i < 128; i++) {
ccodedot11_table[i] = 0;
/* Compute R output bits */
for (j = 0; j < 2; j++) {
sum = 0;
for (k = 0; k < 7; k++)
if ((i & gdot11[j]) & (1 << k))
sum++;
/* Write the sum modulo 2 in bit j */
ccodedot11_table[i] |= (sum & 1) << j;
}
@@ -216,12 +232,15 @@ void ccodedot11_init_inv(void)
for (i = 0; i < 128; i++) {
ccodedot11_table_rev[i] = 0;
/* Compute R output bits */
for (j = 0; j < 2; j++) {
sum = 0;
for (k = 0; k < 7; k++)
if ((i & gdot11_rev[j]) & (1 << k))
sum++;
/* Write the sum modulo 2 in bit j */
ccodedot11_table_rev[i] |= (sum & 1) << j;
}
@@ -232,7 +251,7 @@ void ccodedot11_init_inv(void)
/*****************************************************************/
/**
Test program
Test program
******************************************************************/
@@ -250,11 +269,12 @@ main()
ccodedot11_init();
inPtr = test;
outPtr = output;
ccodedot11_encode(16, inPtr, outPtr,0);
for (i = 0; i < 32; i++) printf("%x ", output[i]);
printf("\n");