lte-softmodem-common.c 3.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

/*! \file lte-softmodem-common.c
 * \brief Top-level threads for eNodeB
 * \author Nokia BellLabs France, francois Taburet
 * \date 2012
 * \version 0.1
 * \company Eurecom
 * \email: francois.taburet@nokia-bell-labs.com
 * \note
 * \warning
 */

#include "lte-softmodem.h"
#include "UTIL/OPT/opt.h"
#include "common/config/config_userapi.h"
#include "common/utils/load_module_shlib.h"
static softmodem_params_t softmodem_params;
38 39
char *parallel_config=NULL;
char *worker_config=NULL;
40 41

uint64_t get_softmodem_optmask(void) {
42
  return softmodem_params.optmask;
43 44 45
}

uint64_t set_softmodem_optmask(uint64_t bitmask) {
46 47
  softmodem_params.optmask = softmodem_params.optmask | bitmask;
  return softmodem_params.optmask;
48 49
}

50 51
softmodem_params_t *get_softmodem_params(void) {
  return &softmodem_params;
52 53
}

54 55 56 57 58 59 60 61 62 63 64 65 66 67
void get_common_options(void) {
  uint32_t online_log_messages;
  uint32_t glog_level ;
  uint32_t start_telnetsrv;
  uint32_t noS1;
  uint32_t nokrnmod;
  uint32_t nonbiot;
  paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
  paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
  checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
  config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
  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);
68 69

  if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
70
    set_glog_onlinelog(online_log_messages);
71
  }
72

73
  if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
74
    set_glog(glog_level);
75
  }
76

77
  if (start_telnetsrv) {
78
    load_module_shlib("telnetsrv",NULL,0,NULL);
79 80 81
  }

  if (noS1) {
82
    set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
83
  }
84

85
  if (nokrnmod) {
86 87 88
    set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
  }

89
  if (nonbiot) {
90 91 92
    set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
  }

93
  if(parallel_config != NULL) set_parallel_conf(parallel_config);
94

95 96
  if(worker_config != NULL)   set_worker_conf(worker_config);
}
97 98 99 100

unsigned int is_nos1exec(char *exepath) {
  if ( strcmp( basename(exepath), "lte-softmodem-nos1") == 0)
    return 1;
101

102 103
  if ( strcmp( basename(exepath), "lte-uesoftmodem-nos1") == 0)
    return 1;
104

105 106
  return 0;
}