Merge remote-tracking branch 'origin/develop-NR_SA_F1AP_5GRECORDS-abs' into NR_UE_SA
This commit is contained in:
@@ -211,7 +211,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
||||
|
||||
while (c > 0 ) {
|
||||
char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
|
||||
|
||||
if(!oneargv) abort();
|
||||
/* first check help options, either --help, -h or --help_<section> */
|
||||
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
|
||||
char *tokctx = NULL;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
|
||||
#include "ENB_APP/enb_config.h"
|
||||
//#include "ENB_APP/enb_config.h"
|
||||
#include "flexran_agent_defs.h"
|
||||
|
||||
#include "gtpv1u.h"
|
||||
@@ -122,5 +122,5 @@ typedef struct {
|
||||
pthread_cond_t ru_cond;
|
||||
} RAN_CONTEXT_t;
|
||||
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
* 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 common/utils/lte/prach_utils.c
|
||||
* \brief utils for PRACH common to both PHY and MAC
|
||||
* \author R. Knopp
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "PHY/LTE_TRANSPORT/transport_common.h"
|
||||
|
||||
// This is table 5.7.1-4 from 36.211
|
||||
PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
|
||||
// TDD Configuration Index 0
|
||||
{ {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}},
|
||||
// TDD Configuration Index 1
|
||||
{ {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}},
|
||||
// TDD Configuration Index 2
|
||||
{ {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}},
|
||||
// TDD Configuration Index 3
|
||||
{ {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}},
|
||||
// TDD Configuration Index 4
|
||||
{ {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}},
|
||||
// TDD Configuration Index 5
|
||||
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
|
||||
// TDD Configuration Index 6
|
||||
{ {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 7
|
||||
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
|
||||
// TDD Configuration Index 8
|
||||
{ {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 9
|
||||
{ {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 10
|
||||
{ {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}},
|
||||
// TDD Configuration Index 11
|
||||
{ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 12
|
||||
{ {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}},
|
||||
{4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 13
|
||||
{ {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 14
|
||||
{ {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 15
|
||||
{ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}},
|
||||
{5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}},
|
||||
{5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}},
|
||||
{5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 16
|
||||
{ {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}},
|
||||
{5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}},
|
||||
{5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
|
||||
},
|
||||
// TDD Configuration Index 17
|
||||
{ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
|
||||
},
|
||||
// TDD Configuration Index 18
|
||||
{ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}},
|
||||
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}},
|
||||
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}}
|
||||
},
|
||||
// TDD Configuration Index 19
|
||||
{ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 20
|
||||
{ {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
|
||||
// TDD Configuration Index 21
|
||||
{ {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 22
|
||||
{ {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 23
|
||||
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 24
|
||||
{ {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 25
|
||||
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 26
|
||||
{ {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 27
|
||||
{ {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 28
|
||||
{ {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
|
||||
{5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 29
|
||||
{ {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
|
||||
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
|
||||
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
|
||||
},
|
||||
|
||||
|
||||
// TDD Configuration Index 30
|
||||
{ {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 31
|
||||
{ {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 32
|
||||
{ {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 33
|
||||
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 34
|
||||
{ {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 35
|
||||
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 36
|
||||
{ {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 37
|
||||
{ {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 38
|
||||
{ {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
|
||||
{5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 39
|
||||
{ {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
|
||||
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
|
||||
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 40
|
||||
{ {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}},
|
||||
// TDD Configuration Index 41
|
||||
{ {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 42
|
||||
{ {1,{{0,1,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 43
|
||||
{ {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 44
|
||||
{ {1,{{0,0,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 45
|
||||
{ {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 46
|
||||
{ {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 47
|
||||
{ {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type) {
|
||||
if (frame_type == FDD) // FDD
|
||||
return(prach_ConfigIndex>>4);
|
||||
else {
|
||||
if (prach_ConfigIndex < 20)
|
||||
return (0);
|
||||
|
||||
if (prach_ConfigIndex < 30)
|
||||
return (1);
|
||||
|
||||
if (prach_ConfigIndex < 40)
|
||||
return (2);
|
||||
|
||||
if (prach_ConfigIndex < 48)
|
||||
return (3);
|
||||
else
|
||||
return (4);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t get_prach_prb_offset(int frame_type,
|
||||
int tdd_config,
|
||||
int N_RB_UL,
|
||||
uint8_t prach_ConfigIndex,
|
||||
uint8_t n_ra_prboffset,
|
||||
uint8_t tdd_mapindex, uint16_t Nf) {
|
||||
uint8_t n_ra_prb;
|
||||
uint8_t f_ra,t1_ra;
|
||||
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
|
||||
uint8_t Nsp=2;
|
||||
|
||||
if (frame_type == TDD) { // TDD
|
||||
if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
|
||||
LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
|
||||
f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
|
||||
|
||||
if (prach_fmt < 4) {
|
||||
if ((f_ra&1) == 0) {
|
||||
n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
|
||||
} else {
|
||||
n_ra_prb = N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
|
||||
}
|
||||
} else {
|
||||
if ((tdd_config >2) && (tdd_config<6))
|
||||
Nsp = 2;
|
||||
|
||||
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
|
||||
|
||||
if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
|
||||
n_ra_prb = 6*f_ra;
|
||||
} else {
|
||||
n_ra_prb = N_RB_UL - 6*(f_ra+1);
|
||||
}
|
||||
}
|
||||
} else { //FDD
|
||||
n_ra_prb = n_ra_prboffset;
|
||||
}
|
||||
|
||||
return(n_ra_prb);
|
||||
}
|
||||
|
||||
int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) {
|
||||
uint8_t t0_ra;
|
||||
uint8_t t1_ra;
|
||||
uint8_t t2_ra;
|
||||
int prach_mask = 0;
|
||||
|
||||
if (frame_type == FDD) { //FDD
|
||||
//implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
|
||||
if ((((frame&1) == 1) && (subframe < 9)) ||
|
||||
(((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
|
||||
if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
|
||||
((prach_ConfigIndex&0x1f)==18) || // 18,50
|
||||
((prach_ConfigIndex&0xf)==15)) // 15,47
|
||||
return(0);
|
||||
|
||||
switch (prach_ConfigIndex&0x1f) {
|
||||
case 0:
|
||||
case 3:
|
||||
if (subframe==1) prach_mask = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 4:
|
||||
if (subframe==4) prach_mask = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 5:
|
||||
if (subframe==7) prach_mask = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if ((subframe==1) || (subframe==6)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
if ((subframe==2) || (subframe==7)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if ((subframe==3) || (subframe==8)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 11:
|
||||
if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 12:
|
||||
if ((subframe&1)==0) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 13:
|
||||
if ((subframe&1)==1) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 14:
|
||||
prach_mask=1;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
if (subframe==9) prach_mask=1;
|
||||
|
||||
break;
|
||||
}
|
||||
} else { // TDD
|
||||
AssertFatal(prach_ConfigIndex<64,
|
||||
"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
|
||||
AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
|
||||
"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
|
||||
t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
|
||||
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
|
||||
t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
|
||||
#ifdef PRACH_DEBUG
|
||||
LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
|
||||
prach_ConfigIndex,
|
||||
subframe,
|
||||
t0_ra,t1_ra,t2_ra);
|
||||
#endif
|
||||
|
||||
if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
|
||||
((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
|
||||
(t0_ra == 0)) && // PRACH is in all frames
|
||||
(((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
|
||||
(((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
|
||||
if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
|
||||
(((subframe%5)-2)==t2_ra)) prach_mask=1;
|
||||
else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
|
||||
}
|
||||
}
|
||||
|
||||
return(prach_mask);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 common/utils/prach_utils.h
|
||||
* \brief computation of some PRACH variables used in both MAC and PHY
|
||||
* \author R. Knopp
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type);
|
||||
|
||||
uint8_t get_prach_prb_offset(int frame_type,
|
||||
int tdd_config,
|
||||
int N_RB_UL,
|
||||
uint8_t prach_ConfigIndex,
|
||||
uint8_t n_ra_prboffset,
|
||||
uint8_t tdd_mapindex, uint16_t Nf);
|
||||
int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* 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 ue_power.c
|
||||
* \brief Routines to compute UE TX power according to 36.213
|
||||
* \author R. Knopp, F. Kaltenberger
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/TOOLS/dB_routines.h"
|
||||
|
||||
extern int16_t hundred_times_delta_TF[100];
|
||||
extern uint16_t hundred_times_log10_NPRB[100];
|
||||
|
||||
int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs)
|
||||
{
|
||||
|
||||
/// The payload + CRC size in bits, "B"
|
||||
uint32_t B;
|
||||
/// Number of code segments
|
||||
uint32_t C;
|
||||
/// Number of "small" code segments
|
||||
uint32_t Cminus;
|
||||
/// Number of "large" code segments
|
||||
uint32_t Cplus;
|
||||
/// Number of bits in "small" code segments (<6144)
|
||||
uint32_t Kminus;
|
||||
/// Number of bits in "large" code segments (<6144)
|
||||
uint32_t Kplus;
|
||||
/// Total number of bits across all segments
|
||||
uint32_t sumKr;
|
||||
/// Number of "Filler" bits
|
||||
uint32_t F;
|
||||
// num resource elements
|
||||
uint32_t num_re=0.0;
|
||||
// num symbols
|
||||
uint32_t num_symb=0.0;
|
||||
/// effective spectral efficiency of the PUSCH
|
||||
uint32_t MPR_x100=0;
|
||||
/// beta_offset
|
||||
uint16_t beta_offset_pusch_x8=8;
|
||||
/// delta mcs
|
||||
float delta_mcs=0.0;
|
||||
/// bandwidth factor
|
||||
float bw_factor=0.0;
|
||||
|
||||
B= tbs+24;
|
||||
lte_segmentation(NULL,
|
||||
NULL,
|
||||
B,
|
||||
&C,
|
||||
&Cplus,
|
||||
&Cminus,
|
||||
&Kplus,
|
||||
&Kminus,
|
||||
&F);
|
||||
|
||||
|
||||
sumKr = Cminus*Kminus + Cplus*Kplus;
|
||||
num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
|
||||
num_re = num_symb * nb_rb * 12;
|
||||
|
||||
if (num_re == 0)
|
||||
return(0);
|
||||
|
||||
MPR_x100 = 100*sumKr/num_re;
|
||||
|
||||
if (control_only == 1 )
|
||||
beta_offset_pusch_x8=8; // fixme
|
||||
|
||||
//(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
|
||||
|
||||
// if deltamcs_enabledm
|
||||
delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
|
||||
|
||||
bw_factor = (norm!=0) ? 0 : (hundred_times_log10_NPRB[nb_rb-1]/100.0);
|
||||
LOG_D(PHY,"estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
|
||||
(int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
|
||||
return (int16_t)ceil(delta_mcs + bw_factor);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 ue_power.h
|
||||
* \brief support routines used in MAC and PHY
|
||||
* \author R. Knopp, F. Kaltenberger
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
|
||||
|
||||
@@ -136,7 +136,7 @@ extern "C" {
|
||||
LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
|
||||
|
||||
if ( s > 50 )
|
||||
LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1);
|
||||
LOG_I(TMR,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message));
|
||||
|
||||
t->message_queue.insert(t->message_queue.begin(), message);
|
||||
eventfd_t sem_counter = 1;
|
||||
|
||||
+73
-16
@@ -96,6 +96,54 @@ static void read_pipe(int p, char *b, int size) {
|
||||
}
|
||||
}
|
||||
|
||||
static int baseRunTimeCommand(char* cmd, size_t cmdSize) {
|
||||
FILE *fp;
|
||||
size_t retSize = 0;
|
||||
|
||||
fp = popen(cmd, "r");
|
||||
if(fp) {
|
||||
memset(cmd, 0, cmdSize);
|
||||
retSize = fread(cmd, 1, cmdSize, fp);
|
||||
fclose(fp);
|
||||
} else {
|
||||
LOG_D(HW,"%s:%d:%s: Cannot open %s\n", __FILE__, __LINE__, __FUNCTION__, cmd);
|
||||
}
|
||||
|
||||
if (retSize == 0) {
|
||||
return 0;
|
||||
}
|
||||
return atoi(cmd);
|
||||
}
|
||||
|
||||
int checkIfFedoraDistribution(void) {
|
||||
char cmd[200];
|
||||
|
||||
memset(cmd, 0, 200);
|
||||
sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora || true");
|
||||
return baseRunTimeCommand(cmd, 200);
|
||||
}
|
||||
|
||||
int checkIfGenericKernelOnFedora(void) {
|
||||
char cmd[200];
|
||||
|
||||
memset(cmd, 0, 200);
|
||||
sprintf(cmd, "uname -a | grep -c rt || true");
|
||||
return (1 - baseRunTimeCommand(cmd, 200));
|
||||
}
|
||||
|
||||
int checkIfInsideContainer(void) {
|
||||
char cmd[200];
|
||||
int res = 0;
|
||||
|
||||
memset(cmd, 0, 200);
|
||||
sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods' || true");
|
||||
res = baseRunTimeCommand(cmd, 200);
|
||||
if (res > 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* background process */
|
||||
/********************************************************************/
|
||||
@@ -200,29 +248,38 @@ void start_background_system(void) {
|
||||
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){
|
||||
pthread_attr_t attr;
|
||||
int ret;
|
||||
int settingPriority = 1;
|
||||
ret=pthread_attr_init(&attr);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
if(priority<sched_get_priority_min(SCHED_OAI) || priority>sched_get_priority_max(SCHED_FIFO)) {
|
||||
LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n",
|
||||
priority,
|
||||
sched_get_priority_min(SCHED_OAI),
|
||||
sched_get_priority_max(SCHED_OAI));
|
||||
if(priority<sched_get_priority_min(SCHED_OAI))
|
||||
priority=sched_get_priority_min(SCHED_OAI);
|
||||
if(priority>sched_get_priority_max(SCHED_OAI))
|
||||
priority=sched_get_priority_max(SCHED_OAI);
|
||||
if (checkIfFedoraDistribution())
|
||||
if (checkIfGenericKernelOnFedora())
|
||||
if (checkIfInsideContainer())
|
||||
settingPriority = 0;
|
||||
|
||||
if (settingPriority) {
|
||||
ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
if(priority<sched_get_priority_min(SCHED_OAI) || priority>sched_get_priority_max(SCHED_FIFO)) {
|
||||
LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n",
|
||||
priority,
|
||||
sched_get_priority_min(SCHED_OAI),
|
||||
sched_get_priority_max(SCHED_OAI));
|
||||
if(priority<sched_get_priority_min(SCHED_OAI))
|
||||
priority=sched_get_priority_min(SCHED_OAI);
|
||||
if(priority>sched_get_priority_max(SCHED_OAI))
|
||||
priority=sched_get_priority_max(SCHED_OAI);
|
||||
}
|
||||
AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),"");
|
||||
struct sched_param sparam={0};
|
||||
sparam.sched_priority = priority;
|
||||
ret=pthread_attr_setschedparam(&attr, &sparam);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
}
|
||||
AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),"");
|
||||
struct sched_param sparam={0};
|
||||
sparam.sched_priority = priority;
|
||||
ret=pthread_attr_setschedparam(&attr, &sparam);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
|
||||
ret=pthread_create(t, &attr, func, param);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
|
||||
|
||||
@@ -58,6 +58,14 @@ void thread_top_init(char *thread_name,
|
||||
uint64_t deadline,
|
||||
uint64_t period);
|
||||
|
||||
/****************************************************
|
||||
* Functions to check system at runtime.
|
||||
****************************************************/
|
||||
|
||||
int checkIfFedoraDistribution(void);
|
||||
int checkIfGenericKernelOnFedora(void);
|
||||
int checkIfInsideContainer(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#ifndef TELNETSRV_H
|
||||
#define TELNETSRV_H
|
||||
|
||||
#include <common/ran_context.h>
|
||||
#define TELNETSRV_MODNAME "telnetsrv"
|
||||
|
||||
#define TELNET_PORT 9090
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define sizeofArray(a) (sizeof(a)/sizeof(*(a)))
|
||||
void *calloc_or_fail(size_t size);
|
||||
void *malloc_or_fail(size_t size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user