mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
6.8 KiB
C
186 lines
6.8 KiB
C
11 years ago
|
/**
|
||
|
*
|
||
|
* \section COPYRIGHT
|
||
|
*
|
||
9 years ago
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||
11 years ago
|
*
|
||
|
* \section LICENSE
|
||
|
*
|
||
10 years ago
|
* This file is part of the srsLTE library.
|
||
11 years ago
|
*
|
||
10 years ago
|
* srsLTE is free software: you can redistribute it and/or modify
|
||
10 years ago
|
* it under the terms of the GNU Affero General Public License as
|
||
11 years ago
|
* published by the Free Software Foundation, either version 3 of
|
||
|
* the License, or (at your option) any later version.
|
||
|
*
|
||
10 years ago
|
* srsLTE is distributed in the hope that it will be useful,
|
||
11 years ago
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
10 years ago
|
* GNU Affero General Public License for more details.
|
||
11 years ago
|
*
|
||
10 years ago
|
* A copy of the GNU Affero General Public License can be found in
|
||
11 years ago
|
* the LICENSE file in the top-level directory of this distribution
|
||
|
* and at http://www.gnu.org/licenses/.
|
||
|
*
|
||
|
*/
|
||
|
|
||
10 years ago
|
/******************************************************************************
|
||
|
* File: dci.h
|
||
|
*
|
||
10 years ago
|
* Description: Downlink control information (DCI).
|
||
|
* Packing/Unpacking functions to convert between bit streams
|
||
|
* and packed DCI UL/DL grants defined in ra.h
|
||
10 years ago
|
*
|
||
|
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.3.3
|
||
|
*****************************************************************************/
|
||
|
|
||
11 years ago
|
#ifndef DCI_
|
||
|
#define DCI_
|
||
|
|
||
11 years ago
|
#include <stdint.h>
|
||
11 years ago
|
|
||
10 years ago
|
#include "srslte/config.h"
|
||
8 years ago
|
#include "srslte/phy/common/phy_common.h"
|
||
|
#include "srslte/phy/phch/ra.h"
|
||
11 years ago
|
|
||
8 years ago
|
#define SRSLTE_DCI_MAX_BITS 128
|
||
10 years ago
|
|
||
|
#define SRSLTE_RAR_GRANT_LEN 20
|
||
11 years ago
|
|
||
8 years ago
|
SRSLTE_API extern int harq_pid_len;
|
||
|
|
||
11 years ago
|
typedef enum {
|
||
9 years ago
|
SRSLTE_DCI_FORMAT0 = 0,
|
||
10 years ago
|
SRSLTE_DCI_FORMAT1,
|
||
|
SRSLTE_DCI_FORMAT1A,
|
||
|
SRSLTE_DCI_FORMAT1C,
|
||
8 years ago
|
SRSLTE_DCI_FORMAT1B,
|
||
|
SRSLTE_DCI_FORMAT1D,
|
||
|
SRSLTE_DCI_FORMAT2,
|
||
|
SRSLTE_DCI_FORMAT2A,
|
||
|
SRSLTE_DCI_FORMAT2B,
|
||
|
//SRSLTE_DCI_FORMAT3,
|
||
|
//SRSLTE_DCI_FORMAT3A,
|
||
|
SRSLTE_DCI_NOF_FORMATS
|
||
10 years ago
|
} srslte_dci_format_t;
|
||
11 years ago
|
|
||
11 years ago
|
// Each type is for a different interface to packing/unpacking functions
|
||
10 years ago
|
typedef struct SRSLTE_API {
|
||
11 years ago
|
enum {
|
||
10 years ago
|
SRSLTE_DCI_MSG_TYPE_PUSCH_SCHED,
|
||
|
SRSLTE_DCI_MSG_TYPE_PDSCH_SCHED,
|
||
|
SRSLTE_DCI_MSG_TYPE_MCCH_CHANGE,
|
||
|
SRSLTE_DCI_MSG_TYPE_TPC_COMMAND,
|
||
|
SRSLTE_DCI_MSG_TYPE_RA_PROC_PDCCH
|
||
11 years ago
|
} type;
|
||
10 years ago
|
srslte_dci_format_t format;
|
||
|
}srslte_dci_msg_type_t;
|
||
11 years ago
|
|
||
11 years ago
|
typedef enum {
|
||
10 years ago
|
SRSLTE_DCI_SPEC_COMMON_ = 0,
|
||
|
SRSLTE_DCI_SPEC_UE = 1
|
||
11 years ago
|
} dci_spec_t;
|
||
11 years ago
|
|
||
10 years ago
|
typedef struct SRSLTE_API {
|
||
11 years ago
|
uint32_t L; // Aggregation level
|
||
11 years ago
|
uint32_t ncce; // Position of first CCE of the dci
|
||
10 years ago
|
} srslte_dci_location_t;
|
||
11 years ago
|
|
||
10 years ago
|
typedef struct SRSLTE_API {
|
||
10 years ago
|
uint8_t data[SRSLTE_DCI_MAX_BITS];
|
||
11 years ago
|
uint32_t nof_bits;
|
||
8 years ago
|
srslte_dci_format_t format;
|
||
10 years ago
|
} srslte_dci_msg_t;
|
||
11 years ago
|
|
||
10 years ago
|
typedef struct SRSLTE_API {
|
||
|
uint32_t rba;
|
||
|
uint32_t trunc_mcs;
|
||
10 years ago
|
uint32_t tpc_pusch;
|
||
|
bool ul_delay;
|
||
|
bool cqi_request;
|
||
10 years ago
|
bool hopping_flag;
|
||
|
} srslte_dci_rar_grant_t;
|
||
|
|
||
11 years ago
|
/* Converts a received PDSCH DL scheduling DCI message
|
||
|
* to ra structures ready to be passed to the harq setup function
|
||
|
*/
|
||
10 years ago
|
SRSLTE_API int srslte_dci_msg_to_dl_grant(srslte_dci_msg_t *msg,
|
||
|
uint16_t msg_rnti,
|
||
10 years ago
|
uint32_t nof_prb,
|
||
8 years ago
|
uint32_t nof_ports,
|
||
10 years ago
|
srslte_ra_dl_dci_t *dl_dci,
|
||
|
srslte_ra_dl_grant_t *grant);
|
||
|
|
||
|
SRSLTE_API int srslte_dci_msg_to_ul_grant(srslte_dci_msg_t *msg,
|
||
10 years ago
|
uint32_t nof_prb,
|
||
10 years ago
|
uint32_t n_rb_ho,
|
||
|
srslte_ra_ul_dci_t *ul_dci,
|
||
9 years ago
|
srslte_ra_ul_grant_t *grant,
|
||
|
uint32_t harq_pid);
|
||
10 years ago
|
|
||
|
SRSLTE_API int srslte_dci_rar_to_ul_grant(srslte_dci_rar_grant_t *rar,
|
||
10 years ago
|
uint32_t nof_prb,
|
||
10 years ago
|
uint32_t n_rb_ho,
|
||
|
srslte_ra_ul_dci_t *ul_dci,
|
||
|
srslte_ra_ul_grant_t *grant);
|
||
10 years ago
|
|
||
10 years ago
|
SRSLTE_API void srslte_dci_rar_grant_unpack(srslte_dci_rar_grant_t *rar,
|
||
|
uint8_t grant[SRSLTE_RAR_GRANT_LEN]);
|
||
|
|
||
9 years ago
|
SRSLTE_API void srslte_dci_rar_grant_pack(srslte_dci_rar_grant_t *rar,
|
||
|
uint8_t grant[SRSLTE_RAR_GRANT_LEN]);
|
||
|
|
||
10 years ago
|
SRSLTE_API void srslte_dci_rar_grant_fprint(FILE *stream,
|
||
|
srslte_dci_rar_grant_t *rar);
|
||
|
|
||
10 years ago
|
SRSLTE_API srslte_dci_format_t srslte_dci_format_from_string(char *str);
|
||
|
|
||
|
SRSLTE_API char* srslte_dci_format_string(srslte_dci_format_t format);
|
||
|
|
||
|
SRSLTE_API int srslte_dci_location_set(srslte_dci_location_t *c,
|
||
|
uint32_t L,
|
||
|
uint32_t nCCE);
|
||
|
|
||
|
SRSLTE_API bool srslte_dci_location_isvalid(srslte_dci_location_t *c);
|
||
|
|
||
|
SRSLTE_API int srslte_dci_msg_get_type(srslte_dci_msg_t *msg,
|
||
|
srslte_dci_msg_type_t *type,
|
||
|
uint32_t nof_prb,
|
||
|
uint16_t msg_rnti);
|
||
|
|
||
|
SRSLTE_API void srslte_dci_msg_type_fprint(FILE *f,
|
||
|
srslte_dci_msg_type_t type);
|
||
|
|
||
|
// For srslte_dci_msg_type_t = SRSLTE_DCI_MSG_TYPE_PUSCH_SCHED
|
||
10 years ago
|
SRSLTE_API int srslte_dci_msg_pack_pusch(srslte_ra_ul_dci_t *data,
|
||
10 years ago
|
srslte_dci_msg_t *msg,
|
||
|
uint32_t nof_prb);
|
||
|
|
||
|
SRSLTE_API int srslte_dci_msg_unpack_pusch(srslte_dci_msg_t *msg,
|
||
10 years ago
|
srslte_ra_ul_dci_t *data,
|
||
10 years ago
|
uint32_t nof_prb);
|
||
|
|
||
|
// For srslte_dci_msg_type_t = SRSLTE_DCI_MSG_TYPE_PDSCH_SCHED
|
||
10 years ago
|
SRSLTE_API int srslte_dci_msg_pack_pdsch(srslte_ra_dl_dci_t *data,
|
||
8 years ago
|
srslte_dci_format_t format,
|
||
10 years ago
|
srslte_dci_msg_t *msg,
|
||
|
uint32_t nof_prb,
|
||
8 years ago
|
uint32_t nof_ports,
|
||
10 years ago
|
bool crc_is_crnti);
|
||
10 years ago
|
|
||
|
SRSLTE_API int srslte_dci_msg_unpack_pdsch(srslte_dci_msg_t *msg,
|
||
10 years ago
|
srslte_ra_dl_dci_t *data,
|
||
10 years ago
|
uint32_t nof_prb,
|
||
8 years ago
|
uint32_t nof_ports,
|
||
10 years ago
|
bool crc_is_crnti);
|
||
10 years ago
|
|
||
|
SRSLTE_API uint32_t srslte_dci_format_sizeof(srslte_dci_format_t format,
|
||
8 years ago
|
uint32_t nof_prb,
|
||
|
uint32_t nof_ports);
|
||
11 years ago
|
|
||
8 years ago
|
// This is for backwards compatibility only for tm1 formats
|
||
9 years ago
|
SRSLTE_API uint32_t srslte_dci_format_sizeof_lut(srslte_dci_format_t format,
|
||
|
uint32_t nof_prb);
|
||
|
|
||
11 years ago
|
#endif // DCI_
|