Merge remote-tracking branch 'origin/issue390_configmodule_cmdlinebug' into develop_integration_2019_w04
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# OAI configuration module
|
# OAI configuration module
|
||||||
|
|
||||||
The configuration module provides an api that other oai components can use to get parameters at init time. It defines a parameter structure, used to describe parameters attributes (for example name and type). The same structure includes a pointer to the variable where the configuration module writes the parameter value, at run time, when calling config_get or config_getlist functions. For each parameter a function to check the value can be specified and pre-defined functions are provided for some common parameter validations (integer in a range or in a list, string in a list). The module also include a mechanism to check that no unknown options have been entered on the command line
|
The configuration module provides an api that other oai components can use to get parameters at init time. It defines a parameter structure, used to describe parameters attributes (for example name and type). The same structure includes a pointer to the variable where the configuration module writes the parameter value, at run time, when calling config_get or config_getlist functions. For each parameter a function to check the value can be specified and pre-defined functions are provided for some common parameter validations (integer in a range or in a list, string in a list). The module also include an api to check that no unknown options have been entered on the command line and a a mechanism to display a help text for suppoted parameters.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
```c
|
```c
|
||||||
configmodule_interface_t *load_configmodule(int argc, char **argv)
|
configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags)
|
||||||
```
|
```
|
||||||
* Parses the command line options, looking for the –O argument
|
* Parses the command line options, looking for the –O argument
|
||||||
* Loads the `libparams_<configsource>.so` (today `libparams_libconfig.so`) shared library
|
* Loads the `libparams_<configsource>.so` (today `libparams_libconfig.so`) shared library
|
||||||
* Looks for `config_<config source>_init` symbol and calls it , passing it an array of string corresponding to the « : » separated strings used in the –O option
|
* Looks for `config_<config source>_init` symbol and calls it , passing it an array of string corresponding to the « : » separated strings used in the –O option
|
||||||
* Looks for `config_<config source>_get`, `config_<config source>_getlist` and `config_<config source>_end` symbols which are the three functions a configuration library should implement. Get and getlist are mandatory, end is optional.
|
* Looks for `config_<config source>_get`, `config_<config source>_getlist` and `config_<config source>_end` symbols which are the three functions a configuration library should implement. Get and getlist are mandatory, end is optional.
|
||||||
* Stores all the necessary information in a `configmodule_interface_t structure`, which is of no use for caller as long as we only use one configuration source.
|
* Stores all the necessary information in a `configmodule_interface_t structure`, which is of no use for caller as long as we only use one configuration source.
|
||||||
|
* if the bit CONFIG_ENABLECMDLINEONLY is set in `initflags` then the module allows parameters to be set only via the command line. This is used for the oai UE.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void End_configmodule(void)
|
void End_configmodule(void)
|
||||||
|
|||||||
@@ -27,6 +27,63 @@ $ ./lte-softmodem -O libconfig:<config>:dbgl1
|
|||||||
```bash
|
```bash
|
||||||
$ ./lte-uesoftmodem -O cmdlineonly:dbgl1
|
$ ./lte-uesoftmodem -O cmdlineonly:dbgl1
|
||||||
```
|
```
|
||||||
|
To get help on supported parameters you can use specific options:
|
||||||
|
* ---help: print help for command line only parameters and for parameters not defined in a specific section
|
||||||
|
* ---help_< prefix > : print help for parameters defined under the section < prefix >
|
||||||
|
|
||||||
|
```
|
||||||
|
./lte-softmodem -O libconfig:/usr/local/oai/conf/enb.nbiot.band7.tm1.50PRB.usrpb210.conf --help
|
||||||
|
[CONFIG] get parameters from libconfig /usr/local/oai/conf/enb.nbiot.band7.tm1.50PRB.usrpb210.conf , debug flags: 0x00000000
|
||||||
|
.............................................
|
||||||
|
[LIBCONFIG] (root): 19/19 parameters successfully set, (16 to default value)
|
||||||
|
|
||||||
|
-----Help for section (root section) : 019 entries------
|
||||||
|
--rf-config-file: Configuration file for front-end (e.g. LMS7002M)
|
||||||
|
--ulsch-max-errors: set the eNodeB max ULSCH erros
|
||||||
|
--phy-test: test UE phy layer, mac disabled
|
||||||
|
--usim-test: use XOR autentication algo in case of test usim mode
|
||||||
|
--emulate-rf: Emulated RF enabled(disable by defult)
|
||||||
|
--clock: tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)
|
||||||
|
--wait-for-sync: Help string not specified
|
||||||
|
--single-thread-enable: Disables single-thread mode in lte-softmodem
|
||||||
|
-C: Set the downlink frequency for all component carriers
|
||||||
|
-a: Channel id offset
|
||||||
|
-d: Enable soft scope and L1 and L2 stats (Xforms)
|
||||||
|
-q: Enable processing timing measurement of lte softmodem on per subframe basis
|
||||||
|
-S: Skip the missed slots/subframes
|
||||||
|
--numerology: adding numerology for 5G
|
||||||
|
--parallel-config: three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'
|
||||||
|
--worker-config: two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'
|
||||||
|
--nbiot-disable: disable nb-iot, even if defined in config
|
||||||
|
--noS1: Disable s1 interface
|
||||||
|
--nokrnmod: (noS1 only): Use tun instead of namesh module
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
[LIBCONFIG] (root): 4/4 parameters successfully set, (4 to default value)
|
||||||
|
|
||||||
|
-----Help for section (root section) : 004 entries------
|
||||||
|
-R: Enable online log
|
||||||
|
-g: Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))
|
||||||
|
--telnetsrv: Start embedded telnet server
|
||||||
|
--msc: Enable the MSC tracing utility
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
[LIBCONFIG] loader: 2/2 parameters successfully set, (2 to default value)
|
||||||
|
[LIBCONFIG] loader.telnetsrv: 2/2 parameters successfully set, (1 to default value)
|
||||||
|
[LOADER] library libtelnetsrv.so is not loaded: libtelnetsrv.so: cannot open shared object file: No such file or directory
|
||||||
|
Getting ENBSParams
|
||||||
|
[LIBCONFIG] (root): 3/3 parameters successfully set, (1 to default value)
|
||||||
|
|
||||||
|
-----Help for section (root section) : 003 entries------
|
||||||
|
--Asn1_verbosity: Help string not specified
|
||||||
|
--Active_eNBs: Help string not specified
|
||||||
|
--noS1: Help string not specified
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
/usr/local/oai/issue390_configmodule_cmdlinebug/openairinterface5g/common/config/config_cmdline.c:224 config_process_cmdline() Exiting OAI softmodem: [CONFIG] Exiting after displaying help
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level.
|
For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <platform_types.h>
|
#include <platform_types.h>
|
||||||
#include "config_userapi.h"
|
#include "config_userapi.h"
|
||||||
|
#include "../utils/LOG/log.h"
|
||||||
|
|
||||||
int parse_stringlist(paramdef_t *cfgoptions, char *val) {
|
int parse_stringlist(paramdef_t *cfgoptions, char *val) {
|
||||||
char *atoken;
|
char *atoken;
|
||||||
@@ -74,15 +74,15 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
|||||||
|
|
||||||
if ( value == NULL) {
|
if ( value == NULL) {
|
||||||
if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
|
if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
|
||||||
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
|
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
|
||||||
exit_fun("[CONFIG] command line parsing fatal error");
|
|
||||||
return 0;
|
|
||||||
} else { /* boolean value option without argument, set value to true*/
|
} else { /* boolean value option without argument, set value to true*/
|
||||||
tmpval = defbool;
|
tmpval = defbool;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(cfgoptions->type) {
|
switch(cfgoptions->type) {
|
||||||
|
char *charptr;
|
||||||
|
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
if (cfgoptions->numelt == 0 ) {
|
if (cfgoptions->numelt == 0 ) {
|
||||||
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
|
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
|
||||||
@@ -106,14 +106,24 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
|||||||
case TYPE_UINT8:
|
case TYPE_UINT8:
|
||||||
case TYPE_INT8:
|
case TYPE_INT8:
|
||||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
|
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
|
||||||
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,NULL,0));
|
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,&charptr,0));
|
||||||
|
|
||||||
|
if( *charptr != 0) {
|
||||||
|
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
|
||||||
|
}
|
||||||
|
|
||||||
optisset=1;
|
optisset=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_UINT64:
|
case TYPE_UINT64:
|
||||||
case TYPE_INT64:
|
case TYPE_INT64:
|
||||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
|
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
|
||||||
*(cfgoptions->i64ptr)=strtoll(tmpval,NULL,0);
|
*(cfgoptions->i64ptr)=strtoll(tmpval,&charptr,0);
|
||||||
|
|
||||||
|
if( *charptr != 0) {
|
||||||
|
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
|
||||||
|
}
|
||||||
|
|
||||||
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
|
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
|
||||||
optisset=1;
|
optisset=1;
|
||||||
break;
|
break;
|
||||||
@@ -124,7 +134,12 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
|||||||
|
|
||||||
case TYPE_DOUBLE:
|
case TYPE_DOUBLE:
|
||||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
|
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
|
||||||
*(cfgoptions->dblptr) = strtof(tmpval,NULL);
|
*(cfgoptions->dblptr) = strtof(tmpval,&charptr);
|
||||||
|
|
||||||
|
if( *charptr != 0) {
|
||||||
|
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires a double argument\n",cfgoptions->optname);
|
||||||
|
}
|
||||||
|
|
||||||
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
|
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
|
||||||
optisset=1;
|
optisset=1;
|
||||||
break;
|
break;
|
||||||
@@ -133,7 +148,7 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
|
CONFIG_PRINTF_ERROR("[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
|
||||||
break;
|
break;
|
||||||
} /* switch on param type */
|
} /* switch on param type */
|
||||||
|
|
||||||
@@ -149,14 +164,15 @@ int processoption(paramdef_t *cfgoptions, char *value) {
|
|||||||
*/
|
*/
|
||||||
int config_check_unknown_cmdlineopt(char *prefix) {
|
int config_check_unknown_cmdlineopt(char *prefix) {
|
||||||
int unknowndetected=0;
|
int unknowndetected=0;
|
||||||
char testprefix[CONFIG_MAXOPTLENGTH]="";
|
char testprefix[CONFIG_MAXOPTLENGTH];
|
||||||
int finalcheck = 0;
|
int finalcheck = 0;
|
||||||
|
|
||||||
|
memset(testprefix,0,sizeof(testprefix));
|
||||||
if (prefix != NULL) {
|
if (prefix != NULL) {
|
||||||
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
|
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
|
||||||
finalcheck = 1;
|
finalcheck = 1;
|
||||||
else if (strlen(prefix) > 0) {
|
else if (strlen(prefix) > 0) {
|
||||||
sprintf(testprefix,"--%s.",prefix);
|
sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-1,prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +192,11 @@ int config_check_unknown_cmdlineopt(char *prefix) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf_cmdl("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n",
|
if (unknowndetected > 0) {
|
||||||
unknowndetected,testprefix,((prefix==NULL)?"":prefix));
|
CONFIG_PRINTF_ERROR("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n",
|
||||||
|
unknowndetected,testprefix,((prefix==NULL)?"":prefix));
|
||||||
|
}
|
||||||
|
|
||||||
return unknowndetected;
|
return unknowndetected;
|
||||||
} /* config_check_unknown_cmdlineopt */
|
} /* config_check_unknown_cmdlineopt */
|
||||||
|
|
||||||
@@ -200,7 +219,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
|||||||
|
|
||||||
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
|
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
|
||||||
if( prefix == NULL) {
|
if( prefix == NULL) {
|
||||||
config_printhelp(cfgoptions,numoptions);
|
config_printhelp(cfgoptions,numoptions,"(root section)");
|
||||||
|
|
||||||
if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
|
if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
|
||||||
exit_fun("[CONFIG] Exiting after displaying help\n");
|
exit_fun("[CONFIG] Exiting after displaying help\n");
|
||||||
@@ -209,8 +228,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
|||||||
pp=strtok_r(NULL, " ",&tokctx);
|
pp=strtok_r(NULL, " ",&tokctx);
|
||||||
|
|
||||||
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
|
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
|
||||||
printf ("Help for %s section:\n",prefix);
|
config_printhelp(cfgoptions,numoptions,prefix);
|
||||||
config_printhelp(cfgoptions,numoptions);
|
|
||||||
|
|
||||||
if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
|
if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
|
||||||
fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
|
fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
|
||||||
@@ -273,16 +291,5 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
|||||||
} /* fin du while */
|
} /* fin du while */
|
||||||
|
|
||||||
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
|
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
|
||||||
|
|
||||||
if ( !(CONFIG_ISFLAGSET( CONFIG_NOCHECKUNKOPT )) ) {
|
|
||||||
i=config_check_unknown_cmdlineopt(prefix);
|
|
||||||
|
|
||||||
if (i > 0) {
|
|
||||||
fprintf(stderr,"[CONFIG] %i unknown options for section %s detected in command line\n",
|
|
||||||
i,((prefix==NULL)?"\"root section\"":prefix));
|
|
||||||
exit_fun(" Exiting after detecting errors in command line \n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return j;
|
return j;
|
||||||
} /* parse_cmdline*/
|
} /* parse_cmdline*/
|
||||||
|
|||||||
@@ -36,12 +36,15 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <platform_types.h>
|
||||||
|
|
||||||
#define CONFIG_LOADCONFIG_MAIN
|
#define CONFIG_LOADCONFIG_MAIN
|
||||||
#include "config_load_configmodule.h"
|
#include "config_load_configmodule.h"
|
||||||
#include "config_userapi.h"
|
#include "config_userapi.h"
|
||||||
|
#include "../utils/LOG/log.h"
|
||||||
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
|
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
|
||||||
|
|
||||||
|
|
||||||
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
||||||
void *lib_handle;
|
void *lib_handle;
|
||||||
char fname[128];
|
char fname[128];
|
||||||
@@ -198,7 +201,7 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( strstr(argv[i], "help_config") != NULL ) {
|
if ( strstr(argv[i], "help_config") != NULL ) {
|
||||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +307,7 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init
|
|||||||
if (cfgmode != NULL) free(cfgmode);
|
if (cfgmode != NULL) free(cfgmode);
|
||||||
|
|
||||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME );
|
||||||
// exit(-1);
|
// exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +345,7 @@ void free_configmodule(void) {
|
|||||||
|
|
||||||
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
|
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
|
||||||
|
|
||||||
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
|
printf ("[CONFIG] free %i config parameter pointers\n",cfgptr->num_cfgP);
|
||||||
|
|
||||||
for (int i=0; i<cfgptr->num_cfgP; i++) {
|
for (int i=0; i<cfgptr->num_cfgP; i++) {
|
||||||
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
|
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
|
||||||
|
|||||||
@@ -51,7 +51,6 @@
|
|||||||
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
|
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
|
||||||
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
|
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
|
||||||
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
|
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
|
||||||
#define CONFIG_NOCHECKUNKOPT (1<<3) // disable check unprocessed (so invalid) command line options
|
|
||||||
#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails
|
#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails
|
||||||
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
|
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
|
||||||
#define CONFIG_HELP (1<<20) // print help message
|
#define CONFIG_HELP (1<<20) // print help message
|
||||||
@@ -109,5 +108,7 @@ extern configmodule_interface_t *cfgptr;
|
|||||||
#define CONFIG_ENABLECMDLINEONLY (1<<1)
|
#define CONFIG_ENABLECMDLINEONLY (1<<1)
|
||||||
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
|
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
|
||||||
extern void end_configmodule(void);
|
extern void end_configmodule(void);
|
||||||
|
#define CONFIG_PRINTF_ERROR(f, x... ) if (isLogInitDone ()) { LOG_E(ENB_APP,f,x);} else {printf(f,x);}; if ( !CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) ) exit_fun("exit because configuration failed\n");
|
||||||
|
|
||||||
|
|
||||||
#endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */
|
#endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */
|
||||||
|
|||||||
@@ -39,15 +39,13 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <platform_types.h>
|
#include <platform_types.h>
|
||||||
#include "config_userapi.h"
|
#include "config_userapi.h"
|
||||||
|
#include "../utils/LOG/log.h"
|
||||||
|
|
||||||
configmodule_interface_t *config_get_if(void) {
|
configmodule_interface_t *config_get_if(void) {
|
||||||
if (cfgptr == NULL) {
|
if (cfgptr == NULL) {
|
||||||
fprintf(stderr,"[CONFIG] %s %d config module not initialized\n",__FILE__, __LINE__);
|
CONFIG_PRINTF_ERROR("[CONFIG] %s %d config module not initialized\n",__FILE__,__LINE__);
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cfgptr;
|
return cfgptr;
|
||||||
@@ -66,9 +64,8 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
|||||||
config_get_if()->numptrs++;
|
config_get_if()->numptrs++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
|
CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
|
||||||
__FILE__, __LINE__, cfgoptions->optname, strerror(errno));
|
__FILE__, __LINE__, cfgoptions->optname, strerror(errno));
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,9 +75,8 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
|||||||
if (*ptr != NULL) {
|
if (*ptr != NULL) {
|
||||||
return *ptr;
|
return *ptr;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
|
CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
|
||||||
__FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
|
__FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +91,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
|||||||
config_get_if()->numptrs++;
|
config_get_if()->numptrs++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
CONFIG_PRINTF_ERROR("[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,8 +152,7 @@ void config_assign_processedint(paramdef_t *cfgoption, int val) {
|
|||||||
if ( cfgoption->processedvalue != NULL) {
|
if ( cfgoption->processedvalue != NULL) {
|
||||||
*(cfgoption->processedvalue) = val;
|
*(cfgoption->processedvalue) = val;
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
CONFIG_PRINTF_ERROR("[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,15 +171,17 @@ int config_get_processedint(paramdef_t *cfgoption) {
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
void config_printhelp(paramdef_t *params,int numparams) {
|
void config_printhelp(paramdef_t *params,int numparams, char *prefix) {
|
||||||
|
printf("\n-----Help for section %-26s: %03i entries------\n",(prefix==NULL)?"(root section)":prefix ,numparams);
|
||||||
|
|
||||||
for (int i=0 ; i<numparams ; i++) {
|
for (int i=0 ; i<numparams ; i++) {
|
||||||
if ( params[i].helpstr != NULL) {
|
printf(" %s%s: %s",
|
||||||
printf("%s%s: %s",
|
(strlen(params[i].optname) <= 1) ? "-" : "--",
|
||||||
(strlen(params[i].optname) <= 1) ? "-" : "--",
|
params[i].optname,
|
||||||
params[i].optname,
|
(params[i].helpstr != NULL)?params[i].helpstr:"Help string not specified\n");
|
||||||
params[i].helpstr);
|
} /* for on params entries */
|
||||||
}
|
|
||||||
}
|
printf("--------------------------------------------------------------------\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int config_execcheck(paramdef_t *params,int numparams, char *prefix) {
|
int config_execcheck(paramdef_t *params,int numparams, char *prefix) {
|
||||||
@@ -202,11 +198,7 @@ int config_execcheck(paramdef_t *params,int numparams, char *prefix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (st != 0) {
|
if (st != 0) {
|
||||||
fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
|
CONFIG_PRINTF_ERROR("[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
|
||||||
|
|
||||||
if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
|
|
||||||
exit_fun("exit because configuration failed\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
@@ -263,6 +255,7 @@ int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams
|
|||||||
for (int i = 0; i < ParamList->numelt; ++i) {
|
for (int i = 0; i < ParamList->numelt; ++i) {
|
||||||
// TODO config_process_cmdline?
|
// TODO config_process_cmdline?
|
||||||
sprintf(cfgpath, "%s.[%i]", newprefix, i);
|
sprintf(cfgpath, "%s.[%i]", newprefix, i);
|
||||||
|
config_process_cmdline(ParamList->paramarray[i],numparams,cfgpath);
|
||||||
config_execcheck(ParamList->paramarray[i], numparams, cfgpath);
|
config_execcheck(ParamList->paramarray[i], numparams, cfgpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ extern "C"
|
|||||||
/* utility functions, to be used by configuration module and/or configuration libraries */
|
/* utility functions, to be used by configuration module and/or configuration libraries */
|
||||||
extern configmodule_interface_t *config_get_if(void);
|
extern configmodule_interface_t *config_get_if(void);
|
||||||
extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
|
extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
|
||||||
extern void config_printhelp(paramdef_t *,int numparams);
|
extern void config_printhelp(paramdef_t *,int numparams, char *prefix);
|
||||||
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
|
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
|
||||||
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
|
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
|
||||||
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
|
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
|
||||||
|
|||||||
@@ -219,7 +219,6 @@ void log_getconfig(log_t *g_log) {
|
|||||||
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
|
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
|
||||||
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
|
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
|
||||||
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
|
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
|
||||||
CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
|
|
||||||
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
|
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
|
||||||
|
|
||||||
if (ret <0) {
|
if (ret <0) {
|
||||||
@@ -305,8 +304,8 @@ void log_getconfig(log_t *g_log) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
||||||
CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT);
|
|
||||||
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
||||||
|
config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX);
|
||||||
|
|
||||||
/* set the debug mask according to the debug parameters values */
|
/* set the debug mask according to the debug parameters values */
|
||||||
for (int i=0; log_maskmap[i].name != NULL ; i++) {
|
for (int i=0; log_maskmap[i].name != NULL ; i++) {
|
||||||
|
|||||||
@@ -345,6 +345,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define LOG_OPTIONS_IDX 2
|
#define LOG_OPTIONS_IDX 2
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------------*/
|
||||||
/** @defgroup _debugging debugging macros
|
/** @defgroup _debugging debugging macros
|
||||||
* @ingroup _macro
|
* @ingroup _macro
|
||||||
|
|||||||
+97
-67
@@ -12,15 +12,17 @@
|
|||||||
#include "common/config/config_userapi.h"
|
#include "common/config/config_userapi.h"
|
||||||
|
|
||||||
#define QUIT(x) do { \
|
#define QUIT(x) do { \
|
||||||
printf("T tracer: QUIT: %s\n", x); \
|
printf("T tracer: QUIT: %s\n", x); \
|
||||||
exit(1); \
|
exit(1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* array used to activate/disactivate a log */
|
/* array used to activate/disactivate a log */
|
||||||
static int T_IDs[T_NUMBER_OF_IDS];
|
static int T_IDs[T_NUMBER_OF_IDS];
|
||||||
int *T_active = T_IDs;
|
int *T_active = T_IDs;
|
||||||
|
|
||||||
int T_stdout = 1;
|
int T_stdout = 1;
|
||||||
|
|
||||||
|
|
||||||
static int T_socket;
|
static int T_socket;
|
||||||
|
|
||||||
/* T_cache
|
/* T_cache
|
||||||
@@ -32,125 +34,159 @@ volatile int *T_freelist_head = &_T_freelist_head;
|
|||||||
T_cache_t *T_cache;
|
T_cache_t *T_cache;
|
||||||
|
|
||||||
#if BASIC_SIMULATOR
|
#if BASIC_SIMULATOR
|
||||||
/* global variables used by T_GET_SLOT, see in T.h */
|
/* global variables used by T_GET_SLOT, see in T.h */
|
||||||
volatile uint64_t T_next_id;
|
volatile uint64_t T_next_id;
|
||||||
volatile uint64_t T_active_id;
|
volatile uint64_t T_active_id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void get_message(int s)
|
static void get_message(int s) {
|
||||||
{
|
|
||||||
char t;
|
char t;
|
||||||
int l;
|
int l;
|
||||||
int id;
|
int id;
|
||||||
int is_on;
|
int is_on;
|
||||||
|
|
||||||
if (read(s, &t, 1) != 1) QUIT("get_message fails");
|
if (read(s, &t, 1) != 1) QUIT("get_message fails");
|
||||||
printf("T tracer: got mess %d\n", t);
|
|
||||||
|
printf("T tracer: got mess %d\n", t);
|
||||||
|
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case 0:
|
case 0:
|
||||||
/* toggle all those IDs */
|
|
||||||
/* optimze? (too much syscalls) */
|
/* toggle all those IDs */
|
||||||
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
|
/* optimze? (too much syscalls) */
|
||||||
while (l) {
|
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
|
||||||
if (read(s, &id, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
|
|
||||||
T_IDs[id] = 1 - T_IDs[id];
|
while (l) {
|
||||||
l--;
|
if (read(s, &id, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
|
||||||
}
|
|
||||||
break;
|
T_IDs[id] = 1 - T_IDs[id];
|
||||||
case 1:
|
l--;
|
||||||
/* set IDs as given */
|
}
|
||||||
/* optimize? */
|
|
||||||
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
|
break;
|
||||||
id = 0;
|
|
||||||
while (l) {
|
case 1:
|
||||||
if (read(s, &is_on, sizeof(int)) != sizeof(int))
|
|
||||||
QUIT("get_message fails");
|
/* set IDs as given */
|
||||||
T_IDs[id] = is_on;
|
/* optimize? */
|
||||||
id++;
|
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
|
||||||
l--;
|
|
||||||
}
|
id = 0;
|
||||||
break;
|
|
||||||
case 2: break; /* do nothing, this message is to wait for local tracer */
|
while (l) {
|
||||||
|
if (read(s, &is_on, sizeof(int)) != sizeof(int))
|
||||||
|
QUIT("get_message fails");
|
||||||
|
|
||||||
|
T_IDs[id] = is_on;
|
||||||
|
id++;
|
||||||
|
l--;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
break; /* do nothing, this message is to wait for local tracer */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *T_receive_thread(void *_)
|
static void *T_receive_thread(void *_) {
|
||||||
{
|
|
||||||
while (1) get_message(T_socket);
|
while (1) get_message(T_socket);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void new_thread(void *(*f)(void *), void *data)
|
static void new_thread(void *(*f)(void *), void *data) {
|
||||||
{
|
|
||||||
pthread_t t;
|
pthread_t t;
|
||||||
pthread_attr_t att;
|
pthread_attr_t att;
|
||||||
|
|
||||||
if (pthread_attr_init(&att))
|
if (pthread_attr_init(&att)) {
|
||||||
{ fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
|
fprintf(stderr, "pthread_attr_init err\n");
|
||||||
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
|
exit(1);
|
||||||
{ fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
|
}
|
||||||
if (pthread_create(&t, &att, f, data))
|
|
||||||
{ fprintf(stderr, "pthread_create err\n"); exit(1); }
|
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
|
||||||
if (pthread_attr_destroy(&att))
|
fprintf(stderr, "pthread_attr_setdetachstate err\n");
|
||||||
{ fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pthread_create(&t, &att, f, data)) {
|
||||||
|
fprintf(stderr, "pthread_create err\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pthread_attr_destroy(&att)) {
|
||||||
|
fprintf(stderr, "pthread_attr_destroy err\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* defined in local_tracer.c */
|
/* defined in local_tracer.c */
|
||||||
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
||||||
int local_socket, void *shm_array);
|
int local_socket, void *shm_array);
|
||||||
|
|
||||||
/* We monitor the tracee and the local tracer processes.
|
/* We monitor the tracee and the local tracer processes.
|
||||||
* When one dies we forcefully kill the other.
|
* When one dies we forcefully kill the other.
|
||||||
*/
|
*/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
static void monitor_and_kill(int child1, int child2)
|
static void monitor_and_kill(int child1, int child2) {
|
||||||
{
|
|
||||||
int child;
|
int child;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
child = wait(&status);
|
child = wait(&status);
|
||||||
|
|
||||||
if (child == -1) perror("wait");
|
if (child == -1) perror("wait");
|
||||||
|
|
||||||
kill(child1, SIGKILL);
|
kill(child1, SIGKILL);
|
||||||
kill(child2, SIGKILL);
|
kill(child2, SIGKILL);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
void T_init(int remote_port, int wait_for_tracer, int dont_fork) {
|
||||||
{
|
|
||||||
int socket_pair[2];
|
int socket_pair[2];
|
||||||
int s;
|
int s;
|
||||||
int child1, child2;
|
int child1, child2;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair))
|
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair)) {
|
||||||
{ perror("socketpair"); abort(); }
|
perror("socketpair");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
/* setup shared memory */
|
/* setup shared memory */
|
||||||
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
|
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||||
if (T_cache == MAP_FAILED)
|
|
||||||
{ perror("mmap"); abort(); }
|
if (T_cache == MAP_FAILED) {
|
||||||
|
perror("mmap");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
/* let's garbage the memory to catch some potential problems
|
/* let's garbage the memory to catch some potential problems
|
||||||
* (think multiprocessor sync issues, barriers, etc.)
|
* (think multiprocessor sync issues, barriers, etc.)
|
||||||
*/
|
*/
|
||||||
memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
|
memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
|
||||||
|
|
||||||
for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0;
|
for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0;
|
||||||
|
|
||||||
/* child1 runs the local tracer and child2 (or main) runs the tracee */
|
/* child1 runs the local tracer and child2 (or main) runs the tracee */
|
||||||
|
child1 = fork();
|
||||||
|
|
||||||
|
if (child1 == -1) abort();
|
||||||
|
|
||||||
child1 = fork(); if (child1 == -1) abort();
|
|
||||||
if (child1 == 0) {
|
if (child1 == 0) {
|
||||||
close(socket_pair[1]);
|
close(socket_pair[1]);
|
||||||
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
|
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
|
||||||
T_cache);
|
T_cache);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(socket_pair[0]);
|
close(socket_pair[0]);
|
||||||
|
|
||||||
if (dont_fork == 0) {
|
if (dont_fork == 0) {
|
||||||
child2 = fork(); if (child2 == -1) abort();
|
child2 = fork();
|
||||||
|
|
||||||
|
if (child2 == -1) abort();
|
||||||
|
|
||||||
if (child2 != 0) {
|
if (child2 != 0) {
|
||||||
close(socket_pair[1]);
|
close(socket_pair[1]);
|
||||||
munmap(T_cache, T_CACHE_SIZE * sizeof(T_cache_t));
|
munmap(T_cache, T_CACHE_SIZE * sizeof(T_cache_t));
|
||||||
@@ -161,27 +197,21 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
|||||||
s = socket_pair[1];
|
s = socket_pair[1];
|
||||||
/* wait for first message - initial list of active T events */
|
/* wait for first message - initial list of active T events */
|
||||||
get_message(s);
|
get_message(s);
|
||||||
|
|
||||||
T_socket = s;
|
T_socket = s;
|
||||||
|
|
||||||
new_thread(T_receive_thread, NULL);
|
new_thread(T_receive_thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void T_Config_Init(void)
|
void T_Config_Init(void) {
|
||||||
{
|
int T_port=TTRACER_DEFAULT_PORTNUM; /* by default we wait for the tracer */
|
||||||
int T_port; /* by default we wait for the tracer */
|
int T_nowait=0; /* default port to listen to to wait for the tracer */
|
||||||
int T_nowait; /* default port to listen to to wait for the tracer */
|
int T_dont_fork=0; /* default is to fork, see 'T_init' to understand */
|
||||||
int T_dont_fork; /* default is to fork, see 'T_init' to understand */
|
|
||||||
|
|
||||||
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
|
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
|
||||||
|
|
||||||
/* for a cleaner config file, TTracer params should be defined in a
|
/* for a cleaner config file, TTracer params should be defined in a
|
||||||
* specific section...
|
* specific section...
|
||||||
*/
|
*/
|
||||||
config_get(ttraceparams,
|
config_get(ttraceparams,
|
||||||
sizeof(ttraceparams) / sizeof(paramdef_t),
|
sizeof(ttraceparams) / sizeof(paramdef_t),
|
||||||
TTRACER_CONFIG_PREFIX);
|
TTRACER_CONFIG_PREFIX);
|
||||||
|
|
||||||
/* compatibility: look for TTracer command line options in root section */
|
/* compatibility: look for TTracer command line options in root section */
|
||||||
config_process_cmdline(ttraceparams,
|
config_process_cmdline(ttraceparams,
|
||||||
sizeof(ttraceparams) / sizeof(paramdef_t),
|
sizeof(ttraceparams) / sizeof(paramdef_t),
|
||||||
|
|||||||
+41
-40
@@ -8,7 +8,7 @@
|
|||||||
#include "T_defs.h"
|
#include "T_defs.h"
|
||||||
|
|
||||||
#ifdef T_SEND_TIME
|
#ifdef T_SEND_TIME
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* T message IDs */
|
/* T message IDs */
|
||||||
@@ -76,13 +76,13 @@
|
|||||||
T_BUFFER_MAX - T_LOCAL_size, T_PUT_printf_deref x); \
|
T_BUFFER_MAX - T_LOCAL_size, T_PUT_printf_deref x); \
|
||||||
if (T_PUT_len < 0) { \
|
if (T_PUT_len < 0) { \
|
||||||
printf("%s:%d:%s: you can't read this, or can you?", \
|
printf("%s:%d:%s: you can't read this, or can you?", \
|
||||||
__FILE__, __LINE__, __FUNCTION__); \
|
__FILE__, __LINE__, __FUNCTION__); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
if (T_PUT_len >= T_BUFFER_MAX - T_LOCAL_size) { \
|
if (T_PUT_len >= T_BUFFER_MAX - T_LOCAL_size) { \
|
||||||
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
|
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
|
||||||
", consider increasing T_BUFFER_MAX (%d)\n", \
|
", consider increasing T_BUFFER_MAX (%d)\n", \
|
||||||
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
|
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
T_LOCAL_size += T_PUT_len + 1; \
|
T_LOCAL_size += T_PUT_len + 1; \
|
||||||
@@ -97,9 +97,9 @@ struct T_header;
|
|||||||
/* T macro tricks */
|
/* T macro tricks */
|
||||||
extern int T_stdout;
|
extern int T_stdout;
|
||||||
#define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\
|
#define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\
|
||||||
20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
|
20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
|
||||||
#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
|
#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
|
||||||
n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
|
n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
|
||||||
#define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0)
|
#define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0)
|
||||||
|
|
||||||
/* type used to send arbitrary buffer data */
|
/* type used to send arbitrary buffer data */
|
||||||
@@ -119,30 +119,30 @@ extern int *T_active;
|
|||||||
*/
|
*/
|
||||||
#if BASIC_SIMULATOR
|
#if BASIC_SIMULATOR
|
||||||
# define T_GET_SLOT \
|
# define T_GET_SLOT \
|
||||||
do { \
|
do { \
|
||||||
extern volatile uint64_t T_next_id; \
|
extern volatile uint64_t T_next_id; \
|
||||||
extern volatile uint64_t T_active_id; \
|
extern volatile uint64_t T_active_id; \
|
||||||
uint64_t id; \
|
uint64_t id; \
|
||||||
/* get a ticket */ \
|
/* get a ticket */ \
|
||||||
id = __sync_fetch_and_add(&T_next_id, 1); \
|
id = __sync_fetch_and_add(&T_next_id, 1); \
|
||||||
/* wait for our turn */ \
|
/* wait for our turn */ \
|
||||||
while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
|
while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
|
||||||
/* this is our turn, try to acquire the slot until it's free */ \
|
/* this is our turn, try to acquire the slot until it's free */ \
|
||||||
do { \
|
do { \
|
||||||
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
|
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
|
||||||
if (T_LOCAL_busy & 0x01) usleep(100); \
|
if (T_LOCAL_busy & 0x01) usleep(100); \
|
||||||
} while (T_LOCAL_busy & 0x01); \
|
} while (T_LOCAL_busy & 0x01); \
|
||||||
/* check that there are still some tickets */ \
|
/* check that there are still some tickets */ \
|
||||||
if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
|
if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
|
||||||
printf("T: reached the end of times, bye...\n"); \
|
printf("T: reached the end of times, bye...\n"); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
/* free our ticket, which signals the next waiter that it's its turn */ \
|
/* free our ticket, which signals the next waiter that it's its turn */ \
|
||||||
(void)__sync_fetch_and_add(&T_active_id, 1); \
|
(void)__sync_fetch_and_add(&T_active_id, 1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
# define T_GET_SLOT \
|
# define T_GET_SLOT \
|
||||||
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
|
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* used at header of Tn, allocates buffer */
|
/* used at header of Tn, allocates buffer */
|
||||||
@@ -172,8 +172,8 @@ extern int *T_active;
|
|||||||
#define T_CHECK_SIZE(len, argnum) \
|
#define T_CHECK_SIZE(len, argnum) \
|
||||||
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
|
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
|
||||||
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
|
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
|
||||||
", consider increasing T_BUFFER_MAX (%d)\n", \
|
", consider increasing T_BUFFER_MAX (%d)\n", \
|
||||||
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
|
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
|
||||||
abort(); \
|
abort(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,20 +598,21 @@ extern int *T_active;
|
|||||||
|
|
||||||
|
|
||||||
#define TTRACER_CONFIG_PREFIX "TTracer"
|
#define TTRACER_CONFIG_PREFIX "TTracer"
|
||||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
/* configuration parameters for TTRACE utility */
|
/* configuration parameters for TTRACE utility */
|
||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
#define TTRACER_DEFAULT_PORTNUM 2021
|
||||||
#define CMDLINE_TTRACEPARAMS_DESC { \
|
#define CMDLINE_TTRACEPARAMS_DESC { \
|
||||||
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \
|
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:TTRACER_DEFAULT_PORTNUM, TYPE_INT, 0},\
|
||||||
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0}, \
|
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0},\
|
||||||
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0}, \
|
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0},\
|
||||||
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0}, \
|
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0},\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* log on stdout */
|
/* log on stdout */
|
||||||
void T_init(int remote_port, int wait_for_tracer, int dont_fork);
|
void T_init(int remote_port, int wait_for_tracer, int dont_fork);
|
||||||
void T_Config_Init(void);
|
void T_Config_Init(void);
|
||||||
#else /* T_TRACER */
|
#else /* T_TRACER */
|
||||||
|
|||||||
+300
-119
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
|
|
||||||
FILE* g_msc_fd;
|
FILE *g_msc_fd;
|
||||||
char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
|
char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
|
||||||
|
|
||||||
|
|
||||||
@@ -70,15 +70,11 @@ void *msc_task(void *args_p)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
MessageDef *received_message_p = NULL;
|
MessageDef *received_message_p = NULL;
|
||||||
// const char *msg_name = NULL;
|
// const char *msg_name = NULL;
|
||||||
// instance_t instance = 0;
|
// instance_t instance = 0;
|
||||||
long timer_id;
|
long timer_id;
|
||||||
|
|
||||||
itti_mark_task_ready(TASK_MSC);
|
itti_mark_task_ready(TASK_MSC);
|
||||||
|
|
||||||
msc_start_use();
|
msc_start_use();
|
||||||
|
|
||||||
|
|
||||||
timer_setup(0, // seconds
|
timer_setup(0, // seconds
|
||||||
50000, // usec
|
50000, // usec
|
||||||
TASK_MSC,
|
TASK_MSC,
|
||||||
@@ -91,20 +87,18 @@ void *msc_task(void *args_p)
|
|||||||
itti_receive_msg(TASK_MSC, &received_message_p);
|
itti_receive_msg(TASK_MSC, &received_message_p);
|
||||||
|
|
||||||
if (received_message_p != NULL) {
|
if (received_message_p != NULL) {
|
||||||
// msg_name = ITTI_MSG_NAME (received_message_p);
|
// msg_name = ITTI_MSG_NAME (received_message_p);
|
||||||
// instance = ITTI_MSG_INSTANCE (received_message_p);
|
// instance = ITTI_MSG_INSTANCE (received_message_p);
|
||||||
|
|
||||||
switch (ITTI_MSG_ID(received_message_p)) {
|
switch (ITTI_MSG_ID(received_message_p)) {
|
||||||
|
|
||||||
case TIMER_HAS_EXPIRED: {
|
case TIMER_HAS_EXPIRED: {
|
||||||
msc_flush_messages();
|
msc_flush_messages();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TERMINATE_MESSAGE: {
|
case TERMINATE_MESSAGE: {
|
||||||
fprintf(stderr, " *** Exiting MSC thread\n");
|
fprintf(stderr, " *** Exiting MSC thread\n");
|
||||||
timer_remove(timer_id);
|
timer_remove(timer_id);
|
||||||
msc_end();
|
msc_end();
|
||||||
itti_exit_task();
|
itti_exit_task();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -119,6 +113,7 @@ void *msc_task(void *args_p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Task MSC exiting\n");
|
fprintf(stderr, "Task MSC exiting\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -132,15 +127,16 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
|
|||||||
void *pointer_p;
|
void *pointer_p;
|
||||||
char msc_filename[256];
|
char msc_filename[256];
|
||||||
fprintf(stderr, "Initializing MSC logs\n");
|
fprintf(stderr, "Initializing MSC logs\n");
|
||||||
|
rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%i.log", envP); // TODO NAME
|
||||||
|
|
||||||
rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%u.log", envP); // TODO NAME
|
if ((0 >= rv) || (256 < rv)) {
|
||||||
if ((0 >= rv) || (256 < rv)){
|
|
||||||
fprintf(stderr, "Error in MSC log file name");
|
fprintf(stderr, "Error in MSC log file name");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_msc_fd = fopen(msc_filename,"w");
|
g_msc_fd = fopen(msc_filename,"w");
|
||||||
AssertFatal(g_msc_fd != NULL, "Could not open MSC log file %s : %s", msc_filename, strerror(errno));
|
AssertFatal(g_msc_fd != NULL, "Could not open MSC log file %s : %s", msc_filename, strerror(errno));
|
||||||
|
|
||||||
rv = lfds611_stack_new(&g_msc_memory_stack_p, (lfds611_atom_t)max_threadsP + 2);
|
rv = lfds611_stack_new(&g_msc_memory_stack_p, (lfds611_atom_t)max_threadsP + 2);
|
||||||
|
|
||||||
if (0 >= rv) {
|
if (0 >= rv) {
|
||||||
AssertFatal (0, "lfds611_stack_new failed!\n");
|
AssertFatal (0, "lfds611_stack_new failed!\n");
|
||||||
}
|
}
|
||||||
@@ -153,7 +149,7 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
|
|||||||
for (i=0; i < max_threadsP * 30; i++) {
|
for (i=0; i < max_threadsP * 30; i++) {
|
||||||
pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH);
|
pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH);
|
||||||
AssertFatal (pointer_p, "malloc failed!\n");
|
AssertFatal (pointer_p, "malloc failed!\n");
|
||||||
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
|
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
|
||||||
AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i);
|
AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,182 +157,335 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
|
|||||||
switch (i) {
|
switch (i) {
|
||||||
case MSC_IP_UE:
|
case MSC_IP_UE:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_IP_ENB:
|
case MSC_IP_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (envP == MSC_E_UTRAN_LIPA) {
|
if (envP == MSC_E_UTRAN_LIPA) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_NAS_UE:
|
case MSC_NAS_UE:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_RRC_UE:
|
case MSC_RRC_UE:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_PDCP_UE:
|
case MSC_PDCP_UE:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_UE");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_UE");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_RLC_UE:
|
case MSC_RLC_UE:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_MAC_UE:
|
case MSC_MAC_UE:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_UE");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_UE");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
msc_log_declare_proto(i);
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
|
msc_log_declare_proto(i);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_PHY_UE:
|
case MSC_PHY_UE:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_UE");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_UE");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_PHY_ENB:
|
case MSC_PHY_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_MAC_ENB:
|
case MSC_MAC_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_RLC_ENB:
|
case MSC_RLC_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_PDCP_ENB:
|
case MSC_PDCP_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_RRC_ENB:
|
case MSC_RRC_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_S1AP_ENB:
|
case MSC_S1AP_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_GTPU_ENB:
|
case MSC_GTPU_ENB:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_ENB");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_ENB");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_GTPU_SGW:
|
case MSC_GTPU_SGW:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_SGW");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_SGW");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_MME_GW) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_MME_GW) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_S1AP_MME:
|
case MSC_S1AP_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_MME");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_MME");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_MME_GW) || (envP == MSC_MME) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
if ((envP == MSC_MME_GW) || (envP == MSC_MME) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_MMEAPP_MME:
|
case MSC_MMEAPP_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MME_APP");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MME_APP");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_NAS_MME:
|
case MSC_NAS_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_MME");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_MME");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_NAS_EMM_MME:
|
case MSC_NAS_EMM_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_EMM");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_EMM");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_NAS_ESM_MME:
|
case MSC_NAS_ESM_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_ESM");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_ESM");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_SP_GWAPP_MME:
|
case MSC_SP_GWAPP_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "SP_GW_MME");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "SP_GW_MME");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (envP == MSC_MME_GW) {
|
if (envP == MSC_MME_GW) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_S11_MME:
|
case MSC_S11_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S11_MME");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S11_MME");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (envP == MSC_MME) {
|
if (envP == MSC_MME) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_S6A_MME:
|
case MSC_S6A_MME:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S6A");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S6A");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSC_HSS:
|
case MSC_HSS:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "HSS");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "HSS");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
|
||||||
msc_log_declare_proto(i);
|
msc_log_declare_proto(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
|
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
|
||||||
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
|
|
||||||
|
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
|
||||||
|
g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = itti_create_task (TASK_MSC, msc_task, NULL);
|
rv = itti_create_task (TASK_MSC, msc_task, NULL);
|
||||||
AssertFatal (rv == 0, "Create task for MSC failed!\n");
|
AssertFatal (rv == 0, "Create task for MSC failed!\n");
|
||||||
fprintf(stderr, "Initializing MSC logs Done\n");
|
fprintf(stderr, "Initializing MSC logs Done\n");
|
||||||
@@ -359,15 +508,17 @@ void msc_flush_messages(void)
|
|||||||
int rv;
|
int rv;
|
||||||
msc_queue_item_t *item_p = NULL;
|
msc_queue_item_t *item_p = NULL;
|
||||||
|
|
||||||
while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void**)&item_p )) == 1) {
|
while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void **)&item_p )) == 1) {
|
||||||
if (NULL != item_p->message_str) {
|
if (NULL != item_p->message_str) {
|
||||||
fputs(item_p->message_str, g_msc_fd);
|
fputs(item_p->message_str, g_msc_fd);
|
||||||
// TODO BIN DATA
|
// TODO BIN DATA
|
||||||
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str );
|
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str );
|
||||||
}
|
}
|
||||||
// TODO FREE BIN DATA
|
|
||||||
free(item_p);
|
// TODO FREE BIN DATA
|
||||||
|
free(item_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(g_msc_fd);
|
fflush(g_msc_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,23 +528,27 @@ void msc_end(void)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (NULL != g_msc_fd ) {
|
if (NULL != g_msc_fd ) {
|
||||||
msc_flush_messages();
|
msc_flush_messages();
|
||||||
rv = fflush(g_msc_fd);
|
rv = fflush(g_msc_fd);
|
||||||
if (rv != 0) {
|
|
||||||
fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
|
|
||||||
}
|
|
||||||
rv = fclose(g_msc_fd);
|
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
|
fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
rv = fclose(g_msc_fd);
|
||||||
|
|
||||||
|
if (rv != 0) {
|
||||||
|
fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void msc_log_declare_proto(
|
void msc_log_declare_proto(
|
||||||
const msc_proto_t protoP
|
const msc_proto_t protoP
|
||||||
)
|
)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
@@ -401,47 +556,55 @@ void msc_log_declare_proto(
|
|||||||
char *char_message_p = NULL;
|
char *char_message_p = NULL;
|
||||||
|
|
||||||
if ((MIN_MSC_PROTOS <= protoP) && (MAX_MSC_PROTOS > protoP)) {
|
if ((MIN_MSC_PROTOS <= protoP) && (MAX_MSC_PROTOS > protoP)) {
|
||||||
// may be build a memory pool for that also ?
|
// may be build a memory pool for that also ?
|
||||||
new_item_p = malloc(sizeof(msc_queue_item_t));
|
new_item_p = malloc(sizeof(msc_queue_item_t));
|
||||||
if (NULL != new_item_p) {
|
|
||||||
|
|
||||||
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
|
if (NULL != new_item_p) {
|
||||||
if (0 == rv) {
|
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
|
||||||
msc_flush_messages();
|
|
||||||
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
|
if (0 == rv) {
|
||||||
}
|
msc_flush_messages();
|
||||||
if (1 == rv) {
|
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 == rv) {
|
||||||
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [PROTO] %d %s\n", __sync_fetch_and_add (&g_message_number, 1), protoP, &g_msc_proto2str[protoP][0]);
|
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [PROTO] %d %s\n", __sync_fetch_and_add (&g_message_number, 1), protoP, &g_msc_proto2str[protoP][0]);
|
||||||
|
|
||||||
if (0 > rv) {
|
if (0 > rv) {
|
||||||
fprintf(stderr, "Error while declaring new protocol in MSC: %s", strerror(errno));
|
fprintf(stderr, "Error while declaring new protocol in MSC: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
new_item_p->message_str = char_message_p;
|
new_item_p->message_str = char_message_p;
|
||||||
new_item_p->message_str_size = rv;
|
new_item_p->message_str_size = rv;
|
||||||
new_item_p->message_bin = NULL;
|
new_item_p->message_bin = NULL;
|
||||||
new_item_p->message_bin_size = 0;
|
new_item_p->message_bin_size = 0;
|
||||||
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
|
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
|
||||||
if (0 == rv) {
|
|
||||||
rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p );
|
if (0 == rv) {
|
||||||
if (0 == rv) {
|
rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p );
|
||||||
|
|
||||||
|
if (0 == rv) {
|
||||||
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
|
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
|
||||||
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
||||||
free(new_item_p);
|
free(new_item_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
} else {
|
return;
|
||||||
fprintf(stderr, "Error while lfds611_stack_pop()\n");
|
} else {
|
||||||
}
|
fprintf(stderr, "Error while lfds611_stack_pop()\n");
|
||||||
|
}
|
||||||
|
|
||||||
free(new_item_p);
|
free(new_item_p);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error while malloc in MSC");
|
fprintf(stderr, "Error while malloc in MSC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void msc_log_event(
|
void msc_log_event(
|
||||||
const msc_proto_t protoP,
|
const msc_proto_t protoP,
|
||||||
char *format, ...)
|
char *format, ...)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -450,52 +613,62 @@ void msc_log_event(
|
|||||||
msc_queue_item_t *new_item_p = NULL;
|
msc_queue_item_t *new_item_p = NULL;
|
||||||
char *char_message_p = NULL;
|
char *char_message_p = NULL;
|
||||||
|
|
||||||
|
|
||||||
if ((MIN_MSC_PROTOS > protoP) || (MAX_MSC_PROTOS <= protoP)) {
|
if ((MIN_MSC_PROTOS > protoP) || (MAX_MSC_PROTOS <= protoP)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new_item_p = malloc(sizeof(msc_queue_item_t));
|
|
||||||
if (NULL != new_item_p) {
|
|
||||||
|
|
||||||
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
|
new_item_p = malloc(sizeof(msc_queue_item_t));
|
||||||
|
|
||||||
|
if (NULL != new_item_p) {
|
||||||
|
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
|
||||||
|
|
||||||
if (0 == rv) {
|
if (0 == rv) {
|
||||||
msc_flush_messages();
|
msc_flush_messages();
|
||||||
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
|
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 == rv) {
|
if (1 == rv) {
|
||||||
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [EVENT] %d ", __sync_fetch_and_add (&g_message_number, 1), protoP);
|
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [EVENT] %d ", __sync_fetch_and_add (&g_message_number, 1), protoP);
|
||||||
|
|
||||||
if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
|
if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
|
||||||
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
|
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
|
rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
||||||
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
|
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv += rv2;
|
rv += rv2;
|
||||||
rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
|
rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
|
||||||
|
|
||||||
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
||||||
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
|
fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv += rv2;
|
rv += rv2;
|
||||||
new_item_p->message_str = char_message_p;
|
new_item_p->message_str = char_message_p;
|
||||||
new_item_p->message_str_size = rv;
|
new_item_p->message_str_size = rv;
|
||||||
new_item_p->message_bin = NULL;
|
new_item_p->message_bin = NULL;
|
||||||
new_item_p->message_bin_size = 0;
|
new_item_p->message_bin_size = 0;
|
||||||
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
|
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
|
||||||
if (0 == rv) {
|
|
||||||
|
if (0 == rv) {
|
||||||
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
|
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
|
||||||
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
||||||
free(new_item_p);
|
free(new_item_p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error while lfds611_stack_pop()\n");
|
fprintf(stderr, "Error while lfds611_stack_pop()\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
error_event:
|
error_event:
|
||||||
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
||||||
@@ -503,12 +676,12 @@ error_event:
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void msc_log_message(
|
void msc_log_message(
|
||||||
const char * const message_operationP,
|
const char *const message_operationP,
|
||||||
const msc_proto_t proto1P,
|
const msc_proto_t proto1P,
|
||||||
const msc_proto_t proto2P,
|
const msc_proto_t proto2P,
|
||||||
const uint8_t * const bytesP,
|
const uint8_t *const bytesP,
|
||||||
const unsigned int num_bytes,
|
const unsigned int num_bytes,
|
||||||
char *format, ...)
|
char *format, ...)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -518,56 +691,65 @@ void msc_log_message(
|
|||||||
msc_queue_item_t *new_item_p = NULL;
|
msc_queue_item_t *new_item_p = NULL;
|
||||||
char *char_message_p = NULL;
|
char *char_message_p = NULL;
|
||||||
|
|
||||||
|
|
||||||
if ((MIN_MSC_PROTOS > proto1P) || (MAX_MSC_PROTOS <= proto1P) ||
|
if ((MIN_MSC_PROTOS > proto1P) || (MAX_MSC_PROTOS <= proto1P) ||
|
||||||
(MIN_MSC_PROTOS > proto2P) || (MAX_MSC_PROTOS <= proto2P) ) {
|
(MIN_MSC_PROTOS > proto2P) || (MAX_MSC_PROTOS <= proto2P) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_item_p = malloc(sizeof(msc_queue_item_t));
|
new_item_p = malloc(sizeof(msc_queue_item_t));
|
||||||
if (NULL != new_item_p) {
|
|
||||||
|
|
||||||
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
|
if (NULL != new_item_p) {
|
||||||
|
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
|
||||||
|
|
||||||
if (0 == rv) {
|
if (0 == rv) {
|
||||||
msc_flush_messages();
|
msc_flush_messages();
|
||||||
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
|
rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 == rv) {
|
if (1 == rv) {
|
||||||
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [MESSAGE] %d %s %d %"PRIu64" ",
|
rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [MESSAGE] %d %s %d %"PRIu64" ",
|
||||||
__sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac);
|
__sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac);
|
||||||
|
|
||||||
if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
|
if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
|
||||||
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
|
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
|
rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
||||||
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
|
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv += rv2;
|
rv += rv2;
|
||||||
rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
|
rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
|
||||||
|
|
||||||
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
|
||||||
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
|
fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv += rv2;
|
rv += rv2;
|
||||||
new_item_p->message_str = char_message_p;
|
new_item_p->message_str = char_message_p;
|
||||||
new_item_p->message_str_size = rv;
|
new_item_p->message_str_size = rv;
|
||||||
new_item_p->message_bin = NULL; // TO DO
|
new_item_p->message_bin = NULL; // TO DO
|
||||||
new_item_p->message_bin_size = 0; // TO DO
|
new_item_p->message_bin_size = 0; // TO DO
|
||||||
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
|
rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
|
||||||
if (0 == rv) {
|
|
||||||
|
if (0 == rv) {
|
||||||
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
|
fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
|
||||||
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
||||||
free(new_item_p);
|
free(new_item_p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error while lfds611_stack_pop()\n");
|
fprintf(stderr, "Error while lfds611_stack_pop()\n");
|
||||||
msc_flush_messages();
|
msc_flush_messages();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
error_event:
|
error_event:
|
||||||
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
|
||||||
@@ -578,8 +760,7 @@ error_event:
|
|||||||
// function called when oai loader loads the msc shared lib
|
// function called when oai loader loads the msc shared lib
|
||||||
int msc_autoinit(msc_interface_t *msc_interface)
|
int msc_autoinit(msc_interface_t *msc_interface)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
|
||||||
msc_interface->msc_init = msc_init;
|
msc_interface->msc_init = msc_init;
|
||||||
msc_interface->msc_start_use = msc_start_use;
|
msc_interface->msc_start_use = msc_start_use;
|
||||||
msc_interface->msc_end = msc_end;
|
msc_interface->msc_end = msc_end;
|
||||||
@@ -587,4 +768,4 @@ int msc_autoinit(msc_interface_t *msc_interface)
|
|||||||
msc_interface->msc_log_message = msc_log_message;
|
msc_interface->msc_log_message = msc_log_message;
|
||||||
msc_interface->msc_loaded = 1;
|
msc_interface->msc_loaded = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+567
-596
File diff suppressed because it is too large
Load Diff
@@ -270,6 +270,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
|
|||||||
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
|
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
|
||||||
{
|
{
|
||||||
phy_info phy;
|
phy_info phy;
|
||||||
|
memset(&phy,0,sizeof(phy));
|
||||||
phy.index = resp->pnf_phy.phy[i].phy_config_index;
|
phy.index = resp->pnf_phy.phy[i].phy_config_index;
|
||||||
|
|
||||||
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
|
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
|
||||||
@@ -287,6 +288,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
|
|||||||
|
|
||||||
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
|
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
|
||||||
rf_info rf;
|
rf_info rf;
|
||||||
|
memset(&rf,0,sizeof(rf));
|
||||||
rf.index = resp->pnf_rf.rf[i].rf_config_index;
|
rf.index = resp->pnf_rf.rf[i].rf_config_index;
|
||||||
|
|
||||||
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
|
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
|
||||||
@@ -897,7 +899,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
|
|||||||
|
|
||||||
// for now just 1
|
// for now just 1
|
||||||
|
|
||||||
printf("[VNF] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
|
printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
|
||||||
|
|
||||||
req->header.message_id = NFAPI_CONFIG_REQUEST;
|
req->header.message_id = NFAPI_CONFIG_REQUEST;
|
||||||
req->header.phy_id = phy->id;
|
req->header.phy_id = phy->id;
|
||||||
@@ -919,7 +921,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
|
|||||||
|
|
||||||
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
|
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
|
||||||
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
|
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
|
||||||
printf("[VNF] Timing window:%d\n", p7_vnf->timing_window);
|
printf("[VNF] Timing window:%u\n", p7_vnf->timing_window);
|
||||||
req->num_tlv++;
|
req->num_tlv++;
|
||||||
|
|
||||||
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
|
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
|
||||||
|
|||||||
+118
-180
@@ -26,9 +26,9 @@
|
|||||||
date: 09.2012
|
date: 09.2012
|
||||||
*/
|
*/
|
||||||
#ifndef TC_MAIN
|
#ifndef TC_MAIN
|
||||||
#include "coding_defs.h"
|
#include "coding_defs.h"
|
||||||
#else
|
#else
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -66,11 +66,11 @@ struct treillis {
|
|||||||
union {
|
union {
|
||||||
uint8x8_t systematic_andp1_64[3];
|
uint8x8_t systematic_andp1_64[3];
|
||||||
char systematic_andp1_8[24];
|
char systematic_andp1_8[24];
|
||||||
}__attribute__((aligned(64)));
|
} __attribute__((aligned(64)));
|
||||||
union {
|
union {
|
||||||
uint8x8_t parity2_64[3];
|
uint8x8_t parity2_64[3];
|
||||||
char parity2_8[24];
|
char parity2_8[24];
|
||||||
}__attribute__((aligned(64)));
|
} __attribute__((aligned(64)));
|
||||||
int exit_state;
|
int exit_state;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -79,23 +79,20 @@ struct treillis all_treillis[8][256];
|
|||||||
|
|
||||||
int all_treillis_initialized=0;
|
int all_treillis_initialized=0;
|
||||||
|
|
||||||
static inline unsigned char threegpplte_rsc(unsigned char input,unsigned char *state)
|
static inline unsigned char threegpplte_rsc(unsigned char input,unsigned char *state) {
|
||||||
{
|
|
||||||
unsigned char output;
|
unsigned char output;
|
||||||
output = (input ^ (*state>>2) ^ (*state>>1))&1;
|
output = (input ^ (*state>>2) ^ (*state>>1))&1;
|
||||||
*state = (((input<<2)^(*state>>1))^((*state>>1)<<2)^((*state)<<2))&7;
|
*state = (((input<<2)^(*state>>1))^((*state>>1)<<2)^((*state)<<2))&7;
|
||||||
return(output);
|
return(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void threegpplte_rsc_termination(unsigned char *x,unsigned char *z,unsigned char *state)
|
static inline void threegpplte_rsc_termination(unsigned char *x,unsigned char *z,unsigned char *state) {
|
||||||
{
|
|
||||||
*z = ((*state>>2) ^ (*state)) &1;
|
*z = ((*state>>2) ^ (*state)) &1;
|
||||||
*x = ((*state) ^ (*state>>1)) &1;
|
*x = ((*state) ^ (*state>>1)) &1;
|
||||||
*state = (*state)>>1;
|
*state = (*state)>>1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void treillis_table_init(void)
|
static void treillis_table_init(void) {
|
||||||
{
|
|
||||||
//struct treillis t[][]=all_treillis;
|
//struct treillis t[][]=all_treillis;
|
||||||
//t=memalign(16,sizeof(struct treillis)*8*256);
|
//t=memalign(16,sizeof(struct treillis)*8*256);
|
||||||
int i, j,b;
|
int i, j,b;
|
||||||
@@ -114,8 +111,8 @@ static void treillis_table_init(void)
|
|||||||
all_treillis[i][j].systematic_andp1_8[b*3]= (j&(1<<(7-b)))>>(7-b);
|
all_treillis[i][j].systematic_andp1_8[b*3]= (j&(1<<(7-b)))>>(7-b);
|
||||||
v=threegpplte_rsc( all_treillis[i][j].systematic_andp1_8[b*3] ,
|
v=threegpplte_rsc( all_treillis[i][j].systematic_andp1_8[b*3] ,
|
||||||
¤t_state);
|
¤t_state);
|
||||||
all_treillis[i][j].systematic_andp1_8[b*3+1]=v; // for the yparity1
|
all_treillis[i][j].systematic_andp1_8[b*3+1]=v; // for the yparity1
|
||||||
// all_treillis[i][j].parity1_8[b*3+1]=v; // for the yparity1
|
// all_treillis[i][j].parity1_8[b*3+1]=v; // for the yparity1
|
||||||
all_treillis[i][j].parity2_8[b*3+2]=v; // for the yparity2
|
all_treillis[i][j].parity2_8[b*3+2]=v; // for the yparity2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,14 +125,12 @@ static void treillis_table_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char interleave_compact_byte(short * base_interleaver,unsigned char * input, unsigned char * output, int n)
|
char interleave_compact_byte(short *base_interleaver,unsigned char *input, unsigned char *output, int n) {
|
||||||
{
|
|
||||||
|
|
||||||
char expandInput[768*8] __attribute__((aligned(32)));
|
char expandInput[768*8] __attribute__((aligned(32)));
|
||||||
int i,loop=n>>4;
|
int i,loop=n>>4;
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
#ifndef __AVX2__
|
#ifndef __AVX2__
|
||||||
__m128i *i_128=(__m128i *)input, *o_128=(__m128i*)expandInput;
|
__m128i *i_128=(__m128i *)input, *o_128=(__m128i *)expandInput;
|
||||||
__m128i tmp1, tmp2, tmp3, tmp4;
|
__m128i tmp1, tmp2, tmp3, tmp4;
|
||||||
__m128i BIT_MASK = _mm_set_epi8( 0b00000001,
|
__m128i BIT_MASK = _mm_set_epi8( 0b00000001,
|
||||||
0b00000010,
|
0b00000010,
|
||||||
@@ -153,42 +148,41 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
0b00100000,
|
0b00100000,
|
||||||
0b01000000,
|
0b01000000,
|
||||||
0b10000000);
|
0b10000000);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
__m256i *i_256=(__m256i *)input, *o_256=(__m256i*)expandInput;
|
__m256i *i_256=(__m256i *)input, *o_256=(__m256i *)expandInput;
|
||||||
__m256i tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
|
__m256i tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
|
||||||
__m256i BIT_MASK = _mm256_set_epi8( 0b00000001,
|
__m256i BIT_MASK = _mm256_set_epi8( 0b00000001,
|
||||||
0b00000010,
|
0b00000010,
|
||||||
0b00000100,
|
0b00000100,
|
||||||
0b00001000,
|
0b00001000,
|
||||||
0b00010000,
|
0b00010000,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b01000000,
|
0b01000000,
|
||||||
0b10000000,
|
0b10000000,
|
||||||
0b00000001,
|
0b00000001,
|
||||||
0b00000010,
|
0b00000010,
|
||||||
0b00000100,
|
0b00000100,
|
||||||
0b00001000,
|
0b00001000,
|
||||||
0b00010000,
|
0b00010000,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b01000000,
|
0b01000000,
|
||||||
0b10000000,
|
0b10000000,
|
||||||
0b00000001,
|
0b00000001,
|
||||||
0b00000010,
|
0b00000010,
|
||||||
0b00000100,
|
0b00000100,
|
||||||
0b00001000,
|
0b00001000,
|
||||||
0b00010000,
|
0b00010000,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b01000000,
|
0b01000000,
|
||||||
0b10000000,
|
0b10000000,
|
||||||
0b00000001,
|
0b00000001,
|
||||||
0b00000010,
|
0b00000010,
|
||||||
0b00000100,
|
0b00000100,
|
||||||
0b00001000,
|
0b00001000,
|
||||||
0b00010000,
|
0b00010000,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b01000000,
|
0b01000000,
|
||||||
0b10000000);
|
0b10000000);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
uint8x16_t *i_128=(uint8x16_t *)input, *o_128=(uint8x16_t *)expandInput;
|
uint8x16_t *i_128=(uint8x16_t *)input, *o_128=(uint8x16_t *)expandInput;
|
||||||
@@ -196,40 +190,41 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
uint16x8_t tmp3;
|
uint16x8_t tmp3;
|
||||||
uint32x4_t tmp4;
|
uint32x4_t tmp4;
|
||||||
uint8x16_t and_tmp;
|
uint8x16_t and_tmp;
|
||||||
uint8x16_t BIT_MASK = { 0b10000000,
|
uint8x16_t BIT_MASK = { 0b10000000,
|
||||||
0b01000000,
|
0b01000000,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b00010000,
|
0b00010000,
|
||||||
0b00001000,
|
0b00001000,
|
||||||
0b00000100,
|
0b00000100,
|
||||||
0b00000010,
|
0b00000010,
|
||||||
0b00000001,
|
0b00000001,
|
||||||
0b10000000,
|
0b10000000,
|
||||||
0b01000000,
|
0b01000000,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b00010000,
|
0b00010000,
|
||||||
0b00001000,
|
0b00001000,
|
||||||
0b00000100,
|
0b00000100,
|
||||||
0b00000010,
|
0b00000010,
|
||||||
0b00000001};
|
0b00000001
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef __AVX2__
|
#ifndef __AVX2__
|
||||||
|
|
||||||
if ((n&15) > 0)
|
if ((n&15) > 0)
|
||||||
loop++;
|
loop++;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
loop=n>>5;
|
loop=n>>5;
|
||||||
|
|
||||||
if ((n&31) > 0)
|
if ((n&31) > 0)
|
||||||
loop++;
|
loop++;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<loop ; i++ ) {
|
for (i=0; i<loop ; i++ ) {
|
||||||
// int cur_byte=i<<3;
|
// int cur_byte=i<<3;
|
||||||
// for (b=0;b<8;b++)
|
// for (b=0;b<8;b++)
|
||||||
// expandInput[cur_byte+b] = (input[i]&(1<<(7-b)))>>(7-b);
|
// expandInput[cur_byte+b] = (input[i]&(1<<(7-b)))>>(7-b);
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
#ifndef __AVX2__
|
#ifndef __AVX2__
|
||||||
tmp1=_mm_load_si128(i_128++); // tmp1 = B0,B1,...,B15
|
tmp1=_mm_load_si128(i_128++); // tmp1 = B0,B1,...,B15
|
||||||
@@ -237,29 +232,22 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
tmp3=_mm_unpacklo_epi16(tmp2,tmp2); // tmp3 = B0,B0,B0,B0,B1,B1,B1,B1,B2,B2,B2,B2,B3,B3,B3,B3
|
tmp3=_mm_unpacklo_epi16(tmp2,tmp2); // tmp3 = B0,B0,B0,B0,B1,B1,B1,B1,B2,B2,B2,B2,B3,B3,B3,B3
|
||||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 - B0,B0,B0,B0,B0,B0,B0,B0,B1,B1,B1,B1,B1,B1,B1,B1
|
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 - B0,B0,B0,B0,B0,B0,B0,B0,B1,B1,B1,B1,B1,B1,B1,B1
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);
|
||||||
|
|
||||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 - B2,B2,B2,B2,B2,B2,B2,B2,B3,B3,B3,B3,B3,B3,B3,B3
|
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 - B2,B2,B2,B2,B2,B2,B2,B2,B3,B3,B3,B3,B3,B3,B3,B3
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||||
|
|
||||||
tmp3=_mm_unpackhi_epi16(tmp2,tmp2); // tmp3 = B4,B4,B4,B4,B5,B5,B5,B5,B6,B6,B6,B6,B7,B7,B7,B7
|
tmp3=_mm_unpackhi_epi16(tmp2,tmp2); // tmp3 = B4,B4,B4,B4,B5,B5,B5,B5,B6,B6,B6,B6,B7,B7,B7,B7
|
||||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 - B4,B4,B4,B4,B4,B4,B4,B4,B5,B5,B5,B5,B5,B5,B5,B5
|
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 - B4,B4,B4,B4,B4,B4,B4,B4,B5,B5,B5,B5,B5,B5,B5,B5
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||||
|
|
||||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 - B6,B6,B6,B6,B6,B6,B6,B6,B7,B7,B7,B7,B7,B7,B7,B7
|
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 - B6,B6,B6,B6,B6,B6,B6,B6,B7,B7,B7,B7,B7,B7,B7,B7
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||||
|
|
||||||
tmp2=_mm_unpackhi_epi8(tmp1,tmp1); // tmp2 = B8,B8,B9,B9,...,B15,B15
|
tmp2=_mm_unpackhi_epi8(tmp1,tmp1); // tmp2 = B8,B8,B9,B9,...,B15,B15
|
||||||
tmp3=_mm_unpacklo_epi16(tmp2,tmp2); // tmp3 = B8,B8,B8,B8,B9,B9,B9,B9,B10,B10,B10,B10,B11,B11,B11,B11
|
tmp3=_mm_unpacklo_epi16(tmp2,tmp2); // tmp3 = B8,B8,B8,B8,B9,B9,B9,B9,B10,B10,B10,B10,B11,B11,B11,B11
|
||||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 = B8,B8,B8,B8,B8,B8,B8,B8,B9,B9,B9,B9,B9,B9,B9,B9
|
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 = B8,B8,B8,B8,B8,B8,B8,B8,B9,B9,B9,B9,B9,B9,B9,B9
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||||
|
|
||||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 = B10,B10,B10,B10,B10,B10,B10,B10,B11,B11,B11,B11,B11,B11,B11,B11
|
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 = B10,B10,B10,B10,B10,B10,B10,B10,B11,B11,B11,B11,B11,B11,B11,B11
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||||
|
|
||||||
tmp3=_mm_unpackhi_epi16(tmp2,tmp2); // tmp3 = B12,B12,B12,B12,B13,B13,B13,B13,B14,B14,B14,B14,B15,B15,B15,B15
|
tmp3=_mm_unpackhi_epi16(tmp2,tmp2); // tmp3 = B12,B12,B12,B12,B13,B13,B13,B13,B14,B14,B14,B14,B15,B15,B15,B15
|
||||||
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 = B12,B12,B12,B12,B12,B12,B12,B12,B13,B13,B13,B13,B13,B13,B13,B13
|
tmp4=_mm_unpacklo_epi32(tmp3,tmp3); // tmp4 = B12,B12,B12,B12,B12,B12,B12,B12,B13,B13,B13,B13,B13,B13,B13,B13
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||||
|
|
||||||
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 = B14,B14,B14,B14,B14,B14,B14,B14,B15,B15,B15,B15,B15,B15,B15,B15
|
tmp4=_mm_unpackhi_epi32(tmp3,tmp3); // tmp4 = B14,B14,B14,B14,B14,B14,B14,B14,B15,B15,B15,B15,B15,B15,B15,B15
|
||||||
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
*o_128++=_mm_cmpeq_epi8(_mm_and_si128(tmp4,BIT_MASK),BIT_MASK);;
|
||||||
#else
|
#else
|
||||||
@@ -281,7 +269,6 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
//print_bytes2("out",(uint8_t*)o_256);
|
//print_bytes2("out",(uint8_t*)o_256);
|
||||||
o_256[4]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
o_256[4]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||||
//print_bytes2("out",(uint8_t*)(o_256+4));
|
//print_bytes2("out",(uint8_t*)(o_256+4));
|
||||||
|
|
||||||
tmp3=_mm256_unpackhi_epi16(tmp2,tmp2); // tmp3 = B4,B4,B4,B4,B5,B5,B5,B5,B6,B6,B6,B6,B7,B7,B7,B7,B20,B20,B20,B20,...,B23,B23,B23,B23
|
tmp3=_mm256_unpackhi_epi16(tmp2,tmp2); // tmp3 = B4,B4,B4,B4,B5,B5,B5,B5,B6,B6,B6,B6,B7,B7,B7,B7,B20,B20,B20,B20,...,B23,B23,B23,B23
|
||||||
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 - B4,B4,B4,B4,B4,B4,B4,B4,B5,B5,B5,B5,B5,B5,B5,B5,B20,B20...,B21..,B21
|
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 - B4,B4,B4,B4,B4,B4,B4,B4,B5,B5,B5,B5,B5,B5,B5,B5,B20,B20...,B21..,B21
|
||||||
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 - B6,B6,B6,B6,B6,B6,B6,B6,B7,B7,B7,B7,B7,B7,B7,B7,B22...,B22,B23,...,B23
|
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 - B6,B6,B6,B6,B6,B6,B6,B6,B7,B7,B7,B7,B7,B7,B7,B7,B22...,B22,B23,...,B23
|
||||||
@@ -297,7 +284,6 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
//print_bytes2("out",(uint8_t*)(o_256+1));
|
//print_bytes2("out",(uint8_t*)(o_256+1));
|
||||||
o_256[5]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
o_256[5]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||||
//print_bytes2("out",(uint8_t*)(o_256+4));
|
//print_bytes2("out",(uint8_t*)(o_256+4));
|
||||||
|
|
||||||
tmp2=_mm256_unpackhi_epi8(tmp1,tmp1); // tmp2 = B8 B9 B10 B11 B12 B13 B14 B15 B25 B26 B27 B28 B29 B30 B31
|
tmp2=_mm256_unpackhi_epi8(tmp1,tmp1); // tmp2 = B8 B9 B10 B11 B12 B13 B14 B15 B25 B26 B27 B28 B29 B30 B31
|
||||||
tmp3=_mm256_unpacklo_epi16(tmp2,tmp2); // tmp3 = B8,B9,B10,B11,B26,B27,B28,B29
|
tmp3=_mm256_unpacklo_epi16(tmp2,tmp2); // tmp3 = B8,B9,B10,B11,B26,B27,B28,B29
|
||||||
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 - B8,B9,B26,B27
|
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 - B8,B9,B26,B27
|
||||||
@@ -314,11 +300,10 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
//print_bytes2("out",(uint8_t*)(o_256+2));
|
//print_bytes2("out",(uint8_t*)(o_256+2));
|
||||||
o_256[6]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
o_256[6]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||||
//print_bytes2("out",(uint8_t*)(o_256+4));
|
//print_bytes2("out",(uint8_t*)(o_256+4));
|
||||||
|
|
||||||
tmp3=_mm256_unpackhi_epi16(tmp2,tmp2); // tmp3 = B12 B13 B14 B15 B28 B29 B30 B31
|
tmp3=_mm256_unpackhi_epi16(tmp2,tmp2); // tmp3 = B12 B13 B14 B15 B28 B29 B30 B31
|
||||||
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 = B12 B13 B28 B29
|
tmp4=_mm256_unpacklo_epi32(tmp3,tmp3); // tmp4 = B12 B13 B28 B29
|
||||||
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 = B14 B15 B30 B31
|
tmp5=_mm256_unpackhi_epi32(tmp3,tmp3); // tmp5 = B14 B15 B30 B31
|
||||||
tmp6=_mm256_insertf128_si256(tmp4,_mm256_extracti128_si256(tmp5,0),1); // tmp6 = B12 B13 B14 B15
|
tmp6=_mm256_insertf128_si256(tmp4,_mm256_extracti128_si256(tmp5,0),1); // tmp6 = B12 B13 B14 B15
|
||||||
tmp7=_mm256_insertf128_si256(tmp5,_mm256_extracti128_si256(tmp4,1),0); // tmp7 = B28 B29 B30 B31
|
tmp7=_mm256_insertf128_si256(tmp5,_mm256_extracti128_si256(tmp4,1),0); // tmp7 = B28 B29 B30 B31
|
||||||
//print_bytes2("tmp2",(uint8_t*)&tmp2);
|
//print_bytes2("tmp2",(uint8_t*)&tmp2);
|
||||||
//print_bytes2("tmp3",(uint8_t*)&tmp3);
|
//print_bytes2("tmp3",(uint8_t*)&tmp3);
|
||||||
@@ -330,48 +315,35 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
//print_bytes2("out",(uint8_t*)(o_256+3));
|
//print_bytes2("out",(uint8_t*)(o_256+3));
|
||||||
o_256[7]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
o_256[7]=_mm256_cmpeq_epi8(_mm256_and_si256(tmp7,BIT_MASK),BIT_MASK);;
|
||||||
//print_bytes2("out",(uint8_t*)(o_256+7));
|
//print_bytes2("out",(uint8_t*)(o_256+7));
|
||||||
|
|
||||||
o_256+=8;
|
o_256+=8;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
tmp1=vld1q_u8((uint8_t*)i_128);
|
tmp1=vld1q_u8((uint8_t *)i_128);
|
||||||
//print_bytes("tmp1:",(uint8_t*)&tmp1);
|
//print_bytes("tmp1:",(uint8_t*)&tmp1);
|
||||||
|
|
||||||
uint8x16x2_t temp1 = vzipq_u8(tmp1,tmp1);
|
uint8x16x2_t temp1 = vzipq_u8(tmp1,tmp1);
|
||||||
tmp2 = temp1.val[0];
|
tmp2 = temp1.val[0];
|
||||||
|
|
||||||
uint16x8x2_t temp2 = vzipq_u16((uint16x8_t)tmp2,(uint16x8_t)tmp2);
|
uint16x8x2_t temp2 = vzipq_u16((uint16x8_t)tmp2,(uint16x8_t)tmp2);
|
||||||
tmp3 = temp2.val[0];
|
tmp3 = temp2.val[0];
|
||||||
|
|
||||||
uint32x4x2_t temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
uint32x4x2_t temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
||||||
tmp4 = temp3.val[0];
|
tmp4 = temp3.val[0];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //1
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //1
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
tmp4 = temp3.val[1];
|
tmp4 = temp3.val[1];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //2
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //2
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
tmp3 = temp2.val[1];
|
tmp3 = temp2.val[1];
|
||||||
temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
||||||
tmp4 = temp3.val[0];
|
tmp4 = temp3.val[0];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //3
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //3
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
tmp4 = temp3.val[1];
|
tmp4 = temp3.val[1];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //4
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //4
|
||||||
//and_tmp = vandq_u8((uint8x16_t)tmp4,BIT_MASK); print_bytes("and:",and_tmp);
|
//and_tmp = vandq_u8((uint8x16_t)tmp4,BIT_MASK); print_bytes("and:",and_tmp);
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
|
|
||||||
temp1 = vzipq_u8(tmp1,tmp1);
|
temp1 = vzipq_u8(tmp1,tmp1);
|
||||||
tmp2 = temp1.val[1];
|
tmp2 = temp1.val[1];
|
||||||
temp2 = vzipq_u16((uint16x8_t)tmp2,(uint16x8_t)tmp2);
|
temp2 = vzipq_u16((uint16x8_t)tmp2,(uint16x8_t)tmp2);
|
||||||
@@ -379,52 +351,41 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
||||||
tmp4 = temp3.val[0];
|
tmp4 = temp3.val[0];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //5
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //5
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
tmp4 = temp3.val[1];
|
tmp4 = temp3.val[1];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //6
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //6
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
|
|
||||||
temp2 = vzipq_u16((uint16x8_t)tmp2,(uint16x8_t)tmp2);
|
temp2 = vzipq_u16((uint16x8_t)tmp2,(uint16x8_t)tmp2);
|
||||||
tmp3 = temp2.val[1];
|
tmp3 = temp2.val[1];
|
||||||
temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
temp3 = vzipq_u32((uint32x4_t)tmp3,(uint32x4_t)tmp3);
|
||||||
tmp4 = temp3.val[0];
|
tmp4 = temp3.val[0];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //7
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //7
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
tmp4 = temp3.val[1];
|
tmp4 = temp3.val[1];
|
||||||
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
//print_bytes("tmp4:",(uint8_t*)&tmp4);
|
||||||
|
|
||||||
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //7
|
*o_128++=vceqq_u8(vandq_u8((uint8x16_t)tmp4,BIT_MASK),BIT_MASK); //7
|
||||||
//print_bytes("o:",(uint8_t*)(o_128-1));
|
//print_bytes("o:",(uint8_t*)(o_128-1));
|
||||||
|
|
||||||
i_128++;
|
i_128++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
short * ptr_intl=base_interleaver;
|
short *ptr_intl=base_interleaver;
|
||||||
#if defined(__x86_64) || defined(__i386__)
|
#if defined(__x86_64) || defined(__i386__)
|
||||||
#ifndef __AVX2__
|
#ifndef __AVX2__
|
||||||
__m128i tmp;
|
__m128i tmp;
|
||||||
uint16_t *systematic2_ptr=(uint16_t *) output;
|
uint16_t *systematic2_ptr=(uint16_t *) output;
|
||||||
#else
|
#else
|
||||||
__m256i tmp;
|
__m256i tmp;
|
||||||
uint32_t *systematic2_ptr=(uint32_t *) output;
|
uint32_t *systematic2_ptr=(uint32_t *) output;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
uint8x16_t tmp;
|
uint8x16_t tmp;
|
||||||
const uint8_t __attribute__ ((aligned (16))) _Powers[16]=
|
const uint8_t __attribute__ ((aligned (16))) _Powers[16]=
|
||||||
{ 1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128 };
|
{ 1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128 };
|
||||||
|
// Set the powers of 2 (do it once for all, if applicable)
|
||||||
// Set the powers of 2 (do it once for all, if applicable)
|
|
||||||
uint8x16_t Powers= vld1q_u8(_Powers);
|
uint8x16_t Powers= vld1q_u8(_Powers);
|
||||||
uint8_t *systematic2_ptr=(uint8_t *) output;
|
uint8_t *systematic2_ptr=(uint8_t *) output;
|
||||||
#endif
|
#endif
|
||||||
@@ -435,8 +396,6 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for ( i=0; i< input_length_words ; i ++ ) {
|
for ( i=0; i< input_length_words ; i ++ ) {
|
||||||
|
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
#ifndef __AVX2__
|
#ifndef __AVX2__
|
||||||
tmp=_mm_insert_epi8(tmp,expandInput[*ptr_intl++],7);
|
tmp=_mm_insert_epi8(tmp,expandInput[*ptr_intl++],7);
|
||||||
@@ -465,7 +424,6 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],2);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],2);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],1);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],1);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],0);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],0);
|
||||||
|
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+7);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+7);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+6);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+6);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+5);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+5);
|
||||||
@@ -474,7 +432,6 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+2);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+2);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+1);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+1);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+0);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],8+0);
|
||||||
|
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+7);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+7);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+6);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+6);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+5);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+5);
|
||||||
@@ -483,7 +440,6 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+2);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+2);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+1);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+1);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+0);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],16+0);
|
||||||
|
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+7);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+7);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+6);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+6);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+5);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+5);
|
||||||
@@ -492,7 +448,6 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+2);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+2);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+1);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+1);
|
||||||
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+0);
|
tmp=_mm256_insert_epi8(tmp,expandInput[*ptr_intl++],24+0);
|
||||||
|
|
||||||
*systematic2_ptr++=(unsigned int)_mm256_movemask_epi8(tmp);
|
*systematic2_ptr++=(unsigned int)_mm256_movemask_epi8(tmp);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
@@ -512,11 +467,10 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,8+2);
|
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,8+2);
|
||||||
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,8+1);
|
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,8+1);
|
||||||
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,8+0);
|
tmp=vsetq_lane_u8(expandInput[*ptr_intl++],tmp,8+0);
|
||||||
// Compute the mask from the input
|
// Compute the mask from the input
|
||||||
uint64x2_t Mask= vpaddlq_u32(vpaddlq_u16(vpaddlq_u8(vandq_u8(tmp, Powers))));
|
uint64x2_t Mask= vpaddlq_u32(vpaddlq_u16(vpaddlq_u8(vandq_u8(tmp, Powers))));
|
||||||
vst1q_lane_u8(systematic2_ptr++, (uint8x16_t)Mask, 0);
|
vst1q_lane_u8(systematic2_ptr++, (uint8x16_t)Mask, 0);
|
||||||
vst1q_lane_u8(systematic2_ptr++, (uint8x16_t)Mask, 8);
|
vst1q_lane_u8(systematic2_ptr++, (uint8x16_t)Mask, 8);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,14 +491,12 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
|||||||
void threegpplte_turbo_encoder_sse(unsigned char *input,
|
void threegpplte_turbo_encoder_sse(unsigned char *input,
|
||||||
unsigned short input_length_bytes,
|
unsigned short input_length_bytes,
|
||||||
unsigned char *output,
|
unsigned char *output,
|
||||||
unsigned char F)
|
unsigned char F) {
|
||||||
{
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
unsigned char *x;
|
unsigned char *x;
|
||||||
unsigned char state0=0,state1=0;
|
unsigned char state0=0,state1=0;
|
||||||
unsigned short input_length_bits = input_length_bytes<<3;
|
unsigned short input_length_bits = input_length_bytes<<3;
|
||||||
short * base_interleaver;
|
short *base_interleaver;
|
||||||
|
|
||||||
if ( all_treillis_initialized == 0 ) {
|
if ( all_treillis_initialized == 0 ) {
|
||||||
treillis_table_init();
|
treillis_table_init();
|
||||||
@@ -560,15 +512,12 @@ void threegpplte_turbo_encoder_sse(unsigned char *input,
|
|||||||
base_interleaver=il_tb+f1f2mat[i].beg_index;
|
base_interleaver=il_tb+f1f2mat[i].beg_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned char systematic2[768] __attribute__((aligned(32)));
|
unsigned char systematic2[768] __attribute__((aligned(32)));
|
||||||
|
|
||||||
interleave_compact_byte(base_interleaver,input,systematic2,input_length_bytes);
|
interleave_compact_byte(base_interleaver,input,systematic2,input_length_bytes);
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
__m64 *ptr_output=(__m64*) output;
|
__m64 *ptr_output=(__m64 *) output;
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
uint8x8_t *ptr_output=(uint8x8_t*)output;
|
uint8x8_t *ptr_output=(uint8x8_t *)output;
|
||||||
#endif
|
#endif
|
||||||
unsigned char cur_s1, cur_s2;
|
unsigned char cur_s1, cur_s2;
|
||||||
int code_rate;
|
int code_rate;
|
||||||
@@ -582,54 +531,45 @@ void threegpplte_turbo_encoder_sse(unsigned char *input,
|
|||||||
/*
|
/*
|
||||||
*ptr_output++ = _mm_add_pi8(all_treillis[state0][cur_s1].systematic_64[code_rate],
|
*ptr_output++ = _mm_add_pi8(all_treillis[state0][cur_s1].systematic_64[code_rate],
|
||||||
_mm_add_pi8(all_treillis[state0][cur_s1].parity1_64[code_rate],
|
_mm_add_pi8(all_treillis[state0][cur_s1].parity1_64[code_rate],
|
||||||
all_treillis[state1][cur_s2].parity2_64[code_rate]));
|
all_treillis[state1][cur_s2].parity2_64[code_rate]));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*ptr_output++ = _mm_add_pi8(all_treillis[state0][cur_s1].systematic_andp1_64[code_rate],
|
*ptr_output++ = _mm_add_pi8(all_treillis[state0][cur_s1].systematic_andp1_64[code_rate],
|
||||||
all_treillis[state1][cur_s2].parity2_64[code_rate]);
|
all_treillis[state1][cur_s2].parity2_64[code_rate]);
|
||||||
|
|
||||||
|
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
*ptr_output++ = vadd_u8(all_treillis[state0][cur_s1].systematic_andp1_64[code_rate],
|
*ptr_output++ = vadd_u8(all_treillis[state0][cur_s1].systematic_andp1_64[code_rate],
|
||||||
all_treillis[state0][cur_s1].parity2_64[code_rate]);
|
all_treillis[state0][cur_s1].parity2_64[code_rate]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
state0=all_treillis[state0][cur_s1].exit_state;
|
state0=all_treillis[state0][cur_s1].exit_state;
|
||||||
state1=all_treillis[state1][cur_s2].exit_state;
|
state1=all_treillis[state1][cur_s2].exit_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
x=output+(input_length_bits*3);
|
x=output+(input_length_bits*3);
|
||||||
|
|
||||||
// Trellis termination
|
// Trellis termination
|
||||||
threegpplte_rsc_termination(&x[0],&x[1],&state0);
|
threegpplte_rsc_termination(&x[0],&x[1],&state0);
|
||||||
#ifdef DEBUG_TURBO_ENCODER
|
#ifdef DEBUG_TURBO_ENCODER
|
||||||
printf("term: x0 %d, x1 %d, state0 %d\n",x[0],x[1],state0);
|
printf("term: x0 %u, x1 %u, state0 %d\n",x[0],x[1],state0);
|
||||||
#endif //DEBUG_TURBO_ENCODER
|
#endif //DEBUG_TURBO_ENCODER
|
||||||
|
|
||||||
threegpplte_rsc_termination(&x[2],&x[3],&state0);
|
threegpplte_rsc_termination(&x[2],&x[3],&state0);
|
||||||
#ifdef DEBUG_TURBO_ENCODER
|
#ifdef DEBUG_TURBO_ENCODER
|
||||||
printf("term: x0 %d, x1 %d, state0 %d\n",x[2],x[3],state0);
|
printf("term: x0 %u, x1 %u, state0 %d\n",x[2],x[3],state0);
|
||||||
#endif //DEBUG_TURBO_ENCODER
|
#endif //DEBUG_TURBO_ENCODER
|
||||||
|
|
||||||
threegpplte_rsc_termination(&x[4],&x[5],&state0);
|
threegpplte_rsc_termination(&x[4],&x[5],&state0);
|
||||||
#ifdef DEBUG_TURBO_ENCODER
|
#ifdef DEBUG_TURBO_ENCODER
|
||||||
printf("term: x0 %d, x1 %d, state0 %d\n",x[4],x[5],state0);
|
printf("term: x0 %u, x1 %u, state0 %d\n",x[4],x[5],state0);
|
||||||
#endif //DEBUG_TURBO_ENCODER
|
#endif //DEBUG_TURBO_ENCODER
|
||||||
|
|
||||||
threegpplte_rsc_termination(&x[6],&x[7],&state1);
|
threegpplte_rsc_termination(&x[6],&x[7],&state1);
|
||||||
|
|
||||||
#ifdef DEBUG_TURBO_ENCODER
|
#ifdef DEBUG_TURBO_ENCODER
|
||||||
printf("term: x0 %d, x1 %d, state1 %d\n",x[6],x[7],state1);
|
printf("term: x0 %u, x1 %u, state1 %d\n",x[6],x[7],state1);
|
||||||
#endif //DEBUG_TURBO_ENCODER
|
#endif //DEBUG_TURBO_ENCODER
|
||||||
threegpplte_rsc_termination(&x[8],&x[9],&state1);
|
threegpplte_rsc_termination(&x[8],&x[9],&state1);
|
||||||
#ifdef DEBUG_TURBO_ENCODER
|
#ifdef DEBUG_TURBO_ENCODER
|
||||||
printf("term: x0 %d, x1 %d, state1 %d\n",x[8],x[9],state1);
|
printf("term: x0 %u, x1 %u, state1 %d\n",x[8],x[9],state1);
|
||||||
#endif //DEBUG_TURBO_ENCODER
|
#endif //DEBUG_TURBO_ENCODER
|
||||||
threegpplte_rsc_termination(&x[10],&x[11],&state1);
|
threegpplte_rsc_termination(&x[10],&x[11],&state1);
|
||||||
|
|
||||||
#ifdef DEBUG_TURBO_ENCODER
|
#ifdef DEBUG_TURBO_ENCODER
|
||||||
printf("term: x0 %d, x1 %d, state1 %d\n",x[10],x[11],state1);
|
printf("term: x0 %u, x1 %u, state1 %d\n",x[10],x[11],state1);
|
||||||
#endif //DEBUG_TURBO_ENCODER
|
#endif //DEBUG_TURBO_ENCODER
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
_mm_empty();
|
_mm_empty();
|
||||||
@@ -638,32 +578,31 @@ void threegpplte_turbo_encoder_sse(unsigned char *input,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void init_encoder_sse (void) {
|
void init_encoder_sse (void) {
|
||||||
treillis_table_init();
|
treillis_table_init();
|
||||||
}
|
}
|
||||||
/* function which will be called by the shared lib loader, to check shared lib version
|
/* function which will be called by the shared lib loader, to check shared lib version
|
||||||
against main exec version. version mismatch no considered as fatal (interfaces not supposed to change)
|
against main exec version. version mismatch no considered as fatal (interfaces not supposed to change)
|
||||||
*/
|
*/
|
||||||
int coding_checkbuildver(char * mainexec_buildversion, char ** shlib_buildversion)
|
int coding_checkbuildver(char *mainexec_buildversion, char **shlib_buildversion) {
|
||||||
{
|
|
||||||
#ifndef PACKAGE_VERSION
|
#ifndef PACKAGE_VERSION
|
||||||
#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__
|
#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__
|
||||||
#endif
|
#endif
|
||||||
*shlib_buildversion = PACKAGE_VERSION;
|
*shlib_buildversion = PACKAGE_VERSION;
|
||||||
if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) {
|
|
||||||
fprintf(stderr,"[CODING] shared lib version %s, doesn't match main version %s, compatibility should be checked\n",
|
if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) {
|
||||||
mainexec_buildversion,*shlib_buildversion);
|
fprintf(stderr,"[CODING] shared lib version %s, doesn't match main version %s, compatibility should be checked\n",
|
||||||
}
|
mainexec_buildversion,*shlib_buildversion);
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TC_MAIN
|
#ifdef TC_MAIN
|
||||||
#define INPUT_LENGTH 20
|
#define INPUT_LENGTH 20
|
||||||
#define F1 21
|
#define F1 21
|
||||||
#define F2 120
|
#define F2 120
|
||||||
|
|
||||||
int main(int argc,char **argv)
|
int main(int argc,char **argv) {
|
||||||
{
|
|
||||||
|
|
||||||
unsigned char input[INPUT_LENGTH+32],state,state2;
|
unsigned char input[INPUT_LENGTH+32],state,state2;
|
||||||
unsigned char output[12+(3*(INPUT_LENGTH<<3))],x,z;
|
unsigned char output[12+(3*(INPUT_LENGTH<<3))],x,z;
|
||||||
int i;
|
int i;
|
||||||
@@ -680,28 +619,27 @@ int main(int argc,char **argv)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
for (state=0; state<8; state++) {
|
for (state=0; state<8; state++) {
|
||||||
|
|
||||||
state2=state;
|
state2=state;
|
||||||
threegpplte_rsc_termination(&x,&z,&state2);
|
threegpplte_rsc_termination(&x,&z,&state2);
|
||||||
printf("Termination: (%d->%d) : (%d,%d)\n",state,state2,x,z);
|
printf("Termination: (%d->%d) : (%d,%d)\n",state,state2,x,z);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((void*)input,0,INPUT_LENGTH+16);
|
memset((void *)input,0,INPUT_LENGTH+16);
|
||||||
|
|
||||||
for (i=0; i<INPUT_LENGTH; i++) {
|
for (i=0; i<INPUT_LENGTH; i++) {
|
||||||
input[i] = i*219;
|
input[i] = i*219;
|
||||||
printf("Input %d : %d\n",i,input[i]);
|
printf("Input %d : %u\n",i,input[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
threegpplte_turbo_encoder_sse(&input[0],
|
threegpplte_turbo_encoder_sse(&input[0],
|
||||||
INPUT_LENGTH,
|
INPUT_LENGTH,
|
||||||
&output[0],
|
&output[0],
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
for (i=0; i<12+(INPUT_LENGTH*24); i++)
|
||||||
|
printf("%u",output[i]);
|
||||||
|
|
||||||
for (i=0;i<12+(INPUT_LENGTH*24);i++)
|
|
||||||
printf("%d",output[i]);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -47,27 +47,20 @@ void
|
|||||||
ccodedot11_encode (unsigned int numbytes,
|
ccodedot11_encode (unsigned int numbytes,
|
||||||
unsigned char *inPtr,
|
unsigned char *inPtr,
|
||||||
unsigned char *outPtr,
|
unsigned char *outPtr,
|
||||||
unsigned char puncturing)
|
unsigned char puncturing) {
|
||||||
{
|
|
||||||
unsigned int state;
|
unsigned int state;
|
||||||
|
|
||||||
unsigned char c, out, shiftbit =0;
|
unsigned char c, out, shiftbit =0;
|
||||||
|
|
||||||
// printf("In ccodedot11_encode (%d,%p,%p,%d)\n",numbytes,inPtr,outPtr,puncturing);
|
// printf("In ccodedot11_encode (%d,%p,%p,%d)\n",numbytes,inPtr,outPtr,puncturing);
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
unsigned int dummy;
|
unsigned int dummy;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
int bit_index;
|
int bit_index;
|
||||||
|
|
||||||
/* The input bit is shifted in position 8 of the state.
|
/* The input bit is shifted in position 8 of the state.
|
||||||
Shiftbit will take values between 1 and 8 */
|
Shiftbit will take values between 1 and 8 */
|
||||||
state = 0;
|
state = 0;
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
dummy = 0;
|
dummy = 0;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
|
||||||
/* Do not increment inPtr until we read the next octet */
|
/* Do not increment inPtr until we read the next octet */
|
||||||
bit_index=0;
|
bit_index=0;
|
||||||
|
|
||||||
@@ -78,85 +71,75 @@ ccodedot11_encode (unsigned int numbytes,
|
|||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
|
||||||
switch (puncturing) {
|
switch (puncturing) {
|
||||||
case 0: //rate 1/2
|
case 0: //rate 1/2
|
||||||
for (shiftbit = 0; shiftbit<8; shiftbit++) {
|
for (shiftbit = 0; shiftbit<8; shiftbit++) {
|
||||||
|
state >>= 1;
|
||||||
|
|
||||||
state >>= 1;
|
if ((c&(1<<shiftbit)) != 0) {
|
||||||
|
state |= 64;
|
||||||
|
}
|
||||||
|
|
||||||
if ((c&(1<<shiftbit)) != 0) {
|
out = ccodedot11_table[state];
|
||||||
state |= 64;
|
*outPtr++ = out & 1;
|
||||||
|
*outPtr++ = (out>>1)&1;
|
||||||
|
#ifdef DEBUG_CCODE
|
||||||
|
printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
|
||||||
|
dummy+=2;
|
||||||
|
#endif //DEBUG_CCODE
|
||||||
}
|
}
|
||||||
|
|
||||||
out = ccodedot11_table[state];
|
break;
|
||||||
|
|
||||||
*outPtr++ = out & 1;
|
case 1: // rate 3/4
|
||||||
*outPtr++ = (out>>1)&1;
|
for (shiftbit = 0; shiftbit<8; shiftbit++) {
|
||||||
|
state >>= 1;
|
||||||
|
|
||||||
|
if ((c&(1<<shiftbit)) != 0) {
|
||||||
|
state |= 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
out = ccodedot11_table[state];
|
||||||
|
|
||||||
|
if (bit_index<2)
|
||||||
|
*outPtr++ = out & 1;
|
||||||
|
|
||||||
|
if (bit_index!=1)
|
||||||
|
*outPtr++ = (out>>1)&1;
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
|
printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
|
||||||
dummy+=2;
|
dummy+=2;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
bit_index=(bit_index==2)?0:(bit_index+1);
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: // rate 3/4
|
|
||||||
for (shiftbit = 0; shiftbit<8; shiftbit++) {
|
|
||||||
|
|
||||||
state >>= 1;
|
|
||||||
|
|
||||||
if ((c&(1<<shiftbit)) != 0) {
|
|
||||||
state |= 64;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out = ccodedot11_table[state];
|
break;
|
||||||
|
|
||||||
if (bit_index<2)
|
case 2: // rate 2/3
|
||||||
|
for (shiftbit = 0; shiftbit<8; shiftbit++) {
|
||||||
|
state >>= 1;
|
||||||
|
|
||||||
|
if ((c&(1<<shiftbit)) != 0) {
|
||||||
|
state |= 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
out = ccodedot11_table[state];
|
||||||
*outPtr++ = out & 1;
|
*outPtr++ = out & 1;
|
||||||
|
|
||||||
if (bit_index!=1)
|
if (bit_index==0)
|
||||||
*outPtr++ = (out>>1)&1;
|
*outPtr++ = (out>>1)&1;
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
|
printf("%d: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
|
||||||
dummy+=2;
|
dummy+=2;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
bit_index=(bit_index==0)?1:0;
|
||||||
bit_index=(bit_index==2)?0:(bit_index+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: // rate 2/3
|
|
||||||
for (shiftbit = 0; shiftbit<8; shiftbit++) {
|
|
||||||
|
|
||||||
state >>= 1;
|
|
||||||
|
|
||||||
if ((c&(1<<shiftbit)) != 0) {
|
|
||||||
state |= 64;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out = ccodedot11_table[state];
|
break;
|
||||||
|
|
||||||
*outPtr++ = out & 1;
|
default:
|
||||||
|
break;
|
||||||
if (bit_index==0)
|
|
||||||
*outPtr++ = (out>>1)&1;
|
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
|
||||||
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
|
|
||||||
dummy+=2;
|
|
||||||
#endif //DEBUG_CCODE
|
|
||||||
|
|
||||||
bit_index=(bit_index==0)?1:0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,8 +164,6 @@ ccodedot11_encode (unsigned int numbytes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -197,8 +178,7 @@ ccodedot11_encode (unsigned int numbytes,
|
|||||||
/* Basic code table initialization for constraint length 7 */
|
/* Basic code table initialization for constraint length 7 */
|
||||||
/* Input in MSB, followed by state in 6 LSBs */
|
/* Input in MSB, followed by state in 6 LSBs */
|
||||||
|
|
||||||
void ccodedot11_init(void)
|
void ccodedot11_init(void) {
|
||||||
{
|
|
||||||
unsigned int i, j, k, sum;
|
unsigned int i, j, k, sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
@@ -219,8 +199,7 @@ void ccodedot11_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Input in LSB, followed by state in 6 MSBs */
|
/* Input in LSB, followed by state in 6 MSBs */
|
||||||
void ccodedot11_init_inv(void)
|
void ccodedot11_init_inv(void) {
|
||||||
{
|
|
||||||
unsigned int i, j, k, sum;
|
unsigned int i, j, k, sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
@@ -251,21 +230,15 @@ void ccodedot11_init_inv(void)
|
|||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
main()
|
main() {
|
||||||
{
|
|
||||||
unsigned char test[] = "0Thebigredfox";
|
unsigned char test[] = "0Thebigredfox";
|
||||||
unsigned char output[512], *inPtr, *outPtr;
|
unsigned char output[512], *inPtr, *outPtr;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
test[0] = 128;
|
test[0] = 128;
|
||||||
test[1] = 0;
|
test[1] = 0;
|
||||||
|
|
||||||
|
|
||||||
ccodedot11_init();
|
ccodedot11_init();
|
||||||
|
|
||||||
inPtr = test;
|
inPtr = test;
|
||||||
outPtr = output;
|
outPtr = output;
|
||||||
|
|
||||||
ccodedot11_encode(16, inPtr, outPtr,0);
|
ccodedot11_encode(16, inPtr, outPtr,0);
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) printf("%x ", output[i]);
|
for (i = 0; i < 32; i++) printf("%x ", output[i]);
|
||||||
|
|||||||
@@ -52,20 +52,16 @@ ccodelte_encode (int32_t numbits,
|
|||||||
uint8_t add_crc,
|
uint8_t add_crc,
|
||||||
uint8_t *inPtr,
|
uint8_t *inPtr,
|
||||||
uint8_t *outPtr,
|
uint8_t *outPtr,
|
||||||
uint16_t rnti)
|
uint16_t rnti) {
|
||||||
{
|
|
||||||
uint32_t state;
|
uint32_t state;
|
||||||
|
|
||||||
uint8_t c, out, first_bit;
|
uint8_t c, out, first_bit;
|
||||||
int8_t shiftbit=0;
|
int8_t shiftbit=0;
|
||||||
uint16_t c16;
|
uint16_t c16;
|
||||||
uint16_t next_last_byte=0;
|
uint16_t next_last_byte=0;
|
||||||
uint32_t crc=0;
|
uint32_t crc=0;
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
uint32_t dummy=0;
|
uint32_t dummy=0;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
|
||||||
/* The input bit is shifted in position 8 of the state.
|
/* The input bit is shifted in position 8 of the state.
|
||||||
Shiftbit will take values between 1 and 8 */
|
Shiftbit will take values between 1 and 8 */
|
||||||
state = 0;
|
state = 0;
|
||||||
@@ -137,17 +133,12 @@ ccodelte_encode (int32_t numbits,
|
|||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
/* Do not increment inPtr until we read the next octet */
|
/* Do not increment inPtr until we read the next octet */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (numbits > 0) {
|
while (numbits > 0) {
|
||||||
|
|
||||||
c = *inPtr++;
|
c = *inPtr++;
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
printf("** %x **\n",c);
|
printf("** %x **\n",c);
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
|
||||||
|
|
||||||
// for (shiftbit = 0; (shiftbit<8) && (numbits>0);shiftbit++,numbits--) {
|
// for (shiftbit = 0; (shiftbit<8) && (numbits>0);shiftbit++,numbits--) {
|
||||||
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
|
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
|
||||||
state >>= 1;
|
state >>= 1;
|
||||||
@@ -157,23 +148,18 @@ ccodelte_encode (int32_t numbits,
|
|||||||
}
|
}
|
||||||
|
|
||||||
out = ccodelte_table[state];
|
out = ccodelte_table[state];
|
||||||
|
|
||||||
*outPtr++ = out & 1;
|
*outPtr++ = out & 1;
|
||||||
*outPtr++ = (out>>1)&1;
|
*outPtr++ = (out>>1)&1;
|
||||||
*outPtr++ = (out>>2)&1;
|
*outPtr++ = (out>>2)&1;
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
printf("numbits %d, input %d, outbit %d: %d -> %d (%d%d%d)\n",numbits,state>>6,dummy,state,out,out&1,(out>>1)&1,(out>>2)&1);
|
printf("numbits %d, input %d, outbit %d: %d -> %d (%d%d%d)\n",numbits,state>>6,dummy,state,out,out&1,(out>>1)&1,(out>>2)&1);
|
||||||
dummy+=3;
|
dummy+=3;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now code 8-bit CRC for UCI
|
// now code 8-bit CRC for UCI
|
||||||
if (add_crc == 1) {
|
if (add_crc == 1) {
|
||||||
|
|
||||||
c = (uint8_t)(crc>>24);
|
c = (uint8_t)(crc>>24);
|
||||||
|
|
||||||
// for (shiftbit = 0; (shiftbit<8);shiftbit++) {
|
// for (shiftbit = 0; (shiftbit<8);shiftbit++) {
|
||||||
@@ -185,22 +171,18 @@ ccodelte_encode (int32_t numbits,
|
|||||||
}
|
}
|
||||||
|
|
||||||
out = ccodelte_table[state];
|
out = ccodelte_table[state];
|
||||||
|
|
||||||
*outPtr++ = out & 1;
|
*outPtr++ = out & 1;
|
||||||
*outPtr++ = (out>>1)&1;
|
*outPtr++ = (out>>1)&1;
|
||||||
*outPtr++ = (out>>2)&1;
|
*outPtr++ = (out>>2)&1;
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
|
printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
|
||||||
dummy+=3;
|
dummy+=3;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now code 16-bit CRC for DCI
|
// now code 16-bit CRC for DCI
|
||||||
if (add_crc == 2) {
|
if (add_crc == 2) {
|
||||||
|
|
||||||
c16 = (uint16_t)(crc>>16);
|
c16 = (uint16_t)(crc>>16);
|
||||||
|
|
||||||
// for (shiftbit = 0; (shiftbit<16);shiftbit++) {
|
// for (shiftbit = 0; (shiftbit<16);shiftbit++) {
|
||||||
@@ -212,16 +194,13 @@ ccodelte_encode (int32_t numbits,
|
|||||||
}
|
}
|
||||||
|
|
||||||
out = ccodelte_table[state];
|
out = ccodelte_table[state];
|
||||||
|
|
||||||
*outPtr++ = out & 1;
|
*outPtr++ = out & 1;
|
||||||
*outPtr++ = (out>>1)&1;
|
*outPtr++ = (out>>1)&1;
|
||||||
*outPtr++ = (out>>2)&1;
|
*outPtr++ = (out>>2)&1;
|
||||||
|
|
||||||
#ifdef DEBUG_CCODE
|
#ifdef DEBUG_CCODE
|
||||||
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
|
printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
|
||||||
dummy+=3;
|
dummy+=3;
|
||||||
#endif //DEBUG_CCODE
|
#endif //DEBUG_CCODE
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,8 +217,7 @@ ccodelte_encode (int32_t numbits,
|
|||||||
/* Basic code table initialization for constraint length 7 */
|
/* Basic code table initialization for constraint length 7 */
|
||||||
/* Input in MSB, followed by state in 6 LSBs */
|
/* Input in MSB, followed by state in 6 LSBs */
|
||||||
|
|
||||||
void ccodelte_init(void)
|
void ccodelte_init(void) {
|
||||||
{
|
|
||||||
unsigned int i, j, k, sum;
|
unsigned int i, j, k, sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
@@ -260,8 +238,7 @@ void ccodelte_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Input in LSB, followed by state in 6 MSBs */
|
/* Input in LSB, followed by state in 6 MSBs */
|
||||||
void ccodelte_init_inv(void)
|
void ccodelte_init_inv(void) {
|
||||||
{
|
|
||||||
unsigned int i, j, k, sum;
|
unsigned int i, j, k, sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
@@ -281,8 +258,7 @@ void ccodelte_init_inv(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ccodedab_init(void)
|
void ccodedab_init(void) {
|
||||||
{
|
|
||||||
unsigned int i, j, k, sum;
|
unsigned int i, j, k, sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
@@ -303,8 +279,7 @@ void ccodedab_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Input in LSB, followed by state in 6 MSBs */
|
/* Input in LSB, followed by state in 6 MSBs */
|
||||||
void ccodedab_init_inv(void)
|
void ccodedab_init_inv(void) {
|
||||||
{
|
|
||||||
unsigned int i, j, k, sum;
|
unsigned int i, j, k, sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
@@ -334,21 +309,15 @@ void ccodedab_init_inv(void)
|
|||||||
#ifdef CCODE_MAIN
|
#ifdef CCODE_MAIN
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
main()
|
main() {
|
||||||
{
|
|
||||||
unsigned char test[] = "Thebigredfox";
|
unsigned char test[] = "Thebigredfox";
|
||||||
unsigned char output[512], *inPtr, *outPtr;
|
unsigned char output[512], *inPtr, *outPtr;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
test[0] = 128;
|
test[0] = 128;
|
||||||
test[1] = 0;
|
test[1] = 0;
|
||||||
|
|
||||||
|
|
||||||
ccodelte_init();
|
ccodelte_init();
|
||||||
|
|
||||||
inPtr = test;
|
inPtr = test;
|
||||||
outPtr = output;
|
outPtr = output;
|
||||||
|
|
||||||
ccodelte_encode(21, inPtr, outPtr);
|
ccodelte_encode(21, inPtr, outPtr);
|
||||||
|
|
||||||
for (i = 0; i < 21*3; i++) printf("%x ", output[i]);
|
for (i = 0; i < 21*3; i++) printf("%x ", output[i]);
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
date: 21.10.2009
|
date: 21.10.2009
|
||||||
*/
|
*/
|
||||||
#ifdef MAIN
|
#ifdef MAIN
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#include "PHY/defs_eNB.h"
|
#include "PHY/defs_eNB.h"
|
||||||
#include "PHY/LTE_TRANSPORT/transport_common.h"
|
#include "PHY/LTE_TRANSPORT/transport_common.h"
|
||||||
@@ -42,9 +42,7 @@ static uint32_t bitrev_cc[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16
|
|||||||
//#define RM_DEBUG2 1
|
//#define RM_DEBUG2 1
|
||||||
//#define RM_DEBUG_CC 1
|
//#define RM_DEBUG_CC 1
|
||||||
|
|
||||||
uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
|
uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w) {
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t RTC = (D>>5), ND, ND3;
|
uint32_t RTC = (D>>5), ND, ND3;
|
||||||
uint32_t row,col,Kpi;
|
uint32_t row,col,Kpi;
|
||||||
uint32_t index3,k,k2;
|
uint32_t index3,k,k2;
|
||||||
@@ -64,7 +62,6 @@ uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
|
|||||||
printf("RTC = %d, Kpi=%d, ND=%d\n",RTC,Kpi,ND);
|
printf("RTC = %d, Kpi=%d, ND=%d\n",RTC,Kpi,ND);
|
||||||
#endif
|
#endif
|
||||||
ND3 = ND*3;
|
ND3 = ND*3;
|
||||||
|
|
||||||
// copy d02 to dD2 (for mod Kpi operation from clause (4), p.16 of 36.212
|
// copy d02 to dD2 (for mod Kpi operation from clause (4), p.16 of 36.212
|
||||||
d[(3*D)+2] = d[2];
|
d[(3*D)+2] = d[2];
|
||||||
k=0;
|
k=0;
|
||||||
@@ -80,12 +77,9 @@ uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
|
|||||||
index3 = bitrev_x3[col];//3*index;
|
index3 = bitrev_x3[col];//3*index;
|
||||||
|
|
||||||
for (row=0; row<RTC; row++) {
|
for (row=0; row<RTC; row++) {
|
||||||
|
|
||||||
w[k] = d1[index3];//d[index3-ND3];
|
w[k] = d1[index3];//d[index3-ND3];
|
||||||
w[Kpi+k2] = d2[index3];//d[index3-ND3+1];
|
w[Kpi+k2] = d2[index3];//d[index3-ND3+1];
|
||||||
w[Kpi+1+k2] = d3[index3];//d[index3-ND3+5];
|
w[Kpi+1+k2] = d3[index3];//d[index3-ND3+5];
|
||||||
|
|
||||||
|
|
||||||
#ifdef RM_DEBUG
|
#ifdef RM_DEBUG
|
||||||
printf("row %d, index %d, index-Nd %d index-Nd+1 %d (k,Kpi+2k,Kpi+2k+1) (%d,%d,%d) w(%d,%d,%d)\n",row,index,index-ND,((index+1)%Kpi)-ND,k,Kpi+(k<<1),Kpi+(k<<1)+1,w[k],w[Kpi+(k<<1)],w[Kpi+1+(k<<1)]);
|
printf("row %d, index %d, index-Nd %d index-Nd+1 %d (k,Kpi+2k,Kpi+2k+1) (%d,%d,%d) w(%d,%d,%d)\n",row,index,index-ND,((index+1)%Kpi)-ND,k,Kpi+(k<<1),Kpi+(k<<1)+1,w[k],w[Kpi+(k<<1)],w[Kpi+1+(k<<1)]);
|
||||||
|
|
||||||
@@ -100,7 +94,8 @@ uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
index3+=96;
|
index3+=96;
|
||||||
k++;k2+=2;
|
k++;
|
||||||
|
k2+=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,9 +115,7 @@ uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w)
|
uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w) {
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t RCC = (D>>5), ND, ND3;
|
uint32_t RCC = (D>>5), ND, ND3;
|
||||||
uint32_t row,col,Kpi,index;
|
uint32_t row,col,Kpi,index;
|
||||||
uint32_t index3,k;
|
uint32_t index3,k;
|
||||||
@@ -141,7 +134,6 @@ uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w)
|
|||||||
printf("RCC = %d, Kpi=%d, ND=%d\n",RCC,Kpi,ND);
|
printf("RCC = %d, Kpi=%d, ND=%d\n",RCC,Kpi,ND);
|
||||||
#endif
|
#endif
|
||||||
ND3 = ND*3;
|
ND3 = ND*3;
|
||||||
|
|
||||||
k=0;
|
k=0;
|
||||||
|
|
||||||
for (col=0; col<32; col++) {
|
for (col=0; col<32; col++) {
|
||||||
@@ -180,9 +172,7 @@ uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w)
|
|||||||
return(RCC);
|
return(RCC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_block_deinterleaving_turbo(uint32_t D,int16_t *d,int16_t *w)
|
void sub_block_deinterleaving_turbo(uint32_t D,int16_t *d,int16_t *w) {
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t RTC = (D>>5), ND, ND3;
|
uint32_t RTC = (D>>5), ND, ND3;
|
||||||
uint32_t row,col,Kpi,index;
|
uint32_t row,col,Kpi,index;
|
||||||
uint32_t index3,k,k2;
|
uint32_t index3,k,k2;
|
||||||
@@ -199,7 +189,6 @@ void sub_block_deinterleaving_turbo(uint32_t D,int16_t *d,int16_t *w)
|
|||||||
printf("RTC = %d, Kpi=%d, ND=%d\n",RTC,Kpi,ND);
|
printf("RTC = %d, Kpi=%d, ND=%d\n",RTC,Kpi,ND);
|
||||||
#endif
|
#endif
|
||||||
ND3 = ND*3;
|
ND3 = ND*3;
|
||||||
|
|
||||||
// copy d02 to dD2 (for mod Kpi operation from clause (4), p.16 of 36.212
|
// copy d02 to dD2 (for mod Kpi operation from clause (4), p.16 of 36.212
|
||||||
k=0;
|
k=0;
|
||||||
k2=0;
|
k2=0;
|
||||||
@@ -215,7 +204,6 @@ void sub_block_deinterleaving_turbo(uint32_t D,int16_t *d,int16_t *w)
|
|||||||
index3 = bitrev_x3[col];//3*index;
|
index3 = bitrev_x3[col];//3*index;
|
||||||
|
|
||||||
for (row=0; row<RTC; row++) {
|
for (row=0; row<RTC; row++) {
|
||||||
|
|
||||||
d1[index3] = w[k];
|
d1[index3] = w[k];
|
||||||
d2[index3] = w[Kpi+k2];
|
d2[index3] = w[Kpi+k2];
|
||||||
d3[index3] = w[Kpi+1+k2];
|
d3[index3] = w[Kpi+1+k2];
|
||||||
@@ -229,12 +217,9 @@ void sub_block_deinterleaving_turbo(uint32_t D,int16_t *d,int16_t *w)
|
|||||||
|
|
||||||
// if (ND>0)
|
// if (ND>0)
|
||||||
// d[2] = LTE_NULL;//d[(3*D)+2];
|
// d[2] = LTE_NULL;//d[(3*D)+2];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w)
|
void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
|
||||||
{
|
|
||||||
|
|
||||||
//WANG_Hao uint32_t RCC = (D>>5), ND, ND3;
|
//WANG_Hao uint32_t RCC = (D>>5), ND, ND3;
|
||||||
uint32_t RCC = (D>>5);
|
uint32_t RCC = (D>>5);
|
||||||
ptrdiff_t ND, ND3;
|
ptrdiff_t ND, ND3;
|
||||||
@@ -251,10 +236,9 @@ 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=%d\n",RCC,Kpi,ND);
|
printf("RCC = %d, Kpi=%d, ND=%ld\n",RCC,Kpi,ND);
|
||||||
#endif
|
#endif
|
||||||
ND3 = ND*3;
|
ND3 = ND*3;
|
||||||
|
|
||||||
k=0;
|
k=0;
|
||||||
|
|
||||||
for (col=0; col<32; col++) {
|
for (col=0; col<32; col++) {
|
||||||
@@ -265,24 +249,20 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w)
|
|||||||
index3 = 3*index;
|
index3 = 3*index;
|
||||||
|
|
||||||
for (row=0; row<RCC; row++) {
|
for (row=0; row<RCC; row++) {
|
||||||
|
|
||||||
d[index3-ND3] = w[k];
|
d[index3-ND3] = w[k];
|
||||||
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 %d 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,index3-ND3,w[k],w[Kpi+k],w[(Kpi<<1)+k]);
|
||||||
#endif
|
#endif
|
||||||
index3+=96;
|
index3+=96;
|
||||||
index+=32;
|
index+=32;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t generate_dummy_w(uint32_t D, uint8_t *w,uint8_t F)
|
uint32_t generate_dummy_w(uint32_t D, uint8_t *w,uint8_t F) {
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t RTC = (D>>5), ND;
|
uint32_t RTC = (D>>5), ND;
|
||||||
uint32_t col,Kpi,index;
|
uint32_t col,Kpi,index;
|
||||||
int32_t k,k2;
|
int32_t k,k2;
|
||||||
@@ -301,8 +281,6 @@ uint32_t generate_dummy_w(uint32_t D, uint8_t *w,uint8_t F)
|
|||||||
printf("dummy sub_block_interleaving_turbo : D = %d (%d)\n",D,D*3);
|
printf("dummy sub_block_interleaving_turbo : D = %d (%d)\n",D,D*3);
|
||||||
printf("RTC = %d, Kpi=%d, ND=%d, F=%d (Nulled %d)\n",RTC,Kpi,ND,F,(2*F + 3*ND));
|
printf("RTC = %d, Kpi=%d, ND=%d, F=%d (Nulled %d)\n",RTC,Kpi,ND,F,(2*F + 3*ND));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
k=0;
|
k=0;
|
||||||
k2=0;
|
k2=0;
|
||||||
wKpi = &w[Kpi];
|
wKpi = &w[Kpi];
|
||||||
@@ -371,9 +349,7 @@ uint32_t generate_dummy_w(uint32_t D, uint8_t *w,uint8_t F)
|
|||||||
return(RTC);
|
return(RTC);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t generate_dummy_w_cc(uint32_t D, uint8_t *w)
|
uint32_t generate_dummy_w_cc(uint32_t D, uint8_t *w) {
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t RCC = (D>>5), ND;
|
uint32_t RCC = (D>>5), ND;
|
||||||
uint32_t col,Kpi,index;
|
uint32_t col,Kpi,index;
|
||||||
int32_t k;
|
int32_t k;
|
||||||
@@ -392,7 +368,6 @@ uint32_t generate_dummy_w_cc(uint32_t D, uint8_t *w)
|
|||||||
printf("RCC = %d, Kpi=%d, ND=%d, (Nulled %d)\n",RCC,Kpi,ND,3*ND);
|
printf("RCC = %d, Kpi=%d, ND=%d, (Nulled %d)\n",RCC,Kpi,ND,3*ND);
|
||||||
#endif
|
#endif
|
||||||
// ND3 = ND*3;
|
// ND3 = ND*3;
|
||||||
|
|
||||||
// copy d02 to dD2 (for mod Kpi operation from clause (4), p.16 of 36.212
|
// copy d02 to dD2 (for mod Kpi operation from clause (4), p.16 of 36.212
|
||||||
k=0;
|
k=0;
|
||||||
|
|
||||||
@@ -466,8 +441,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
|||||||
uint8_t nb_rb)
|
uint8_t nb_rb)
|
||||||
// uint8_t m)
|
// uint8_t m)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
uint32_t Nir,Ncb,Gp,GpmodC,E,Ncbmod,ind,k;
|
uint32_t Nir,Ncb,Gp,GpmodC,E,Ncbmod,ind,k;
|
||||||
// int cnt=0;
|
// int cnt=0;
|
||||||
uint8_t *e2;
|
uint8_t *e2;
|
||||||
@@ -487,11 +460,11 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
|||||||
if (Mdlharq>0) { // Downlink
|
if (Mdlharq>0) { // Downlink
|
||||||
Nir = Nsoft/Kmimo/cmin(8,Mdlharq);
|
Nir = Nsoft/Kmimo/cmin(8,Mdlharq);
|
||||||
Ncb = cmin(Nir/C,3*(RTC<<5));
|
Ncb = cmin(Nir/C,3*(RTC<<5));
|
||||||
}
|
} else { // Uplink
|
||||||
else { // Uplink
|
|
||||||
Nir=0;
|
Nir=0;
|
||||||
Ncb = 3*(RTC<<5); // Kw
|
Ncb = 3*(RTC<<5); // Kw
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RM_DEBUG_TX
|
#ifdef RM_DEBUG_TX
|
||||||
|
|
||||||
if (rvidx==0 && r==0) {
|
if (rvidx==0 && r==0) {
|
||||||
@@ -518,7 +491,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
|||||||
AssertFatal(Qm>0,"Qm is 0\n");
|
AssertFatal(Qm>0,"Qm is 0\n");
|
||||||
Gp = G/Nl/Qm;
|
Gp = G/Nl/Qm;
|
||||||
GpmodC = Gp%C;
|
GpmodC = Gp%C;
|
||||||
|
|
||||||
#ifdef RM_DEBUG
|
#ifdef RM_DEBUG
|
||||||
printf("lte_rate_matching_turbo: Ncb %d, Kw %d, Nir/C %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",Ncb,3*(RTC<<5),Nir/C,rvidx, G, Qm,Nl,r);
|
printf("lte_rate_matching_turbo: Ncb %d, Kw %d, Nir/C %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",Ncb,3*(RTC<<5),Nir/C,rvidx, G, Qm,Nl,r);
|
||||||
#endif
|
#endif
|
||||||
@@ -529,16 +501,12 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
|||||||
E = Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
E = Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||||
|
|
||||||
Ncbmod = Ncb%(RTC<<3);
|
Ncbmod = Ncb%(RTC<<3);
|
||||||
|
|
||||||
ind = RTC * (2+(rvidx*(((Ncbmod==0)?0:1) + (Ncb/(RTC<<3)))*2));
|
ind = RTC * (2+(rvidx*(((Ncbmod==0)?0:1) + (Ncb/(RTC<<3)))*2));
|
||||||
|
|
||||||
#ifdef RM_DEBUG_TX
|
#ifdef RM_DEBUG_TX
|
||||||
printf("lte_rate_matching_turbo: E %d, k0 %d, Ncbmod %d, Ncb/(RTC<<3) %d\n",E,ind,Ncbmod,Ncb/(RTC<<3));
|
printf("lte_rate_matching_turbo: E %d, k0 %d, Ncbmod %d, Ncb/(RTC<<3) %d\n",E,ind,Ncbmod,Ncb/(RTC<<3));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//e2=e+(r*E);
|
//e2=e+(r*E);
|
||||||
e2 = e;
|
e2 = e;
|
||||||
|
|
||||||
k=0;
|
k=0;
|
||||||
|
|
||||||
for (; (ind<Ncb)&&(k<E); ind++) {
|
for (; (ind<Ncb)&&(k<E); ind++) {
|
||||||
@@ -633,25 +601,16 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
|||||||
uint32_t lte_rate_matching_cc(uint32_t RCC,
|
uint32_t lte_rate_matching_cc(uint32_t RCC,
|
||||||
uint16_t E,
|
uint16_t E,
|
||||||
uint8_t *w,
|
uint8_t *w,
|
||||||
uint8_t *e)
|
uint8_t *e) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t ind=0,k;
|
uint32_t ind=0,k;
|
||||||
|
|
||||||
uint16_t Kw = 3*(RCC<<5);
|
uint16_t Kw = 3*(RCC<<5);
|
||||||
|
|
||||||
#ifdef RM_DEBUG_CC
|
#ifdef RM_DEBUG_CC
|
||||||
uint32_t nulled=0;
|
uint32_t nulled=0;
|
||||||
|
|
||||||
printf("lte_rate_matching_cc: Kw %d, E %d\n",Kw, E);
|
printf("lte_rate_matching_cc: Kw %d, E %d\n",Kw, E);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (k=0; k<E; k++) {
|
for (k=0; k<E; k++) {
|
||||||
|
|
||||||
|
|
||||||
while(w[ind] == LTE_NULL) {
|
while(w[ind] == LTE_NULL) {
|
||||||
|
|
||||||
#ifdef RM_DEBUG_CC
|
#ifdef RM_DEBUG_CC
|
||||||
nulled++;
|
nulled++;
|
||||||
printf("RM_TX_CC : ind %d, NULL\n",ind);
|
printf("RM_TX_CC : ind %d, NULL\n",ind);
|
||||||
@@ -662,7 +621,6 @@ uint32_t lte_rate_matching_cc(uint32_t RCC,
|
|||||||
ind=0;
|
ind=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
e[k] = w[ind];
|
e[k] = w[ind];
|
||||||
#ifdef RM_DEBUG_CC
|
#ifdef RM_DEBUG_CC
|
||||||
// printf("k %d ind %d, w %c(%d)\n",k,ind,w[ind],w[ind]);
|
// printf("k %d ind %d, w %c(%d)\n",k,ind,w[ind],w[ind]);
|
||||||
@@ -695,10 +653,7 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
|
|||||||
uint8_t Qm,
|
uint8_t Qm,
|
||||||
uint8_t Nl,
|
uint8_t Nl,
|
||||||
uint8_t r,
|
uint8_t r,
|
||||||
uint32_t *E_out)
|
uint32_t *E_out) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t Nir,Ncb,Gp,GpmodC,E,Ncbmod,ind,k;
|
uint32_t Nir,Ncb,Gp,GpmodC,E,Ncbmod,ind,k;
|
||||||
int16_t *soft_input2;
|
int16_t *soft_input2;
|
||||||
// int32_t w_tmp;
|
// int32_t w_tmp;
|
||||||
@@ -708,15 +663,14 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
|
|||||||
|
|
||||||
if (Kmimo==0 || C==0 || Qm==0 || Nl==0) {
|
if (Kmimo==0 || C==0 || Qm==0 || Nl==0) {
|
||||||
printf("lte_rate_matching.c: invalid parameters (Kmimo %d, Mdlharq %d, C %d, Qm %d, Nl %d\n",
|
printf("lte_rate_matching.c: invalid parameters (Kmimo %d, Mdlharq %d, C %d, Qm %d, Nl %d\n",
|
||||||
Kmimo,Mdlharq,C,Qm,Nl);
|
Kmimo,Mdlharq,C,Qm,Nl);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mdlharq>0) { // Downlink
|
if (Mdlharq>0) { // Downlink
|
||||||
Nir = Nsoft/Kmimo/cmin(8,Mdlharq);
|
Nir = Nsoft/Kmimo/cmin(8,Mdlharq);
|
||||||
Ncb = cmin(Nir/C,3*(RTC<<5));
|
Ncb = cmin(Nir/C,3*(RTC<<5));
|
||||||
}
|
} else { // Uplink
|
||||||
else { // Uplink
|
|
||||||
Nir=0;
|
Nir=0;
|
||||||
Ncb = 3*(RTC<<5);
|
Ncb = 3*(RTC<<5);
|
||||||
}
|
}
|
||||||
@@ -726,17 +680,13 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
|
|||||||
Gp = G/Nl/Qm;
|
Gp = G/Nl/Qm;
|
||||||
GpmodC = Gp%C;
|
GpmodC = Gp%C;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (r < (C-(GpmodC)))
|
if (r < (C-(GpmodC)))
|
||||||
E = Nl*Qm * (Gp/C);
|
E = Nl*Qm * (Gp/C);
|
||||||
else
|
else
|
||||||
E = Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
E = Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||||
|
|
||||||
Ncbmod = Ncb%(RTC<<3);
|
Ncbmod = Ncb%(RTC<<3);
|
||||||
|
|
||||||
ind = RTC * (2+(rvidx*(((Ncbmod==0)?0:1) + (Ncb/(RTC<<3)))*2));
|
ind = RTC * (2+(rvidx*(((Ncbmod==0)?0:1) + (Ncb/(RTC<<3)))*2));
|
||||||
|
|
||||||
#ifdef RM_DEBUG
|
#ifdef RM_DEBUG
|
||||||
printf("lte_rate_matching_turbo_rx: Clear %d, E %d, Ncb %d, Kw %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",clear,E,Ncb,3*(RTC<<5),rvidx, G, Qm,Nl,r);
|
printf("lte_rate_matching_turbo_rx: Clear %d, E %d, Ncb %d, Kw %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",clear,E,Ncb,3*(RTC<<5),rvidx, G, Qm,Nl,r);
|
||||||
#endif
|
#endif
|
||||||
@@ -751,8 +701,8 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
|
|||||||
if (dummy_w[ind] != LTE_NULL) {
|
if (dummy_w[ind] != LTE_NULL) {
|
||||||
/*
|
/*
|
||||||
if ((w[ind]>0 && soft_input2[k]<0) ||
|
if ((w[ind]>0 && soft_input2[k]<0) ||
|
||||||
(w[ind]<0 && soft_input2[k]>0))
|
(w[ind]<0 && soft_input2[k]>0))
|
||||||
printf("ind %d: w %d => soft_in %d\n",ind,w[ind],soft_input2[k]);*/
|
printf("ind %d: w %d => soft_in %d\n",ind,w[ind],soft_input2[k]);*/
|
||||||
w[ind] += soft_input2[k++];
|
w[ind] += soft_input2[k++];
|
||||||
#ifdef RM_DEBUG
|
#ifdef RM_DEBUG
|
||||||
printf("RM_RX k%d Ind: %d (%d)\n",k-1,ind,w[ind]);
|
printf("RM_RX k%d Ind: %d (%d)\n",k-1,ind,w[ind]);
|
||||||
@@ -831,10 +781,8 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
|
|||||||
ind=0;
|
ind=0;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*E_out = E;
|
*E_out = E;
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -842,28 +790,19 @@ void lte_rate_matching_cc_rx(uint32_t RCC,
|
|||||||
uint16_t E,
|
uint16_t E,
|
||||||
int8_t *w,
|
int8_t *w,
|
||||||
uint8_t *dummy_w,
|
uint8_t *dummy_w,
|
||||||
int8_t *soft_input)
|
int8_t *soft_input) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t ind=0,k;
|
uint32_t ind=0,k;
|
||||||
uint16_t Kw = 3*(RCC<<5);
|
uint16_t Kw = 3*(RCC<<5);
|
||||||
uint32_t acc=1;
|
uint32_t acc=1;
|
||||||
int16_t w16[Kw];
|
int16_t w16[Kw];
|
||||||
#ifdef RM_DEBUG_CC
|
#ifdef RM_DEBUG_CC
|
||||||
uint32_t nulled=0;
|
uint32_t nulled=0;
|
||||||
|
|
||||||
printf("lte_rate_matching_cc_rx: Kw %d, E %d, w %p, soft_input %p\n",3*(RCC<<5),E,w,soft_input);
|
printf("lte_rate_matching_cc_rx: Kw %d, E %d, w %p, soft_input %p\n",3*(RCC<<5),E,w,soft_input);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
memset(w,0,Kw);
|
memset(w,0,Kw);
|
||||||
memset(w16,0,Kw*sizeof(int16_t));
|
memset(w16,0,Kw*sizeof(int16_t));
|
||||||
|
|
||||||
for (k=0; k<E; k++) {
|
for (k=0; k<E; k++) {
|
||||||
|
|
||||||
|
|
||||||
while(dummy_w[ind] == LTE_NULL) {
|
while(dummy_w[ind] == LTE_NULL) {
|
||||||
#ifdef RM_DEBUG_CC
|
#ifdef RM_DEBUG_CC
|
||||||
nulled++;
|
nulled++;
|
||||||
@@ -883,10 +822,7 @@ void lte_rate_matching_cc_rx(uint32_t RCC,
|
|||||||
#ifdef RM_DEBUG_CC
|
#ifdef RM_DEBUG_CC
|
||||||
printf("RM_RX_CC k %d (%d) ind: %d (%d)\n",k,soft_input[k],ind,w16[ind]);
|
printf("RM_RX_CC k %d (%d) ind: %d (%d)\n",k,soft_input[k],ind,w16[ind]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
w16[ind] += soft_input[k];
|
w16[ind] += soft_input[k];
|
||||||
|
|
||||||
ind++;
|
ind++;
|
||||||
|
|
||||||
if (ind==Kw) {
|
if (ind==Kw) {
|
||||||
@@ -907,7 +843,6 @@ void lte_rate_matching_cc_rx(uint32_t RCC,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RM_DEBUG_CC
|
#ifdef RM_DEBUG_CC
|
||||||
|
|
||||||
printf("Nulled %d\n",nulled);
|
printf("Nulled %d\n",nulled);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -915,8 +850,7 @@ void lte_rate_matching_cc_rx(uint32_t RCC,
|
|||||||
|
|
||||||
#ifdef MAIN
|
#ifdef MAIN
|
||||||
|
|
||||||
void main()
|
void main() {
|
||||||
{
|
|
||||||
uint8_t d[96+3+(3*6144)];
|
uint8_t d[96+3+(3*6144)];
|
||||||
uint8_t w[3*6144],e[12*6144];
|
uint8_t w[3*6144],e[12*6144];
|
||||||
uint32_t RTC,G,rvidx;
|
uint32_t RTC,G,rvidx;
|
||||||
@@ -924,7 +858,6 @@ void main()
|
|||||||
uint32_t mod_order = 4;
|
uint32_t mod_order = 4;
|
||||||
uint32_t first_dlsch_symbol = 2;
|
uint32_t first_dlsch_symbol = 2;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
G = ( nb_rb * (12 * mod_order) * (12-first_dlsch_symbol-3)) ;//( nb_rb * (12 * mod_order) * (14-first_dlsch_symbol-3)) :
|
G = ( nb_rb * (12 * mod_order) * (12-first_dlsch_symbol-3)) ;//( nb_rb * (12 * mod_order) * (14-first_dlsch_symbol-3)) :
|
||||||
|
|
||||||
// initialize 96 first positions to "LTE_NULL"
|
// initialize 96 first positions to "LTE_NULL"
|
||||||
|
|||||||
@@ -38,9 +38,7 @@ int lte_segmentation(unsigned char *input_buffer,
|
|||||||
unsigned int *Cminus,
|
unsigned int *Cminus,
|
||||||
unsigned int *Kplus,
|
unsigned int *Kplus,
|
||||||
unsigned int *Kminus,
|
unsigned int *Kminus,
|
||||||
unsigned int *F)
|
unsigned int *F) {
|
||||||
{
|
|
||||||
|
|
||||||
unsigned int L,Bprime,Bprime_by_C,r,Kr,k,s,crc;
|
unsigned int L,Bprime,Bprime_by_C,r,Kr,k,s,crc;
|
||||||
|
|
||||||
if (B<=6144) {
|
if (B<=6144) {
|
||||||
@@ -56,19 +54,19 @@ int lte_segmentation(unsigned char *input_buffer,
|
|||||||
|
|
||||||
Bprime = B+((*C)*L);
|
Bprime = B+((*C)*L);
|
||||||
#ifdef DEBUG_SEGMENTATION
|
#ifdef DEBUG_SEGMENTATION
|
||||||
printf("Bprime %d\n",Bprime);
|
printf("Bprime %u\n",Bprime);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*C)>MAX_NUM_DLSCH_SEGMENTS) {
|
if ((*C)>MAX_NUM_DLSCH_SEGMENTS) {
|
||||||
LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
|
LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find K+
|
// Find K+
|
||||||
Bprime_by_C = Bprime/(*C);
|
Bprime_by_C = Bprime/(*C);
|
||||||
#ifdef DEBUG_SEGMENTATION
|
#ifdef DEBUG_SEGMENTATION
|
||||||
printf("Bprime_by_C %d\n",Bprime_by_C);
|
printf("Bprime_by_C %u\n",Bprime_by_C);
|
||||||
#endif
|
#endif
|
||||||
// Bprime = Bprime_by_C>>3;
|
// Bprime = Bprime_by_C>>3;
|
||||||
|
|
||||||
@@ -93,17 +91,16 @@ int lte_segmentation(unsigned char *input_buffer,
|
|||||||
|
|
||||||
*Kminus = (*Kplus - 32);
|
*Kminus = (*Kplus - 32);
|
||||||
} else if (Bprime_by_C <=6144 ) { // increase by 8 bytes til here
|
} else if (Bprime_by_C <=6144 ) { // increase by 8 bytes til here
|
||||||
|
|
||||||
*Kplus = (Bprime_by_C>>6)<<6;
|
*Kplus = (Bprime_by_C>>6)<<6;
|
||||||
#ifdef DEBUG_SEGMENTATION
|
#ifdef DEBUG_SEGMENTATION
|
||||||
printf("Bprime_by_C_by_C %d , Kplus %d\n",Bprime_by_C,*Kplus);
|
printf("Bprime_by_C_by_C %u , Kplus %u\n",Bprime_by_C,*Kplus);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (*Kplus < Bprime_by_C)
|
if (*Kplus < Bprime_by_C)
|
||||||
*Kplus = *Kplus + 64;
|
*Kplus = *Kplus + 64;
|
||||||
|
|
||||||
#ifdef DEBUG_SEGMENTATION
|
#ifdef DEBUG_SEGMENTATION
|
||||||
printf("Bprime_by_C_by_C %d , Kplus2 %d\n",Bprime_by_C,*Kplus);
|
printf("Bprime_by_C_by_C %u , Kplus2 %u\n",Bprime_by_C,*Kplus);
|
||||||
#endif
|
#endif
|
||||||
*Kminus = (*Kplus - 64);
|
*Kminus = (*Kplus - 64);
|
||||||
} else {
|
} else {
|
||||||
@@ -116,25 +113,21 @@ int lte_segmentation(unsigned char *input_buffer,
|
|||||||
*Kminus = 0;
|
*Kminus = 0;
|
||||||
*Cminus = 0;
|
*Cminus = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// printf("More than one segment (%d), exiting \n",*C);
|
// printf("More than one segment (%d), exiting \n",*C);
|
||||||
// exit(-1);
|
// exit(-1);
|
||||||
*Cminus = ((*C)*(*Kplus) - (Bprime))/((*Kplus) - (*Kminus));
|
*Cminus = ((*C)*(*Kplus) - (Bprime))/((*Kplus) - (*Kminus));
|
||||||
*Cplus = (*C) - (*Cminus);
|
*Cplus = (*C) - (*Cminus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AssertFatal(Bprime <= (*Cplus)*(*Kplus) + (*Cminus)*(*Kminus),
|
AssertFatal(Bprime <= (*Cplus)*(*Kplus) + (*Cminus)*(*Kminus),
|
||||||
"Bprime %d < (*Cplus %d)*(*Kplus %d) + (*Cminus %d)*(*Kminus %d)\n",
|
"Bprime %d < (*Cplus %d)*(*Kplus %d) + (*Cminus %d)*(*Kminus %d)\n",
|
||||||
Bprime,*Cplus,*Kplus,*Cminus,*Kminus);
|
Bprime,*Cplus,*Kplus,*Cminus,*Kminus);
|
||||||
|
|
||||||
*F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime));
|
*F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime));
|
||||||
#ifdef DEBUG_SEGMENTATION
|
#ifdef DEBUG_SEGMENTATION
|
||||||
printf("C %d, Cplus %d, Cminus %d, Kplus %d, Kminus %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
|
printf("C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u\n",*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((input_buffer) && (output_buffers)) {
|
if ((input_buffer) && (output_buffers)) {
|
||||||
|
|
||||||
for (k=0; k<*F>>3; k++) {
|
for (k=0; k<*F>>3; k++) {
|
||||||
output_buffers[0][k] = 0;
|
output_buffers[0][k] = 0;
|
||||||
}
|
}
|
||||||
@@ -142,7 +135,6 @@ int lte_segmentation(unsigned char *input_buffer,
|
|||||||
s=0;
|
s=0;
|
||||||
|
|
||||||
for (r=0; r<*C; r++) {
|
for (r=0; r<*C; r++) {
|
||||||
|
|
||||||
if (r<*Cminus)
|
if (r<*Cminus)
|
||||||
Kr = *Kminus;
|
Kr = *Kminus;
|
||||||
else
|
else
|
||||||
@@ -150,18 +142,18 @@ int lte_segmentation(unsigned char *input_buffer,
|
|||||||
|
|
||||||
while (k<((Kr - L)>>3)) {
|
while (k<((Kr - L)>>3)) {
|
||||||
output_buffers[r][k] = input_buffer[s];
|
output_buffers[r][k] = input_buffer[s];
|
||||||
// printf("encoding segment %d : byte %d (%d) => %d\n",r,k,Kr>>3,input_buffer[s]);
|
// printf("encoding segment %d : byte %d (%d) => %d\n",r,k,Kr>>3,input_buffer[s]);
|
||||||
k++;
|
k++;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*C > 1) { // add CRC
|
if (*C > 1) { // add CRC
|
||||||
crc = crc24b(output_buffers[r],Kr-24)>>8;
|
crc = crc24b(output_buffers[r],Kr-24)>>8;
|
||||||
output_buffers[r][(Kr-24)>>3] = ((uint8_t*)&crc)[2];
|
output_buffers[r][(Kr-24)>>3] = ((uint8_t *)&crc)[2];
|
||||||
output_buffers[r][1+((Kr-24)>>3)] = ((uint8_t*)&crc)[1];
|
output_buffers[r][1+((Kr-24)>>3)] = ((uint8_t *)&crc)[1];
|
||||||
output_buffers[r][2+((Kr-24)>>3)] = ((uint8_t*)&crc)[0];
|
output_buffers[r][2+((Kr-24)>>3)] = ((uint8_t *)&crc)[0];
|
||||||
#ifdef DEBUG_SEGMENTATION
|
#ifdef DEBUG_SEGMENTATION
|
||||||
printf("Segment %d : CRC %x\n",r,crc);
|
printf("Segment %u : CRC %x\n",r,crc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,9 +167,7 @@ int lte_segmentation(unsigned char *input_buffer,
|
|||||||
|
|
||||||
|
|
||||||
#ifdef MAIN
|
#ifdef MAIN
|
||||||
main()
|
main() {
|
||||||
{
|
|
||||||
|
|
||||||
unsigned int Kplus,Kminus,C,Cplus,Cminus,F,Bbytes;
|
unsigned int Kplus,Kminus,C,Cplus,Cminus,F,Bbytes;
|
||||||
|
|
||||||
for (Bbytes=5; Bbytes<2*768; Bbytes++) {
|
for (Bbytes=5; Bbytes<2*768; Bbytes++) {
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned char p,
|
unsigned char p,
|
||||||
unsigned char l,
|
unsigned char l,
|
||||||
unsigned char symbol)
|
unsigned char symbol) {
|
||||||
{
|
|
||||||
int pilot[2][200] __attribute__((aligned(16)));
|
int pilot[2][200] __attribute__((aligned(16)));
|
||||||
unsigned char nu,aarx;
|
unsigned char nu,aarx;
|
||||||
unsigned short k;
|
unsigned short k;
|
||||||
@@ -45,16 +44,14 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
// unsigned int n;
|
// unsigned int n;
|
||||||
// int i;
|
// int i;
|
||||||
static int interpolateS11S12 = 1;
|
static int interpolateS11S12 = 1;
|
||||||
|
|
||||||
uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
|
uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
|
||||||
|
|
||||||
uint8_t nushift,pilot0,pilot1,pilot2,pilot3;
|
uint8_t nushift,pilot0,pilot1,pilot2,pilot3;
|
||||||
uint8_t previous_thread_id = ue->current_thread_id[Ns>>1]==0 ? (RX_NB_TH-1):(ue->current_thread_id[Ns>>1]-1);
|
uint8_t previous_thread_id = ue->current_thread_id[Ns>>1]==0 ? (RX_NB_TH-1):(ue->current_thread_id[Ns>>1]-1);
|
||||||
int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset];
|
int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset];
|
||||||
int **dl_ch_estimates_previous=ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].dl_ch_estimates[eNB_offset];
|
int **dl_ch_estimates_previous=ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].dl_ch_estimates[eNB_offset];
|
||||||
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF;
|
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF;
|
||||||
|
|
||||||
pilot0 = 0;
|
pilot0 = 0;
|
||||||
|
|
||||||
if (ue->frame_parms.Ncp == 0) { // normal prefix
|
if (ue->frame_parms.Ncp == 0) { // normal prefix
|
||||||
pilot1 = 4;
|
pilot1 = 4;
|
||||||
pilot2 = 7;
|
pilot2 = 7;
|
||||||
@@ -81,7 +78,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//ch_offset = (l*(ue->frame_parms.ofdm_symbol_size));
|
//ch_offset = (l*(ue->frame_parms.ofdm_symbol_size));
|
||||||
if (ue->high_speed_flag == 0) // use second channel estimate position for temporary storage
|
if (ue->high_speed_flag == 0) // use second channel estimate position for temporary storage
|
||||||
ch_offset = ue->frame_parms.ofdm_symbol_size ;
|
ch_offset = ue->frame_parms.ofdm_symbol_size ;
|
||||||
@@ -89,93 +85,88 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
ch_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
ch_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
||||||
|
|
||||||
symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
||||||
|
|
||||||
k = (nu + nushift)%6;
|
k = (nu + nushift)%6;
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("Channel Estimation : ThreadId %d, eNB_offset %d cell_id %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d\n",ue->current_thread_id[Ns>>1], eNB_offset,Nid_cell,ch_offset,ue->frame_parms.ofdm_symbol_size,
|
printf("Channel Estimation : ThreadId %d, eNB_offset %d cell_id %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d\n",ue->current_thread_id[Ns>>1], eNB_offset,Nid_cell,ch_offset,
|
||||||
|
ue->frame_parms.ofdm_symbol_size,
|
||||||
ue->frame_parms.Ncp,l,Ns,k);
|
ue->frame_parms.Ncp,l,Ns,k);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case 0 :
|
case 0 :
|
||||||
f=filt24_0; //for first pilot of RB, first half
|
f=filt24_0; //for first pilot of RB, first half
|
||||||
f2=filt24_2; //for second pilot of RB, first half
|
f2=filt24_2; //for second pilot of RB, first half
|
||||||
fl=filt24_0; //for first pilot of leftmost RB
|
fl=filt24_0; //for first pilot of leftmost RB
|
||||||
f2l2=filt24_2;
|
f2l2=filt24_2;
|
||||||
// fr=filt24_2r; //for first pilot of rightmost RB
|
// fr=filt24_2r; //for first pilot of rightmost RB
|
||||||
fr=filt24_0r2; //for first pilot of rightmost RB
|
fr=filt24_0r2; //for first pilot of rightmost RB
|
||||||
// f2r2=filt24_0r2;
|
// f2r2=filt24_0r2;
|
||||||
f2r2=filt24_2r;
|
f2r2=filt24_2r;
|
||||||
|
f_dc=filt24_0_dcr;
|
||||||
|
f2_dc=filt24_2_dcl;
|
||||||
|
break;
|
||||||
|
|
||||||
f_dc=filt24_0_dcr;
|
case 1 :
|
||||||
f2_dc=filt24_2_dcl;
|
f=filt24_1;
|
||||||
|
f2=filt24_3;
|
||||||
|
fl=filt24_1l;
|
||||||
|
f2l2=filt24_3l2;
|
||||||
|
fr=filt24_1r2;
|
||||||
|
f2r2=filt24_3r;
|
||||||
|
f_dc=filt24_1_dcr; //for first pilot of RB, first half
|
||||||
|
f2_dc=filt24_3_dcl; //for first pilot of RB, first half
|
||||||
|
break;
|
||||||
|
|
||||||
break;
|
case 2 :
|
||||||
|
f=filt24_2;
|
||||||
|
f2=filt24_4;
|
||||||
|
fl=filt24_2l;
|
||||||
|
f2l2=filt24_4l2;
|
||||||
|
fr=filt24_2r2;
|
||||||
|
f2r2=filt24_4r;
|
||||||
|
f_dc=filt24_2_dcr; //for first pilot of RB, first half
|
||||||
|
f2_dc=filt24_4_dcl; //for first pilot of RB, first half
|
||||||
|
break;
|
||||||
|
|
||||||
case 1 :
|
case 3 :
|
||||||
f=filt24_1;
|
f=filt24_3;
|
||||||
f2=filt24_3;
|
f2=filt24_5;
|
||||||
fl=filt24_1l;
|
fl=filt24_3l;
|
||||||
f2l2=filt24_3l2;
|
f2l2=filt24_5l2;
|
||||||
fr=filt24_1r2;
|
fr=filt24_3r2;
|
||||||
f2r2=filt24_3r;
|
f2r2=filt24_5r;
|
||||||
f_dc=filt24_1_dcr; //for first pilot of RB, first half
|
f_dc=filt24_3_dcr; //for first pilot of RB, first half
|
||||||
f2_dc=filt24_3_dcl; //for first pilot of RB, first half
|
f2_dc=filt24_5_dcl; //for first pilot of RB, first half
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2 :
|
case 4 :
|
||||||
f=filt24_2;
|
f=filt24_4;
|
||||||
f2=filt24_4;
|
f2=filt24_6;
|
||||||
fl=filt24_2l;
|
fl=filt24_4l;
|
||||||
f2l2=filt24_4l2;
|
f2l2=filt24_6l2;
|
||||||
fr=filt24_2r2;
|
fr=filt24_4r2;
|
||||||
f2r2=filt24_4r;
|
f2r2=filt24_6r;
|
||||||
f_dc=filt24_2_dcr; //for first pilot of RB, first half
|
f_dc=filt24_4_dcr; //for first pilot of RB, first half
|
||||||
f2_dc=filt24_4_dcl; //for first pilot of RB, first half
|
f2_dc=filt24_6_dcl; //for first pilot of RB, first half
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3 :
|
case 5 :
|
||||||
f=filt24_3;
|
f=filt24_5;
|
||||||
f2=filt24_5;
|
f2=filt24_7;
|
||||||
fl=filt24_3l;
|
fl=filt24_5l;
|
||||||
f2l2=filt24_5l2;
|
f2l2=filt24_7l2;
|
||||||
fr=filt24_3r2;
|
fr=filt24_5r2;
|
||||||
f2r2=filt24_5r;
|
f2r2=filt24_7r;
|
||||||
f_dc=filt24_3_dcr; //for first pilot of RB, first half
|
f_dc=filt24_5_dcr; //for first pilot of RB, first half
|
||||||
f2_dc=filt24_5_dcl; //for first pilot of RB, first half
|
f2_dc=filt24_7_dcl; //for first pilot of RB, first half
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4 :
|
default:
|
||||||
f=filt24_4;
|
LOG_E(PHY,"lte_dl_channel_estimation: k=%d -> ERROR\n",k);
|
||||||
f2=filt24_6;
|
return(-1);
|
||||||
fl=filt24_4l;
|
break;
|
||||||
f2l2=filt24_6l2;
|
|
||||||
fr=filt24_4r2;
|
|
||||||
f2r2=filt24_6r;
|
|
||||||
f_dc=filt24_4_dcr; //for first pilot of RB, first half
|
|
||||||
f2_dc=filt24_6_dcl; //for first pilot of RB, first half
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5 :
|
|
||||||
f=filt24_5;
|
|
||||||
f2=filt24_7;
|
|
||||||
fl=filt24_5l;
|
|
||||||
f2l2=filt24_7l2;
|
|
||||||
fr=filt24_5r2;
|
|
||||||
f2r2=filt24_7r;
|
|
||||||
f_dc=filt24_5_dcr; //for first pilot of RB, first half
|
|
||||||
f2_dc=filt24_7_dcl; //for first pilot of RB, first half
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG_E(PHY,"lte_dl_channel_estimation: k=%d -> ERROR\n",k);
|
|
||||||
return(-1);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// generate pilot
|
// generate pilot
|
||||||
lte_dl_cell_spec_rx(ue,
|
lte_dl_cell_spec_rx(ue,
|
||||||
eNB_offset,
|
eNB_offset,
|
||||||
@@ -184,27 +175,25 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
(l==0)?0:1,
|
(l==0)?0:1,
|
||||||
p);
|
p);
|
||||||
|
|
||||||
|
|
||||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||||
|
|
||||||
pil = (int16_t *)&pilot[p][0];
|
pil = (int16_t *)&pilot[p][0];
|
||||||
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+k+ue->frame_parms.first_carrier_offset))];
|
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+k+ue->frame_parms.first_carrier_offset))];
|
||||||
dl_ch = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset];
|
dl_ch = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset];
|
||||||
|
|
||||||
|
|
||||||
// if (eNb_id==0)
|
// if (eNb_id==0)
|
||||||
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size));
|
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size));
|
||||||
|
|
||||||
if (ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha
|
if (ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha
|
||||||
multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
|
multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
|
||||||
ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
|
ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
|
||||||
1,ue->frame_parms.ofdm_symbol_size);
|
1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
|
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((ue->frame_parms.N_RB_DL==6) ||
|
if ((ue->frame_parms.N_RB_DL==6) ||
|
||||||
(ue->frame_parms.N_RB_DL==50) ||
|
(ue->frame_parms.N_RB_DL==50) ||
|
||||||
(ue->frame_parms.N_RB_DL==100)) {
|
(ue->frame_parms.N_RB_DL==100)) {
|
||||||
|
|
||||||
//First half of pilots
|
//First half of pilots
|
||||||
// Treat first 2 pilots specially (left edge)
|
// Treat first 2 pilots specially (left edge)
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
@@ -219,7 +208,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
@@ -234,28 +222,22 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
for (pilot_cnt=2; pilot_cnt<((ue->frame_parms.N_RB_DL)-1); pilot_cnt+=2) {
|
for (pilot_cnt=2; pilot_cnt<((ue->frame_parms.N_RB_DL)-1); pilot_cnt+=2) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); //Re
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); //Re
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); //Im
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); //Im
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
#endif
|
#endif
|
||||||
multadd_real_vector_complex_scalar(f,
|
multadd_real_vector_complex_scalar(f,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
24);
|
24);
|
||||||
|
|
||||||
|
|
||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
#endif
|
#endif
|
||||||
multadd_real_vector_complex_scalar(f2,
|
multadd_real_vector_complex_scalar(f2,
|
||||||
ch,
|
ch,
|
||||||
@@ -264,29 +246,25 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("Second half\n");
|
// printf("Second half\n");
|
||||||
// Second half of RBs
|
// Second half of RBs
|
||||||
|
|
||||||
k = (nu + nushift)%6;
|
k = (nu + nushift)%6;
|
||||||
|
|
||||||
if (k > 6)
|
if (k > 6)
|
||||||
k -=6;
|
k -=6;
|
||||||
|
|
||||||
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))];
|
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))];
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("second half k %d\n",k);
|
printf("second half k %d\n",k);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (pilot_cnt=0; pilot_cnt<((ue->frame_parms.N_RB_DL)-3); pilot_cnt+=2) {
|
for (pilot_cnt=0; pilot_cnt<((ue->frame_parms.N_RB_DL)-3); pilot_cnt+=2) {
|
||||||
|
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
#endif
|
#endif
|
||||||
multadd_real_vector_complex_scalar(f,
|
multadd_real_vector_complex_scalar(f,
|
||||||
ch,
|
ch,
|
||||||
@@ -295,11 +273,10 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
#endif
|
#endif
|
||||||
multadd_real_vector_complex_scalar(f2,
|
multadd_real_vector_complex_scalar(f2,
|
||||||
ch,
|
ch,
|
||||||
@@ -308,13 +285,12 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
#endif
|
#endif
|
||||||
multadd_real_vector_complex_scalar(fr,
|
multadd_real_vector_complex_scalar(fr,
|
||||||
ch,
|
ch,
|
||||||
@@ -323,34 +299,25 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
#endif
|
#endif
|
||||||
multadd_real_vector_complex_scalar(f2r2,
|
multadd_real_vector_complex_scalar(f2r2,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
24);
|
24);
|
||||||
|
} else if (ue->frame_parms.N_RB_DL==25) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (ue->frame_parms.N_RB_DL==25) {
|
|
||||||
//printf("Channel estimation\n");
|
//printf("Channel estimation\n");
|
||||||
|
|
||||||
// Treat first 2 pilots specially (left edge)
|
// Treat first 2 pilots specially (left edge)
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot 0 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot 0 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(fl,
|
multadd_real_vector_complex_scalar(fl,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -358,17 +325,13 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f2l2,
|
multadd_real_vector_complex_scalar(f2l2,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -378,21 +341,15 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
for (pilot_cnt=2; pilot_cnt<24; pilot_cnt+=2) {
|
for (pilot_cnt=2; pilot_cnt<24; pilot_cnt+=2) {
|
||||||
|
|
||||||
// printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
|
// printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
|
||||||
// printf("rx[%d][%d] -> (%d,%d)\n",p,ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),rxF[0],rxF[1]);
|
// printf("rx[%d][%d] -> (%d,%d)\n",p,ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),rxF[0],rxF[1]);
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f,
|
multadd_real_vector_complex_scalar(f,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -400,13 +357,10 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
@@ -417,39 +371,31 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot 24: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot 24: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f_dc,
|
multadd_real_vector_complex_scalar(f_dc,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
24);
|
24);
|
||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
// printf("Second half\n");
|
// printf("Second half\n");
|
||||||
// Second half of RBs
|
// Second half of RBs
|
||||||
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))];
|
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+k))];
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot 25: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot 25: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f2_dc,
|
multadd_real_vector_complex_scalar(f2_dc,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -459,19 +405,15 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
for (pilot_cnt=0; pilot_cnt<22; pilot_cnt+=2) {
|
for (pilot_cnt=0; pilot_cnt<22; pilot_cnt+=2) {
|
||||||
|
|
||||||
// printf("* pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
|
// printf("* pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
|
||||||
// printf("rx[%d][%d] -> (%d,%d)\n",p,ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),rxF[0],rxF[1]);
|
// printf("rx[%d][%d] -> (%d,%d)\n",p,ue->frame_parms.first_carrier_offset + ue->frame_parms.nushift + 6*rb+(3*p),rxF[0],rxF[1]);
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",26+pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",26+pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f,
|
multadd_real_vector_complex_scalar(f,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -479,16 +421,13 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot %d : rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",27+pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot %u : rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",27+pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f2,
|
multadd_real_vector_complex_scalar(f2,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -496,20 +435,15 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pilot 49: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot 49: rxF -> (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(fr,
|
multadd_real_vector_complex_scalar(fr,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -517,28 +451,20 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
|
|
||||||
printf("pilot 50: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
printf("pilot 50: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||||
|
|
||||||
// ch[0] = 1024;
|
// ch[0] = 1024;
|
||||||
// ch[1] = -128;
|
// ch[1] = -128;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f2r2,
|
multadd_real_vector_complex_scalar(f2r2,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
24);
|
24);
|
||||||
|
|
||||||
} else if (ue->frame_parms.N_RB_DL==15) {
|
} else if (ue->frame_parms.N_RB_DL==15) {
|
||||||
|
|
||||||
//printf("First Half\n");
|
//printf("First Half\n");
|
||||||
for (rb=0; rb<28; rb+=4) {
|
for (rb=0; rb<28; rb+=4) {
|
||||||
|
|
||||||
//printf("aarx=%d\n",aarx);
|
//printf("aarx=%d\n",aarx);
|
||||||
//printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
|
//printf("pilot[%d][%d] (%d,%d)\n",p,rb,pil[0],pil[1]);
|
||||||
//printf("rx[%d][%d] -> (%d,%d)\n",p,
|
//printf("rx[%d][%d] -> (%d,%d)\n",p,
|
||||||
@@ -555,7 +481,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
//printf("ch -> (%d,%d)\n",ch[0],ch[1]);
|
//printf("ch -> (%d,%d)\n",ch[0],ch[1]);
|
||||||
@@ -566,7 +491,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
@@ -578,13 +502,11 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
24);
|
24);
|
||||||
pil+=2; // Re Im
|
pil+=2; // Re Im
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
//printf("Second half\n");
|
//printf("Second half\n");
|
||||||
//Second half of RBs
|
//Second half of RBs
|
||||||
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+nushift + (3*p)))];
|
rxF = (int16_t *)&rxdataF[aarx][((symbol_offset+1+nushift + (3*p)))];
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f2,
|
multadd_real_vector_complex_scalar(f2,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -602,7 +524,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
// rxF[1]);
|
// rxF[1]);
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f,
|
multadd_real_vector_complex_scalar(f,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -610,10 +531,8 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=8;
|
dl_ch+=8;
|
||||||
|
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
|
|
||||||
multadd_real_vector_complex_scalar(f2,
|
multadd_real_vector_complex_scalar(f2,
|
||||||
ch,
|
ch,
|
||||||
dl_ch,
|
dl_ch,
|
||||||
@@ -621,17 +540,14 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
pil+=2;
|
pil+=2;
|
||||||
rxF+=12;
|
rxF+=12;
|
||||||
dl_ch+=16;
|
dl_ch+=16;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_E(PHY,"channel estimation not implemented for ue->frame_parms.N_RB_DL = %d\n",ue->frame_parms.N_RB_DL);
|
LOG_E(PHY,"channel estimation not implemented for ue->frame_parms.N_RB_DL = %d\n",ue->frame_parms.N_RB_DL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ue->perfect_ce == 0) {
|
if (ue->perfect_ce == 0) {
|
||||||
// Temporal Interpolation
|
// Temporal Interpolation
|
||||||
// printf("ch_offset %d\n",ch_offset);
|
// printf("ch_offset %d\n",ch_offset);
|
||||||
|
|
||||||
dl_ch = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset];
|
dl_ch = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][ch_offset];
|
||||||
|
|
||||||
if (ue->high_speed_flag == 0) {
|
if (ue->high_speed_flag == 0) {
|
||||||
@@ -639,182 +555,155 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
|||||||
32767-ue->ch_est_alpha,
|
32767-ue->ch_est_alpha,
|
||||||
dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),0,ue->frame_parms.ofdm_symbol_size);
|
dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
} else { // high_speed_flag == 1
|
} else { // high_speed_flag == 1
|
||||||
if ((symbol == 0)) {
|
if ((symbol == 0)) {
|
||||||
// printf("Interpolating %d->0\n",4-ue->frame_parms.Ncp);
|
// printf("Interpolating %d->0\n",4-ue->frame_parms.Ncp);
|
||||||
// dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][(4-ue->frame_parms.Ncp)*(ue->frame_parms.ofdm_symbol_size)];
|
// dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][(4-ue->frame_parms.Ncp)*(ue->frame_parms.ofdm_symbol_size)];
|
||||||
if(((Ns>>1)!=0) || ( ((Ns>>1)==0) && interpolateS11S12))
|
if(((Ns>>1)!=0) || ( ((Ns>>1)==0) && interpolateS11S12)) {
|
||||||
{
|
//LOG_I(PHY,"Interpolate s11-->s0 to get s12 and s13 Ns %d \n", Ns);
|
||||||
//LOG_I(PHY,"Interpolate s11-->s0 to get s12 and s13 Ns %d \n", Ns);
|
dl_ch_prev = (int16_t *)&dl_ch_estimates_previous[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)];
|
||||||
dl_ch_prev = (int16_t *)&dl_ch_estimates_previous[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)];
|
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
}
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
interpolateS11S12 = 1;
|
||||||
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
} // this is 1/3,2/3 combination for pilots spaced by 3 symbols
|
||||||
|
else if (symbol == pilot1) {
|
||||||
|
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][0];
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
//LOG_I(PHY,"Interpolate s0-->s4 to get s1 s2 and s3 Ns %d \n", Ns);
|
||||||
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination)
|
||||||
}
|
uint8_t previous_subframe;
|
||||||
|
|
||||||
interpolateS11S12 = 1;
|
if(Ns>>1 == 0)
|
||||||
} // this is 1/3,2/3 combination for pilots spaced by 3 symbols
|
previous_subframe = 9;
|
||||||
else if (symbol == pilot1) {
|
else
|
||||||
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][0];
|
previous_subframe = ((Ns>>1) - 1 )%9;
|
||||||
|
|
||||||
//LOG_I(PHY,"Interpolate s0-->s4 to get s1 s2 and s3 Ns %d \n", Ns);
|
|
||||||
if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination)
|
|
||||||
|
|
||||||
uint8_t previous_subframe;
|
|
||||||
if(Ns>>1 == 0)
|
|
||||||
previous_subframe = 9;
|
|
||||||
else
|
|
||||||
previous_subframe = ((Ns>>1) - 1 )%9;
|
|
||||||
|
|
||||||
if((subframe_select(&ue->frame_parms,previous_subframe) == SF_UL))
|
|
||||||
{
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
} // pilot spacing 3 symbols (1/3,2/3 combination)
|
|
||||||
} else if (symbol == pilot2) {
|
|
||||||
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot1*(ue->frame_parms.ofdm_symbol_size)];
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
} else { // symbol == pilot3
|
|
||||||
// printf("Interpolating 0->%d\n",4-ue->frame_parms.Ncp);
|
|
||||||
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)];
|
|
||||||
|
|
||||||
if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination)
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
} else {
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
|
||||||
} // pilot spacing 3 symbols (1/3,2/3 combination)
|
|
||||||
|
|
||||||
if((ue->rx_offset_diff !=0) && ((Ns>>1) == 9))
|
|
||||||
{
|
|
||||||
//LOG_I(PHY,"Extrapolate s7-->s11 to get s12 and s13 Ns %d\n", Ns);
|
|
||||||
interpolateS11S12 = 0;
|
|
||||||
//LOG_E(PHY,"Interpolate s7--s11 s12 s13 pilot 3 Ns %d l %d symbol %d \n", Ns, l, symbol);
|
|
||||||
int16_t *dlChEst_ofdm11 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)];
|
|
||||||
int16_t *dlChEst_ofdm7 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)];
|
|
||||||
|
|
||||||
// interpolate ofdm s12: 5/4*ofdms11 + -1/4*ofdms7 5/4 q1.15 40960 -1/4 q1.15 8192
|
|
||||||
int16_t *dlChEst_ofdm12 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][12*ue->frame_parms.ofdm_symbol_size];
|
|
||||||
for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++)
|
|
||||||
{
|
|
||||||
int64_t tmp_mult = 0;
|
|
||||||
tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 40960 - (int64_t)dlChEst_ofdm7[i] * 8192);
|
|
||||||
|
|
||||||
tmp_mult = tmp_mult >> 15;
|
|
||||||
dlChEst_ofdm12[i] = tmp_mult;
|
|
||||||
}
|
|
||||||
|
|
||||||
// interpolate ofdm s13: 3/2*ofdms11 + -1/2*ofdms7 3/2 q1.15 49152 1/2 q1.15 16384
|
|
||||||
int16_t *dlChEst_ofdm13 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][13*ue->frame_parms.ofdm_symbol_size];
|
|
||||||
for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++)
|
|
||||||
{
|
|
||||||
int64_t tmp_mult = 0;
|
|
||||||
tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 49152 - (int64_t)dlChEst_ofdm7[i] * 16384);
|
|
||||||
|
|
||||||
tmp_mult = tmp_mult >> 15;
|
|
||||||
dlChEst_ofdm13[i] = tmp_mult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if((subframe_select(&ue->frame_parms,previous_subframe) == SF_UL)) {
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
} else {
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
} // pilot spacing 3 symbols (1/3,2/3 combination)
|
||||||
|
} else if (symbol == pilot2) {
|
||||||
|
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot1*(ue->frame_parms.ofdm_symbol_size)];
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
} else { // symbol == pilot3
|
||||||
|
// printf("Interpolating 0->%d\n",4-ue->frame_parms.Ncp);
|
||||||
|
dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)];
|
||||||
|
|
||||||
|
if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination)
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
} else {
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size);
|
||||||
|
} // pilot spacing 3 symbols (1/3,2/3 combination)
|
||||||
|
|
||||||
|
if((ue->rx_offset_diff !=0) && ((Ns>>1) == 9)) {
|
||||||
|
//LOG_I(PHY,"Extrapolate s7-->s11 to get s12 and s13 Ns %d\n", Ns);
|
||||||
|
interpolateS11S12 = 0;
|
||||||
|
//LOG_E(PHY,"Interpolate s7--s11 s12 s13 pilot 3 Ns %d l %d symbol %d \n", Ns, l, symbol);
|
||||||
|
int16_t *dlChEst_ofdm11 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)];
|
||||||
|
int16_t *dlChEst_ofdm7 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)];
|
||||||
|
// interpolate ofdm s12: 5/4*ofdms11 + -1/4*ofdms7 5/4 q1.15 40960 -1/4 q1.15 8192
|
||||||
|
int16_t *dlChEst_ofdm12 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][12*ue->frame_parms.ofdm_symbol_size];
|
||||||
|
|
||||||
|
for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++) {
|
||||||
|
int64_t tmp_mult = 0;
|
||||||
|
tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 40960 - (int64_t)dlChEst_ofdm7[i] * 8192);
|
||||||
|
tmp_mult = tmp_mult >> 15;
|
||||||
|
dlChEst_ofdm12[i] = tmp_mult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// interpolate ofdm s13: 3/2*ofdms11 + -1/2*ofdms7 3/2 q1.15 49152 1/2 q1.15 16384
|
||||||
|
int16_t *dlChEst_ofdm13 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][13*ue->frame_parms.ofdm_symbol_size];
|
||||||
|
|
||||||
|
for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++) {
|
||||||
|
int64_t tmp_mult = 0;
|
||||||
|
tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 49152 - (int64_t)dlChEst_ofdm7[i] * 16384);
|
||||||
|
tmp_mult = tmp_mult >> 15;
|
||||||
|
dlChEst_ofdm13[i] = tmp_mult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*idft)(int16_t *,int16_t *, int);
|
void (*idft)(int16_t *,int16_t *, int);
|
||||||
|
|
||||||
switch (ue->frame_parms.ofdm_symbol_size) {
|
switch (ue->frame_parms.ofdm_symbol_size) {
|
||||||
case 128:
|
case 128:
|
||||||
idft = idft128;
|
idft = idft128;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 256:
|
case 256:
|
||||||
idft = idft256;
|
idft = idft256;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 512:
|
case 512:
|
||||||
idft = idft512;
|
idft = idft512;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1024:
|
case 1024:
|
||||||
idft = idft1024;
|
idft = idft1024;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1536:
|
case 1536:
|
||||||
idft = idft1536;
|
idft = idft1536;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2048:
|
case 2048:
|
||||||
idft = idft2048;
|
idft = idft2048;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
idft = idft512;
|
idft = idft512;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ((Ns%2) == 0) && (l == pilot0))
|
if( ((Ns%2) == 0) && (l == pilot0)) {
|
||||||
{
|
// do ifft of channel estimate
|
||||||
// do ifft of channel estimate
|
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
|
||||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
|
for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) {
|
||||||
for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) {
|
if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx]) {
|
||||||
if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx])
|
//LOG_I(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns>>1], l);
|
||||||
{
|
idft((int16_t *) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx][8],
|
||||||
//LOG_I(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns>>1], l);
|
(int16_t *) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1);
|
||||||
idft((int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx][8],
|
}
|
||||||
(int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(eNB_id),
|
T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(eNB_id),
|
||||||
T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].frame_rx%1024), T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].subframe_rx),
|
T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].frame_rx%1024), T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].subframe_rx),
|
||||||
T_INT(0), T_BUFFER(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][0][0], 512 * 4));
|
T_INT(0), T_BUFFER(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][0][0], 512 * 4));
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+399
-397
File diff suppressed because it is too large
Load Diff
+43
-22
@@ -33,26 +33,23 @@ This header file must be included */
|
|||||||
#define OPT_H_
|
#define OPT_H_
|
||||||
|
|
||||||
#ifndef sys_include
|
#ifndef sys_include
|
||||||
#define sys_include
|
#define sys_include
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef project_include
|
#ifndef project_include
|
||||||
#define project_include
|
#define project_include
|
||||||
#include "common/utils/LOG/log_if.h"
|
#include "common/utils/LOG/log_if.h"
|
||||||
// #include "UTIL/LOG/log_extern.h"
|
#include "PHY/impl_defs_lte.h"
|
||||||
//#include "PHY/defs.h"
|
|
||||||
//#include "PHY/extern.h"
|
|
||||||
#include "PHY/impl_defs_lte.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999)
|
#define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999)
|
||||||
@@ -65,6 +62,32 @@ typedef guint8 gboolean;
|
|||||||
#include "packet-mac-lte.h"
|
#include "packet-mac-lte.h"
|
||||||
#include "mac_pcap.h"
|
#include "mac_pcap.h"
|
||||||
|
|
||||||
|
/* OPT parameters definitions */
|
||||||
|
#define OPT_CONFIGPREFIX "opt"
|
||||||
|
|
||||||
|
#define CONFIG_HLP_TYPEMON "Type of L2 monitoring messages: none,pcap,wireshark \n"
|
||||||
|
#define CONFIG_HLP_L2MONIP "ip address for wireshark messages \n"
|
||||||
|
#define CONFIG_HLP_L2MONPATH "file path for pcap messages on localhost \n"
|
||||||
|
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
/* command line parameters for LOG utility */
|
||||||
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
|
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
#define OPT_PARAMS_DESC { \
|
||||||
|
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \
|
||||||
|
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||||
|
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define OPTTYPE_IDX 0
|
||||||
|
/* check function for opt parameters */
|
||||||
|
#define OPTTYPE_OKSTRINGS {"none","pcap","wireshark"}
|
||||||
|
#define OPTTYPE_VALUES {OPT_NONE,OPT_PCAP,OPT_WIRESHARK}
|
||||||
|
#define OPTPARAMS_CHECK_DESC { \
|
||||||
|
{ .s3a= { config_checkstr_assign_integer, OPTTYPE_OKSTRINGS,OPTTYPE_VALUES ,3}} ,\
|
||||||
|
{ .s5= {NULL }} , \
|
||||||
|
{ .s5= {NULL }} , \
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef OCP_FRAMEWORK
|
#ifdef OCP_FRAMEWORK
|
||||||
#include <enums.h>
|
#include <enums.h>
|
||||||
#else
|
#else
|
||||||
@@ -82,9 +105,7 @@ typedef enum radio_type_e {
|
|||||||
RADIO_TYPE_MAX
|
RADIO_TYPE_MAX
|
||||||
} radio_type_t;
|
} radio_type_t;
|
||||||
|
|
||||||
extern trace_mode_t opt_type;
|
|
||||||
extern char in_ip[40];
|
|
||||||
extern char in_path[FILENAME_MAX];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function def
|
* function def
|
||||||
@@ -94,7 +115,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
|||||||
int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
|
int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
|
||||||
int oob_event, int oob_event_value);
|
int oob_event, int oob_event_value);
|
||||||
|
|
||||||
int init_opt(char *path, char *ip);
|
int init_opt(void);
|
||||||
|
|
||||||
void terminate_opt(void);
|
void terminate_opt(void);
|
||||||
|
|
||||||
|
|||||||
+143
-159
@@ -90,7 +90,7 @@ what about the implementation
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "common/config/config_userapi.h"
|
||||||
#include "opt.h"
|
#include "opt.h"
|
||||||
|
|
||||||
int opt_enabled=0;
|
int opt_enabled=0;
|
||||||
@@ -98,8 +98,8 @@ int opt_enabled=0;
|
|||||||
//static unsigned char g_PDUBuffer[1600];
|
//static unsigned char g_PDUBuffer[1600];
|
||||||
//static unsigned int g_PDUOffset;
|
//static unsigned int g_PDUOffset;
|
||||||
|
|
||||||
char in_ip[40];
|
static char *in_ip;
|
||||||
char in_path[FILENAME_MAX];
|
static char *in_path;
|
||||||
FILE *file_fd = NULL;
|
FILE *file_fd = NULL;
|
||||||
pcap_hdr_t file_header = {
|
pcap_hdr_t file_header = {
|
||||||
0xa1b2c3d4, /* magic number */
|
0xa1b2c3d4, /* magic number */
|
||||||
@@ -133,17 +133,15 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
|||||||
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
||||||
const unsigned char *PDU, unsigned int length);
|
const unsigned char *PDU, unsigned int length);
|
||||||
|
|
||||||
static void *opt_listener_thread(void *arg)
|
static void *opt_listener_thread(void *arg) {
|
||||||
{
|
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
struct sockaddr_in from_address;
|
struct sockaddr_in from_address;
|
||||||
socklen_t socklen = sizeof(from_address);
|
socklen_t socklen = sizeof(from_address);
|
||||||
|
|
||||||
memset(&from_address, 0, sizeof(from_address));
|
memset(&from_address, 0, sizeof(from_address));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
/* Simply drop packets */
|
/* Simply drop packets */
|
||||||
ret = recvfrom(opt_listener.sd, NULL, 0, 0, (struct sockaddr*)&from_address,
|
ret = recvfrom(opt_listener.sd, NULL, 0, 0, (struct sockaddr *)&from_address,
|
||||||
&socklen);
|
&socklen);
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
@@ -165,17 +163,13 @@ static void *opt_listener_thread(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int opt_create_listener_socket(char *ip_address, uint16_t port)
|
int opt_create_listener_socket(char *ip_address, uint16_t port) {
|
||||||
{
|
|
||||||
/* Create an UDP socket and listen on it.
|
/* Create an UDP socket and listen on it.
|
||||||
* Silently discard PDU received.
|
* Silently discard PDU received.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int sd = -1;
|
int sd = -1;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
memset(&opt_listener, 0, sizeof(opt_listener_t));
|
memset(&opt_listener, 0, sizeof(opt_listener_t));
|
||||||
|
|
||||||
sd = socket(AF_INET, SOCK_DGRAM, 0);
|
sd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
if (sd < 0) {
|
if (sd < 0) {
|
||||||
@@ -190,8 +184,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port)
|
|||||||
/* Listening only on provided IP address */
|
/* Listening only on provided IP address */
|
||||||
opt_listener.address.sin_addr.s_addr = inet_addr(ip_address);
|
opt_listener.address.sin_addr.s_addr = inet_addr(ip_address);
|
||||||
opt_listener.address.sin_port = htons(port);
|
opt_listener.address.sin_port = htons(port);
|
||||||
|
ret = bind(opt_listener.sd, (struct sockaddr *) &opt_listener.address, sizeof(opt_listener.address));
|
||||||
ret = bind(opt_listener.sd, (struct sockaddr*) &opt_listener.address, sizeof(opt_listener.address));
|
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
LOG_E(OPT, "Failed to bind socket to (%s:%u): %s\n",
|
LOG_E(OPT, "Failed to bind socket to (%s:%u): %s\n",
|
||||||
@@ -231,49 +224,39 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
|||||||
guint16 rnti, guint16 ueid, guint16 sfnSf,
|
guint16 rnti, guint16 ueid, guint16 sfnSf,
|
||||||
guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
|
guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
|
||||||
guint8 oob_event, guint8 oob_event_value,
|
guint8 oob_event, guint8 oob_event_value,
|
||||||
uint8_t *pdu_buffer, unsigned int pdu_buffer_size)
|
uint8_t *pdu_buffer, unsigned int pdu_buffer_size) {
|
||||||
{
|
|
||||||
unsigned char frameBuffer[9000];
|
unsigned char frameBuffer[9000];
|
||||||
unsigned int frameOffset;
|
unsigned int frameOffset;
|
||||||
|
|
||||||
ssize_t bytesSent;
|
ssize_t bytesSent;
|
||||||
frameOffset = 0;
|
frameOffset = 0;
|
||||||
uint16_t tmp16;
|
uint16_t tmp16;
|
||||||
|
|
||||||
memcpy(frameBuffer+frameOffset, MAC_LTE_START_STRING,
|
memcpy(frameBuffer+frameOffset, MAC_LTE_START_STRING,
|
||||||
strlen(MAC_LTE_START_STRING));
|
strlen(MAC_LTE_START_STRING));
|
||||||
frameOffset += strlen(MAC_LTE_START_STRING);
|
frameOffset += strlen(MAC_LTE_START_STRING);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */
|
/* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */
|
||||||
frameBuffer[frameOffset++] = radioType;
|
frameBuffer[frameOffset++] = radioType;
|
||||||
frameBuffer[frameOffset++] = direction;
|
frameBuffer[frameOffset++] = direction;
|
||||||
frameBuffer[frameOffset++] = rntiType;
|
frameBuffer[frameOffset++] = rntiType;
|
||||||
|
|
||||||
/*************************************/
|
/*************************************/
|
||||||
/* Now optional fields */
|
/* Now optional fields */
|
||||||
|
|
||||||
/* RNTI */
|
/* RNTI */
|
||||||
frameBuffer[frameOffset++] = MAC_LTE_RNTI_TAG;
|
frameBuffer[frameOffset++] = MAC_LTE_RNTI_TAG;
|
||||||
tmp16 = htons(rnti);
|
tmp16 = htons(rnti);
|
||||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||||
frameOffset += 2;
|
frameOffset += 2;
|
||||||
|
|
||||||
/* UEId */
|
/* UEId */
|
||||||
frameBuffer[frameOffset++] = MAC_LTE_UEID_TAG;
|
frameBuffer[frameOffset++] = MAC_LTE_UEID_TAG;
|
||||||
tmp16 = htons(ueid);
|
tmp16 = htons(ueid);
|
||||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||||
frameOffset += 2;
|
frameOffset += 2;
|
||||||
|
|
||||||
/* Subframe number */
|
/* Subframe number */
|
||||||
frameBuffer[frameOffset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
|
frameBuffer[frameOffset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
|
||||||
tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F
|
tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F
|
||||||
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
memcpy(frameBuffer+frameOffset, &tmp16, 2);
|
||||||
frameOffset += 2;
|
frameOffset += 2;
|
||||||
|
|
||||||
frameBuffer[frameOffset++] = MAC_LTE_CRC_STATUS_TAG;
|
frameBuffer[frameOffset++] = MAC_LTE_CRC_STATUS_TAG;
|
||||||
frameBuffer[frameOffset++] = crcStatus;
|
frameBuffer[frameOffset++] = crcStatus;
|
||||||
|
|
||||||
#ifdef WIRESHARK_DEV
|
#ifdef WIRESHARK_DEV
|
||||||
frameOffset += 2;
|
frameOffset += 2;
|
||||||
tmp16 = htons(sfnSf); // subframe
|
tmp16 = htons(sfnSf); // subframe
|
||||||
@@ -293,55 +276,55 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
|||||||
frameBuffer[frameOffset++] = retx;
|
frameBuffer[frameOffset++] = retx;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef WIRESHARK_DEV
|
//#ifdef WIRESHARK_DEV
|
||||||
|
|
||||||
/* Relating to out-of-band events */
|
/* Relating to out-of-band events */
|
||||||
/* N.B. dissector will only look to these fields if length is 0... */
|
/* N.B. dissector will only look to these fields if length is 0... */
|
||||||
if (pdu_buffer_size==0) {
|
if (pdu_buffer_size==0) {
|
||||||
switch (oob_event) {
|
switch (oob_event) {
|
||||||
case ltemac_send_preamble :
|
case ltemac_send_preamble :
|
||||||
LOG_D(OPT,"ltemac_send_preamble event %02x."
|
LOG_D(OPT,"ltemac_send_preamble event %02x."
|
||||||
//"%02x."
|
//"%02x."
|
||||||
"%02x.%02x\n",
|
"%02x.%02x\n",
|
||||||
MAC_LTE_SEND_PREAMBLE_TAG,
|
MAC_LTE_SEND_PREAMBLE_TAG,
|
||||||
//ltemac_send_preamble,
|
//ltemac_send_preamble,
|
||||||
rnti,
|
rnti,
|
||||||
oob_event_value);
|
oob_event_value);
|
||||||
//frameBuffer[frameOffset++]=0;
|
//frameBuffer[frameOffset++]=0;
|
||||||
//frameBuffer[frameOffset++]=0;
|
//frameBuffer[frameOffset++]=0;
|
||||||
//frameBuffer[frameOffset++]=0;
|
//frameBuffer[frameOffset++]=0;
|
||||||
frameBuffer[frameOffset++] = MAC_LTE_SEND_PREAMBLE_TAG;
|
frameBuffer[frameOffset++] = MAC_LTE_SEND_PREAMBLE_TAG;
|
||||||
//frameBuffer[frameOffset++]=ltemac_send_preamble;
|
//frameBuffer[frameOffset++]=ltemac_send_preamble;
|
||||||
frameBuffer[frameOffset++]=rnti; // is the preamble
|
frameBuffer[frameOffset++]=rnti; // is the preamble
|
||||||
frameBuffer[frameOffset++]=oob_event_value;
|
frameBuffer[frameOffset++]=oob_event_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ltemac_send_sr:
|
case ltemac_send_sr:
|
||||||
frameBuffer[frameOffset++]=MAC_LTE_SR_TAG ;
|
frameBuffer[frameOffset++]=MAC_LTE_SR_TAG ;
|
||||||
frameOffset+=2;
|
frameOffset+=2;
|
||||||
frameBuffer[frameOffset++]=rnti;
|
frameBuffer[frameOffset++]=rnti;
|
||||||
frameOffset++;
|
frameOffset++;
|
||||||
frameBuffer[frameOffset++]=oob_event_value;
|
frameBuffer[frameOffset++]=oob_event_value;
|
||||||
frameOffset++;
|
frameOffset++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ltemac_sr_failure:
|
case ltemac_sr_failure:
|
||||||
default:
|
default:
|
||||||
LOG_W(OPT,"not implemeneted yet\n");
|
LOG_W(OPT,"not implemeneted yet\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
/***************************************/
|
/***************************************/
|
||||||
/* Now write the MAC PDU */
|
/* Now write the MAC PDU */
|
||||||
frameBuffer[frameOffset++] = MAC_LTE_PAYLOAD_TAG;
|
frameBuffer[frameOffset++] = MAC_LTE_PAYLOAD_TAG;
|
||||||
|
|
||||||
/* Append actual PDU */
|
/* Append actual PDU */
|
||||||
//memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
|
//memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
|
||||||
//frameOffset += g_PDUOffset;
|
//frameOffset += g_PDUOffset;
|
||||||
if (pdu_buffer != NULL) {
|
if (pdu_buffer != NULL) {
|
||||||
memcpy(frameBuffer+frameOffset, (void*)pdu_buffer, pdu_buffer_size);
|
memcpy(frameBuffer+frameOffset, (void *)pdu_buffer, pdu_buffer_size);
|
||||||
frameOffset += pdu_buffer_size;
|
frameOffset += pdu_buffer_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,44 +341,36 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
|||||||
|
|
||||||
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
|
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
|
||||||
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
||||||
const uint8_t *PDU, unsigned int length)
|
const uint8_t *PDU, unsigned int length) {
|
||||||
{
|
|
||||||
pcaprec_hdr_t packet_header;
|
pcaprec_hdr_t packet_header;
|
||||||
uint8_t context_header[256];
|
uint8_t context_header[256];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
unsigned short tmp16;
|
unsigned short tmp16;
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* Context information (same as written by UDP heuristic clients */
|
/* Context information (same as written by UDP heuristic clients */
|
||||||
context_header[offset++] = context->radioType;
|
context_header[offset++] = context->radioType;
|
||||||
context_header[offset++] = context->direction;
|
context_header[offset++] = context->direction;
|
||||||
context_header[offset++] = context->rntiType;
|
context_header[offset++] = context->rntiType;
|
||||||
|
|
||||||
/* RNTI */
|
/* RNTI */
|
||||||
context_header[offset++] = MAC_LTE_RNTI_TAG;
|
context_header[offset++] = MAC_LTE_RNTI_TAG;
|
||||||
tmp16 = htons(context->rnti);
|
tmp16 = htons(context->rnti);
|
||||||
memcpy(context_header+offset, &tmp16, 2);
|
memcpy(context_header+offset, &tmp16, 2);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
|
||||||
/* UEId */
|
/* UEId */
|
||||||
context_header[offset++] = MAC_LTE_UEID_TAG;
|
context_header[offset++] = MAC_LTE_UEID_TAG;
|
||||||
tmp16 = htons(context->ueid);
|
tmp16 = htons(context->ueid);
|
||||||
memcpy(context_header+offset, &tmp16, 2);
|
memcpy(context_header+offset, &tmp16, 2);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
|
||||||
/* Subframe number */
|
/* Subframe number */
|
||||||
context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
|
context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
|
||||||
tmp16 = htons(context->subFrameNumber);
|
tmp16 = htons(context->subFrameNumber);
|
||||||
memcpy(context_header+offset, &tmp16, 2);
|
memcpy(context_header+offset, &tmp16, 2);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
|
||||||
/* CRC Status */
|
/* CRC Status */
|
||||||
context_header[offset++] = MAC_LTE_CRC_STATUS_TAG;
|
context_header[offset++] = MAC_LTE_CRC_STATUS_TAG;
|
||||||
context_header[offset++] = context->crcStatusOK;
|
context_header[offset++] = context->crcStatusOK;
|
||||||
|
|
||||||
/* Data tag immediately preceding PDU */
|
/* Data tag immediately preceding PDU */
|
||||||
context_header[offset++] = MAC_LTE_PAYLOAD_TAG;
|
context_header[offset++] = MAC_LTE_PAYLOAD_TAG;
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* PCAP Header */
|
/* PCAP Header */
|
||||||
/* TODO: Timestamp might want to be relative to a more sensible
|
/* TODO: Timestamp might want to be relative to a more sensible
|
||||||
@@ -404,13 +379,11 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
|||||||
packet_header.ts_usec = (context->subframesSinceCaptureStart % 1000) * 1000;
|
packet_header.ts_usec = (context->subframesSinceCaptureStart % 1000) * 1000;
|
||||||
packet_header.incl_len = offset + length;
|
packet_header.incl_len = offset + length;
|
||||||
packet_header.orig_len = offset + length;
|
packet_header.orig_len = offset + length;
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* Now write everything to the file */
|
/* Now write everything to the file */
|
||||||
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, file_fd);
|
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, file_fd);
|
||||||
fwrite(context_header, 1, offset, file_fd);
|
fwrite(context_header, 1, offset, file_fd);
|
||||||
fwrite(PDU, 1, length, file_fd);
|
fwrite(PDU, 1, length, file_fd);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#include <common/ran_context.h>
|
#include <common/ran_context.h>
|
||||||
@@ -419,117 +392,129 @@ extern RAN_CONTEXT_t RC;
|
|||||||
/* Remote serveraddress (where Wireshark is running) */
|
/* Remote serveraddress (where Wireshark is running) */
|
||||||
void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||||
int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
|
int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
|
||||||
int oob_event_value)
|
int oob_event_value) {
|
||||||
{
|
|
||||||
MAC_Context_Info_t pdu_context;
|
MAC_Context_Info_t pdu_context;
|
||||||
int radioType=FDD_RADIO;
|
int radioType=FDD_RADIO;
|
||||||
|
|
||||||
if (RC.eNB[0][0]!=NULL)
|
if (RC.eNB[0][0]!=NULL)
|
||||||
radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
||||||
|
|
||||||
if (PHY_vars_UE_g[0][0] != NULL)
|
if (PHY_vars_UE_g[0][0] != NULL)
|
||||||
radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
|
||||||
|
|
||||||
switch (opt_type) {
|
switch (opt_type) {
|
||||||
case OPT_WIRESHARK :
|
case OPT_WIRESHARK :
|
||||||
if (g_socksd == -1) {
|
if (g_socksd == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendFrame( radioType,
|
SendFrame( radioType,
|
||||||
(direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
|
(direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
|
||||||
rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
|
rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
|
||||||
1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
|
1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
|
||||||
oob_event,oob_event_value,
|
oob_event,oob_event_value,
|
||||||
pdu_buffer, pdu_buffer_size);
|
pdu_buffer, pdu_buffer_size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_PCAP:
|
case OPT_PCAP:
|
||||||
if (file_fd == NULL) {
|
if (file_fd == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdu_context.radioType = radioType;
|
pdu_context.radioType = radioType;
|
||||||
pdu_context.direction = (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK
|
pdu_context.direction = (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK
|
||||||
: DIRECTION_UPLINK;
|
: DIRECTION_UPLINK;
|
||||||
pdu_context.rntiType = rntiType;
|
pdu_context.rntiType = rntiType;
|
||||||
pdu_context.rnti = rnti;
|
pdu_context.rnti = rnti;
|
||||||
pdu_context.ueid = ueid;
|
pdu_context.ueid = ueid;
|
||||||
pdu_context.isRetx = 0;
|
pdu_context.isRetx = 0;
|
||||||
pdu_context.crcStatusOK =1;
|
pdu_context.crcStatusOK =1;
|
||||||
pdu_context.sysFrameNumber = sysFrameNumber;
|
pdu_context.sysFrameNumber = sysFrameNumber;
|
||||||
pdu_context.subFrameNumber = subFrameNumber;
|
pdu_context.subFrameNumber = subFrameNumber;
|
||||||
pdu_context.subframesSinceCaptureStart = subframesSinceCaptureStart++;
|
pdu_context.subframesSinceCaptureStart = subframesSinceCaptureStart++;
|
||||||
MAC_LTE_PCAP_WritePDU( &pdu_context, pdu_buffer, pdu_buffer_size);
|
MAC_LTE_PCAP_WritePDU( &pdu_context, pdu_buffer, pdu_buffer_size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_TSHARK:
|
case OPT_TSHARK:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------*/
|
/*---------------------------------------------------*/
|
||||||
int init_opt(char *path, char *ip)
|
int init_opt(void) {
|
||||||
{
|
char *in_type=NULL;
|
||||||
|
paramdef_t opt_params[] = OPT_PARAMS_DESC ;
|
||||||
|
checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC;
|
||||||
uint16_t in_port;
|
uint16_t in_port;
|
||||||
|
config_set_checkfunctions(opt_params, opt_checkParams,
|
||||||
|
sizeof(opt_params)/sizeof(paramdef_t));
|
||||||
|
config_get( opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
|
||||||
subframesSinceCaptureStart = 0;
|
subframesSinceCaptureStart = 0;
|
||||||
|
int tmptype = config_get_processedint( &(opt_params[OPTTYPE_IDX]));
|
||||||
|
|
||||||
if (path != NULL) {
|
if (tmptype == OPT_NONE) {
|
||||||
strncpy( in_path, path, sizeof(in_path) );
|
opt_enabled=0;
|
||||||
in_path[sizeof(in_path) - 1] = 0; // terminate string
|
LOG_I(OPT,"OPT disabled\n");
|
||||||
|
return 0;
|
||||||
|
} else if (tmptype == OPT_PCAP && strlen(in_path) > 0) {
|
||||||
|
opt_type = OPT_PCAP;
|
||||||
|
opt_enabled=1;
|
||||||
|
LOG_I(OPT,"Enabling OPT for PCAP with the following file %s \n",in_path);
|
||||||
|
} else if (tmptype == OPT_WIRESHARK && strlen(in_ip) > 0) {
|
||||||
|
opt_enabled=1;
|
||||||
|
opt_type = OPT_WIRESHARK;
|
||||||
|
LOG_I(OPT,"Enabling OPT for wireshark for local interface %s\n",in_ip);
|
||||||
} else {
|
} else {
|
||||||
strcpy( in_path, "/tmp/opt.pcap" );
|
LOG_E(OPT,"Invalid OPT configuration\n");
|
||||||
}
|
config_printhelp(opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
|
||||||
|
|
||||||
if (ip != NULL) {
|
|
||||||
strncpy( in_ip, ip, sizeof(in_ip) );
|
|
||||||
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
|
|
||||||
} else {
|
|
||||||
strcpy( in_ip, "127.0.0.1" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
in_port = PACKET_MAC_LTE_DEFAULT_UDP_PORT;
|
in_port = PACKET_MAC_LTE_DEFAULT_UDP_PORT;
|
||||||
|
|
||||||
// trace_mode
|
// trace_mode
|
||||||
switch (opt_type) {
|
switch (opt_type) {
|
||||||
case OPT_WIRESHARK:
|
case OPT_WIRESHARK:
|
||||||
|
|
||||||
/* Create local server socket only if using localhost address */
|
/* Create local server socket only if using localhost address */
|
||||||
if (strcmp(in_ip, "127.0.0.1") == 0) {
|
if (strcmp(in_ip, "127.0.0.1") == 0) {
|
||||||
opt_create_listener_socket(in_ip, in_port);
|
opt_create_listener_socket(in_ip, in_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_socksd = socket(AF_INET, SOCK_DGRAM, 0);
|
g_socksd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
if (g_socksd == -1) {
|
if (g_socksd == -1) {
|
||||||
LOG_E(OPT, "Error trying to create socket (errno=%d)\n", errno);
|
LOG_E(OPT, "Error trying to create socket (errno=%d)\n", errno);
|
||||||
LOG_E(OPT, "CREATING SOCKET FAILED\n");
|
LOG_E(OPT, "CREATING SOCKET FAILED\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get remote IP address from the function argument */
|
/* Get remote IP address from the function argument */
|
||||||
g_serv_addr.sin_family = AF_INET;
|
g_serv_addr.sin_family = AF_INET;
|
||||||
g_serv_addr.sin_port = htons(in_port);
|
g_serv_addr.sin_port = htons(in_port);
|
||||||
g_serv_addr.sin_addr.s_addr = inet_addr(in_ip);
|
g_serv_addr.sin_addr.s_addr = inet_addr(in_ip);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_PCAP:
|
case OPT_PCAP:
|
||||||
file_fd = fopen(in_path, "w");
|
file_fd = fopen(in_path, "w");
|
||||||
|
|
||||||
if (file_fd == NULL) {
|
if (file_fd == NULL) {
|
||||||
LOG_D(OPT, "Failed to open file \"%s\" for writing\n", in_path);
|
LOG_D(OPT, "Failed to open file \"%s\" for writing\n", in_path);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
/* Write the file header */
|
|
||||||
fwrite(&file_header, sizeof(pcap_hdr_t), 1, file_fd);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OPT_TSHARK:
|
/* Write the file header */
|
||||||
LOG_W(OPT, "Tshark is currently not supported\n");
|
fwrite(&file_header, sizeof(pcap_hdr_t), 1, file_fd);
|
||||||
opt_type = OPT_NONE;
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
case OPT_TSHARK:
|
||||||
opt_type = OPT_NONE;
|
LOG_W(OPT, "Tshark is currently not supported\n");
|
||||||
LOG_W(OPT, "supported Option\n");
|
opt_type = OPT_NONE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
opt_type = OPT_NONE;
|
||||||
|
LOG_W(OPT, "supported Option\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( opt_type == OPT_WIRESHARK )
|
if ( opt_type == OPT_WIRESHARK )
|
||||||
@@ -543,8 +528,7 @@ int init_opt(char *path, char *ip)
|
|||||||
// memset(mac_info, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
|
// memset(mac_info, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
void terminate_opt(void)
|
void terminate_opt(void) {
|
||||||
{
|
|
||||||
/* Close local socket */
|
/* Close local socket */
|
||||||
// free(mac_info);
|
// free(mac_info);
|
||||||
if (opt_type != OPT_NONE) {
|
if (opt_type != OPT_NONE) {
|
||||||
@@ -552,18 +536,18 @@ void terminate_opt(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (opt_type) {
|
switch (opt_type) {
|
||||||
case OPT_WIRESHARK:
|
case OPT_WIRESHARK:
|
||||||
close(g_socksd);
|
close(g_socksd);
|
||||||
g_socksd = -1;
|
g_socksd = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_PCAP:
|
case OPT_PCAP:
|
||||||
fclose (file_fd);
|
fclose (file_fd);
|
||||||
file_fd = NULL;
|
file_fd = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,67 +39,58 @@ char *parallel_config=NULL;
|
|||||||
char *worker_config=NULL;
|
char *worker_config=NULL;
|
||||||
|
|
||||||
uint64_t get_softmodem_optmask(void) {
|
uint64_t get_softmodem_optmask(void) {
|
||||||
return softmodem_params.optmask;
|
return softmodem_params.optmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t set_softmodem_optmask(uint64_t bitmask) {
|
uint64_t set_softmodem_optmask(uint64_t bitmask) {
|
||||||
softmodem_params.optmask = softmodem_params.optmask | bitmask;
|
softmodem_params.optmask = softmodem_params.optmask | bitmask;
|
||||||
return softmodem_params.optmask;
|
return softmodem_params.optmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
softmodem_params_t* get_softmodem_params(void) {
|
softmodem_params_t *get_softmodem_params(void) {
|
||||||
return &softmodem_params;
|
return &softmodem_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_common_options(void)
|
void get_common_options(void) {
|
||||||
{
|
uint32_t online_log_messages;
|
||||||
|
uint32_t glog_level ;
|
||||||
|
uint32_t start_telnetsrv;
|
||||||
uint32_t online_log_messages;
|
uint32_t noS1;
|
||||||
uint32_t glog_level ;
|
uint32_t nokrnmod;
|
||||||
uint32_t start_telnetsrv;
|
uint32_t nonbiot;
|
||||||
uint32_t noS1;
|
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
|
||||||
uint32_t nokrnmod;
|
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
|
||||||
uint32_t nonbiot;
|
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
|
||||||
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
|
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||||
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
|
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
|
||||||
|
sizeof(cmdline_logparams)/sizeof(paramdef_t));
|
||||||
|
config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
|
||||||
|
|
||||||
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
|
||||||
|
|
||||||
if (strlen(in_path) > 0) {
|
|
||||||
opt_type = OPT_PCAP;
|
|
||||||
opt_enabled=1;
|
|
||||||
printf("Enabling OPT for PCAP with the following file %s \n",in_path);
|
|
||||||
}
|
|
||||||
if (strlen(in_ip) > 0) {
|
|
||||||
opt_enabled=1;
|
|
||||||
opt_type = OPT_WIRESHARK;
|
|
||||||
printf("Enabling OPT for wireshark for local interface");
|
|
||||||
}
|
|
||||||
|
|
||||||
config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
|
|
||||||
|
|
||||||
if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
|
if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
|
||||||
set_glog_onlinelog(online_log_messages);
|
set_glog_onlinelog(online_log_messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
|
if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
|
||||||
set_glog(glog_level);
|
set_glog(glog_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start_telnetsrv) {
|
if (start_telnetsrv) {
|
||||||
load_module_shlib("telnetsrv",NULL,0,NULL);
|
load_module_shlib("telnetsrv",NULL,0,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noS1) {
|
if (noS1) {
|
||||||
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
|
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nokrnmod) {
|
if (nokrnmod) {
|
||||||
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
|
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonbiot) {
|
if (nonbiot) {
|
||||||
set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
|
set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
||||||
|
|
||||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,9 +305,6 @@ void exit_function(const char *file, const char *function, const int line, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
sleep(1); //allow lte-softmodem threads to exit first
|
sleep(1); //allow lte-softmodem threads to exit first
|
||||||
#if defined(ENABLE_ITTI)
|
|
||||||
itti_terminate_tasks (TASK_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +446,7 @@ static void get_options(void) {
|
|||||||
NB_eNB_INST = RC.nb_inst;
|
NB_eNB_INST = RC.nb_inst;
|
||||||
printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,RC.nb_RU);
|
printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,RC.nb_RU);
|
||||||
|
|
||||||
if (!SOFTMODEM_NONBIOT) {
|
if (!IS_SOFTMODEM_NONBIOT) {
|
||||||
load_NB_IoT();
|
load_NB_IoT();
|
||||||
printf(" nb_nbiot_rrc_inst %d, nb_nbiot_L1_inst %d, nb_nbiot_macrlc_inst %d\n",
|
printf(" nb_nbiot_rrc_inst %d, nb_nbiot_L1_inst %d, nb_nbiot_macrlc_inst %d\n",
|
||||||
RC.nb_nb_iot_rrc_inst, RC.nb_nb_iot_L1_inst, RC.nb_nb_iot_macrlc_inst);
|
RC.nb_nb_iot_rrc_inst, RC.nb_nb_iot_L1_inst, RC.nb_nb_iot_macrlc_inst);
|
||||||
@@ -505,7 +502,8 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wait_RUs(void) {
|
void wait_RUs(void) {
|
||||||
LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask);
|
/* do not modify the following LOG_UI message, which is used by CI */
|
||||||
|
LOG_UI(ENB_APP,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask);
|
||||||
// wait for all RUs to be configured over fronthaul
|
// wait for all RUs to be configured over fronthaul
|
||||||
pthread_mutex_lock(&RC.ru_mutex);
|
pthread_mutex_lock(&RC.ru_mutex);
|
||||||
|
|
||||||
@@ -678,7 +676,6 @@ int main( int argc, char **argv ) {
|
|||||||
set_latency_target();
|
set_latency_target();
|
||||||
logInit();
|
logInit();
|
||||||
printf("Reading in command-line options\n");
|
printf("Reading in command-line options\n");
|
||||||
CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
|
|
||||||
get_options ();
|
get_options ();
|
||||||
|
|
||||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
||||||
@@ -689,14 +686,6 @@ int main( int argc, char **argv ) {
|
|||||||
#if T_TRACER
|
#if T_TRACER
|
||||||
T_Config_Init();
|
T_Config_Init();
|
||||||
#endif
|
#endif
|
||||||
ret=config_check_unknown_cmdlineopt(NULL);
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
LOG_E(ENB_APP, "%i unknown options in command line\n",ret);
|
|
||||||
exit_fun("");
|
|
||||||
}
|
|
||||||
|
|
||||||
CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT);
|
|
||||||
//randominit (0);
|
//randominit (0);
|
||||||
set_taus_seed (0);
|
set_taus_seed (0);
|
||||||
printf("configuring for RAU/RRU\n");
|
printf("configuring for RAU/RRU\n");
|
||||||
@@ -717,12 +706,7 @@ int main( int argc, char **argv ) {
|
|||||||
|
|
||||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
init_opt();
|
||||||
if (opt_type != OPT_NONE) {
|
|
||||||
if (init_opt(in_path, in_ip) == -1)
|
|
||||||
LOG_E(OPT,"failed to run OPT \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PDCP_USE_NETLINK
|
#ifdef PDCP_USE_NETLINK
|
||||||
printf("PDCP netlink\n");
|
printf("PDCP netlink\n");
|
||||||
netlink_init();
|
netlink_init();
|
||||||
@@ -947,13 +931,7 @@ if (nfapi_mode==2) {// VNF
|
|||||||
sync_var=0;
|
sync_var=0;
|
||||||
pthread_cond_broadcast(&sync_cond);
|
pthread_cond_broadcast(&sync_cond);
|
||||||
pthread_mutex_unlock(&sync_mutex);
|
pthread_mutex_unlock(&sync_mutex);
|
||||||
ret=config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
LOG_E(ENB_APP, "%i unknown options in command line (invalid section name)\n",ret);
|
|
||||||
exit_fun("");
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for end of program
|
// wait for end of program
|
||||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||||
//getchar();
|
//getchar();
|
||||||
@@ -1008,9 +986,7 @@ if (nfapi_mode==2) {// VNF
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_lte_top();
|
free_lte_top();
|
||||||
printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
|
|
||||||
end_configmodule();
|
end_configmodule();
|
||||||
printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
|
|
||||||
pthread_cond_destroy(&sync_cond);
|
pthread_cond_destroy(&sync_cond);
|
||||||
pthread_mutex_destroy(&sync_mutex);
|
pthread_mutex_destroy(&sync_mutex);
|
||||||
pthread_cond_destroy(&nfapi_sync_cond);
|
pthread_cond_destroy(&nfapi_sync_cond);
|
||||||
@@ -1029,9 +1005,7 @@ if (nfapi_mode==2) {// VNF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_enabled == 1)
|
terminate_opt();
|
||||||
terminate_opt();
|
|
||||||
|
|
||||||
logClean();
|
logClean();
|
||||||
printf("Bye.\n");
|
printf("Bye.\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+115
-113
@@ -35,12 +35,12 @@
|
|||||||
#include "flexran_agent.h"
|
#include "flexran_agent.h"
|
||||||
|
|
||||||
#if defined(ENABLE_ITTI)
|
#if defined(ENABLE_ITTI)
|
||||||
#if defined(ENABLE_USE_MME)
|
#if defined(ENABLE_USE_MME)
|
||||||
#include "s1ap_eNB.h"
|
#include "s1ap_eNB.h"
|
||||||
#ifdef PDCP_USE_NETLINK
|
#ifdef PDCP_USE_NETLINK
|
||||||
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
|
/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
|
||||||
@@ -60,14 +60,14 @@
|
|||||||
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
|
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
|
||||||
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
|
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
|
||||||
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\n"
|
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\n"
|
||||||
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
|
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
|
||||||
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
|
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
|
||||||
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
|
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
|
||||||
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
|
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
|
||||||
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
|
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
|
||||||
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
|
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
|
||||||
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
|
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
|
||||||
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
|
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
|
||||||
#define CONFIG_HLP_TADV "Set timing_advance\n"
|
#define CONFIG_HLP_TADV "Set timing_advance\n"
|
||||||
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
|
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
|
||||||
#define CONFIG_HLP_CHOFF "Channel id offset\n"
|
#define CONFIG_HLP_CHOFF "Channel id offset\n"
|
||||||
@@ -76,16 +76,14 @@
|
|||||||
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
|
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
|
||||||
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
|
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
|
||||||
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
|
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
|
||||||
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
|
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
|
||||||
#define CONFIG_HLP_EMULIFACE "Set the interface name for the multicast transport for emulation mode (e.g. eth0, lo, etc.) \n"
|
#define CONFIG_HLP_EMULIFACE "Set the interface name for the multicast transport for emulation mode (e.g. eth0, lo, etc.) \n"
|
||||||
//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
|
//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
|
||||||
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
|
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
|
||||||
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
|
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
|
||||||
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
|
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
|
||||||
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
|
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
|
||||||
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
|
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
|
||||||
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
|
|
||||||
#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
|
|
||||||
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
|
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
|
||||||
#define CONFIG_HLP_TPORT "tracer port\n"
|
#define CONFIG_HLP_TPORT "tracer port\n"
|
||||||
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
|
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
|
||||||
@@ -103,7 +101,7 @@
|
|||||||
#define CONFIG_HLP_USRP_CLK_SRC "USRP clock source: 'internal' or 'external'\n"
|
#define CONFIG_HLP_USRP_CLK_SRC "USRP clock source: 'internal' or 'external'\n"
|
||||||
|
|
||||||
/***************************************************************************************************************************************/
|
/***************************************************************************************************************************************/
|
||||||
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
|
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
|
||||||
when calling config_get or config_getlist functions */
|
when calling config_get or config_getlist functions */
|
||||||
|
|
||||||
|
|
||||||
@@ -112,15 +110,15 @@
|
|||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
#define CMDLINE_UEMODEPARAMS_DESC { \
|
#define CMDLINE_UEMODEPARAMS_DESC { \
|
||||||
{"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
{"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||||
{"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
{"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||||
{"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
{"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||||
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||||
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||||
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||||
{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
|
{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
|
||||||
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
|
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
|
||||||
}
|
}
|
||||||
#define CMDLINE_CALIBUERX_IDX 0
|
#define CMDLINE_CALIBUERX_IDX 0
|
||||||
#define CMDLINE_CALIBUERXMED_IDX 1
|
#define CMDLINE_CALIBUERXMED_IDX 1
|
||||||
#define CMDLINE_CALIBUERXBYP_IDX 2
|
#define CMDLINE_CALIBUERXBYP_IDX 2
|
||||||
@@ -138,42 +136,42 @@
|
|||||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define CMDLINE_UEPARAMS_DESC { \
|
#define CMDLINE_UEPARAMS_DESC { \
|
||||||
{"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \
|
{"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \
|
||||||
{"U", CONFIG_HLP_NUMUE, 0, u8ptr:&NB_UE_INST, defuintval:1, TYPE_UINT, 0}, \
|
{"U", CONFIG_HLP_NUMUE, 0, u8ptr:&NB_UE_INST, defuintval:1, TYPE_UINT, 0}, \
|
||||||
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \
|
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \
|
||||||
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||||
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
|
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
|
||||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
|
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
|
||||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
||||||
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \
|
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \
|
||||||
{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
|
{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
|
||||||
{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \
|
{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \
|
||||||
{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \
|
{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \
|
||||||
{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
|
{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
|
||||||
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
|
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
|
||||||
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
||||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
|
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
|
||||||
{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0}, \
|
{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0}, \
|
||||||
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
|
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
|
||||||
{"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \
|
{"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \
|
||||||
{"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \
|
{"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \
|
||||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||||
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
|
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
/* command line parameters specific to UE threads */
|
/* command line parameters specific to UE threads */
|
||||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
#define CMDLINE_UETHREADSPARAMS_DESC { \
|
#define CMDLINE_UETHREADSPARAMS_DESC { \
|
||||||
{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
|
{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
|
||||||
{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
|
{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
|
||||||
{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
|
{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
|
||||||
{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
|
{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
|
||||||
{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
|
{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
|
||||||
{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
|
{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFAULT_DLF 2680000000
|
#define DEFAULT_DLF 2680000000
|
||||||
|
|
||||||
@@ -192,28 +190,26 @@
|
|||||||
#define CLOCK_SOURCE softmodem_params.clock_source
|
#define CLOCK_SOURCE softmodem_params.clock_source
|
||||||
#define USIM_TEST softmodem_params.usim_test
|
#define USIM_TEST softmodem_params.usim_test
|
||||||
#define CMDLINE_PARAMS_DESC { \
|
#define CMDLINE_PARAMS_DESC { \
|
||||||
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)}, \
|
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)}, \
|
||||||
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
|
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
|
||||||
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
|
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
|
||||||
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
|
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
|
||||||
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
|
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
|
||||||
{"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
{"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
||||||
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
|
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
|
||||||
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
|
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
|
||||||
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
|
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
|
||||||
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
|
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
|
||||||
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&DO_FORMS, defintval:0, TYPE_INT8, 0}, \
|
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&DO_FORMS, defintval:0, TYPE_INT8, 0}, \
|
||||||
{"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \
|
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
|
||||||
{"P" , CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \
|
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
|
||||||
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
|
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \
|
||||||
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
|
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
|
||||||
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \
|
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
|
||||||
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
|
{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
|
||||||
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
|
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
|
||||||
{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
|
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
|
||||||
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
|
}
|
||||||
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CONFIG_HLP_FLOG "Enable online log \n"
|
#define CONFIG_HLP_FLOG "Enable online log \n"
|
||||||
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
|
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
|
||||||
@@ -225,17 +221,23 @@
|
|||||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
#define START_MSC softmodem_params.start_msc
|
#define START_MSC softmodem_params.start_msc
|
||||||
#define CMDLINE_LOGPARAMS_DESC { \
|
#define CMDLINE_LOGPARAMS_DESC { \
|
||||||
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
|
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
|
||||||
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
|
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
|
||||||
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
|
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
|
||||||
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
|
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
|
||||||
}
|
}
|
||||||
#define CMDLINE_ONLINELOG_IDX 0
|
#define CMDLINE_ONLINELOG_IDX 0
|
||||||
#define CMDLINE_GLOGLEVEL_IDX 1
|
#define CMDLINE_GLOGLEVEL_IDX 1
|
||||||
#define CMDLINE_STARTTELN_IDX 2
|
#define CMDLINE_STARTTELN_IDX 2
|
||||||
|
|
||||||
|
/* check function for global log level */
|
||||||
/***************************************************************************************************************************************/
|
#define CMDLINE_LOGPARAMS_CHECK_DESC { \
|
||||||
|
{ .s5= {NULL }} , \
|
||||||
|
{ .s2= { config_check_intrange, {0,4}}}, \
|
||||||
|
{ .s5= {NULL }} , \
|
||||||
|
{ .s5= {NULL }} , \
|
||||||
|
}
|
||||||
|
/***************************************************************************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
#include "threads_t.h"
|
#include "threads_t.h"
|
||||||
|
|
||||||
@@ -243,30 +245,29 @@
|
|||||||
#define SOFTMODEM_NOKRNMOD_BIT (1<<1)
|
#define SOFTMODEM_NOKRNMOD_BIT (1<<1)
|
||||||
#define SOFTMODEM_NONBIOT_BIT (1<<2)
|
#define SOFTMODEM_NONBIOT_BIT (1<<2)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t optmask;
|
uint64_t optmask;
|
||||||
THREAD_STRUCT thread_struct;
|
THREAD_STRUCT thread_struct;
|
||||||
char rf_config_file[1024];
|
char rf_config_file[1024];
|
||||||
int phy_test;
|
int phy_test;
|
||||||
uint8_t usim_test;
|
uint8_t usim_test;
|
||||||
int emulate_rf;
|
int emulate_rf;
|
||||||
int wait_for_sync; //eNodeB only
|
int wait_for_sync; //eNodeB only
|
||||||
int single_thread_flag; //eNodeB only
|
int single_thread_flag; //eNodeB only
|
||||||
int chain_offset;
|
int chain_offset;
|
||||||
uint32_t do_forms;
|
uint32_t do_forms;
|
||||||
int numerology;
|
int numerology;
|
||||||
unsigned int start_msc;
|
unsigned int start_msc;
|
||||||
int nonbiotflag;
|
uint32_t clock_source;
|
||||||
uint32_t clock_source;
|
int hw_timing_advance;
|
||||||
int hw_timing_advance;
|
|
||||||
} softmodem_params_t;
|
} softmodem_params_t;
|
||||||
|
|
||||||
#define SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
|
#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
|
||||||
#define SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
|
#define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
|
||||||
#define SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
|
#define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
|
||||||
extern uint64_t get_softmodem_optmask(void);
|
extern uint64_t get_softmodem_optmask(void);
|
||||||
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
|
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
|
||||||
extern void get_common_options(void);
|
extern void get_common_options(void);
|
||||||
extern softmodem_params_t* get_softmodem_params(void);
|
extern softmodem_params_t *get_softmodem_params(void);
|
||||||
|
|
||||||
uint64_t get_pdcp_optmask(void);
|
uint64_t get_pdcp_optmask(void);
|
||||||
extern pthread_cond_t sync_cond;
|
extern pthread_cond_t sync_cond;
|
||||||
@@ -292,8 +293,8 @@ extern int transmission_mode;
|
|||||||
extern double cpuf;
|
extern double cpuf;
|
||||||
|
|
||||||
#if defined(ENABLE_ITTI)
|
#if defined(ENABLE_ITTI)
|
||||||
extern volatile int start_eNB;
|
extern volatile int start_eNB;
|
||||||
extern volatile int start_UE;
|
extern volatile int start_UE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -305,7 +306,7 @@ extern void stop_eNB(int);
|
|||||||
extern void kill_eNB_proc(int inst);
|
extern void kill_eNB_proc(int inst);
|
||||||
|
|
||||||
// In lte-ru.c
|
// In lte-ru.c
|
||||||
extern void init_RU(char*);
|
extern void init_RU(char *);
|
||||||
extern void stop_ru(RU_t *ru);
|
extern void stop_ru(RU_t *ru);
|
||||||
extern void init_ru_vnf(void);
|
extern void init_ru_vnf(void);
|
||||||
extern void init_RU_proc(RU_t *ru);
|
extern void init_RU_proc(RU_t *ru);
|
||||||
@@ -317,8 +318,9 @@ extern void set_function_spec_param(RU_t *ru);
|
|||||||
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||||
extern void fill_ue_band_info(void);
|
extern void fill_ue_band_info(void);
|
||||||
|
|
||||||
extern void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax, LTE_DL_FRAME_PARMS *fp);
|
extern void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,
|
||||||
extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char * name);
|
LTE_DL_FRAME_PARMS *fp);
|
||||||
|
extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char *name);
|
||||||
|
|
||||||
extern void reset_opp_meas(void);
|
extern void reset_opp_meas(void);
|
||||||
extern void print_opp_meas(void);
|
extern void print_opp_meas(void);
|
||||||
@@ -333,7 +335,7 @@ extern void RCConfig_sim(void);
|
|||||||
extern void init_ocm(double,double);
|
extern void init_ocm(double,double);
|
||||||
extern void init_ue_devices(PHY_VARS_UE *);
|
extern void init_ue_devices(PHY_VARS_UE *);
|
||||||
|
|
||||||
PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
uint8_t UE_id,
|
uint8_t UE_id,
|
||||||
uint8_t abstraction_flag);
|
uint8_t abstraction_flag);
|
||||||
void init_eNB_afterRU(void);
|
void init_eNB_afterRU(void);
|
||||||
@@ -348,8 +350,8 @@ extern int restart_L1L2(module_id_t enb_id);
|
|||||||
|
|
||||||
extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface);
|
extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface);
|
||||||
|
|
||||||
extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
uint8_t UE_id,
|
uint8_t UE_id,
|
||||||
uint8_t abstraction_flag);
|
uint8_t abstraction_flag);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -456,7 +456,6 @@ static void get_options(void) {
|
|||||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||||
/* unknown parameters on command line will be checked in main
|
/* unknown parameters on command line will be checked in main
|
||||||
after all init have been performed */
|
after all init have been performed */
|
||||||
CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
|
|
||||||
get_common_options();
|
get_common_options();
|
||||||
get_uethreads_params();
|
get_uethreads_params();
|
||||||
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
|
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
|
||||||
@@ -754,7 +753,6 @@ int main( int argc, char **argv ) {
|
|||||||
|
|
||||||
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
|
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
|
||||||
|
|
||||||
CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
|
|
||||||
get_options ();
|
get_options ();
|
||||||
printf("Running with %d UE instances\n",NB_UE_INST);
|
printf("Running with %d UE instances\n",NB_UE_INST);
|
||||||
|
|
||||||
@@ -791,7 +789,6 @@ int main( int argc, char **argv ) {
|
|||||||
#if T_TRACER
|
#if T_TRACER
|
||||||
T_Config_Init();
|
T_Config_Init();
|
||||||
#endif
|
#endif
|
||||||
CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT);
|
|
||||||
//randominit (0);
|
//randominit (0);
|
||||||
set_taus_seed (0);
|
set_taus_seed (0);
|
||||||
cpuf=get_cpu_freq_GHz();
|
cpuf=get_cpu_freq_GHz();
|
||||||
@@ -808,12 +805,7 @@ int main( int argc, char **argv ) {
|
|||||||
|
|
||||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
init_opt();
|
||||||
if (opt_type != OPT_NONE) {
|
|
||||||
if (init_opt(in_path, in_ip) == -1)
|
|
||||||
LOG_E(OPT,"failed to run OPT \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PDCP_USE_NETLINK
|
#ifdef PDCP_USE_NETLINK
|
||||||
printf("PDCP netlink\n");
|
printf("PDCP netlink\n");
|
||||||
netlink_init();
|
netlink_init();
|
||||||
@@ -1077,13 +1069,7 @@ int main( int argc, char **argv ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
ret=config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
LOG_E(ENB_APP, "%i unknown options in command line (invalid section name)\n",ret);
|
|
||||||
exit_fun("");
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex);
|
printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex);
|
||||||
pthread_mutex_lock(&sync_mutex);
|
pthread_mutex_lock(&sync_mutex);
|
||||||
sync_var=0;
|
sync_var=0;
|
||||||
@@ -1134,9 +1120,7 @@ int main( int argc, char **argv ) {
|
|||||||
if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func)
|
if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func)
|
||||||
PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
|
PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
|
||||||
|
|
||||||
if (opt_enabled == 1)
|
terminate_opt();
|
||||||
terminate_opt();
|
|
||||||
|
|
||||||
logClean();
|
logClean();
|
||||||
printf("Bye.\n");
|
printf("Bye.\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user