|
|
|
@ -347,7 +347,7 @@ static int dci_nr_format_0_0_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int dci_nr_format_0_0_to_str(const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
static uint32_t dci_nr_format_0_0_to_str(const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
|
|
|
|
|
@ -706,7 +706,7 @@ static int dci_nr_format_0_1_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
static uint32_t
|
|
|
|
|
dci_nr_format_0_1_to_str(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
@ -811,6 +811,113 @@ dci_nr_format_0_1_to_str(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dci
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint32_t dci_nr_rar_sizeof()
|
|
|
|
|
{
|
|
|
|
|
uint32_t count = 0;
|
|
|
|
|
|
|
|
|
|
// Frequency hopping flag - 1 bit
|
|
|
|
|
count += 1;
|
|
|
|
|
|
|
|
|
|
// PUSCH frequency resource allocation - 14 bits
|
|
|
|
|
count += 14;
|
|
|
|
|
|
|
|
|
|
// PUSCH time resource allocation - 4 bits
|
|
|
|
|
count += 4;
|
|
|
|
|
|
|
|
|
|
// MCS - 4 bits
|
|
|
|
|
count += 4;
|
|
|
|
|
|
|
|
|
|
// TPC command for PUSCH - 3 bits
|
|
|
|
|
count += 3;
|
|
|
|
|
|
|
|
|
|
// CSI request - 1 bits
|
|
|
|
|
count += 1;
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int dci_nr_rar_pack(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dci, srsran_dci_msg_nr_t* msg)
|
|
|
|
|
{
|
|
|
|
|
uint8_t* y = msg->payload;
|
|
|
|
|
|
|
|
|
|
// Frequency hopping flag - 1 bit
|
|
|
|
|
srsran_bit_unpack(dci->freq_hopping_flag, &y, 1);
|
|
|
|
|
|
|
|
|
|
// PUSCH frequency resource allocation - 14 bits
|
|
|
|
|
srsran_bit_unpack(dci->freq_domain_assigment, &y, 14);
|
|
|
|
|
|
|
|
|
|
// PUSCH time resource allocation - 4 bits
|
|
|
|
|
srsran_bit_unpack(dci->time_domain_assigment, &y, 4);
|
|
|
|
|
|
|
|
|
|
// MCS - 4 bits
|
|
|
|
|
srsran_bit_unpack(dci->mcs, &y, 4);
|
|
|
|
|
|
|
|
|
|
// TPC command for PUSCH - 3 bits
|
|
|
|
|
srsran_bit_unpack(dci->tpc, &y, 3);
|
|
|
|
|
|
|
|
|
|
// CSI request - 1 bits
|
|
|
|
|
srsran_bit_unpack(dci->csi_request, &y, 1);
|
|
|
|
|
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int dci_nr_rar_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_t* msg, srsran_dci_ul_nr_t* dci)
|
|
|
|
|
{
|
|
|
|
|
if (msg == NULL || dci == NULL) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t* y = msg->payload;
|
|
|
|
|
|
|
|
|
|
// Copy DCI MSG fields
|
|
|
|
|
dci->ctx = msg->ctx;
|
|
|
|
|
|
|
|
|
|
// Frequency hopping flag - 1 bit
|
|
|
|
|
dci->freq_hopping_flag = srsran_bit_pack(&y, 1);
|
|
|
|
|
|
|
|
|
|
// PUSCH frequency resource allocation - 14 bits
|
|
|
|
|
dci->freq_domain_assigment = srsran_bit_pack(&y, 14);
|
|
|
|
|
|
|
|
|
|
// PUSCH time resource allocation - 4 bits
|
|
|
|
|
dci->time_domain_assigment = srsran_bit_pack(&y, 4);
|
|
|
|
|
|
|
|
|
|
// MCS -4 bits
|
|
|
|
|
dci->mcs = srsran_bit_pack(&y, 4);
|
|
|
|
|
|
|
|
|
|
// TPC command for PUSCH - 3 bits
|
|
|
|
|
dci->tpc = srsran_bit_pack(&y, 3);
|
|
|
|
|
|
|
|
|
|
// CSI request - 1 bits
|
|
|
|
|
dci->csi_request = srsran_bit_pack(&y, 1);
|
|
|
|
|
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint32_t dci_nr_rar_to_str(const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
|
|
|
|
|
|
// Frequency hopping flag
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "hop=%d ", dci->freq_hopping_flag);
|
|
|
|
|
|
|
|
|
|
// PUSCH frequency resource allocation
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "f_alloc=0x%x ", dci->freq_domain_assigment);
|
|
|
|
|
|
|
|
|
|
// PUSCH time resource allocation
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "t_alloc=0x%x ", dci->time_domain_assigment);
|
|
|
|
|
|
|
|
|
|
// Modulation and coding scheme
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "mcs=%d ", dci->mcs);
|
|
|
|
|
|
|
|
|
|
// TPC command for scheduled PUSCH
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "tpc=%d ", dci->tpc);
|
|
|
|
|
|
|
|
|
|
// CSI request
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "csi=%d ", dci->csi_request);
|
|
|
|
|
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint32_t dci_nr_format_1_0_sizeof(uint32_t N_DL_BWP_RB, srsran_rnti_type_t rnti_type)
|
|
|
|
|
{
|
|
|
|
|
uint32_t count = 0;
|
|
|
|
@ -1123,7 +1230,7 @@ static int dci_nr_format_1_0_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int dci_nr_format_1_0_to_str(const srsran_dci_dl_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
static uint32_t dci_nr_format_1_0_to_str(const srsran_dci_dl_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
|
srsran_rnti_type_t rnti_type = dci->ctx.rnti_type;
|
|
|
|
@ -1560,7 +1667,7 @@ static int dci_nr_format_1_1_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
static uint32_t
|
|
|
|
|
dci_nr_format_1_1_to_str(const srsran_dci_nr_t* q, const srsran_dci_dl_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
@ -1675,6 +1782,10 @@ dci_nr_format_1_1_to_str(const srsran_dci_nr_t* q, const srsran_dci_dl_nr_t* dci
|
|
|
|
|
|
|
|
|
|
int srsran_dci_nr_set_cfg(srsran_dci_nr_t* q, const srsran_dci_cfg_nr_t* cfg)
|
|
|
|
|
{
|
|
|
|
|
if (q == NULL || cfg == NULL) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset current setup
|
|
|
|
|
SRSRAN_MEM_ZERO(q, srsran_dci_nr_t, 1);
|
|
|
|
|
|
|
|
|
@ -1816,6 +1927,11 @@ uint32_t srsran_dci_nr_size(const srsran_dci_nr_t* q, srsran_search_space_type_t
|
|
|
|
|
return q->dci_1_1_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RAR packed MSG3 DCI
|
|
|
|
|
if (format == srsran_dci_format_nr_rar) {
|
|
|
|
|
return dci_nr_rar_sizeof();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Not implemented
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1844,71 +1960,12 @@ bool srsran_dci_nr_valid_direction(const srsran_dci_msg_nr_t* dci)
|
|
|
|
|
return (dci->ctx.format == srsran_dci_format_nr_1_0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int dci_nr_rar_pack(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dci, srsran_dci_msg_nr_t* msg)
|
|
|
|
|
{
|
|
|
|
|
ERROR("Not implemented");
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int dci_nr_rar_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_t* msg, srsran_dci_ul_nr_t* dci)
|
|
|
|
|
int srsran_dci_nr_dl_pack(const srsran_dci_nr_t* q, const srsran_dci_dl_nr_t* dci, srsran_dci_msg_nr_t* msg)
|
|
|
|
|
{
|
|
|
|
|
if (msg == NULL || dci == NULL) {
|
|
|
|
|
if (q == NULL || dci == NULL || msg == NULL) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t* y = msg->payload;
|
|
|
|
|
|
|
|
|
|
// Copy DCI MSG fields
|
|
|
|
|
dci->ctx = msg->ctx;
|
|
|
|
|
|
|
|
|
|
// Frequency hopping flag - 1 bit
|
|
|
|
|
dci->freq_hopping_flag = srsran_bit_pack(&y, 1);
|
|
|
|
|
|
|
|
|
|
// PUSCH frequency resource allocation - 14 bits
|
|
|
|
|
dci->freq_domain_assigment = srsran_bit_pack(&y, 14);
|
|
|
|
|
|
|
|
|
|
// PUSCH time resource allocation - 4 bits
|
|
|
|
|
dci->time_domain_assigment = srsran_bit_pack(&y, 4);
|
|
|
|
|
|
|
|
|
|
// MCS -4 bits
|
|
|
|
|
dci->mcs = srsran_bit_pack(&y, 4);
|
|
|
|
|
|
|
|
|
|
// TPC command for PUSCH - 3 bits
|
|
|
|
|
dci->tpc = srsran_bit_pack(&y, 3);
|
|
|
|
|
|
|
|
|
|
// CSI request - 1 bits
|
|
|
|
|
dci->csi_request = srsran_bit_pack(&y, 3);
|
|
|
|
|
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int dci_nr_rar_to_str(const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
|
|
|
|
|
|
// Frequency hopping flag
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "hop=%d ", dci->freq_hopping_flag);
|
|
|
|
|
|
|
|
|
|
// PUSCH frequency resource allocation
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "f_alloc=0x%x ", dci->freq_domain_assigment);
|
|
|
|
|
|
|
|
|
|
// PUSCH time resource allocation
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "t_alloc=0x%x ", dci->time_domain_assigment);
|
|
|
|
|
|
|
|
|
|
// Modulation and coding scheme
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "mcs=%d ", dci->mcs);
|
|
|
|
|
|
|
|
|
|
// TPC command for scheduled PUSCH
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "tpc=%d ", dci->tpc);
|
|
|
|
|
|
|
|
|
|
// CSI request
|
|
|
|
|
len = srsran_print_check(str, str_len, len, "csi=%d ", dci->csi_request);
|
|
|
|
|
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int srsran_dci_nr_dl_pack(const srsran_dci_nr_t* q, const srsran_dci_dl_nr_t* dci, srsran_dci_msg_nr_t* msg)
|
|
|
|
|
{
|
|
|
|
|
// Copy DCI MSG fields
|
|
|
|
|
msg->ctx = dci->ctx;
|
|
|
|
|
|
|
|
|
@ -1927,6 +1984,10 @@ int srsran_dci_nr_dl_pack(const srsran_dci_nr_t* q, const srsran_dci_dl_nr_t* dc
|
|
|
|
|
|
|
|
|
|
int srsran_dci_nr_dl_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_t* msg, srsran_dci_dl_nr_t* dci)
|
|
|
|
|
{
|
|
|
|
|
if (q == NULL || dci == NULL || msg == NULL) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Copy DCI MSG fields
|
|
|
|
|
dci->ctx = msg->ctx;
|
|
|
|
|
|
|
|
|
@ -1944,6 +2005,10 @@ int srsran_dci_nr_dl_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_t* msg,
|
|
|
|
|
|
|
|
|
|
int srsran_dci_nr_ul_pack(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dci, srsran_dci_msg_nr_t* msg)
|
|
|
|
|
{
|
|
|
|
|
if (q == NULL || msg == NULL || dci == NULL) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Copy DCI MSG fields
|
|
|
|
|
msg->ctx = dci->ctx;
|
|
|
|
|
|
|
|
|
@ -1964,6 +2029,10 @@ int srsran_dci_nr_ul_pack(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dc
|
|
|
|
|
|
|
|
|
|
int srsran_dci_nr_ul_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_t* msg, srsran_dci_ul_nr_t* dci)
|
|
|
|
|
{
|
|
|
|
|
if (q == NULL || msg == NULL || dci == NULL) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Copy DCI MSG fields
|
|
|
|
|
dci->ctx = msg->ctx;
|
|
|
|
|
|
|
|
|
@ -1981,8 +2050,12 @@ int srsran_dci_nr_ul_unpack(const srsran_dci_nr_t* q, srsran_dci_msg_nr_t* msg,
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int srsran_dci_ctx_to_str(const srsran_dci_ctx_t* ctx, char* str, uint32_t str_len)
|
|
|
|
|
uint32_t srsran_dci_ctx_to_str(const srsran_dci_ctx_t* ctx, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
if (ctx == NULL || str == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
|
|
|
|
|
|
// Print base
|
|
|
|
@ -2001,8 +2074,12 @@ int srsran_dci_ctx_to_str(const srsran_dci_ctx_t* ctx, char* str, uint32_t str_l
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int srsran_dci_ul_nr_to_str(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
uint32_t srsran_dci_ul_nr_to_str(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
if (q == NULL || dci == NULL || str == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
|
|
|
|
|
|
len += srsran_dci_ctx_to_str(&dci->ctx, &str[len], str_len - len);
|
|
|
|
@ -2026,8 +2103,12 @@ int srsran_dci_ul_nr_to_str(const srsran_dci_nr_t* q, const srsran_dci_ul_nr_t*
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int srsran_dci_dl_nr_to_str(const srsran_dci_nr_t* q, const srsran_dci_dl_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
uint32_t srsran_dci_dl_nr_to_str(const srsran_dci_nr_t* q, const srsran_dci_dl_nr_t* dci, char* str, uint32_t str_len)
|
|
|
|
|
{
|
|
|
|
|
if (q == NULL || dci == NULL || str == NULL) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t len = 0;
|
|
|
|
|
|
|
|
|
|
len += srsran_dci_ctx_to_str(&dci->ctx, &str[len], str_len - len);
|
|
|
|
|