srsLTE/srsenb/hdr/phy/prach_worker.h

107 lines
2.8 KiB
C
Raw Normal View History

2017-06-02 03:46:06 -07:00
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2017 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of srsLTE.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
2018-03-31 10:04:04 -07:00
#ifndef SRSENB_PRACH_WORKER_H
#define SRSENB_PRACH_WORKER_H
2017-06-01 03:25:57 -07:00
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/common/log.h"
#include "srslte/common/threads.h"
2018-09-19 08:37:23 -07:00
#include "srslte/common/block_queue.h"
#include "srslte/common/buffer_pool.h"
2017-06-01 03:25:57 -07:00
namespace srsenb {
2018-09-19 08:37:23 -07:00
2017-06-01 03:25:57 -07:00
class prach_worker : thread
{
public:
2018-09-19 08:37:23 -07:00
prach_worker() : initiated(false), prach_nof_det(0), max_prach_offset_us(0), buffer_pool(8),
2018-01-31 07:48:50 -08:00
running(false), nof_sf(0), sf_cnt(0) {
log_h = NULL;
mac = NULL;
bzero(&prach, sizeof(srslte_prach_t));
bzero(&prach_indices, sizeof(prach_indices));
bzero(&prach_offsets, sizeof(prach_offsets));
bzero(&prach_p2avg, sizeof(prach_p2avg));
bzero(&cell, sizeof(cell));
bzero(&prach_cfg, sizeof(prach_cfg));
}
2017-06-01 03:25:57 -07:00
int init(srslte_cell_t *cell, srslte_prach_cfg_t *prach_cfg, mac_interface_phy *mac, srslte::log *log_h, int priority);
int new_tti(uint32_t tti, cf_t *buffer);
void set_max_prach_offset_us(float delay_us);
void stop();
private:
2018-09-19 08:37:23 -07:00
uint32_t prach_nof_det;
2017-06-01 03:25:57 -07:00
uint32_t prach_indices[165];
float prach_offsets[165];
float prach_p2avg[165];
srslte_cell_t cell;
srslte_prach_cfg_t prach_cfg;
srslte_prach_t prach;
2018-09-19 08:37:23 -07:00
const static int sf_buffer_sz = 128*1024;
class sf_buffer {
public:
2019-04-23 01:53:11 -07:00
sf_buffer()
{
nof_samples = 0;
tti = 0;
}
void reset()
{
nof_samples = 0;
tti = 0;
}
cf_t samples[sf_buffer_sz];
2018-09-19 08:37:23 -07:00
uint32_t nof_samples;
uint32_t tti;
2019-04-23 01:53:11 -07:00
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN];
#endif /* SRSLTE_BUFFER_POOL_LOG_ENABLED */
2018-09-19 08:37:23 -07:00
};
srslte::buffer_pool<sf_buffer> buffer_pool;
srslte::block_queue<sf_buffer*> pending_buffers;
sf_buffer* current_buffer;
2017-06-01 03:25:57 -07:00
srslte::log* log_h;
mac_interface_phy *mac;
float max_prach_offset_us;
bool initiated;
bool running;
uint32_t nof_sf;
uint32_t sf_cnt;
2018-09-19 08:37:23 -07:00
void run_thread();
int run_tti(sf_buffer *b);
2017-06-01 03:25:57 -07:00
};
}
2018-03-31 10:04:04 -07:00
#endif // SRSENB_PRACH_WORKER_H