srsLTE/srsue/hdr/phy/prach.h

80 lines
2.3 KiB
C
Raw Normal View History

2019-04-26 12:27:38 -07:00
/*
* Copyright 2013-2019 Software Radio Systems Limited
2017-05-30 06:38:04 -07:00
*
2019-04-26 12:27:38 -07:00
* This file is part of srsLTE.
2017-05-30 06:38:04 -07:00
*
2019-04-26 12:27:38 -07:00
* srsLTE is free software: you can redistribute it and/or modify
2017-05-30 06:38:04 -07:00
* 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.
*
2019-04-26 12:27:38 -07:00
* srsLTE is distributed in the hope that it will be useful,
2017-05-30 06:38:04 -07:00
* 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 SRSUE_PRACH_H
#define SRSUE_PRACH_H
2017-05-30 06:38:04 -07:00
#include <string.h>
#include "srslte/srslte.h"
#include "srslte/radio/radio.h"
#include "srslte/common/log.h"
#include "srslte/interfaces/ue_interfaces.h"
2017-05-30 06:38:04 -07:00
namespace srsue {
class prach {
public:
prach() {
bzero(&prach_obj, sizeof(srslte_prach_t));
bzero(&cell, sizeof(srslte_cell_t));
bzero(&cfo_h, sizeof(srslte_cfo_t));
2019-04-23 01:53:11 -07:00
transmitted_tti = 0;
target_power_dbm = 0;
mem_initiated = false;
cell_initiated = false;
signal_buffer = NULL;
2017-05-30 06:38:04 -07:00
}
~prach();
2019-04-23 01:53:11 -07:00
void init(uint32_t max_prb, srslte::log* log_h);
void stop();
bool set_cell(srslte_cell_t cell, srslte_prach_cfg_t prach_cfg);
2017-05-30 06:38:04 -07:00
bool prepare_to_send(uint32_t preamble_idx, int allowed_subframe = -1, float target_power_dbm = -1);
bool is_ready_to_send(uint32_t current_tti);
bool is_pending();
cf_t* generate(float cfo, uint32_t *nof_sf, float *target_power = NULL);
phy_interface_mac_lte::prach_info_t get_info();
2019-04-23 01:53:11 -07:00
private:
const static int MAX_LEN_SF = 3;
2019-01-17 03:42:01 -08:00
2017-05-30 06:38:04 -07:00
srslte::log *log_h;
int preamble_idx;
int allowed_subframe;
bool mem_initiated;
bool cell_initiated;
2019-04-23 01:53:11 -07:00
uint32_t len;
cf_t* buffer[12][64];
srslte_prach_t prach_obj;
2017-05-30 06:38:04 -07:00
int transmitted_tti;
srslte_cell_t cell;
cf_t *signal_buffer;
2017-05-30 06:38:04 -07:00
srslte_cfo_t cfo_h;
float target_power_dbm;
2017-05-30 06:38:04 -07:00
};
} // namespace srsue
2018-03-31 10:04:04 -07:00
#endif // SRSUE_PRACH_H