Merge branch 'enhancement-199-nas-multi-ue' into develop_integration_w07
Conflicts: openair1/SCHED/phy_procedures_lte_ue.c targets/RT/USER/lte-softmodem.c targets/SIMU/USER/oaisim.c targets/SIMU/USER/oaisim_functions.c
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
export KERNEL_DIR=/lib/modules/$(shell uname -r)/
|
||||
CC=gcc
|
||||
CCC=gcc
|
||||
linux := $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi)
|
||||
|
||||
|
||||
CFLAGS += -std=gnu99
|
||||
CFLAGS += -Wall -g -ggdb -Wstrict-prototypes -fno-strict-aliasing
|
||||
|
||||
# Need to force this option because default kernel module builder is wrong
|
||||
CFLAGS += $(call cc-option,-mpreferred-stack-boundary=4)
|
||||
|
||||
#For performance, if some option doesn't exist in all gcc versions, use $(call cc-option,MY_OPTION)
|
||||
#CFLAGS += -O2
|
||||
#CFLAGS += -funroll-loops
|
||||
CFLAGS += -Wno-packed-bitfield-compat
|
||||
|
||||
# This is the minimum CPU faetures for OAI
|
||||
CFLAGS += -mmmx -msse -msse2 -mssse3 -msse4.1
|
||||
# Add CPU features from local CPU
|
||||
#CFLAGS += -march=native
|
||||
|
||||
ifeq ($(OSTYPE),Cygwin)
|
||||
cygwin=1
|
||||
CFLAGS += -DCYGWIN
|
||||
else
|
||||
cygwin=0
|
||||
endif
|
||||
|
||||
ifeq ($(linux),1)
|
||||
CFLAGS +=
|
||||
LDFLAGS +=
|
||||
endif
|
||||
|
||||
ITTI_DIR = $(COMMON_UTILS_DIR)/itti
|
||||
|
||||
ITTI_OBJS = $(ITTI_DIR)/intertask_interface.o
|
||||
ITTI_OBJS += $(ITTI_DIR)/intertask_interface_dump.o
|
||||
ITTI_OBJS += $(ITTI_DIR)/backtrace.o
|
||||
ITTI_OBJS += $(ITTI_DIR)/memory_pools.o
|
||||
ITTI_OBJS += $(ITTI_DIR)/signals.o
|
||||
ITTI_OBJS += $(ITTI_DIR)/timer.o
|
||||
|
||||
|
||||
HASHTABLE_DIR = $(COMMON_UTILS_DIR)/collection/hashtable
|
||||
MSC_DIR = $(COMMON_UTILS_DIR)/msc
|
||||
|
||||
HASHTABLE_OBJS = $(HASHTABLE_DIR)/hashtable.o
|
||||
HASHTABLE_OBJS += $(HASHTABLE_DIR)/obj_hashtable.o
|
||||
|
||||
UTILS_OBJS = $(ITTI_OBJS) $(HASHTABLE_OBJS)
|
||||
|
||||
UTILS_incl = \
|
||||
-I$(COMMON_UTILS_DIR) \
|
||||
-I$(HASHTABLE_DIR) \
|
||||
-I$(ITTI_DIR) \
|
||||
-I$(MSC_DIR)
|
||||
|
||||
print-% : ; @echo $* = $($*)
|
||||
@@ -0,0 +1,107 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "utils.h"
|
||||
|
||||
void *calloc_or_fail(size_t size) {
|
||||
void *ptr = calloc(1, size);
|
||||
if (ptr == NULL) {
|
||||
fprintf(stderr, "[UE] Failed to calloc %zu bytes", size);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *malloc_or_fail(size_t size) {
|
||||
void *ptr = malloc(size);
|
||||
if (ptr == NULL) {
|
||||
fprintf(stderr, "[UE] Failed to malloc %zu bytes", size);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
** Name: hex_char_to_hex_value() **
|
||||
** **
|
||||
** Description: Converts an hexadecimal ASCII coded digit into its value. **
|
||||
** **
|
||||
** Inputs: c: A char holding the ASCII coded value **
|
||||
** Others: None **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: Converted value (-1 on error) **
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int hex_char_to_hex_value (char c)
|
||||
{
|
||||
if (!((c >= 'a' && c <= 'f') ||
|
||||
(c >= 'A' && c <= 'F') ||
|
||||
(c >= '0' && c <= '9')))
|
||||
return -1;
|
||||
|
||||
if (c >= 'A') {
|
||||
/* Remove case bit */
|
||||
c &= ~('a' ^ 'A');
|
||||
|
||||
return (c - 'A' + 10);
|
||||
} else {
|
||||
return (c - '0');
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
** Name: hex_string_to_hex_value() **
|
||||
** **
|
||||
** Description: Converts an hexadecimal ASCII coded string into its value.**
|
||||
** **
|
||||
** Inputs: hex_value: A pointer to the location to store the **
|
||||
** conversion result **
|
||||
** size: The size of hex_value in bytes **
|
||||
** Others: None **
|
||||
** **
|
||||
** Outputs: hex_value: Converted value **
|
||||
** Return: 0 on success, -1 on error **
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (strlen(hex_string) != size*2) {
|
||||
fprintf(stderr, "the string '%s' should be of length %d\n", hex_string, size*2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=0; i < size; i++) {
|
||||
int a = hex_char_to_hex_value(hex_string[2 * i]);
|
||||
int b = hex_char_to_hex_value(hex_string[2 * i + 1]);
|
||||
if (a == -1 || b == -1) goto error;
|
||||
hex_value[i] = (a << 4) | b;
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
fprintf(stderr, "the string '%s' is not a valid hexadecimal string\n", hex_string);
|
||||
for (i=0; i < size; i++)
|
||||
hex_value[i] = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *itoa(int i) {
|
||||
char buffer[64];
|
||||
int ret;
|
||||
|
||||
ret = snprintf(buffer, sizeof(buffer), "%d",i);
|
||||
if ( ret <= 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return strdup(buffer);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef _UTILS_H
|
||||
#define _UTILS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
void *calloc_or_fail(size_t size);
|
||||
void *malloc_or_fail(size_t size);
|
||||
|
||||
// Converts an hexadecimal ASCII coded digit into its value. **
|
||||
int hex_char_to_hex_value (char c);
|
||||
// Converts an hexadecimal ASCII coded string into its value.**
|
||||
int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size);
|
||||
|
||||
char *itoa(int i);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user