Commit 1cb484f1 authored by frtabu's avatar frtabu

fix more trivial cppcheck errors and warnings

parent d171e18c
...@@ -164,9 +164,10 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -164,9 +164,10 @@ int processoption(paramdef_t *cfgoptions, char *value) {
*/ */
int config_check_unknown_cmdlineopt(char *prefix) { int config_check_unknown_cmdlineopt(char *prefix) {
int unknowndetected=0; int unknowndetected=0;
char testprefix[CONFIG_MAXOPTLENGTH]=""; char testprefix[CONFIG_MAXOPTLENGTH];
int finalcheck = 0; int finalcheck = 0;
memset(testpref,0,sizeof(testprefix));
if (prefix != NULL) { if (prefix != NULL) {
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0) if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
finalcheck = 1; finalcheck = 1;
......
...@@ -270,6 +270,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re ...@@ -270,6 +270,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i) for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
{ {
phy_info phy; phy_info phy;
memset(phy,0,sizeof(phy));
phy.index = resp->pnf_phy.phy[i].phy_config_index; phy.index = resp->pnf_phy.phy[i].phy_config_index;
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index); printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
...@@ -287,6 +288,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re ...@@ -287,6 +288,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) { for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
rf_info rf; rf_info rf;
memset(rf,0,sizeof(rf));
rf.index = resp->pnf_rf.rf[i].rf_config_index; rf.index = resp->pnf_rf.rf[i].rf_config_index;
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index); printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
...@@ -897,7 +899,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t ...@@ -897,7 +899,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
// for now just 1 // for now just 1
printf("[VNF] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period); printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
req->header.message_id = NFAPI_CONFIG_REQUEST; req->header.message_id = NFAPI_CONFIG_REQUEST;
req->header.phy_id = phy->id; req->header.phy_id = phy->id;
...@@ -919,7 +921,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t ...@@ -919,7 +921,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG; req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window; req->nfapi_config.timing_window.value = p7_vnf->timing_window;
printf("[VNF] Timing window:%d\n", p7_vnf->timing_window); printf("[VNF] Timing window:%u\n", p7_vnf->timing_window);
req->num_tlv++; req->num_tlv++;
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) { if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
......
This diff is collapsed.
...@@ -47,27 +47,20 @@ void ...@@ -47,27 +47,20 @@ void
ccodedot11_encode (unsigned int numbytes, ccodedot11_encode (unsigned int numbytes,
unsigned char *inPtr, unsigned char *inPtr,
unsigned char *outPtr, unsigned char *outPtr,
unsigned char puncturing) unsigned char puncturing) {
{
unsigned int state; unsigned int state;
unsigned char c, out, shiftbit =0; unsigned char c, out, shiftbit =0;
// printf("In ccodedot11_encode (%d,%p,%p,%d)\n",numbytes,inPtr,outPtr,puncturing); // printf("In ccodedot11_encode (%d,%p,%p,%d)\n",numbytes,inPtr,outPtr,puncturing);
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
unsigned int dummy; unsigned int dummy;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
int bit_index; int bit_index;
/* The input bit is shifted in position 8 of the state. /* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */ Shiftbit will take values between 1 and 8 */
state = 0; state = 0;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
dummy = 0; dummy = 0;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
/* Do not increment inPtr until we read the next octet */ /* Do not increment inPtr until we read the next octet */
bit_index=0; bit_index=0;
...@@ -80,7 +73,6 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -80,7 +73,6 @@ ccodedot11_encode (unsigned int numbytes,
switch (puncturing) { switch (puncturing) {
case 0: //rate 1/2 case 0: //rate 1/2
for (shiftbit = 0; shiftbit<8; shiftbit++) { for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1; state >>= 1;
if ((c&(1<<shiftbit)) != 0) { if ((c&(1<<shiftbit)) != 0) {
...@@ -88,22 +80,18 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -88,22 +80,18 @@ ccodedot11_encode (unsigned int numbytes,
} }
out = ccodedot11_table[state]; out = ccodedot11_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]); printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2; dummy+=2;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
} }
break; break;
case 1: // rate 3/4 case 1: // rate 3/4
for (shiftbit = 0; shiftbit<8; shiftbit++) { for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1; state >>= 1;
if ((c&(1<<shiftbit)) != 0) { if ((c&(1<<shiftbit)) != 0) {
...@@ -119,10 +107,9 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -119,10 +107,9 @@ ccodedot11_encode (unsigned int numbytes,
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]); printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2; dummy+=2;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
bit_index=(bit_index==2)?0:(bit_index+1); bit_index=(bit_index==2)?0:(bit_index+1);
} }
...@@ -130,7 +117,6 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -130,7 +117,6 @@ ccodedot11_encode (unsigned int numbytes,
case 2: // rate 2/3 case 2: // rate 2/3
for (shiftbit = 0; shiftbit<8; shiftbit++) { for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1; state >>= 1;
if ((c&(1<<shiftbit)) != 0) { if ((c&(1<<shiftbit)) != 0) {
...@@ -138,19 +124,16 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -138,19 +124,16 @@ ccodedot11_encode (unsigned int numbytes,
} }
out = ccodedot11_table[state]; out = ccodedot11_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
if (bit_index==0) if (bit_index==0)
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]); printf("%d: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2; dummy+=2;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
bit_index=(bit_index==0)?1:0; bit_index=(bit_index==0)?1:0;
} }
break; break;
...@@ -181,8 +164,6 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -181,8 +164,6 @@ ccodedot11_encode (unsigned int numbytes,
} }
*/ */
} }
...@@ -197,8 +178,7 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -197,8 +178,7 @@ ccodedot11_encode (unsigned int numbytes,
/* Basic code table initialization for constraint length 7 */ /* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */ /* Input in MSB, followed by state in 6 LSBs */
void ccodedot11_init(void) void ccodedot11_init(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -219,8 +199,7 @@ void ccodedot11_init(void) ...@@ -219,8 +199,7 @@ void ccodedot11_init(void)
} }
/* Input in LSB, followed by state in 6 MSBs */ /* Input in LSB, followed by state in 6 MSBs */
void ccodedot11_init_inv(void) void ccodedot11_init_inv(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -251,21 +230,15 @@ void ccodedot11_init_inv(void) ...@@ -251,21 +230,15 @@ void ccodedot11_init_inv(void)
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
#include <stdio.h> #include <stdio.h>
main() main() {
{
unsigned char test[] = "0Thebigredfox"; unsigned char test[] = "0Thebigredfox";
unsigned char output[512], *inPtr, *outPtr; unsigned char output[512], *inPtr, *outPtr;
unsigned int i; unsigned int i;
test[0] = 128; test[0] = 128;
test[1] = 0; test[1] = 0;
ccodedot11_init(); ccodedot11_init();
inPtr = test; inPtr = test;
outPtr = output; outPtr = output;
ccodedot11_encode(16, inPtr, outPtr,0); ccodedot11_encode(16, inPtr, outPtr,0);
for (i = 0; i < 32; i++) printf("%x ", output[i]); for (i = 0; i < 32; i++) printf("%x ", output[i]);
......
...@@ -52,20 +52,16 @@ ccodelte_encode (int32_t numbits, ...@@ -52,20 +52,16 @@ ccodelte_encode (int32_t numbits,
uint8_t add_crc, uint8_t add_crc,
uint8_t *inPtr, uint8_t *inPtr,
uint8_t *outPtr, uint8_t *outPtr,
uint16_t rnti) uint16_t rnti) {
{
uint32_t state; uint32_t state;
uint8_t c, out, first_bit; uint8_t c, out, first_bit;
int8_t shiftbit=0; int8_t shiftbit=0;
uint16_t c16; uint16_t c16;
uint16_t next_last_byte=0; uint16_t next_last_byte=0;
uint32_t crc=0; uint32_t crc=0;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
uint32_t dummy=0; uint32_t dummy=0;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
/* The input bit is shifted in position 8 of the state. /* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */ Shiftbit will take values between 1 and 8 */
state = 0; state = 0;
...@@ -137,17 +133,12 @@ ccodelte_encode (int32_t numbits, ...@@ -137,17 +133,12 @@ ccodelte_encode (int32_t numbits,
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
/* Do not increment inPtr until we read the next octet */ /* Do not increment inPtr until we read the next octet */
while (numbits > 0) { while (numbits > 0) {
c = *inPtr++; c = *inPtr++;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("** %x **\n",c); printf("** %x **\n",c);
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
// for (shiftbit = 0; (shiftbit<8) && (numbits>0);shiftbit++,numbits--) { // for (shiftbit = 0; (shiftbit<8) && (numbits>0);shiftbit++,numbits--) {
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) { for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
state >>= 1; state >>= 1;
...@@ -157,23 +148,18 @@ ccodelte_encode (int32_t numbits, ...@@ -157,23 +148,18 @@ ccodelte_encode (int32_t numbits,
} }
out = ccodelte_table[state]; out = ccodelte_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1; *outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("numbits %d, input %d, outbit %d: %d -> %d (%d%d%d)\n",numbits,state>>6,dummy,state,out,out&1,(out>>1)&1,(out>>2)&1); printf("numbits %d, input %d, outbit %d: %d -> %d (%d%d%d)\n",numbits,state>>6,dummy,state,out,out&1,(out>>1)&1,(out>>2)&1);
dummy+=3; dummy+=3;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
} }
} }
// now code 8-bit CRC for UCI // now code 8-bit CRC for UCI
if (add_crc == 1) { if (add_crc == 1) {
c = (uint8_t)(crc>>24); c = (uint8_t)(crc>>24);
// for (shiftbit = 0; (shiftbit<8);shiftbit++) { // for (shiftbit = 0; (shiftbit<8);shiftbit++) {
...@@ -185,22 +171,18 @@ ccodelte_encode (int32_t numbits, ...@@ -185,22 +171,18 @@ ccodelte_encode (int32_t numbits,
} }
out = ccodelte_table[state]; out = ccodelte_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1; *outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]); printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
dummy+=3; dummy+=3;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
} }
} }
// now code 16-bit CRC for DCI // now code 16-bit CRC for DCI
if (add_crc == 2) { if (add_crc == 2) {
c16 = (uint16_t)(crc>>16); c16 = (uint16_t)(crc>>16);
// for (shiftbit = 0; (shiftbit<16);shiftbit++) { // for (shiftbit = 0; (shiftbit<16);shiftbit++) {
...@@ -212,16 +194,13 @@ ccodelte_encode (int32_t numbits, ...@@ -212,16 +194,13 @@ ccodelte_encode (int32_t numbits,
} }
out = ccodelte_table[state]; out = ccodelte_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1; *outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]); printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
dummy+=3; dummy+=3;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
} }
} }
} }
...@@ -238,8 +217,7 @@ ccodelte_encode (int32_t numbits, ...@@ -238,8 +217,7 @@ ccodelte_encode (int32_t numbits,
/* Basic code table initialization for constraint length 7 */ /* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */ /* Input in MSB, followed by state in 6 LSBs */
void ccodelte_init(void) void ccodelte_init(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -260,8 +238,7 @@ void ccodelte_init(void) ...@@ -260,8 +238,7 @@ void ccodelte_init(void)
} }
/* Input in LSB, followed by state in 6 MSBs */ /* Input in LSB, followed by state in 6 MSBs */
void ccodelte_init_inv(void) void ccodelte_init_inv(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -281,8 +258,7 @@ void ccodelte_init_inv(void) ...@@ -281,8 +258,7 @@ void ccodelte_init_inv(void)
} }
} }
void ccodedab_init(void) void ccodedab_init(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -303,8 +279,7 @@ void ccodedab_init(void) ...@@ -303,8 +279,7 @@ void ccodedab_init(void)
} }
/* Input in LSB, followed by state in 6 MSBs */ /* Input in LSB, followed by state in 6 MSBs */
void ccodedab_init_inv(void) void ccodedab_init_inv(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -334,21 +309,15 @@ void ccodedab_init_inv(void) ...@@ -334,21 +309,15 @@ void ccodedab_init_inv(void)
#ifdef CCODE_MAIN #ifdef CCODE_MAIN
#include <stdio.h> #include <stdio.h>
main() main() {
{
unsigned char test[] = "Thebigredfox"; unsigned char test[] = "Thebigredfox";
unsigned char output[512], *inPtr, *outPtr; unsigned char output[512], *inPtr, *outPtr;
unsigned int i; unsigned int i;
test[0] = 128; test[0] = 128;
test[1] = 0; test[1] = 0;
ccodelte_init(); ccodelte_init();
inPtr = test; inPtr = test;
outPtr = output; outPtr = output;
ccodelte_encode(21, inPtr, outPtr); ccodelte_encode(21, inPtr, outPtr);
for (i = 0; i < 21*3; i++) printf("%x ", output[i]); for (i = 0; i < 21*3; i++) printf("%x ", output[i]);
......
This diff is collapsed.
...@@ -38,9 +38,7 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -38,9 +38,7 @@ int lte_segmentation(unsigned char *input_buffer,
unsigned int *Cminus, unsigned int *Cminus,
unsigned int *Kplus, unsigned int *Kplus,
unsigned int *Kminus, unsigned int *Kminus,
unsigned int *F) unsigned int *F) {
{
unsigned int L,Bprime,Bprime_by_C,r,Kr,k,s,crc; unsigned int L,Bprime,Bprime_by_C,r,Kr,k,s,crc;
if (B<=6144) { if (B<=6144) {
...@@ -56,7 +54,7 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -56,7 +54,7 @@ int lte_segmentation(unsigned char *input_buffer,
Bprime = B+((*C)*L); Bprime = B+((*C)*L);
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("Bprime %d\n",Bprime); printf("Bprime %u\n",Bprime);
#endif #endif
} }
...@@ -68,7 +66,7 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -68,7 +66,7 @@ int lte_segmentation(unsigned char *input_buffer,
// Find K+ // Find K+
Bprime_by_C = Bprime/(*C); Bprime_by_C = Bprime/(*C);
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C %d\n",Bprime_by_C); printf("Bprime_by_C %u\n",Bprime_by_C);
#endif #endif
// Bprime = Bprime_by_C>>3; // Bprime = Bprime_by_C>>3;
...@@ -93,17 +91,16 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -93,17 +91,16 @@ int lte_segmentation(unsigned char *input_buffer,
*Kminus = (*Kplus - 32); *Kminus = (*Kplus - 32);
} else if (Bprime_by_C <=6144 ) { // increase by 8 bytes til here } else if (Bprime_by_C <=6144 ) { // increase by 8 bytes til here
*Kplus = (Bprime_by_C>>6)<<6; *Kplus = (Bprime_by_C>>6)<<6;
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C_by_C %d , Kplus %d\n",Bprime_by_C,*Kplus); printf("Bprime_by_C_by_C %u , Kplus %u\n",Bprime_by_C,*Kplus);
#endif #endif
if (*Kplus < Bprime_by_C) if (*Kplus < Bprime_by_C)
*Kplus = *Kplus + 64; *Kplus = *Kplus + 64;
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C_by_C %d , Kplus2 %d\n",Bprime_by_C,*Kplus); printf("Bprime_by_C_by_C %u , Kplus2 %u\n",Bprime_by_C,*Kplus);
#endif #endif
*Kminus = (*Kplus - 64); *Kminus = (*Kplus - 64);
} else { } else {
...@@ -116,25 +113,21 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -116,25 +113,21 @@ int lte_segmentation(unsigned char *input_buffer,
*Kminus = 0; *Kminus = 0;
*Cminus = 0; *Cminus = 0;
} else { } else {
// printf("More than one segment (%d), exiting \n",*C); // printf("More than one segment (%d), exiting \n",*C);
// exit(-1); // exit(-1);
*Cminus = ((*C)*(*Kplus) - (Bprime))/((*Kplus) - (*Kminus)); *Cminus = ((*C)*(*Kplus) - (Bprime))/((*Kplus) - (*Kminus));
*Cplus = (*C) - (*Cminus); *Cplus = (*C) - (*Cminus);
} }
AssertFatal(Bprime <= (*Cplus)*(*Kplus) + (*Cminus)*(*Kminus), AssertFatal(Bprime <= (*Cplus)*(*Kplus) + (*Cminus)*(*Kminus),
"Bprime %d < (*Cplus %d)*(*Kplus %d) + (*Cminus %d)*(*Kminus %d)\n", "Bprime %d < (*Cplus %d)*(*Kplus %d) + (*Cminus %d)*(*Kminus %d)\n",
Bprime,*Cplus,*Kplus,*Cminus,*Kminus); Bprime,*Cplus,*Kplus,*Cminus,*Kminus);
*F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime)); *F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime));
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("C %d, Cplus %d, Cminus %d, Kplus %d, Kminus %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F); printf("C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u\n",*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
#endif #endif
if ((input_buffer) && (output_buffers)) { if ((input_buffer) && (output_buffers)) {
for (k=0; k<*F>>3; k++) { for (k=0; k<*F>>3; k++) {
output_buffers[0][k] = 0; output_buffers[0][k] = 0;
} }
...@@ -142,7 +135,6 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -142,7 +135,6 @@ int lte_segmentation(unsigned char *input_buffer,
s=0; s=0;
for (r=0; r<*C; r++) { for (r=0; r<*C; r++) {
if (r<*Cminus) if (r<*Cminus)
Kr = *Kminus; Kr = *Kminus;
else else
...@@ -157,11 +149,11 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -157,11 +149,11 @@ int lte_segmentation(unsigned char *input_buffer,
if (*C > 1) { // add CRC if (*C > 1) { // add CRC
crc = crc24b(output_buffers[r],Kr-24)>>8; crc = crc24b(output_buffers[r],Kr-24)>>8;
output_buffers[r][(Kr-24)>>3] = ((uint8_t*)&crc)[2]; output_buffers[r][(Kr-24)>>3] = ((uint8_t *)&crc)[2];
output_buffers[r][1+((Kr-24)>>3)] = ((uint8_t*)&crc)[1]; output_buffers[r][1+((Kr-24)>>3)] = ((uint8_t *)&crc)[1];
output_buffers[r][2+((Kr-24)>>3)] = ((uint8_t*)&crc)[0]; output_buffers[r][2+((Kr-24)>>3)] = ((uint8_t *)&crc)[0];
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("Segment %d : CRC %x\n",r,crc); printf("Segment %u : CRC %x\n",r,crc);
#endif #endif
} }
...@@ -175,9 +167,7 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -175,9 +167,7 @@ int lte_segmentation(unsigned char *input_buffer,
#ifdef MAIN #ifdef MAIN
main() main() {
{
unsigned int Kplus,Kminus,C,Cplus,Cminus,F,Bbytes; unsigned int Kplus,Kminus,C,Cplus,Cminus,F,Bbytes;
for (Bbytes=5; Bbytes<2*768; Bbytes++) { for (Bbytes=5; Bbytes<2*768; Bbytes++) {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment