Commit 63143b87 authored by frtabu's avatar frtabu

Go on removing printf arguments warnings, add a suppression file to be used with cppcheck command

parent 875bdaf2
// suppress error about keysP not free, it is done by calling func */
memleak:common/utils/hashtable/obj_hashtable.c
// followings errors are in file not used in oai exec's included in CI
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c
memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
...@@ -31,18 +31,18 @@ ...@@ -31,18 +31,18 @@
#include "backtrace.h" #include "backtrace.h"
/* Obtain a backtrace and print it to stdout. */ /* Obtain a backtrace and print it to stdout. */
void display_backtrace(void) void display_backtrace(void) {
{
void *array[10]; void *array[10];
size_t size; size_t size;
char **strings; char **strings;
size_t i; size_t i;
char* test=getenv("NO_BACKTRACE"); char *test=getenv("NO_BACKTRACE");
if (test!=0) *((int*)0)=0;
if (test!=0) *((int *)0)=0;
size = backtrace(array, 10); size = backtrace(array, 10);
strings = backtrace_symbols(array, size); strings = backtrace_symbols(array, size);
printf("Obtained %u stack frames.\n", (unsigned int)size);
printf("Obtained %zd stack frames.\n", size);
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
printf("%s\n", strings[i]); printf("%s\n", strings[i]);
...@@ -50,8 +50,7 @@ void display_backtrace(void) ...@@ -50,8 +50,7 @@ void display_backtrace(void)
free(strings); free(strings);
} }
void backtrace_handle_signal(siginfo_t *info) void backtrace_handle_signal(siginfo_t *info) {
{
display_backtrace(); display_backtrace();
//exit(EXIT_FAILURE); //exit(EXIT_FAILURE);
} }
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables. * This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
*/ */
static hash_size_t def_hashfunc(const void *keyP, int key_sizeP) static hash_size_t def_hashfunc(const void *keyP, int key_sizeP) {
{
hash_size_t hash=0; hash_size_t hash=0;
while(key_sizeP) hash^=((unsigned char*)keyP)[key_sizeP --]; while(key_sizeP) hash^=((unsigned char *)keyP)[key_sizeP --];
return hash; return hash;
} }
...@@ -46,13 +45,12 @@ static hash_size_t def_hashfunc(const void *keyP, int key_sizeP) ...@@ -46,13 +45,12 @@ static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used. * The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
* If an error occurred, NULL is returned. All other values in the returned obj_hash_table_t pointer should be released with hashtable_destroy(). * If an error occurred, NULL is returned. All other values in the returned obj_hash_table_t pointer should be released with hashtable_destroy().
*/ */
obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfuncP)(const void*, int ), void (*freekeyfuncP)(void*), void (*freedatafuncP)(void*)) obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfuncP)(const void *, int ), void (*freekeyfuncP)(void *), void (*freedatafuncP)(void *)) {
{
obj_hash_table_t *hashtbl; obj_hash_table_t *hashtbl;
if(!(hashtbl=malloc(sizeof(obj_hash_table_t)))) return NULL; if(!(hashtbl=malloc(sizeof(obj_hash_table_t)))) return NULL;
if(!(hashtbl->nodes=calloc(sizeP, sizeof(obj_hash_node_t*)))) { if(!(hashtbl->nodes=calloc(sizeP, sizeof(obj_hash_node_t *)))) {
free(hashtbl); free(hashtbl);
return NULL; return NULL;
} }
...@@ -75,13 +73,13 @@ obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfunc ...@@ -75,13 +73,13 @@ obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfunc
* Cleanup * Cleanup
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the obj_hash_table_t. * The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the obj_hash_table_t.
*/ */
hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP) hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP) {
{
hash_size_t n; hash_size_t n;
obj_hash_node_t *node, *oldnode; obj_hash_node_t *node, *oldnode;
for(n=0; n<hashtblP->size; ++n) { for(n=0; n<hashtblP->size; ++n) {
node=hashtblP->nodes[n]; node=hashtblP->nodes[n];
while(node) { while(node) {
oldnode=node; oldnode=node;
node=node->next; node=node->next;
...@@ -90,12 +88,13 @@ hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP) ...@@ -90,12 +88,13 @@ hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP)
free(oldnode); free(oldnode);
} }
} }
free(hashtblP->nodes); free(hashtblP->nodes);
free(hashtblP); free(hashtblP);
return HASH_TABLE_OK; return HASH_TABLE_OK;
} }
//------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------
hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP) hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void *keyP, int key_sizeP)
//------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------
{ {
obj_hash_node_t *node; obj_hash_node_t *node;
...@@ -104,8 +103,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke ...@@ -104,8 +103,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
if (hashtblP == NULL) { if (hashtblP == NULL) {
return HASH_TABLE_BAD_PARAMETER_HASHTABLE; return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
} }
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size; hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
node=hashtblP->nodes[hash]; node=hashtblP->nodes[hash];
while(node) { while(node) {
if(node->key == keyP) { if(node->key == keyP) {
return HASH_TABLE_OK; return HASH_TABLE_OK;
...@@ -114,8 +115,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke ...@@ -114,8 +115,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
return HASH_TABLE_OK; return HASH_TABLE_OK;
} }
} }
node=node->next; node=node->next;
} }
return HASH_TABLE_KEY_NOT_EXISTS; return HASH_TABLE_KEY_NOT_EXISTS;
} }
//------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------
...@@ -123,35 +126,42 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke ...@@ -123,35 +126,42 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
* Adding a new element * Adding a new element
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size. * To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
*/ */
hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int key_sizeP, void *dataP) hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void *keyP, int key_sizeP, void *dataP) {
{
obj_hash_node_t *node; obj_hash_node_t *node;
hash_size_t hash; hash_size_t hash;
if (hashtblP == NULL) { if (hashtblP == NULL) {
return HASH_TABLE_BAD_PARAMETER_HASHTABLE; return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
} }
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size; hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
node=hashtblP->nodes[hash]; node=hashtblP->nodes[hash];
while(node) { while(node) {
if(node->key == keyP) { if(node->key == keyP) {
if (node->data) { if (node->data) {
hashtblP->freedatafunc(node->data); hashtblP->freedatafunc(node->data);
} }
node->data=dataP; node->data=dataP;
// waste of memory here (keyP is lost) we should free it now // waste of memory here (keyP is lost) we should free it now
return HASH_TABLE_INSERT_OVERWRITTEN_DATA; return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
} }
node=node->next; node=node->next;
} }
if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1; if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
node->key=keyP; node->key=keyP;
node->data=dataP; node->data=dataP;
if (hashtblP->nodes[hash]) { if (hashtblP->nodes[hash]) {
node->next=hashtblP->nodes[hash]; node->next=hashtblP->nodes[hash];
} else { } else {
node->next = NULL; node->next = NULL;
} }
hashtblP->nodes[hash]=node; hashtblP->nodes[hash]=node;
return HASH_TABLE_OK; return HASH_TABLE_OK;
} }
...@@ -160,8 +170,7 @@ hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int ...@@ -160,8 +170,7 @@ hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int
* To remove an element from the hash table, we just search for it in the linked list for that hash value, * To remove an element from the hash table, we just search for it in the linked list for that hash value,
* and remove it if it is found. If it was not found, it is an error and -1 is returned. * and remove it if it is found. If it was not found, it is an error and -1 is returned.
*/ */
hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP) hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void *keyP, int key_sizeP) {
{
obj_hash_node_t *node, *prevnode=NULL; obj_hash_node_t *node, *prevnode=NULL;
hash_size_t hash; hash_size_t hash;
...@@ -171,21 +180,25 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP ...@@ -171,21 +180,25 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size; hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
node=hashtblP->nodes[hash]; node=hashtblP->nodes[hash];
while(node) { while(node) {
if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))){ if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))) {
if(prevnode) { if(prevnode) {
prevnode->next=node->next; prevnode->next=node->next;
} else { } else {
hashtblP->nodes[hash]=node->next; hashtblP->nodes[hash]=node->next;
} }
hashtblP->freekeyfunc(node->key); hashtblP->freekeyfunc(node->key);
hashtblP->freedatafunc(node->data); hashtblP->freedatafunc(node->data);
free(node); free(node);
return HASH_TABLE_OK; return HASH_TABLE_OK;
} }
prevnode=node; prevnode=node;
node=node->next; node=node->next;
} }
return HASH_TABLE_KEY_NOT_EXISTS; return HASH_TABLE_KEY_NOT_EXISTS;
} }
//------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------
...@@ -193,8 +206,7 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP ...@@ -193,8 +206,7 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP
* Searching for an element is easy. We just search through the linked list for the corresponding hash value. * Searching for an element is easy. We just search through the linked list for the corresponding hash value.
* NULL is returned if we didn't find it. * NULL is returned if we didn't find it.
*/ */
hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP, void** dataP) hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void *keyP, int key_sizeP, void **dataP) {
{
obj_hash_node_t *node; obj_hash_node_t *node;
hash_size_t hash; hash_size_t hash;
...@@ -202,8 +214,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i ...@@ -202,8 +214,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
*dataP = NULL; *dataP = NULL;
return HASH_TABLE_BAD_PARAMETER_HASHTABLE; return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
} }
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size; hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
node=hashtblP->nodes[hash]; node=hashtblP->nodes[hash];
while(node) { while(node) {
if(node->key == keyP) { if(node->key == keyP) {
*dataP = node->data; *dataP = node->data;
...@@ -214,8 +228,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i ...@@ -214,8 +228,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
return HASH_TABLE_OK; return HASH_TABLE_OK;
} }
} }
node=node->next; node=node->next;
} }
*dataP = NULL; *dataP = NULL;
return HASH_TABLE_KEY_NOT_EXISTS; return HASH_TABLE_KEY_NOT_EXISTS;
} }
...@@ -223,14 +239,14 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i ...@@ -223,14 +239,14 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
/* /*
* Function to return all keys of an object hash table * Function to return all keys of an object hash table
*/ */
hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, unsigned int *sizeP)
{ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void **keysP, unsigned int *sizeP) {
size_t n = 0; size_t n = 0;
obj_hash_node_t *node = NULL; obj_hash_node_t *node = NULL;
obj_hash_node_t *next = NULL; obj_hash_node_t *next = NULL;
*sizeP = 0; *sizeP = 0;
keysP = calloc(hashtblP->num_elements, sizeof(void *)); keysP = calloc(hashtblP->num_elements, sizeof(void *));
if (keysP) { if (keysP) {
for(n=0; n<hashtblP->size; ++n) { for(n=0; n<hashtblP->size; ++n) {
for(node=hashtblP->nodes[n]; node; node=next) { for(node=hashtblP->nodes[n]; node; node=next) {
...@@ -238,8 +254,11 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, ...@@ -238,8 +254,11 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
next = node->next; next = node->next;
} }
} }
// cppcheck-suppress memleak
return HASH_TABLE_OK; return HASH_TABLE_OK;
} }
return HASH_TABLE_SYSTEM_ERROR; return HASH_TABLE_SYSTEM_ERROR;
} }
//------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------
...@@ -253,8 +272,7 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, ...@@ -253,8 +272,7 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
* This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table. * This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
* After that, we can just free the old table and copy the elements from newtbl to hashtbl. * After that, we can just free the old table and copy the elements from newtbl to hashtbl.
*/ */
hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t sizeP) hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t sizeP) {
{
obj_hash_table_t newtbl; obj_hash_table_t newtbl;
hash_size_t n; hash_size_t n;
obj_hash_node_t *node,*next; obj_hash_node_t *node,*next;
...@@ -266,7 +284,7 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size ...@@ -266,7 +284,7 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size
newtbl.size = sizeP; newtbl.size = sizeP;
newtbl.hashfunc = hashtblP->hashfunc; newtbl.hashfunc = hashtblP->hashfunc;
if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t*)))) return HASH_TABLE_SYSTEM_ERROR; if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t *)))) return HASH_TABLE_SYSTEM_ERROR;
for(n=0; n<hashtblP->size; ++n) { for(n=0; n<hashtblP->size; ++n) {
for(node=hashtblP->nodes[n]; node; node=next) { for(node=hashtblP->nodes[n]; node; node=next) {
...@@ -279,7 +297,6 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size ...@@ -279,7 +297,6 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size
free(hashtblP->nodes); free(hashtblP->nodes);
hashtblP->size=newtbl.size; hashtblP->size=newtbl.size;
hashtblP->nodes=newtbl.nodes; hashtblP->nodes=newtbl.nodes;
return HASH_TABLE_OK; return HASH_TABLE_OK;
} }
......
...@@ -130,7 +130,7 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -130,7 +130,7 @@ ccodedot11_encode (unsigned int numbytes,
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("%d: %u -> %d (%u)\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==0)?1:0; bit_index=(bit_index==0)?1:0;
......
...@@ -236,7 +236,7 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) { ...@@ -236,7 +236,7 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
ND = Kpi - D; ND = Kpi - D;
#ifdef RM_DEBUG2 #ifdef RM_DEBUG2
printf("sub_block_interleaving_cc : D = %d (%d), d %p, w %p\n",D,D*3,d,w); printf("sub_block_interleaving_cc : D = %d (%d), d %p, w %p\n",D,D*3,d,w);
printf("RCC = %d, Kpi=%d, ND=%ld\n",RCC,Kpi,ND); printf("RCC = %d, Kpi=%d, ND=%ld\n",RCC,Kpi,(long)ND);
#endif #endif
ND3 = ND*3; ND3 = ND*3;
k=0; k=0;
...@@ -253,7 +253,8 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) { ...@@ -253,7 +253,8 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
d[index3-ND3+1] = w[Kpi+k]; d[index3-ND3+1] = w[Kpi+k];
d[index3-ND3+2] = w[(Kpi<<1)+k]; d[index3-ND3+2] = w[(Kpi<<1)+k];
#ifdef RM_DEBUG2 #ifdef RM_DEBUG2
printf("row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)\n",row,index,k,index3-ND3,w[k],w[Kpi+k],w[(Kpi<<1)+k]); printf("row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)\n",
row,index,k,(long)(index3-ND3),w[k],w[Kpi+k],w[(Kpi<<1)+k]);
#endif #endif
index3+=96; index3+=96;
index+=32; index+=32;
...@@ -453,7 +454,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC, ...@@ -453,7 +454,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
int threed =0; int threed =0;
uint32_t nulled=0; uint32_t nulled=0;
static unsigned char *counter_buffer[MAX_NUM_DLSCH_SEGMENTS][4]; static unsigned char *counter_buffer[MAX_NUM_DLSCH_SEGMENTS][4];
FILE *counter_fd;
char fname[512]; char fname[512];
#endif #endif
...@@ -476,7 +476,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC, ...@@ -476,7 +476,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
} else if(rvidx==3) { } else if(rvidx==3) {
sprintf(fname, "mcs%d_rate_matching_RB_%d.txt", m, nb_rb); sprintf(fname, "mcs%d_rate_matching_RB_%d.txt", m, nb_rb);
// sprintf(fname,"mcs0_rate_matching_RB_6.txt"); // sprintf(fname,"mcs0_rate_matching_RB_6.txt");
counter_fd = fopen(fname,"w");
} }
#endif #endif
......
...@@ -124,8 +124,8 @@ int lte_segmentation(unsigned char *input_buffer, ...@@ -124,8 +124,8 @@ int lte_segmentation(unsigned char *input_buffer,
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 %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); printf("C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u\n",
#endif *C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
if ((input_buffer) && (output_buffers)) { if ((input_buffer) && (output_buffers)) {
for (k=0; k<*F>>3; k++) { for (k=0; k<*F>>3; k++) {
......
...@@ -35,30 +35,22 @@ ...@@ -35,30 +35,22 @@
int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output, int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
short amp, short amp,
int subframe, int subframe,
unsigned char l) unsigned char l) {
{
unsigned int mprime,mprime_dword,mprime_qpsk_symb,m; unsigned int mprime,mprime_dword,mprime_qpsk_symb,m;
unsigned short k=0,a; unsigned short k=0,a;
int32_t qpsk[4]; int32_t qpsk[4];
a = (amp*ONE_OVER_SQRT2_Q15)>>15; a = (amp*ONE_OVER_SQRT2_Q15)>>15;
((short *)&qpsk[0])[0] = a; ((short *)&qpsk[0])[0] = a;
((short *)&qpsk[0])[1] = a; ((short *)&qpsk[0])[1] = a;
((short *)&qpsk[1])[0] = -a; ((short *)&qpsk[1])[0] = -a;
((short *)&qpsk[1])[1] = a; ((short *)&qpsk[1])[1] = a;
((short *)&qpsk[2])[0] = a; ((short *)&qpsk[2])[0] = a;
((short *)&qpsk[2])[1] = -a; ((short *)&qpsk[2])[1] = -a;
((short *)&qpsk[3])[0] = -a; ((short *)&qpsk[3])[0] = -a;
((short *)&qpsk[3])[1] = -a; ((short *)&qpsk[3])[1] = -a;
mprime = 3*(110 - eNB->frame_parms.N_RB_DL); mprime = 3*(110 - eNB->frame_parms.N_RB_DL);
for (m=0; m<eNB->frame_parms.N_RB_DL*6; m++) { for (m=0; m<eNB->frame_parms.N_RB_DL*6; m++) {
if ((l==0) || (l==2)) if ((l==0) || (l==2))
k = m<<1; k = m<<1;
else if (l==1) else if (l==1)
...@@ -69,7 +61,6 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output, ...@@ -69,7 +61,6 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
} }
k+=eNB->frame_parms.first_carrier_offset; k+=eNB->frame_parms.first_carrier_offset;
mprime_dword = mprime>>4; mprime_dword = mprime>>4;
mprime_qpsk_symb = mprime&0xf; mprime_qpsk_symb = mprime&0xf;
...@@ -80,22 +71,18 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output, ...@@ -80,22 +71,18 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
output[k] = qpsk[(eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3]; output[k] = qpsk[(eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
//output[k] = (lte_gold_table[eNB_offset][subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3; //output[k] = (lte_gold_table[eNB_offset][subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
#ifdef DEBUG_DL_MBSFN #ifdef DEBUG_DL_MBSFN
LOG_D(PHY,"subframe %d, l %d, m %d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d\n", LOG_D(PHY,"subframe %d, l %d, m %d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d\n",
subframe,l,m,mprime,mprime_dword,mprime_qpsk_symb); subframe,l,m,mprime,mprime_dword,mprime_qpsk_symb);
LOG_D(PHY,"index = %d (k %d)(%x)\n",(eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k,eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]); LOG_D(PHY,"index = %d (k %d)(%x)\n",(eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k,eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]);
#endif #endif
mprime++; mprime++;
#ifdef DEBUG_DL_MBSFN #ifdef DEBUG_DL_MBSFN
if (m<18) if (m<18)
printf("subframe %d, l %d output[%d] = (%d,%d)\n",subframe,l,k,((short *)&output[k])[0],((short *)&output[k])[1]); printf("subframe %d, l %d output[%d] = (%d,%d)\n",subframe,l,k,((short *)&output[k])[0],((short *)&output[k])[1]);
#endif #endif
} }
return(0); return(0);
...@@ -106,15 +93,11 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output, ...@@ -106,15 +93,11 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
int lte_dl_mbsfn_rx(PHY_VARS_UE *ue, int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
int *output, int *output,
int subframe, int subframe,
unsigned char l) unsigned char l) {
{
unsigned int mprime,mprime_dword,mprime_qpsk_symb,m; unsigned int mprime,mprime_dword,mprime_qpsk_symb,m;
unsigned short k=0; unsigned short k=0;
unsigned int qpsk[4]; unsigned int qpsk[4];
// This includes complex conjugate for channel estimation // This includes complex conjugate for channel estimation
((short *)&qpsk[0])[0] = ONE_OVER_SQRT2_Q15; ((short *)&qpsk[0])[0] = ONE_OVER_SQRT2_Q15;
((short *)&qpsk[0])[1] = -ONE_OVER_SQRT2_Q15; ((short *)&qpsk[0])[1] = -ONE_OVER_SQRT2_Q15;
((short *)&qpsk[1])[0] = -ONE_OVER_SQRT2_Q15; ((short *)&qpsk[1])[0] = -ONE_OVER_SQRT2_Q15;
...@@ -123,23 +106,18 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue, ...@@ -123,23 +106,18 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
((short *)&qpsk[2])[1] = ONE_OVER_SQRT2_Q15; ((short *)&qpsk[2])[1] = ONE_OVER_SQRT2_Q15;
((short *)&qpsk[3])[0] = -ONE_OVER_SQRT2_Q15; ((short *)&qpsk[3])[0] = -ONE_OVER_SQRT2_Q15;
((short *)&qpsk[3])[1] = ONE_OVER_SQRT2_Q15; ((short *)&qpsk[3])[1] = ONE_OVER_SQRT2_Q15;
mprime = 3*(110 - ue->frame_parms.N_RB_DL); mprime = 3*(110 - ue->frame_parms.N_RB_DL);
for (m=0; m<ue->frame_parms.N_RB_DL*6; m++) { for (m=0; m<ue->frame_parms.N_RB_DL*6; m++) {
mprime_dword = mprime>>4; mprime_dword = mprime>>4;
mprime_qpsk_symb = mprime&0xf; mprime_qpsk_symb = mprime&0xf;
// this is r_mprime from 3GPP 36-211 6.10.1.2 // this is r_mprime from 3GPP 36-211 6.10.1.2
output[k] = qpsk[(ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3]; output[k] = qpsk[(ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
#ifdef DEBUG_DL_MBSFN #ifdef DEBUG_DL_MBSFN
printf("subframe %d, l %d, m %d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d\n", printf("subframe %d, l %d, m %u, mprime %u, mprime_dword %u, mprime_qpsk_symbol %u\n",
subframe,l,m,mprime, mprime_dword,mprime_qpsk_symb); subframe,l,m,mprime, mprime_dword,mprime_qpsk_symb);
printf("index = %d (k %d) (%x)\n",(ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k,ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]); printf("index = %d (k %d) (%x)\n",(ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k,ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]);
#endif #endif
mprime++; mprime++;
#ifdef DEBUG_DL_MBSFN #ifdef DEBUG_DL_MBSFN
...@@ -148,7 +126,6 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue, ...@@ -148,7 +126,6 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
#endif #endif
k++; k++;
} }
return(0); return(0);
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
*/ */
#ifdef MAIN #ifdef MAIN
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#endif #endif
#include "lte_refsig.h" #include "lte_refsig.h"
#include "PHY/defs_eNB.h" #include "PHY/defs_eNB.h"
...@@ -43,8 +43,7 @@ char ref24[720] = { ...@@ -43,8 +43,7 @@ char ref24[720] = {
-1,3,1,-3,3,-1,1,3,-3,3,1,3,-3,3,1,1,-1,1,3,-3,3,-3,-1,-3,-3,3,-3,-3,-3,1,-3,-3,3,-1,1,1,1,3,1,-1,3,-3,-3,1,3,1,1,-3,3,-1,3,3,1,1,-3,3,3,3,3,1,-1,3,-1,1,1,-1,-3,-1,-1,1,3,3,-1,-3,1,1,3,-3,1,1,-3,-1,-1,1,3,1,3,1,-1,3,1,1,-3,-1,-3,-1,-1,-1,-1,-3,-3,-1,1,1,3,3,-1,3,-1,1,-1,-3,1,-1,-3,-3,1,-3,-1,-1,-3,1,1,3,-1,1,3,1,-3,1,-3,1,1,-1,-1,3,-1,-3,3,-3,-3,-3,1,1,1,1,-1,-1,3,-3,-3,3,-3,1,-1,-1,1,-1,1,1,-1,-3,-1,1,-1,3,-1,-3,-3,3,3,-1,-1,-3,-1,3,1,3,1,3,1,1,-1,3,1,-1,1,3,-3,-1,-1,1,-3,1,3,-3,1,-1,-3,3,-3,3,-1,-1,-1,-1,1,-3,-3,-3,1,-3,-3,-3,1,-3,1,1,-3,3,3,-1,-3,-1,3,-3,3,3,3,-1,1,1,-3,1,-1,1,1,-3,1,1,-1,1,-3,-3,3,-1,3,-1,-1,-3,-3,-3,-1,-3,-3,1,-1,1,3,3,-1,1,-1,3,1,3,3,-3,-3,1,3,1,-1,-3,-3,-3,3,3,-3,3,3,-1,-3,3,-1,1,-3,1,1,3,3,1,1,1,-1,-1,1,-3,3,-1,1,1,-3,3,3,-1,-3,3,-3,-1,-3,-1,3,-1,-1,-1,-1,-3,-1,3,3,1,-1,1,3,3,3,-1,1,1,-3,1,3,-1,-3,3,-3,-3,3,1,3,1,-3,3,1,3,1,1,3,3,-1,-1,-3,1,-3,-1,3,1,1,3,-1,-1,1,-3,1,3,-3,1,-1,-3,-1,3,1,3,1,-1,-3,-3,-1,-1,-3,-3,-3,-1,-1,-3,3,-1,-1,-1,-1,1,1,-3,3,1,3,3,1,-1,1,-3,1,-3,1,1,-3,-1,1,3,-1,3,3,-1,-3,1,-1,-3,3,3,3,-1,1,1,3,-1,-3,-1,3,-1,-1,-1,1,1,1,1,1,-1,3,-1,-3,1,1,3,-3,1,-3,-1,1,1,-3,-3,3,1,1,-3,1,3,3,1,-1,-3,3,-1,3,3,3,-3,1,-1,1,-1,-3,-1,1,3,-1,3,-3,-3,-1,-3,3,-3,-3,-3,-1,-1,-3,-1,-3,3,1,3,-3,-1,3,-1,1,-1,3,-3,1,-1,-3,-3,1,1,-1,1,-1,1,-1,3,1,-3,-1,1,-1,1,-1,-1,3,3,-3,-1,1,-3,-3,-1,-3,3,1,-1,-3,-1,-3,-3,3,-3,3,-3,-1,1,3,1,-3,1,3,3,-1,-3,-1,-1,-1,-1,3,3,3,1,3,3,-3,1,3,-1,3,-1,3,3,-3,3,1,-1,3,3,1,-1,3,3,-1,-3,3,-3,-1,-1,3,-1,3,-1,-1,1,1,1,1,-1,-1,-3,-1,3,1,-1,1,-1,3,-1,3,1,1,-1,-1,-3,1,1,-3,1,3,-3,1,1,-3,-3,-1,-1,-3,-1,1,3,1,1,-3,-1,-1,-3,3,-3,3,1,-3,3,-3,1,-1,1,-3,1,1,1,-1,-3,3,3,1,1,3,-1,-3,-1,-1,-1,3,1,-3,-3,-1,3,-3,-1,-3,-1,-3,-1,-1,-3,-1,-1,1,-3,-1,-1,1,-1,-3,1,1,-3,1,-3,-3,3,1,1,-1,3,-1,-1,1,1,-1,-1,-3,-1,3,-1,3,-1,1,3,1,-1,3,1,3,-3,-3,1,-1,-1,1,3 -1,3,1,-3,3,-1,1,3,-3,3,1,3,-3,3,1,1,-1,1,3,-3,3,-3,-1,-3,-3,3,-3,-3,-3,1,-3,-3,3,-1,1,1,1,3,1,-1,3,-3,-3,1,3,1,1,-3,3,-1,3,3,1,1,-3,3,3,3,3,1,-1,3,-1,1,1,-1,-3,-1,-1,1,3,3,-1,-3,1,1,3,-3,1,1,-3,-1,-1,1,3,1,3,1,-1,3,1,1,-3,-1,-3,-1,-1,-1,-1,-3,-3,-1,1,1,3,3,-1,3,-1,1,-1,-3,1,-1,-3,-3,1,-3,-1,-1,-3,1,1,3,-1,1,3,1,-3,1,-3,1,1,-1,-1,3,-1,-3,3,-3,-3,-3,1,1,1,1,-1,-1,3,-3,-3,3,-3,1,-1,-1,1,-1,1,1,-1,-3,-1,1,-1,3,-1,-3,-3,3,3,-1,-1,-3,-1,3,1,3,1,3,1,1,-1,3,1,-1,1,3,-3,-1,-1,1,-3,1,3,-3,1,-1,-3,3,-3,3,-1,-1,-1,-1,1,-3,-3,-3,1,-3,-3,-3,1,-3,1,1,-3,3,3,-1,-3,-1,3,-3,3,3,3,-1,1,1,-3,1,-1,1,1,-3,1,1,-1,1,-3,-3,3,-1,3,-1,-1,-3,-3,-3,-1,-3,-3,1,-1,1,3,3,-1,1,-1,3,1,3,3,-3,-3,1,3,1,-1,-3,-3,-3,3,3,-3,3,3,-1,-3,3,-1,1,-3,1,1,3,3,1,1,1,-1,-1,1,-3,3,-1,1,1,-3,3,3,-1,-3,3,-3,-1,-3,-1,3,-1,-1,-1,-1,-3,-1,3,3,1,-1,1,3,3,3,-1,1,1,-3,1,3,-1,-3,3,-3,-3,3,1,3,1,-3,3,1,3,1,1,3,3,-1,-1,-3,1,-3,-1,3,1,1,3,-1,-1,1,-3,1,3,-3,1,-1,-3,-1,3,1,3,1,-1,-3,-3,-1,-1,-3,-3,-3,-1,-1,-3,3,-1,-1,-1,-1,1,1,-3,3,1,3,3,1,-1,1,-3,1,-3,1,1,-3,-1,1,3,-1,3,3,-1,-3,1,-1,-3,3,3,3,-1,1,1,3,-1,-3,-1,3,-1,-1,-1,1,1,1,1,1,-1,3,-1,-3,1,1,3,-3,1,-3,-1,1,1,-3,-3,3,1,1,-3,1,3,3,1,-1,-3,3,-1,3,3,3,-3,1,-1,1,-1,-3,-1,1,3,-1,3,-3,-3,-1,-3,3,-3,-3,-3,-1,-1,-3,-1,-3,3,1,3,-3,-1,3,-1,1,-1,3,-3,1,-1,-3,-3,1,1,-1,1,-1,1,-1,3,1,-3,-1,1,-1,1,-1,-1,3,3,-3,-1,1,-3,-3,-1,-3,3,1,-1,-3,-1,-3,-3,3,-3,3,-3,-1,1,3,1,-3,1,3,3,-1,-3,-1,-1,-1,-1,3,3,3,1,3,3,-3,1,3,-1,3,-1,3,3,-3,3,1,-1,3,3,1,-1,3,3,-1,-3,3,-3,-1,-1,3,-1,3,-1,-1,1,1,1,1,-1,-1,-3,-1,3,1,-1,1,-1,3,-1,3,1,1,-1,-1,-3,1,1,-3,1,3,-3,1,1,-3,-3,-1,-1,-3,-1,1,3,1,1,-3,-1,-1,-3,3,-3,3,1,-3,3,-3,1,-1,1,-3,1,1,1,-1,-3,3,3,1,1,3,-1,-3,-1,-1,-1,3,1,-3,-3,-1,3,-3,-1,-3,-1,-3,-1,-1,-3,-1,-1,1,-3,-1,-1,1,-1,-3,1,1,-3,1,-3,-3,3,1,1,-1,3,-1,-1,1,1,-1,-1,-3,-1,3,-1,3,-1,1,3,1,-1,3,1,3,-3,-3,1,-1,-1,1,3
}; };
void generate_ul_ref_sigs(void) void generate_ul_ref_sigs(void) {
{
double qbar,phase; double qbar,phase;
unsigned int u,v,Msc_RS,q,m,n; unsigned int u,v,Msc_RS,q,m,n;
...@@ -53,7 +52,7 @@ void generate_ul_ref_sigs(void) ...@@ -53,7 +52,7 @@ void generate_ul_ref_sigs(void)
for (u=0; u<30; u++) { for (u=0; u<30; u++) {
for (v=0; v<2; v++) { for (v=0; v<2; v++) {
qbar = ref_primes[Msc_RS] * (u+1)/(double)31; qbar = ref_primes[Msc_RS] * (u+1)/(double)31;
ul_ref_sigs[u][v][Msc_RS] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]); ul_ref_sigs[u][v][Msc_RS] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]);
if ((((int)floor(2*qbar))&1) == 0) if ((((int)floor(2*qbar))&1) == 0)
q = (int)(floor(qbar+.5)) - v; q = (int)(floor(qbar+.5)) - v;
...@@ -61,7 +60,7 @@ void generate_ul_ref_sigs(void) ...@@ -61,7 +60,7 @@ void generate_ul_ref_sigs(void)
q = (int)(floor(qbar+.5)) + v; q = (int)(floor(qbar+.5)) + v;
#ifdef MAIN #ifdef MAIN
printf("Msc_RS %d (%d), u %d, v %d -> q %d (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar); printf("Msc_RS %u (%d), u %u, v %u -> q %u (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar);
#endif #endif
for (n=0; n<dftsizes[Msc_RS]; n++) { for (n=0; n<dftsizes[Msc_RS]; n++) {
...@@ -89,32 +88,26 @@ void generate_ul_ref_sigs(void) ...@@ -89,32 +88,26 @@ void generate_ul_ref_sigs(void)
// These are the sequences for RB 1 // These are the sequences for RB 1
for (u=0; u<30; u++) { for (u=0; u<30; u++) {
ul_ref_sigs[u][0][0] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[0]); ul_ref_sigs[u][0][0] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[0]);
for (n=0; n<dftsizes[0]; n++) { for (n=0; n<dftsizes[0]; n++) {
ul_ref_sigs[u][0][0][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref12[(u*12) + n]/4))); ul_ref_sigs[u][0][0][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref12[(u*12) + n]/4)));
ul_ref_sigs[u][0][0][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref12[(u*12) + n]/4))); ul_ref_sigs[u][0][0][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref12[(u*12) + n]/4)));
} }
} }
// These are the sequences for RB 2 // These are the sequences for RB 2
for (u=0; u<30; u++) { for (u=0; u<30; u++) {
ul_ref_sigs[u][0][1] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[1]); ul_ref_sigs[u][0][1] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[1]);
for (n=0; n<dftsizes[1]; n++) { for (n=0; n<dftsizes[1]; n++) {
ul_ref_sigs[u][0][1][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref24[(u*24) + n]/4))); ul_ref_sigs[u][0][1][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref24[(u*24) + n]/4)));
ul_ref_sigs[u][0][1][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref24[(u*24) + n]/4))); ul_ref_sigs[u][0][1][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref24[(u*24) + n]/4)));
} }
} }
} }
void generate_ul_ref_sigs_rx(void) void generate_ul_ref_sigs_rx(void) {
{
double qbar,phase; double qbar,phase;
unsigned int u,v,Msc_RS,q,m,n; unsigned int u,v,Msc_RS,q,m,n;
...@@ -123,7 +116,7 @@ void generate_ul_ref_sigs_rx(void) ...@@ -123,7 +116,7 @@ void generate_ul_ref_sigs_rx(void)
for (u=0; u<30; u++) { for (u=0; u<30; u++) {
for (v=0; v<2; v++) { for (v=0; v<2; v++) {
qbar = ref_primes[Msc_RS] * (u+1)/(double)31; qbar = ref_primes[Msc_RS] * (u+1)/(double)31;
ul_ref_sigs_rx[u][v][Msc_RS] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]); ul_ref_sigs_rx[u][v][Msc_RS] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]);
if ((((int)floor(2*qbar))&1) == 0) if ((((int)floor(2*qbar))&1) == 0)
q = (int)(floor(qbar+.5)) - v; q = (int)(floor(qbar+.5)) - v;
...@@ -131,7 +124,7 @@ void generate_ul_ref_sigs_rx(void) ...@@ -131,7 +124,7 @@ void generate_ul_ref_sigs_rx(void)
q = (int)(floor(qbar+.5)) + v; q = (int)(floor(qbar+.5)) + v;
#ifdef MAIN #ifdef MAIN
printf("Msc_RS %d (%d), u %d, v %d -> q %d (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar); printf("Msc_RS %u (%d), u %u, v %u -> q %u (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar);
#endif #endif
for (n=0; n<dftsizes[Msc_RS]; n++) { for (n=0; n<dftsizes[Msc_RS]; n++) {
...@@ -159,7 +152,7 @@ void generate_ul_ref_sigs_rx(void) ...@@ -159,7 +152,7 @@ void generate_ul_ref_sigs_rx(void)
// These are the sequences for RB 1 // These are the sequences for RB 1
for (u=0; u<30; u++) { for (u=0; u<30; u++) {
ul_ref_sigs_rx[u][0][0] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[0]); ul_ref_sigs_rx[u][0][0] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[0]);
for (n=0; n<dftsizes[0]; n++) { for (n=0; n<dftsizes[0]; n++) {
ul_ref_sigs_rx[u][0][0][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref12[(u*12) + n]/4))); ul_ref_sigs_rx[u][0][0][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref12[(u*12) + n]/4)));
...@@ -169,21 +162,17 @@ void generate_ul_ref_sigs_rx(void) ...@@ -169,21 +162,17 @@ void generate_ul_ref_sigs_rx(void)
// These are the sequences for RB 2 // These are the sequences for RB 2
for (u=0; u<30; u++) { for (u=0; u<30; u++) {
ul_ref_sigs_rx[u][0][1] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[1]); ul_ref_sigs_rx[u][0][1] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[1]);
for (n=0; n<dftsizes[1]; n++) { for (n=0; n<dftsizes[1]; n++) {
ul_ref_sigs_rx[u][0][1][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref24[(u*24) + n]/4))); ul_ref_sigs_rx[u][0][1][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref24[(u*24) + n]/4)));
ul_ref_sigs_rx[u][0][1][1+(n<<1)]= (int16_t)(floor(32767*sin(M_PI*ref24[(u*24) + n]/4))); ul_ref_sigs_rx[u][0][1][1+(n<<1)]= (int16_t)(floor(32767*sin(M_PI*ref24[(u*24) + n]/4)));
} }
} }
} }
void free_ul_ref_sigs(void) void free_ul_ref_sigs(void) {
{
unsigned int u,v,Msc_RS; unsigned int u,v,Msc_RS;
for (Msc_RS=0; Msc_RS<34; Msc_RS++) { for (Msc_RS=0; Msc_RS<34; Msc_RS++) {
...@@ -204,9 +193,7 @@ void free_ul_ref_sigs(void) ...@@ -204,9 +193,7 @@ void free_ul_ref_sigs(void)
} }
#ifdef MAIN #ifdef MAIN
main() main() {
{
generate_ul_ref_sigs(); generate_ul_ref_sigs();
generate_ul_ref_sigs_rx(); generate_ul_ref_sigs_rx();
free_ul_ref_sigs(); free_ul_ref_sigs();
......
This diff is collapsed.
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