2014-03-03 11:09:26 -08:00
|
|
|
/**
|
2014-01-28 03:41:17 -08:00
|
|
|
*
|
2014-03-03 11:09:26 -08:00
|
|
|
* \section COPYRIGHT
|
2014-01-28 03:41:17 -08:00
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* Copyright 2013-2014 The srsLTE Developers. See the
|
2014-03-03 11:09:26 -08:00
|
|
|
* COPYRIGHT file at the top-level directory of this distribution.
|
|
|
|
*
|
|
|
|
* \section LICENSE
|
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* This file is part of the srsLTE library.
|
2014-03-03 11:09:26 -08:00
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is free software: you can redistribute it and/or modify
|
2014-03-03 11:09:26 -08:00
|
|
|
* it under the terms of the GNU Lesser General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is distributed in the hope that it will be useful,
|
2014-01-28 03:41:17 -08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
2014-03-03 11:09:26 -08:00
|
|
|
* A copy of the GNU Lesser 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/.
|
|
|
|
*
|
2014-01-28 03:41:17 -08:00
|
|
|
*/
|
|
|
|
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2014-01-28 03:41:17 -08:00
|
|
|
#ifndef _LTEBASE_
|
|
|
|
#define _LTEBASE_
|
|
|
|
|
2014-10-24 03:06:04 -07:00
|
|
|
#include <stdio.h>
|
2014-06-29 10:51:25 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2014-12-09 15:29:48 -08:00
|
|
|
#include <math.h>
|
|
|
|
|
2015-03-18 05:16:28 -07:00
|
|
|
#include "srslte/config.h"
|
2014-06-13 04:42:29 -07:00
|
|
|
|
2015-03-18 05:41:50 -07:00
|
|
|
#define SRSLTE_NSUBFRAMES_X_FRAME 10
|
|
|
|
#define SRSLTE_NSLOTS_X_FRAME (2*SRSLTE_NSUBFRAMES_X_FRAME)
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-06-17 07:32:19 -07:00
|
|
|
#define LTE_NSOFT_BITS 250368 // Soft buffer size for Category 1 UE
|
2014-06-17 03:44:42 -07:00
|
|
|
|
2015-03-18 05:41:50 -07:00
|
|
|
#define SRSLTE_MAX_PORTS 4
|
2014-06-17 02:11:41 -07:00
|
|
|
#define MAX_LAYERS 8
|
2014-06-17 07:32:19 -07:00
|
|
|
#define MAX_CODEWORDS 2
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-06-17 02:11:41 -07:00
|
|
|
#define LTE_CRC24A 0x1864CFB
|
|
|
|
#define LTE_CRC24B 0X1800063
|
2014-07-10 05:43:18 -07:00
|
|
|
#define LTE_CRC16 0x11021
|
|
|
|
#define LTE_CRC8 0x19B
|
2014-06-03 05:59:15 -07:00
|
|
|
|
2015-03-18 05:41:50 -07:00
|
|
|
typedef enum {CPNORM, CPEXT} srslte_cp_t;
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2015-02-26 09:10:44 -08:00
|
|
|
|
|
|
|
#define CRNTI_START 0x003D
|
|
|
|
#define CRNTI_END 0xFFF3
|
|
|
|
#define RARNTI_START 0x0001
|
|
|
|
#define RARNTI_END 0x003C
|
|
|
|
#define SIRNTI 0xFFFF
|
|
|
|
#define PRNTI 0xFFFE
|
|
|
|
#define MRNTI 0xFFFD
|
2014-04-17 03:28:21 -07:00
|
|
|
|
2014-12-11 15:04:21 -08:00
|
|
|
#define CELL_ID_UNKNOWN 1000
|
|
|
|
|
2014-07-10 05:43:18 -07:00
|
|
|
#define MAX_NSYMB 7
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-07-21 07:19:17 -07:00
|
|
|
#define MAX_PRB 110
|
|
|
|
#define RE_X_RB 12
|
|
|
|
|
|
|
|
#define SYMBOL_SZ_MAX 2048
|
|
|
|
|
2015-03-18 05:41:50 -07:00
|
|
|
#define SRSLTE_CPNORM_NSYMB 7
|
|
|
|
#define CPNORM_SF_NSYMB (2*SRSLTE_CPNORM_NSYMB)
|
2014-07-10 05:43:18 -07:00
|
|
|
#define CPNORM_0_LEN 160
|
|
|
|
#define CPNORM_LEN 144
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-07-10 05:43:18 -07:00
|
|
|
#define CPEXT_NSYMB 6
|
2014-08-01 17:38:47 -07:00
|
|
|
#define CPEXT_SF_NSYMB (2*CPEXT_NSYMB)
|
2014-07-10 05:43:18 -07:00
|
|
|
#define CPEXT_LEN 512
|
|
|
|
#define CPEXT_7_5_LEN 1024
|
2014-01-28 03:41:17 -08:00
|
|
|
|
|
|
|
#define CP_ISNORM(cp) (cp==CPNORM)
|
|
|
|
#define CP_ISEXT(cp) (cp==CPEXT)
|
2015-03-18 05:41:50 -07:00
|
|
|
#define CP_NSYMB(cp) (CP_ISNORM(cp)?SRSLTE_CPNORM_NSYMB:CPEXT_NSYMB)
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-12-09 15:29:48 -08:00
|
|
|
#define CP(symbol_sz, c) ((int) ceil((((float) (c)*(symbol_sz))/2048)))
|
2014-08-01 17:38:47 -07:00
|
|
|
#define CP_NORM(symbol, symbol_sz) ((symbol==0)?CP((symbol_sz),CPNORM_0_LEN):CP((symbol_sz),CPNORM_LEN))
|
|
|
|
#define CP_EXT(symbol_sz) (CP((symbol_sz),CPEXT_LEN))
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-08-01 14:26:28 -07:00
|
|
|
#define SLOT_LEN(symbol_sz) (480*((symbol_sz)/64))
|
|
|
|
#define SF_LEN(symbol_sz) (2*SLOT_LEN(symbol_sz))
|
2014-08-01 17:38:47 -07:00
|
|
|
#define SF_LEN_MAX (SF_LEN(SYMBOL_SZ_MAX))
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-10-24 03:06:04 -07:00
|
|
|
#define SLOT_LEN_PRB(nof_prb) (SLOT_LEN(lte_symbol_sz(nof_prb)))
|
|
|
|
#define SF_LEN_PRB(nof_prb) (SF_LEN(lte_symbol_sz(nof_prb)))
|
|
|
|
|
2014-08-01 14:26:28 -07:00
|
|
|
#define SLOT_LEN_RE(nof_prb, cp) (nof_prb*RE_X_RB*CP_NSYMB(cp))
|
|
|
|
#define SF_LEN_RE(nof_prb, cp) (2*SLOT_LEN_RE(nof_prb, cp))
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2015-03-17 10:26:23 -07:00
|
|
|
#define TA_OFFSET (10e-6)
|
2015-03-12 04:34:21 -07:00
|
|
|
|
2015-03-09 03:53:15 -07:00
|
|
|
#define LTE_TS 1.0/(15000.0*2048)
|
2015-03-06 04:51:02 -08:00
|
|
|
|
2014-12-06 01:16:11 -08:00
|
|
|
#define SLOT_IDX_CPNORM(symbol_idx, symbol_sz) (symbol_idx==0?0:(symbol_sz + CP(symbol_sz, CPNORM_0_LEN) + \
|
|
|
|
(symbol_idx-1)*(symbol_sz+CP(symbol_sz, CPNORM_LEN))))
|
2014-03-03 11:09:26 -08:00
|
|
|
#define SLOT_IDX_CPEXT(idx, symbol_sz) (idx*(symbol_sz+CP(symbol_sz, CPEXT_LEN)))
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2015-01-20 23:55:40 -08:00
|
|
|
#define RE_IDX(nof_prb, symbol_idx, sample_idx) ((symbol_idx)*(nof_prb)*(RE_X_RB) + sample_idx)
|
2014-06-17 03:44:42 -07:00
|
|
|
|
2014-01-28 03:41:17 -08:00
|
|
|
#define RS_VSHIFT(cell_id) (cell_id%6)
|
|
|
|
|
2014-06-17 07:32:19 -07:00
|
|
|
#define GUARD_RE(nof_prb) ((lte_symbol_sz(nof_prb)-nof_prb*RE_X_RB)/2)
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-06-27 09:36:25 -07:00
|
|
|
#define SYMBOL_HAS_REF(l, cp, nof_ports) ((l == 1 && nof_ports == 4) \
|
|
|
|
|| l == 0 \
|
|
|
|
|| l == CP_NSYMB(cp) - 3)
|
|
|
|
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-06-17 07:32:19 -07:00
|
|
|
#define NOF_LTE_BANDS 29
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2014-05-13 08:00:49 -07:00
|
|
|
#define NOF_TC_CB_SIZES 188
|
|
|
|
|
2014-12-11 17:03:32 -08:00
|
|
|
typedef _Complex float cf_t;
|
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
typedef enum SRSLTE_API { PHICH_NORM = 0, PHICH_EXT} phich_length_t;
|
|
|
|
typedef enum SRSLTE_API { R_1_6 = 0, R_1_2, R_1, R_2} phich_resources_t;
|
2014-10-17 11:16:20 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
typedef struct SRSLTE_API {
|
2014-07-01 01:48:51 -07:00
|
|
|
uint32_t nof_prb;
|
|
|
|
uint32_t nof_ports;
|
2015-03-05 09:36:15 -08:00
|
|
|
uint32_t bw_idx;
|
2014-07-01 01:48:51 -07:00
|
|
|
uint32_t id;
|
2015-03-18 05:41:50 -07:00
|
|
|
srslte_cp_t cp;
|
2014-10-17 11:16:20 -07:00
|
|
|
phich_length_t phich_length;
|
|
|
|
phich_resources_t phich_resources;
|
2015-03-18 05:41:50 -07:00
|
|
|
}srslte_cell_t;
|
2014-06-27 09:36:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
typedef enum SRSLTE_API {
|
2014-06-17 02:11:41 -07:00
|
|
|
SINGLE_ANTENNA,TX_DIVERSITY, SPATIAL_MULTIPLEX
|
2014-05-12 10:43:14 -07:00
|
|
|
} lte_mimo_type_t;
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
typedef enum SRSLTE_API {
|
2014-12-27 14:09:22 -08:00
|
|
|
LTE_BPSK = 0, LTE_QPSK = 1, LTE_QAM16 = 2, LTE_QAM64 = 3
|
2014-07-10 05:43:18 -07:00
|
|
|
} lte_mod_t;
|
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
typedef struct SRSLTE_API {
|
2014-06-17 02:11:41 -07:00
|
|
|
int id;
|
|
|
|
float fd;
|
2015-02-15 23:55:17 -08:00
|
|
|
} lte_earfcn_t;
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2015-03-11 01:52:13 -07:00
|
|
|
enum band_geographical_area {
|
2014-06-17 02:11:41 -07:00
|
|
|
ALL, NAR, APAC, EMEA, JAPAN, CALA, NA
|
2014-01-28 03:41:17 -08:00
|
|
|
};
|
|
|
|
|
2015-03-18 05:41:50 -07:00
|
|
|
SRSLTE_API bool lte_cell_isvalid(srslte_cell_t *cell);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API void lte_cell_fprint(FILE *stream,
|
2015-03-18 05:41:50 -07:00
|
|
|
srslte_cell_t *cell);
|
2014-10-24 03:06:04 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_cellid_isvalid(uint32_t cell_id);
|
2014-11-05 05:19:35 -08:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_nofprb_isvalid(uint32_t nof_prb);
|
2014-11-05 05:19:35 -08:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_sfidx_isvalid(uint32_t sf_idx);
|
2014-11-05 05:19:35 -08:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_portid_isvalid(uint32_t port_id);
|
2014-11-05 05:19:35 -08:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_N_id_2_isvalid(uint32_t N_id_2);
|
2014-07-21 07:19:17 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_N_id_1_isvalid(uint32_t N_id_1);
|
2014-07-21 07:19:17 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_symbol_sz_isvalid(uint32_t symbol_sz);
|
2014-07-21 07:19:17 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_symbol_sz(uint32_t nof_prb);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2014-07-21 07:19:17 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_sampling_freq_hz(uint32_t nof_prb);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API uint32_t lte_re_x_prb(uint32_t ns,
|
2014-07-07 11:42:10 -07:00
|
|
|
uint32_t symbol,
|
|
|
|
uint32_t nof_ports,
|
|
|
|
uint32_t nof_symbols);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API uint32_t lte_voffset(uint32_t symbol_id,
|
2014-07-07 11:42:10 -07:00
|
|
|
uint32_t cell_id,
|
|
|
|
uint32_t nof_ports);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API uint32_t lte_N_ta_new_rar(uint32_t ta);
|
2015-03-05 10:23:34 -08:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API uint32_t lte_N_ta_new(uint32_t N_ta_old,
|
2015-03-05 10:23:34 -08:00
|
|
|
uint32_t ta);
|
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_cb_size(uint32_t index);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API bool lte_cb_size_isvalid(uint32_t size);
|
2014-12-26 15:36:32 -08:00
|
|
|
|
2015-03-18 05:41:50 -07:00
|
|
|
SRSLTE_API char *lte_cp_string(srslte_cp_t cp);
|
2014-07-21 07:19:17 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API char *lte_mod_string(lte_mod_t mod);
|
2014-07-10 05:43:18 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API uint32_t lte_mod_bits_x_symbol(lte_mod_t mod);
|
2014-07-10 05:43:18 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_find_cb_index(uint32_t long_cb);
|
2014-05-13 08:00:49 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API float lte_band_fd(uint32_t earfcn);
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_band_get_fd_band(uint32_t band,
|
2014-06-29 10:51:25 -07:00
|
|
|
lte_earfcn_t *earfcn,
|
|
|
|
int earfcn_start,
|
|
|
|
int earfcn_end,
|
2014-07-07 11:42:10 -07:00
|
|
|
uint32_t max_elems);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_band_get_fd_band_all(uint32_t band,
|
2014-06-29 10:51:25 -07:00
|
|
|
lte_earfcn_t *earfcn,
|
2014-07-07 11:42:10 -07:00
|
|
|
uint32_t max_nelems);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_band_get_fd_region(enum band_geographical_area region,
|
2014-06-29 10:51:25 -07:00
|
|
|
lte_earfcn_t *earfcn,
|
2014-07-07 11:42:10 -07:00
|
|
|
uint32_t max_elems);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API int lte_str2mimotype(char *mimo_type_str,
|
2014-06-29 10:51:25 -07:00
|
|
|
lte_mimo_type_t *type);
|
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
SRSLTE_API char *lte_mimotype2str(lte_mimo_type_t type);
|
2014-01-28 03:41:17 -08:00
|
|
|
|
|
|
|
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2014-01-28 03:41:17 -08:00
|
|
|
#endif
|