Go on removing printf arguments warnings, add a suppression file to be used with cppcheck command
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
// 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 @@
|
|||||||
#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)
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* this work for additional information regarding copyright ownership.
|
* this work for additional information regarding copyright ownership.
|
||||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||||
* except in compliance with the License.
|
* except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.openairinterface.org/?page_id=698
|
* http://www.openairinterface.org/?page_id=698
|
||||||
@@ -30,13 +30,12 @@
|
|||||||
* 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,201 +45,221 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashtbl->size=sizeP;
|
hashtbl->size=sizeP;
|
||||||
|
|
||||||
if(hashfuncP) hashtbl->hashfunc=hashfuncP;
|
if(hashfuncP) hashtbl->hashfunc=hashfuncP;
|
||||||
else hashtbl->hashfunc=def_hashfunc;
|
else hashtbl->hashfunc=def_hashfunc;
|
||||||
|
|
||||||
if(freekeyfuncP) hashtbl->freekeyfunc=freekeyfuncP;
|
if(freekeyfuncP) hashtbl->freekeyfunc=freekeyfuncP;
|
||||||
else hashtbl->freekeyfunc=free;
|
else hashtbl->freekeyfunc=free;
|
||||||
|
|
||||||
if(freedatafuncP) hashtbl->freedatafunc=freedatafuncP;
|
if(freedatafuncP) hashtbl->freedatafunc=freedatafuncP;
|
||||||
else hashtbl->freedatafunc=free;
|
else hashtbl->freedatafunc=free;
|
||||||
|
|
||||||
return hashtbl;
|
return hashtbl;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
* 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) {
|
|
||||||
oldnode=node;
|
while(node) {
|
||||||
node=node->next;
|
oldnode=node;
|
||||||
hashtblP->freekeyfunc(oldnode->key);
|
node=node->next;
|
||||||
hashtblP->freedatafunc(oldnode->data);
|
hashtblP->freekeyfunc(oldnode->key);
|
||||||
free(oldnode);
|
hashtblP->freedatafunc(oldnode->data);
|
||||||
}
|
free(oldnode);
|
||||||
}
|
}
|
||||||
free(hashtblP->nodes);
|
}
|
||||||
free(hashtblP);
|
|
||||||
return HASH_TABLE_OK;
|
free(hashtblP->nodes);
|
||||||
|
free(hashtblP);
|
||||||
|
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;
|
||||||
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;
|
||||||
|
node=hashtblP->nodes[hash];
|
||||||
|
|
||||||
|
while(node) {
|
||||||
|
if(node->key == keyP) {
|
||||||
|
return HASH_TABLE_OK;
|
||||||
|
} else if (node->key_size == key_sizeP) {
|
||||||
|
if (memcmp(node->key, keyP, key_sizeP) == 0) {
|
||||||
|
return HASH_TABLE_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
|
|
||||||
node=hashtblP->nodes[hash];
|
node=node->next;
|
||||||
while(node) {
|
}
|
||||||
if(node->key == keyP) {
|
|
||||||
return HASH_TABLE_OK;
|
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||||
} else if (node->key_size == key_sizeP) {
|
|
||||||
if (memcmp(node->key, keyP, key_sizeP) == 0) {
|
|
||||||
return HASH_TABLE_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
node=node->next;
|
|
||||||
}
|
|
||||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
* 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;
|
||||||
|
node=hashtblP->nodes[hash];
|
||||||
|
|
||||||
|
while(node) {
|
||||||
|
if(node->key == keyP) {
|
||||||
|
if (node->data) {
|
||||||
|
hashtblP->freedatafunc(node->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
node->data=dataP;
|
||||||
|
// waste of memory here (keyP is lost) we should free it now
|
||||||
|
return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
|
||||||
}
|
}
|
||||||
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
|
|
||||||
node=hashtblP->nodes[hash];
|
node=node->next;
|
||||||
while(node) {
|
}
|
||||||
if(node->key == keyP) {
|
|
||||||
if (node->data) {
|
if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
|
||||||
hashtblP->freedatafunc(node->data);
|
|
||||||
}
|
node->key=keyP;
|
||||||
node->data=dataP;
|
node->data=dataP;
|
||||||
// waste of memory here (keyP is lost) we should free it now
|
|
||||||
return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
|
if (hashtblP->nodes[hash]) {
|
||||||
}
|
node->next=hashtblP->nodes[hash];
|
||||||
node=node->next;
|
} else {
|
||||||
}
|
node->next = NULL;
|
||||||
if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
|
}
|
||||||
node->key=keyP;
|
|
||||||
node->data=dataP;
|
hashtblP->nodes[hash]=node;
|
||||||
if (hashtblP->nodes[hash]) {
|
return HASH_TABLE_OK;
|
||||||
node->next=hashtblP->nodes[hash];
|
|
||||||
} else {
|
|
||||||
node->next = NULL;
|
|
||||||
}
|
|
||||||
hashtblP->nodes[hash]=node;
|
|
||||||
return HASH_TABLE_OK;
|
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
* 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;
|
|
||||||
|
|
||||||
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;
|
||||||
|
node=hashtblP->nodes[hash];
|
||||||
|
|
||||||
|
while(node) {
|
||||||
|
if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))) {
|
||||||
|
if(prevnode) {
|
||||||
|
prevnode->next=node->next;
|
||||||
|
} else {
|
||||||
|
hashtblP->nodes[hash]=node->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
hashtblP->freekeyfunc(node->key);
|
||||||
|
hashtblP->freedatafunc(node->data);
|
||||||
|
free(node);
|
||||||
|
return HASH_TABLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
|
prevnode=node;
|
||||||
node=hashtblP->nodes[hash];
|
node=node->next;
|
||||||
while(node) {
|
}
|
||||||
if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))){
|
|
||||||
if(prevnode) {
|
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||||
prevnode->next=node->next;
|
|
||||||
} else {
|
|
||||||
hashtblP->nodes[hash]=node->next;
|
|
||||||
}
|
|
||||||
hashtblP->freekeyfunc(node->key);
|
|
||||||
hashtblP->freedatafunc(node->data);
|
|
||||||
free(node);
|
|
||||||
return HASH_TABLE_OK;
|
|
||||||
}
|
|
||||||
prevnode=node;
|
|
||||||
node=node->next;
|
|
||||||
}
|
|
||||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
* 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;
|
|
||||||
|
|
||||||
if (hashtblP == NULL) {
|
if (hashtblP == NULL) {
|
||||||
*dataP = NULL;
|
|
||||||
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
|
|
||||||
}
|
|
||||||
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
|
|
||||||
node=hashtblP->nodes[hash];
|
|
||||||
while(node) {
|
|
||||||
if(node->key == keyP) {
|
|
||||||
*dataP = node->data;
|
|
||||||
return HASH_TABLE_OK;
|
|
||||||
} else if (node->key_size == key_sizeP) {
|
|
||||||
if (memcmp(node->key, keyP, key_sizeP) == 0) {
|
|
||||||
*dataP = node->data;
|
|
||||||
return HASH_TABLE_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
node=node->next;
|
|
||||||
}
|
|
||||||
*dataP = NULL;
|
*dataP = NULL;
|
||||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
|
||||||
|
node=hashtblP->nodes[hash];
|
||||||
|
|
||||||
|
while(node) {
|
||||||
|
if(node->key == keyP) {
|
||||||
|
*dataP = node->data;
|
||||||
|
return HASH_TABLE_OK;
|
||||||
|
} else if (node->key_size == key_sizeP) {
|
||||||
|
if (memcmp(node->key, keyP, key_sizeP) == 0) {
|
||||||
|
*dataP = node->data;
|
||||||
|
return HASH_TABLE_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
node=node->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
*dataP = NULL;
|
||||||
|
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
size_t n = 0;
|
|
||||||
obj_hash_node_t *node = NULL;
|
|
||||||
obj_hash_node_t *next = NULL;
|
|
||||||
|
|
||||||
*sizeP = 0;
|
hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void **keysP, unsigned int *sizeP) {
|
||||||
keysP = calloc(hashtblP->num_elements, sizeof(void *));
|
size_t n = 0;
|
||||||
if (keysP) {
|
obj_hash_node_t *node = NULL;
|
||||||
for(n=0; n<hashtblP->size; ++n) {
|
obj_hash_node_t *next = NULL;
|
||||||
for(node=hashtblP->nodes[n]; node; node=next) {
|
*sizeP = 0;
|
||||||
keysP[*sizeP++] = node->key;
|
keysP = calloc(hashtblP->num_elements, sizeof(void *));
|
||||||
next = node->next;
|
|
||||||
}
|
if (keysP) {
|
||||||
}
|
for(n=0; n<hashtblP->size; ++n) {
|
||||||
return HASH_TABLE_OK;
|
for(node=hashtblP->nodes[n]; node; node=next) {
|
||||||
|
keysP[*sizeP++] = node->key;
|
||||||
|
next = node->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return HASH_TABLE_SYSTEM_ERROR;
|
|
||||||
|
// cppcheck-suppress memleak
|
||||||
|
return HASH_TABLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HASH_TABLE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@@ -253,34 +272,32 @@ 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;
|
|
||||||
|
|
||||||
if (hashtblP == NULL) {
|
if (hashtblP == NULL) {
|
||||||
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
|
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
newtbl.size = sizeP;
|
||||||
|
newtbl.hashfunc = hashtblP->hashfunc;
|
||||||
|
|
||||||
|
if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t *)))) return HASH_TABLE_SYSTEM_ERROR;
|
||||||
|
|
||||||
|
for(n=0; n<hashtblP->size; ++n) {
|
||||||
|
for(node=hashtblP->nodes[n]; node; node=next) {
|
||||||
|
next = node->next;
|
||||||
|
obj_hashtable_insert(&newtbl, node->key, node->key_size, node->data);
|
||||||
|
obj_hashtable_remove(hashtblP, node->key, node->key_size);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
newtbl.size = sizeP;
|
free(hashtblP->nodes);
|
||||||
newtbl.hashfunc = hashtblP->hashfunc;
|
hashtblP->size=newtbl.size;
|
||||||
|
hashtblP->nodes=newtbl.nodes;
|
||||||
if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t*)))) return HASH_TABLE_SYSTEM_ERROR;
|
return HASH_TABLE_OK;
|
||||||
|
|
||||||
for(n=0; n<hashtblP->size; ++n) {
|
|
||||||
for(node=hashtblP->nodes[n]; node; node=next) {
|
|
||||||
next = node->next;
|
|
||||||
obj_hashtable_insert(&newtbl, node->key, node->key_size, node->data);
|
|
||||||
obj_hashtable_remove(hashtblP, node->key, node->key_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(hashtblP->nodes);
|
|
||||||
hashtblP->size=newtbl.size;
|
|
||||||
hashtblP->nodes=newtbl.nodes;
|
|
||||||
|
|
||||||
return HASH_TABLE_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
|||||||
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) {
|
|||||||
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,
|
|||||||
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,
|
|||||||
} 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,
|
|||||||
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 @@
|
|||||||
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,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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,
|
|||||||
|
|
||||||
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,
|
|||||||
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,
|
|||||||
((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,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
k++;
|
k++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|||||||
@@ -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] = {
|
|||||||
-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)
|
|||||||
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)
|
|||||||
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)
|
|||||||
|
|
||||||
// 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)
|
|||||||
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)
|
|||||||
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)
|
|||||||
|
|
||||||
// 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)
|
|||||||
|
|
||||||
// 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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#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();
|
||||||
|
|||||||
@@ -53,71 +53,74 @@
|
|||||||
*/
|
*/
|
||||||
#define is_not_pilot(pilots,first_pilot,re) (1)
|
#define is_not_pilot(pilots,first_pilot,re) (1)
|
||||||
/*extern void thread_top_init(char *thread_name,
|
/*extern void thread_top_init(char *thread_name,
|
||||||
int affinity,
|
int affinity,
|
||||||
uint64_t runtime,
|
uint64_t runtime,
|
||||||
uint64_t deadline,
|
uint64_t deadline,
|
||||||
uint64_t period);*/
|
uint64_t period);*/
|
||||||
extern WORKER_CONF_t get_thread_worker_conf(void);
|
extern WORKER_CONF_t get_thread_worker_conf(void);
|
||||||
|
|
||||||
|
|
||||||
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
|
||||||
{
|
|
||||||
int i, r, aa, layer;
|
int i, r, aa, layer;
|
||||||
|
|
||||||
if (dlsch) {
|
if (dlsch) {
|
||||||
for (layer=0; layer<4; layer++) {
|
for (layer=0; layer<4; layer++) {
|
||||||
for (aa=0; aa<64; aa++) free16(dlsch->ue_spec_bf_weights[layer][aa], OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
for (aa=0; aa<64; aa++) free16(dlsch->ue_spec_bf_weights[layer][aa], OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||||
free16(dlsch->ue_spec_bf_weights[layer], 64*sizeof(int32_t*));
|
|
||||||
|
free16(dlsch->ue_spec_bf_weights[layer], 64*sizeof(int32_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<dlsch->Mdlharq; i++) {
|
for (i=0; i<dlsch->Mdlharq; i++) {
|
||||||
if (dlsch->harq_processes[i]) {
|
if (dlsch->harq_processes[i]) {
|
||||||
if (dlsch->harq_processes[i]->b) {
|
if (dlsch->harq_processes[i]->b) {
|
||||||
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
|
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
|
||||||
dlsch->harq_processes[i]->b = NULL;
|
dlsch->harq_processes[i]->b = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
|
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
|
||||||
if (dlsch->harq_processes[i]->c[r]) {
|
if (dlsch->harq_processes[i]->c[r]) {
|
||||||
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
|
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
|
||||||
dlsch->harq_processes[i]->c[r] = NULL;
|
dlsch->harq_processes[i]->c[r] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->d[r]) {
|
if (dlsch->harq_processes[i]->d[r]) {
|
||||||
free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
|
free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
|
||||||
dlsch->harq_processes[i]->d[r] = NULL;
|
dlsch->harq_processes[i]->d[r] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
|
|
||||||
dlsch->harq_processes[i] = NULL;
|
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
|
||||||
|
dlsch->harq_processes[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
|
free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
|
||||||
dlsch = NULL;
|
dlsch = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms)
|
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS *frame_parms) {
|
||||||
{
|
|
||||||
|
|
||||||
LTE_eNB_DLSCH_t *dlsch;
|
LTE_eNB_DLSCH_t *dlsch;
|
||||||
unsigned char exit_flag = 0,i,j,r,aa,layer;
|
unsigned char exit_flag = 0,i,j,r,aa,layer;
|
||||||
int re;
|
int re;
|
||||||
unsigned char bw_scaling =1;
|
unsigned char bw_scaling =1;
|
||||||
|
|
||||||
switch (N_RB_DL) {
|
switch (N_RB_DL) {
|
||||||
case 6:
|
case 6:
|
||||||
bw_scaling =16;
|
bw_scaling =16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 25:
|
case 25:
|
||||||
bw_scaling =4;
|
bw_scaling =4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 50:
|
case 50:
|
||||||
bw_scaling =2;
|
bw_scaling =2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
bw_scaling =1;
|
bw_scaling =1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlsch = (LTE_eNB_DLSCH_t *)malloc16(sizeof(LTE_eNB_DLSCH_t));
|
dlsch = (LTE_eNB_DLSCH_t *)malloc16(sizeof(LTE_eNB_DLSCH_t));
|
||||||
@@ -128,15 +131,16 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
|||||||
dlsch->Mdlharq = Mdlharq;
|
dlsch->Mdlharq = Mdlharq;
|
||||||
dlsch->Mlimit = 8;
|
dlsch->Mlimit = 8;
|
||||||
dlsch->Nsoft = Nsoft;
|
dlsch->Nsoft = Nsoft;
|
||||||
|
|
||||||
for (layer=0; layer<4; layer++) {
|
for (layer=0; layer<4; layer++) {
|
||||||
dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(64*sizeof(int32_t*));
|
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||||
|
|
||||||
for (aa=0; aa<64; aa++) {
|
for (aa=0; aa<64; aa++) {
|
||||||
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||||
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
|
||||||
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
for (re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||||
}
|
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +163,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
|||||||
if (dlsch->harq_processes[i]) {
|
if (dlsch->harq_processes[i]) {
|
||||||
bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
|
bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
|
||||||
// dlsch->harq_processes[i]->first_tx=1;
|
// dlsch->harq_processes[i]->first_tx=1;
|
||||||
dlsch->harq_processes[i]->b = (unsigned char*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
dlsch->harq_processes[i]->b = (unsigned char *)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->b) {
|
if (dlsch->harq_processes[i]->b) {
|
||||||
bzero(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
bzero(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||||
@@ -171,14 +175,16 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
|||||||
if (abstraction_flag==0) {
|
if (abstraction_flag==0) {
|
||||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
||||||
// account for filler in first segment and CRCs for multiple segment case
|
// account for filler in first segment and CRCs for multiple segment case
|
||||||
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768);
|
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(((r==0)?8:0) + 3+ 768);
|
||||||
dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16((96+12+3+(3*6144)));
|
dlsch->harq_processes[i]->d[r] = (uint8_t *)malloc16((96+12+3+(3*6144)));
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->c[r]) {
|
if (dlsch->harq_processes[i]->c[r]) {
|
||||||
bzero(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+ 768);
|
bzero(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+ 768);
|
||||||
} else {
|
} else {
|
||||||
printf("Can't get c\n");
|
printf("Can't get c\n");
|
||||||
exit_flag=2;
|
exit_flag=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dlsch->harq_processes[i]->d[r]) {
|
if (dlsch->harq_processes[i]->d[r]) {
|
||||||
bzero(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
|
bzero(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
|
||||||
} else {
|
} else {
|
||||||
@@ -197,13 +203,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
|||||||
for (i=0; i<Mdlharq; i++) {
|
for (i=0; i<Mdlharq; i++) {
|
||||||
dlsch->harq_processes[i]->round=0;
|
dlsch->harq_processes[i]->round=0;
|
||||||
|
|
||||||
for (j=0; j<96; j++)
|
for (j=0; j<96; j++)
|
||||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
||||||
// printf("dlsch->harq_processes[%d]->d[%d] %p\n",i,r,dlsch->harq_processes[i]->d[r]);
|
// printf("dlsch->harq_processes[%d]->d[%d] %p\n",i,r,dlsch->harq_processes[i]->d[r]);
|
||||||
if (dlsch->harq_processes[i]->d[r])
|
if (dlsch->harq_processes[i]->d[r])
|
||||||
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(dlsch);
|
return(dlsch);
|
||||||
@@ -211,16 +216,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
|
LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
|
||||||
exit_flag, sizeof(LTE_eNB_DLSCH_t));
|
exit_flag, sizeof(LTE_eNB_DLSCH_t));
|
||||||
free_eNB_dlsch(dlsch);
|
free_eNB_dlsch(dlsch);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) {
|
||||||
{
|
|
||||||
|
|
||||||
unsigned char Mdlharq;
|
unsigned char Mdlharq;
|
||||||
unsigned char i,j,r;
|
unsigned char i,j,r;
|
||||||
|
|
||||||
@@ -228,8 +229,10 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
|||||||
Mdlharq = dlsch->Mdlharq;
|
Mdlharq = dlsch->Mdlharq;
|
||||||
dlsch->rnti = 0;
|
dlsch->rnti = 0;
|
||||||
#ifdef PHY_TX_THREAD
|
#ifdef PHY_TX_THREAD
|
||||||
|
|
||||||
for (i=0; i<10; i++)
|
for (i=0; i<10; i++)
|
||||||
dlsch->active[i] = 0;
|
dlsch->active[i] = 0;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
dlsch->active = 0;
|
dlsch->active = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -244,11 +247,10 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
|||||||
dlsch->harq_processes[i]->status = 0;
|
dlsch->harq_processes[i]->status = 0;
|
||||||
dlsch->harq_processes[i]->round = 0;
|
dlsch->harq_processes[i]->round = 0;
|
||||||
|
|
||||||
for (j=0; j<96; j++)
|
for (j=0; j<96; j++)
|
||||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
|
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
|
||||||
if (dlsch->harq_processes[i]->d[r])
|
if (dlsch->harq_processes[i]->d[r])
|
||||||
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,31 +260,24 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
|||||||
|
|
||||||
|
|
||||||
int dlsch_encoding_2threads0(te_params *tep) {
|
int dlsch_encoding_2threads0(te_params *tep) {
|
||||||
|
|
||||||
LTE_eNB_DLSCH_t *dlsch = tep->dlsch;
|
LTE_eNB_DLSCH_t *dlsch = tep->dlsch;
|
||||||
unsigned int G = tep->G;
|
unsigned int G = tep->G;
|
||||||
unsigned char harq_pid = tep->harq_pid;
|
unsigned char harq_pid = tep->harq_pid;
|
||||||
unsigned int total_worker = tep->total_worker;
|
unsigned int total_worker = tep->total_worker;
|
||||||
unsigned int current_worker = tep->current_worker;
|
unsigned int current_worker = tep->current_worker;
|
||||||
|
|
||||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||||
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||||
|
|
||||||
for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
|
for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
|
||||||
|
|
||||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||||
else
|
else
|
||||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||||
|
|
||||||
Kr_bytes = Kr>>3;
|
Kr_bytes = Kr>>3;
|
||||||
|
|
||||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||||
Kr>>3,
|
Kr>>3,
|
||||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||||
@@ -293,25 +288,24 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
|||||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||||
dlsch->harq_processes[harq_pid]->w[r]);
|
dlsch->harq_processes[harq_pid]->w[r]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||||
// outputs for each code segment, see Section 5.1.5 p.20
|
// outputs for each code segment, see Section 5.1.5 p.20
|
||||||
|
|
||||||
for (r=0,r_offset=0; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
|
for (r=0,r_offset=0; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
|
||||||
if(r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker)){
|
if(r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker)) {
|
||||||
int Nl=dlsch->harq_processes[harq_pid]->Nl;
|
int Nl=dlsch->harq_processes[harq_pid]->Nl;
|
||||||
int Qm=dlsch->harq_processes[harq_pid]->Qm;
|
int Qm=dlsch->harq_processes[harq_pid]->Qm;
|
||||||
int C = dlsch->harq_processes[harq_pid]->C;
|
int C = dlsch->harq_processes[harq_pid]->C;
|
||||||
int Gp = G/Nl/Qm;
|
int Gp = G/Nl/Qm;
|
||||||
int GpmodC = Gp%C;
|
int GpmodC = Gp%C;
|
||||||
|
|
||||||
if (r < (C-(GpmodC)))
|
if (r < (C-(GpmodC)))
|
||||||
r_offset += Nl*Qm * (Gp/C);
|
r_offset += Nl*Qm * (Gp/C);
|
||||||
else
|
else
|
||||||
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
||||||
G, //G
|
G, //G
|
||||||
dlsch->harq_processes[harq_pid]->w[r],
|
dlsch->harq_processes[harq_pid]->w[r],
|
||||||
@@ -330,7 +324,6 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,19 +332,16 @@ extern int oai_exit;
|
|||||||
void *te_thread(void *param) {
|
void *te_thread(void *param) {
|
||||||
cpu_set_t cpuset;
|
cpu_set_t cpuset;
|
||||||
CPU_ZERO(&cpuset);
|
CPU_ZERO(&cpuset);
|
||||||
|
|
||||||
thread_top_init("te_thread",1,200000,250000,500000);
|
thread_top_init("te_thread",1,200000,250000,500000);
|
||||||
pthread_setname_np( pthread_self(),"te processing");
|
pthread_setname_np( pthread_self(),"te processing");
|
||||||
LOG_I(PHY,"thread te created id=%ld\n", syscall(__NR_gettid));
|
LOG_I(PHY,"thread te created id=%ld\n", syscall(__NR_gettid));
|
||||||
|
|
||||||
|
|
||||||
te_params *tep = (te_params *)param;
|
te_params *tep = (te_params *)param;
|
||||||
|
|
||||||
//wait_sync("te_thread");
|
|
||||||
|
|
||||||
while (!oai_exit) {
|
|
||||||
|
|
||||||
|
//wait_sync("te_thread");
|
||||||
|
|
||||||
|
while (!oai_exit) {
|
||||||
if (wait_on_condition(&tep->mutex_te,&tep->cond_te,&tep->instance_cnt_te,"te thread")<0) break;
|
if (wait_on_condition(&tep->mutex_te,&tep->cond_te,&tep->instance_cnt_te,"te thread")<0) break;
|
||||||
|
|
||||||
if(oai_exit) break;
|
if(oai_exit) break;
|
||||||
|
|
||||||
dlsch_encoding_2threads0(tep);
|
dlsch_encoding_2threads0(tep);
|
||||||
@@ -363,6 +353,7 @@ void *te_thread(void *param) {
|
|||||||
exit_fun( "ERROR pthread_cond_signal" );
|
exit_fun( "ERROR pthread_cond_signal" );
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if(opp_enabled == 1 && te_wakeup_stats0->p_time>50*3000){
|
/*if(opp_enabled == 1 && te_wakeup_stats0->p_time>50*3000){
|
||||||
print_meas_now(te_wakeup_stats0,"coding_wakeup",stderr);
|
print_meas_now(te_wakeup_stats0,"coding_wakeup",stderr);
|
||||||
printf("te_thread0 delay for waking up in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
|
printf("te_thread0 delay for waking up in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
|
||||||
@@ -375,61 +366,56 @@ void *te_thread(void *param) {
|
|||||||
|
|
||||||
|
|
||||||
int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||||
unsigned char *a,
|
unsigned char *a,
|
||||||
uint8_t num_pdcch_symbols,
|
uint8_t num_pdcch_symbols,
|
||||||
LTE_eNB_DLSCH_t *dlsch,
|
LTE_eNB_DLSCH_t *dlsch,
|
||||||
int frame,
|
int frame,
|
||||||
uint8_t subframe,
|
uint8_t subframe,
|
||||||
time_stats_t *rm_stats,
|
time_stats_t *rm_stats,
|
||||||
time_stats_t *te_stats,
|
time_stats_t *te_stats,
|
||||||
time_stats_t *te_wait_stats,
|
time_stats_t *te_wait_stats,
|
||||||
time_stats_t *te_main_stats,
|
time_stats_t *te_main_stats,
|
||||||
time_stats_t *te_wakeup_stats0,
|
time_stats_t *te_wakeup_stats0,
|
||||||
time_stats_t *te_wakeup_stats1,
|
time_stats_t *te_wakeup_stats1,
|
||||||
time_stats_t *i_stats,
|
time_stats_t *i_stats,
|
||||||
int worker_num)
|
int worker_num) {
|
||||||
{
|
|
||||||
|
|
||||||
//start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
//start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||||
|
|
||||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||||
L1_proc_t *proc = &eNB->proc;
|
L1_proc_t *proc = &eNB->proc;
|
||||||
unsigned int G;
|
unsigned int G;
|
||||||
unsigned int crc=1;
|
unsigned int crc=1;
|
||||||
|
|
||||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||||
|
|
||||||
if(harq_pid >= dlsch->Mdlharq) {
|
if(harq_pid >= dlsch->Mdlharq) {
|
||||||
LOG_E(PHY,"dlsch_encoding_2threads illegal harq_pid %d\n", harq_pid);
|
LOG_E(PHY,"dlsch_encoding_2threads illegal harq_pid %d\n", harq_pid);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||||
unsigned int A;
|
unsigned int A;
|
||||||
unsigned char mod_order;
|
unsigned char mod_order;
|
||||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
||||||
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
||||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,dlsch->harq_processes[harq_pid]->mimo_mode==TM7?7:0);
|
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,
|
||||||
|
dlsch->harq_processes[harq_pid]->mimo_mode==TM7?7:0);
|
||||||
|
|
||||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||||
|
|
||||||
start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||||
// Add 24-bit crc (polynomial A) to payload
|
// Add 24-bit crc (polynomial A) to payload
|
||||||
crc = crc24a(a,
|
crc = crc24a(a,
|
||||||
A)>>8;
|
A)>>8;
|
||||||
stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
a[A>>3] = ((uint8_t *)&crc)[2];
|
||||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
a[1+(A>>3)] = ((uint8_t *)&crc)[1];
|
||||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
a[2+(A>>3)] = ((uint8_t *)&crc)[0];
|
||||||
|
|
||||||
dlsch->harq_processes[harq_pid]->B = A+24;
|
dlsch->harq_processes[harq_pid]->B = A+24;
|
||||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
||||||
//stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
//stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||||
|
|
||||||
start_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
|
start_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
|
||||||
|
|
||||||
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
|
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
|
||||||
dlsch->harq_processes[harq_pid]->c,
|
dlsch->harq_processes[harq_pid]->c,
|
||||||
dlsch->harq_processes[harq_pid]->B,
|
dlsch->harq_processes[harq_pid]->B,
|
||||||
@@ -442,48 +428,46 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
|||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
stop_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
|
stop_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
|
||||||
|
|
||||||
start_meas(&eNB->dlsch_turbo_encoding_signal_stats);
|
start_meas(&eNB->dlsch_turbo_encoding_signal_stats);
|
||||||
for(int i=0;i<worker_num;i++)
|
|
||||||
{
|
for(int i=0; i<worker_num; i++) {
|
||||||
proc->tep[i].eNB = eNB;
|
proc->tep[i].eNB = eNB;
|
||||||
proc->tep[i].dlsch = dlsch;
|
proc->tep[i].dlsch = dlsch;
|
||||||
proc->tep[i].G = G;
|
proc->tep[i].G = G;
|
||||||
proc->tep[i].harq_pid = harq_pid;
|
proc->tep[i].harq_pid = harq_pid;
|
||||||
proc->tep[i].total_worker = worker_num;
|
proc->tep[i].total_worker = worker_num;
|
||||||
proc->tep[i].current_worker = i;
|
proc->tep[i].current_worker = i;
|
||||||
|
|
||||||
pthread_mutex_lock( &proc->tep[i].mutex_te );
|
pthread_mutex_lock( &proc->tep[i].mutex_te );
|
||||||
|
|
||||||
if (proc->tep[i].instance_cnt_te==0) {
|
if (proc->tep[i].instance_cnt_te==0) {
|
||||||
printf("[eNB] TE thread busy\n");
|
printf("[eNB] TE thread busy\n");
|
||||||
exit_fun("TE thread busy");
|
exit_fun("TE thread busy");
|
||||||
pthread_mutex_unlock( &proc->tep[i].mutex_te );
|
pthread_mutex_unlock( &proc->tep[i].mutex_te );
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
++proc->tep[i].instance_cnt_te;
|
++proc->tep[i].instance_cnt_te;
|
||||||
|
|
||||||
// wakeup worker to do segments
|
// wakeup worker to do segments
|
||||||
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
||||||
printf("[eNB] ERROR pthread_cond_signal for te thread %d exit\n",i);
|
printf("[eNB] ERROR pthread_cond_signal for te thread %d exit\n",i);
|
||||||
exit_fun( "ERROR pthread_cond_signal" );
|
exit_fun( "ERROR pthread_cond_signal" );
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock( &proc->tep[i].mutex_te );
|
pthread_mutex_unlock( &proc->tep[i].mutex_te );
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_meas(&eNB->dlsch_turbo_encoding_signal_stats);
|
stop_meas(&eNB->dlsch_turbo_encoding_signal_stats);
|
||||||
start_meas(te_main_stats);
|
start_meas(te_main_stats);
|
||||||
for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
|
||||||
|
|
||||||
|
for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||||
else
|
else
|
||||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||||
|
|
||||||
Kr_bytes = Kr>>3;
|
Kr_bytes = Kr>>3;
|
||||||
|
|
||||||
start_meas(te_stats);
|
start_meas(te_stats);
|
||||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||||
Kr>>3,
|
Kr>>3,
|
||||||
@@ -491,7 +475,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
|||||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||||
);
|
);
|
||||||
stop_meas(te_stats);
|
stop_meas(te_stats);
|
||||||
|
|
||||||
start_meas(i_stats);
|
start_meas(i_stats);
|
||||||
dlsch->harq_processes[harq_pid]->RTC[r] =
|
dlsch->harq_processes[harq_pid]->RTC[r] =
|
||||||
sub_block_interleaving_turbo(4+(Kr_bytes*8),
|
sub_block_interleaving_turbo(4+(Kr_bytes*8),
|
||||||
@@ -499,17 +482,14 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
|||||||
dlsch->harq_processes[harq_pid]->w[r]);
|
dlsch->harq_processes[harq_pid]->w[r]);
|
||||||
stop_meas(i_stats);
|
stop_meas(i_stats);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
for(int i=0; i<worker_num; i++) {
|
||||||
else {
|
|
||||||
|
|
||||||
for(int i=0;i<worker_num;i++)
|
|
||||||
{
|
|
||||||
proc->tep[i].eNB = eNB;
|
proc->tep[i].eNB = eNB;
|
||||||
proc->tep[i].dlsch = dlsch;
|
proc->tep[i].dlsch = dlsch;
|
||||||
proc->tep[i].G = G;
|
proc->tep[i].G = G;
|
||||||
proc->tep[i].total_worker = worker_num;
|
proc->tep[i].total_worker = worker_num;
|
||||||
proc->tep[i].current_worker = i;
|
proc->tep[i].current_worker = i;
|
||||||
|
|
||||||
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
||||||
printf("[eNB] ERROR pthread_cond_signal for te thread exit\n");
|
printf("[eNB] ERROR pthread_cond_signal for te thread exit\n");
|
||||||
exit_fun( "ERROR pthread_cond_signal" );
|
exit_fun( "ERROR pthread_cond_signal" );
|
||||||
@@ -521,7 +501,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
|||||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||||
// outputs for each code segment, see Section 5.1.5 p.20
|
// outputs for each code segment, see Section 5.1.5 p.20
|
||||||
for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||||
|
|
||||||
// get information for E for the segments that are handled by the worker thread
|
// get information for E for the segments that are handled by the worker thread
|
||||||
if (r<(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num) {
|
if (r<(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num) {
|
||||||
int Nl=dlsch->harq_processes[harq_pid]->Nl;
|
int Nl=dlsch->harq_processes[harq_pid]->Nl;
|
||||||
@@ -529,209 +508,186 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
|||||||
int C = dlsch->harq_processes[harq_pid]->C;
|
int C = dlsch->harq_processes[harq_pid]->C;
|
||||||
int Gp = G/Nl/Qm;
|
int Gp = G/Nl/Qm;
|
||||||
int GpmodC = Gp%C;
|
int GpmodC = Gp%C;
|
||||||
|
|
||||||
if (r < (C-(GpmodC)))
|
if (r < (C-(GpmodC)))
|
||||||
r_offset += Nl*Qm * (Gp/C);
|
r_offset += Nl*Qm * (Gp/C);
|
||||||
else
|
else
|
||||||
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
start_meas(rm_stats);
|
start_meas(rm_stats);
|
||||||
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
||||||
G, //G
|
G, //G
|
||||||
dlsch->harq_processes[harq_pid]->w[r],
|
dlsch->harq_processes[harq_pid]->w[r],
|
||||||
dlsch->harq_processes[harq_pid]->e+r_offset,
|
dlsch->harq_processes[harq_pid]->e+r_offset,
|
||||||
dlsch->harq_processes[harq_pid]->C, // C
|
dlsch->harq_processes[harq_pid]->C, // C
|
||||||
dlsch->Nsoft, // Nsoft,
|
dlsch->Nsoft, // Nsoft,
|
||||||
dlsch->Mdlharq,
|
dlsch->Mdlharq,
|
||||||
dlsch->Kmimo,
|
dlsch->Kmimo,
|
||||||
dlsch->harq_processes[harq_pid]->rvidx,
|
dlsch->harq_processes[harq_pid]->rvidx,
|
||||||
dlsch->harq_processes[harq_pid]->Qm,
|
dlsch->harq_processes[harq_pid]->Qm,
|
||||||
dlsch->harq_processes[harq_pid]->Nl,
|
dlsch->harq_processes[harq_pid]->Nl,
|
||||||
r,
|
r,
|
||||||
nb_rb);
|
nb_rb);
|
||||||
// m); // r
|
// m); // r
|
||||||
stop_meas(rm_stats);
|
stop_meas(rm_stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stop_meas(te_main_stats);
|
|
||||||
|
|
||||||
|
stop_meas(te_main_stats);
|
||||||
start_meas(te_wait_stats);
|
start_meas(te_wait_stats);
|
||||||
if(worker_num == 1)
|
|
||||||
{
|
if(worker_num == 1) {
|
||||||
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
||||||
}
|
} else if(worker_num == 2) {
|
||||||
else if(worker_num == 2)
|
|
||||||
{
|
|
||||||
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
||||||
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
|
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
||||||
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
|
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
|
||||||
wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2");
|
wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_meas(te_wait_stats);
|
stop_meas(te_wait_stats);
|
||||||
|
|
||||||
/*if(opp_enabled == 1 && te_wait_stats->p_time>100*3000){
|
/*if(opp_enabled == 1 && te_wait_stats->p_time>100*3000){
|
||||||
print_meas_now(te_wait_stats,"coding_wait",stderr);
|
print_meas_now(te_wait_stats,"coding_wait",stderr);
|
||||||
printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
|
printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
int dlsch_encoding_all(PHY_VARS_eNB *eNB,
|
int dlsch_encoding_all(PHY_VARS_eNB *eNB,
|
||||||
unsigned char *a,
|
unsigned char *a,
|
||||||
uint8_t num_pdcch_symbols,
|
uint8_t num_pdcch_symbols,
|
||||||
LTE_eNB_DLSCH_t *dlsch,
|
LTE_eNB_DLSCH_t *dlsch,
|
||||||
int frame,
|
int frame,
|
||||||
uint8_t subframe,
|
uint8_t subframe,
|
||||||
time_stats_t *rm_stats,
|
time_stats_t *rm_stats,
|
||||||
time_stats_t *te_stats,
|
time_stats_t *te_stats,
|
||||||
time_stats_t *te_wait_stats,
|
time_stats_t *te_wait_stats,
|
||||||
time_stats_t *te_main_stats,
|
time_stats_t *te_main_stats,
|
||||||
time_stats_t *te_wakeup_stats0,
|
time_stats_t *te_wakeup_stats0,
|
||||||
time_stats_t *te_wakeup_stats1,
|
time_stats_t *te_wakeup_stats1,
|
||||||
time_stats_t *i_stats)
|
time_stats_t *i_stats) {
|
||||||
{
|
int encoding_return = 0;
|
||||||
int encoding_return = 0;
|
unsigned int L,C,B;
|
||||||
unsigned int L,C,B;
|
B = dlsch->harq_processes[dlsch->harq_ids[frame%2][subframe]]->B;
|
||||||
B = dlsch->harq_processes[dlsch->harq_ids[frame%2][subframe]]->B;
|
|
||||||
if(B<=6144)
|
|
||||||
{
|
|
||||||
L=0;
|
|
||||||
C=1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
L=24;
|
|
||||||
C = B/(6144-L);
|
|
||||||
if((6144-L)*C < B)
|
|
||||||
{
|
|
||||||
C = C+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(B<=6144) {
|
||||||
|
L=0;
|
||||||
|
C=1;
|
||||||
|
} else {
|
||||||
|
L=24;
|
||||||
|
C = B/(6144-L);
|
||||||
|
|
||||||
if(get_thread_worker_conf() == WORKER_ENABLE)
|
if((6144-L)*C < B) {
|
||||||
{
|
C = C+1;
|
||||||
if(C >= 8)//one main three worker
|
|
||||||
{
|
|
||||||
encoding_return =
|
|
||||||
dlsch_encoding_2threads(eNB,
|
|
||||||
a,
|
|
||||||
num_pdcch_symbols,
|
|
||||||
dlsch,
|
|
||||||
frame,
|
|
||||||
subframe,
|
|
||||||
rm_stats,
|
|
||||||
te_stats,
|
|
||||||
te_wait_stats,
|
|
||||||
te_main_stats,
|
|
||||||
te_wakeup_stats0,
|
|
||||||
te_wakeup_stats1,
|
|
||||||
i_stats,
|
|
||||||
3);
|
|
||||||
}
|
|
||||||
else if(C >= 6)//one main two worker
|
|
||||||
{
|
|
||||||
encoding_return =
|
|
||||||
dlsch_encoding_2threads(eNB,
|
|
||||||
a,
|
|
||||||
num_pdcch_symbols,
|
|
||||||
dlsch,
|
|
||||||
frame,
|
|
||||||
subframe,
|
|
||||||
rm_stats,
|
|
||||||
te_stats,
|
|
||||||
te_wait_stats,
|
|
||||||
te_main_stats,
|
|
||||||
te_wakeup_stats0,
|
|
||||||
te_wakeup_stats1,
|
|
||||||
i_stats,
|
|
||||||
2);
|
|
||||||
}
|
|
||||||
else if(C >= 4)//one main one worker
|
|
||||||
{
|
|
||||||
encoding_return =
|
|
||||||
dlsch_encoding_2threads(eNB,
|
|
||||||
a,
|
|
||||||
num_pdcch_symbols,
|
|
||||||
dlsch,
|
|
||||||
frame,
|
|
||||||
subframe,
|
|
||||||
rm_stats,
|
|
||||||
te_stats,
|
|
||||||
te_wait_stats,
|
|
||||||
te_main_stats,
|
|
||||||
te_wakeup_stats0,
|
|
||||||
te_wakeup_stats1,
|
|
||||||
i_stats,
|
|
||||||
1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
encoding_return =
|
|
||||||
dlsch_encoding(eNB,
|
|
||||||
a,
|
|
||||||
num_pdcch_symbols,
|
|
||||||
dlsch,
|
|
||||||
frame,
|
|
||||||
subframe,
|
|
||||||
rm_stats,
|
|
||||||
te_stats,
|
|
||||||
i_stats);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
encoding_return =
|
if(get_thread_worker_conf() == WORKER_ENABLE) {
|
||||||
dlsch_encoding(eNB,
|
if(C >= 8) { //one main three worker
|
||||||
a,
|
encoding_return =
|
||||||
num_pdcch_symbols,
|
dlsch_encoding_2threads(eNB,
|
||||||
dlsch,
|
a,
|
||||||
frame,
|
num_pdcch_symbols,
|
||||||
subframe,
|
dlsch,
|
||||||
rm_stats,
|
frame,
|
||||||
te_stats,
|
subframe,
|
||||||
i_stats);
|
rm_stats,
|
||||||
|
te_stats,
|
||||||
|
te_wait_stats,
|
||||||
|
te_main_stats,
|
||||||
|
te_wakeup_stats0,
|
||||||
|
te_wakeup_stats1,
|
||||||
|
i_stats,
|
||||||
|
3);
|
||||||
|
} else if(C >= 6) { //one main two worker
|
||||||
|
encoding_return =
|
||||||
|
dlsch_encoding_2threads(eNB,
|
||||||
|
a,
|
||||||
|
num_pdcch_symbols,
|
||||||
|
dlsch,
|
||||||
|
frame,
|
||||||
|
subframe,
|
||||||
|
rm_stats,
|
||||||
|
te_stats,
|
||||||
|
te_wait_stats,
|
||||||
|
te_main_stats,
|
||||||
|
te_wakeup_stats0,
|
||||||
|
te_wakeup_stats1,
|
||||||
|
i_stats,
|
||||||
|
2);
|
||||||
|
} else if(C >= 4) { //one main one worker
|
||||||
|
encoding_return =
|
||||||
|
dlsch_encoding_2threads(eNB,
|
||||||
|
a,
|
||||||
|
num_pdcch_symbols,
|
||||||
|
dlsch,
|
||||||
|
frame,
|
||||||
|
subframe,
|
||||||
|
rm_stats,
|
||||||
|
te_stats,
|
||||||
|
te_wait_stats,
|
||||||
|
te_main_stats,
|
||||||
|
te_wakeup_stats0,
|
||||||
|
te_wakeup_stats1,
|
||||||
|
i_stats,
|
||||||
|
1);
|
||||||
|
} else {
|
||||||
|
encoding_return =
|
||||||
|
dlsch_encoding(eNB,
|
||||||
|
a,
|
||||||
|
num_pdcch_symbols,
|
||||||
|
dlsch,
|
||||||
|
frame,
|
||||||
|
subframe,
|
||||||
|
rm_stats,
|
||||||
|
te_stats,
|
||||||
|
i_stats);
|
||||||
}
|
}
|
||||||
return encoding_return;
|
} else {
|
||||||
|
encoding_return =
|
||||||
|
dlsch_encoding(eNB,
|
||||||
|
a,
|
||||||
|
num_pdcch_symbols,
|
||||||
|
dlsch,
|
||||||
|
frame,
|
||||||
|
subframe,
|
||||||
|
rm_stats,
|
||||||
|
te_stats,
|
||||||
|
i_stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
return encoding_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int dlsch_encoding(PHY_VARS_eNB *eNB,
|
int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||||
unsigned char *a,
|
unsigned char *a,
|
||||||
uint8_t num_pdcch_symbols,
|
uint8_t num_pdcch_symbols,
|
||||||
LTE_eNB_DLSCH_t *dlsch,
|
LTE_eNB_DLSCH_t *dlsch,
|
||||||
int frame,
|
int frame,
|
||||||
uint8_t subframe,
|
uint8_t subframe,
|
||||||
time_stats_t *rm_stats,
|
time_stats_t *rm_stats,
|
||||||
time_stats_t *te_stats,
|
time_stats_t *te_stats,
|
||||||
time_stats_t *i_stats)
|
time_stats_t *i_stats) {
|
||||||
{
|
|
||||||
|
|
||||||
unsigned int G;
|
unsigned int G;
|
||||||
unsigned int crc=1;
|
unsigned int crc=1;
|
||||||
|
|
||||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||||
|
|
||||||
if(harq_pid >= dlsch->Mdlharq) {
|
if(harq_pid >= dlsch->Mdlharq) {
|
||||||
LOG_E(PHY,"dlsch_encoding illegal harq_pid %d\n", harq_pid);
|
LOG_E(PHY,"dlsch_encoding illegal harq_pid %d\n", harq_pid);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||||
unsigned int A;
|
unsigned int A;
|
||||||
unsigned char mod_order;
|
unsigned char mod_order;
|
||||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||||
uint8_t beamforming_mode=0;
|
uint8_t beamforming_mode=0;
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
||||||
// printf("Encoder: A: %d\n",A);
|
// printf("Encoder: A: %d\n",A);
|
||||||
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
||||||
@@ -742,8 +698,8 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
|||||||
beamforming_mode = 8;
|
beamforming_mode = 8;
|
||||||
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10)
|
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10)
|
||||||
beamforming_mode = 9;
|
beamforming_mode = 9;
|
||||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
|
|
||||||
|
|
||||||
|
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
|
||||||
|
|
||||||
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
|
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
|
||||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||||
@@ -758,14 +714,12 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
*/
|
*/
|
||||||
// Add 24-bit crc (polynomial A) to payload
|
// Add 24-bit crc (polynomial A) to payload
|
||||||
|
|
||||||
crc = crc24a(a,
|
crc = crc24a(a,
|
||||||
A)>>8;
|
A)>>8;
|
||||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
a[A>>3] = ((uint8_t *)&crc)[2];
|
||||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
a[1+(A>>3)] = ((uint8_t *)&crc)[1];
|
||||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
a[2+(A>>3)] = ((uint8_t *)&crc)[0];
|
||||||
// printf("CRC %x (A %d)\n",crc,A);
|
// printf("CRC %x (A %d)\n",crc,A);
|
||||||
|
|
||||||
dlsch->harq_processes[harq_pid]->B = A+24;
|
dlsch->harq_processes[harq_pid]->B = A+24;
|
||||||
// dlsch->harq_processes[harq_pid]->b = a;
|
// dlsch->harq_processes[harq_pid]->b = a;
|
||||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
||||||
@@ -782,25 +736,20 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
|||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||||
|
|
||||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||||
else
|
else
|
||||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||||
|
|
||||||
Kr_bytes = Kr>>3;
|
Kr_bytes = Kr>>3;
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
printf("Generating Code Segment %u (%u bits)\n",r,Kr);
|
||||||
// generate codewords
|
// generate codewords
|
||||||
|
printf("bits_per_codeword (Kr)= %u, A %u\n",Kr,A);
|
||||||
printf("bits_per_codeword (Kr)= %d, A %d\n",Kr,A);
|
|
||||||
printf("N_RB = %d\n",nb_rb);
|
printf("N_RB = %d\n",nb_rb);
|
||||||
printf("Ncp %d\n",frame_parms->Ncp);
|
printf("Ncp %d\n",frame_parms->Ncp);
|
||||||
printf("mod_order %d\n",mod_order);
|
printf("mod_order %d\n",mod_order);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
start_meas(te_stats);
|
start_meas(te_stats);
|
||||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||||
Kr>>3,
|
Kr>>3,
|
||||||
@@ -821,7 +770,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
|||||||
dlsch->harq_processes[harq_pid]->w[r]);
|
dlsch->harq_processes[harq_pid]->w[r]);
|
||||||
stop_meas(i_stats);
|
stop_meas(i_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||||
@@ -829,16 +777,15 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
|||||||
|
|
||||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
|
printf("Rate Matching, Code segment %u (coded bits (G) %u,unpunctured/repeated bits per code segment %u,mod_order %d, nb_rb %d)...\n",
|
||||||
r,
|
r,
|
||||||
G,
|
G,
|
||||||
Kr*3,
|
Kr*3,
|
||||||
mod_order,nb_rb);
|
mod_order,nb_rb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
start_meas(rm_stats);
|
start_meas(rm_stats);
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
printf("rvidx in encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
printf("rvidx in encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
||||||
#endif
|
#endif
|
||||||
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
||||||
G, //G
|
G, //G
|
||||||
@@ -853,7 +800,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
|||||||
dlsch->harq_processes[harq_pid]->Nl,
|
dlsch->harq_processes[harq_pid]->Nl,
|
||||||
r,
|
r,
|
||||||
nb_rb);
|
nb_rb);
|
||||||
// m); // r
|
// m); // r
|
||||||
stop_meas(rm_stats);
|
stop_meas(rm_stats);
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
|
|
||||||
@@ -864,7 +811,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+694
-844
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user