2014-03-03 19:09:26 +00:00
|
|
|
/**
|
2014-01-28 11:41:17 +00:00
|
|
|
*
|
2014-03-03 19:09:26 +00:00
|
|
|
* \section COPYRIGHT
|
2014-01-28 11:41:17 +00:00
|
|
|
*
|
2014-03-03 19:09:26 +00:00
|
|
|
* Copyright 2013-2014 The libLTE Developers. See the
|
|
|
|
* COPYRIGHT file at the top-level directory of this distribution.
|
|
|
|
*
|
|
|
|
* \section LICENSE
|
|
|
|
*
|
|
|
|
* This file is part of the libLTE library.
|
|
|
|
*
|
|
|
|
* libLTE is free software: you can redistribute it and/or modify
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* libLTE is distributed in the hope that it will be useful,
|
2014-01-28 11:41:17 +00: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 19:09:26 +00: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 11:41:17 +00:00
|
|
|
*/
|
|
|
|
|
2014-03-03 19:09:26 +00:00
|
|
|
|
2014-01-28 11:41:17 +00:00
|
|
|
#ifndef _LTEBASE_
|
|
|
|
#define _LTEBASE_
|
|
|
|
|
2014-10-24 10:06:04 +00:00
|
|
|
#include <stdio.h>
|
2014-06-29 17:51:25 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2014-06-17 13:20:00 +00:00
|
|
|
#include "liblte/config.h"
|
2014-06-13 11:42:29 +00:00
|
|
|
|
2014-06-17 09:11:41 +00:00
|
|
|
#define NSUBFRAMES_X_FRAME 10
|
2014-07-10 12:43:18 +00:00
|
|
|
#define NSLOTS_X_FRAME (2*NSUBFRAMES_X_FRAME)
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-06-17 14:32:19 +00:00
|
|
|
#define LTE_NSOFT_BITS 250368 // Soft buffer size for Category 1 UE
|
2014-06-17 10:44:42 +00:00
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
#define LTE_NULL_BIT 0
|
2014-06-17 14:32:19 +00:00
|
|
|
#define LTE_NULL_SYMBOL 2
|
2014-06-17 09:11:41 +00:00
|
|
|
#define LTE_NIL_SYMBOL 2
|
2014-04-17 10:28:21 +00:00
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
#define MAX_PORTS 4
|
2014-06-17 09:11:41 +00:00
|
|
|
#define MAX_LAYERS 8
|
2014-06-17 14:32:19 +00:00
|
|
|
#define MAX_CODEWORDS 2
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-06-17 09:11:41 +00:00
|
|
|
#define LTE_CRC24A 0x1864CFB
|
|
|
|
#define LTE_CRC24B 0X1800063
|
2014-07-10 12:43:18 +00:00
|
|
|
#define LTE_CRC16 0x11021
|
|
|
|
#define LTE_CRC8 0x19B
|
2014-06-03 12:59:15 +00:00
|
|
|
|
2014-01-28 11:41:17 +00:00
|
|
|
typedef enum {CPNORM, CPEXT} lte_cp_t;
|
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
#define SIRNTI 0xFFFF
|
2014-06-17 14:32:19 +00:00
|
|
|
#define PRNTI 0xFFFE
|
|
|
|
#define MRNTI 0xFFFD
|
2014-04-17 10:28:21 +00:00
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
#define MAX_NSYMB 7
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-07-21 14:19:17 +00:00
|
|
|
#define MAX_PRB 110
|
|
|
|
#define RE_X_RB 12
|
|
|
|
|
|
|
|
#define SYMBOL_SZ_MAX 2048
|
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
#define CPNORM_NSYMB 7
|
2014-08-02 00:38:47 +00:00
|
|
|
#define CPNORM_SF_NSYMB (2*CPNORM_NSYMB)
|
2014-07-10 12:43:18 +00:00
|
|
|
#define CPNORM_0_LEN 160
|
|
|
|
#define CPNORM_LEN 144
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
#define CPEXT_NSYMB 6
|
2014-08-02 00:38:47 +00:00
|
|
|
#define CPEXT_SF_NSYMB (2*CPEXT_NSYMB)
|
2014-07-10 12:43:18 +00:00
|
|
|
#define CPEXT_LEN 512
|
|
|
|
#define CPEXT_7_5_LEN 1024
|
2014-01-28 11:41:17 +00:00
|
|
|
|
|
|
|
#define CP_ISNORM(cp) (cp==CPNORM)
|
|
|
|
#define CP_ISEXT(cp) (cp==CPEXT)
|
|
|
|
#define CP_NSYMB(cp) (CP_ISNORM(cp)?CPNORM_NSYMB:CPEXT_NSYMB)
|
|
|
|
|
2014-08-02 00:38:47 +00:00
|
|
|
#define CP(symbol_sz, c) ((c*symbol_sz)/2048)
|
|
|
|
#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 11:41:17 +00:00
|
|
|
|
2014-08-01 21:26:28 +00:00
|
|
|
#define SLOT_LEN(symbol_sz) (480*((symbol_sz)/64))
|
|
|
|
#define SF_LEN(symbol_sz) (2*SLOT_LEN(symbol_sz))
|
2014-08-02 00:38:47 +00:00
|
|
|
#define SF_LEN_MAX (SF_LEN(SYMBOL_SZ_MAX))
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-10-24 10:06:04 +00: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 21:26:28 +00: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 11:41:17 +00:00
|
|
|
|
2014-12-06 09:16:11 +00: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 19:09:26 +00:00
|
|
|
#define SLOT_IDX_CPEXT(idx, symbol_sz) (idx*(symbol_sz+CP(symbol_sz, CPEXT_LEN)))
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-12-06 09:16:11 +00:00
|
|
|
#define RE_IDX(nof_prb, symbol_idx, sample_idx) ((symbol_idx)*(nof_prb)*(RE_X_RB) + sample_idx)
|
2014-06-17 10:44:42 +00:00
|
|
|
|
2014-01-28 11:41:17 +00:00
|
|
|
#define RS_VSHIFT(cell_id) (cell_id%6)
|
|
|
|
|
2014-06-17 14:32:19 +00:00
|
|
|
#define GUARD_RE(nof_prb) ((lte_symbol_sz(nof_prb)-nof_prb*RE_X_RB)/2)
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-06-27 16:36:25 +00:00
|
|
|
#define SYMBOL_HAS_REF(l, cp, nof_ports) ((l == 1 && nof_ports == 4) \
|
|
|
|
|| l == 0 \
|
|
|
|
|| l == CP_NSYMB(cp) - 3)
|
|
|
|
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-06-17 14:32:19 +00:00
|
|
|
#define NOF_LTE_BANDS 29
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-05-13 15:00:49 +00:00
|
|
|
#define NOF_TC_CB_SIZES 188
|
|
|
|
|
2014-10-17 18:16:20 +00:00
|
|
|
typedef enum LIBLTE_API { PHICH_NORM, PHICH_EXT} phich_length_t;
|
|
|
|
typedef enum LIBLTE_API { R_1_6, R_1_2, R_1, R_2} phich_resources_t;
|
|
|
|
|
2014-06-27 16:36:25 +00:00
|
|
|
typedef struct LIBLTE_API {
|
2014-07-01 08:48:51 +00:00
|
|
|
uint32_t nof_prb;
|
|
|
|
uint32_t nof_ports;
|
|
|
|
uint32_t id;
|
2014-06-27 16:36:25 +00:00
|
|
|
lte_cp_t cp;
|
2014-10-17 18:16:20 +00:00
|
|
|
phich_length_t phich_length;
|
|
|
|
phich_resources_t phich_resources;
|
2014-06-27 16:36:25 +00:00
|
|
|
}lte_cell_t;
|
|
|
|
|
2014-06-17 14:32:19 +00:00
|
|
|
typedef enum LIBLTE_API {
|
2014-06-17 09:11:41 +00:00
|
|
|
SINGLE_ANTENNA,TX_DIVERSITY, SPATIAL_MULTIPLEX
|
2014-05-12 17:43:14 +00:00
|
|
|
} lte_mimo_type_t;
|
2014-03-03 19:09:26 +00:00
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
typedef enum LIBLTE_API {
|
|
|
|
LTE_BPSK = 1, LTE_QPSK = 2, LTE_QAM16 = 4, LTE_QAM64 = 6
|
|
|
|
} lte_mod_t;
|
|
|
|
|
2014-03-03 19:09:26 +00:00
|
|
|
|
2014-06-17 14:32:19 +00:00
|
|
|
typedef struct LIBLTE_API {
|
2014-06-17 09:11:41 +00:00
|
|
|
int id;
|
|
|
|
float fd;
|
2014-01-28 11:41:17 +00:00
|
|
|
}lte_earfcn_t;
|
|
|
|
|
2014-06-17 14:32:19 +00:00
|
|
|
LIBLTE_API enum band_geographical_area {
|
2014-06-17 09:11:41 +00:00
|
|
|
ALL, NAR, APAC, EMEA, JAPAN, CALA, NA
|
2014-01-28 11:41:17 +00:00
|
|
|
};
|
|
|
|
|
2014-06-29 17:51:25 +00:00
|
|
|
LIBLTE_API bool lte_cell_isvalid(lte_cell_t *cell);
|
|
|
|
|
2014-10-24 10:06:04 +00:00
|
|
|
LIBLTE_API void lte_cell_fprint(FILE *stream,
|
|
|
|
lte_cell_t *cell);
|
|
|
|
|
2014-11-05 13:19:35 +00:00
|
|
|
LIBLTE_API bool lte_cellid_isvalid(uint32_t cell_id);
|
|
|
|
|
|
|
|
LIBLTE_API bool lte_nofprb_isvalid(uint32_t nof_prb);
|
|
|
|
|
|
|
|
LIBLTE_API bool lte_sfidx_isvalid(uint32_t sf_idx);
|
|
|
|
|
|
|
|
LIBLTE_API bool lte_portid_isvalid(uint32_t port_id);
|
|
|
|
|
2014-07-21 14:19:17 +00:00
|
|
|
LIBLTE_API bool lte_N_id_2_isvalid(uint32_t N_id_2);
|
|
|
|
|
|
|
|
LIBLTE_API bool lte_N_id_1_isvalid(uint32_t N_id_1);
|
|
|
|
|
|
|
|
LIBLTE_API bool lte_symbol_sz_isvalid(uint32_t symbol_sz);
|
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API int lte_symbol_sz(uint32_t nof_prb);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
2014-07-21 14:19:17 +00:00
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API int lte_sampling_freq_hz(uint32_t nof_prb);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API uint32_t lte_re_x_prb(uint32_t ns,
|
|
|
|
uint32_t symbol,
|
|
|
|
uint32_t nof_ports,
|
|
|
|
uint32_t nof_symbols);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API uint32_t lte_voffset(uint32_t symbol_id,
|
|
|
|
uint32_t cell_id,
|
|
|
|
uint32_t nof_ports);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API int lte_cb_size(uint32_t index);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
2014-07-21 14:19:17 +00:00
|
|
|
LIBLTE_API char *lte_cp_string(lte_cp_t cp);
|
|
|
|
|
2014-07-10 12:43:18 +00:00
|
|
|
LIBLTE_API char *lte_mod_string(lte_mod_t mod);
|
|
|
|
|
|
|
|
LIBLTE_API uint32_t lte_mod_bits_x_symbol(lte_mod_t mod);
|
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API int lte_find_cb_index(uint32_t long_cb);
|
2014-05-13 15:00:49 +00:00
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API float lte_band_fd(uint32_t earfcn);
|
2014-01-28 11:41:17 +00:00
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API int lte_band_get_fd_band(uint32_t band,
|
2014-06-29 17:51:25 +00:00
|
|
|
lte_earfcn_t *earfcn,
|
|
|
|
int earfcn_start,
|
|
|
|
int earfcn_end,
|
2014-07-07 18:42:10 +00:00
|
|
|
uint32_t max_elems);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
2014-07-07 18:42:10 +00:00
|
|
|
LIBLTE_API int lte_band_get_fd_band_all(uint32_t band,
|
2014-06-29 17:51:25 +00:00
|
|
|
lte_earfcn_t *earfcn,
|
2014-07-07 18:42:10 +00:00
|
|
|
uint32_t max_nelems);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
|
|
|
LIBLTE_API int lte_band_get_fd_region(enum band_geographical_area region,
|
|
|
|
lte_earfcn_t *earfcn,
|
2014-07-07 18:42:10 +00:00
|
|
|
uint32_t max_elems);
|
2014-06-29 17:51:25 +00:00
|
|
|
|
|
|
|
LIBLTE_API int lte_str2mimotype(char *mimo_type_str,
|
|
|
|
lte_mimo_type_t *type);
|
|
|
|
|
2014-06-13 11:42:29 +00:00
|
|
|
LIBLTE_API char *lte_mimotype2str(lte_mimo_type_t type);
|
2014-01-28 11:41:17 +00:00
|
|
|
|
|
|
|
|
2014-06-29 17:51:25 +00:00
|
|
|
|
2014-01-28 11:41:17 +00:00
|
|
|
#endif
|