|
|
|
@ -139,8 +139,20 @@ static int ue_ul_nr_encode_pucch_format1(srslte_ue_ul_nr_t* q,
|
|
|
|
|
const srslte_uci_data_nr_t* uci_data)
|
|
|
|
|
{
|
|
|
|
|
uint8_t b[SRSLTE_PUCCH_NR_FORMAT1_MAX_NOF_BITS] = {};
|
|
|
|
|
b[0] = uci_data->value.ack[0];
|
|
|
|
|
uint32_t nof_bits = 1;
|
|
|
|
|
|
|
|
|
|
// Set ACK bits
|
|
|
|
|
uint32_t nof_bits = SRSLTE_MIN(SRSLTE_PUCCH_NR_FORMAT1_MAX_NOF_BITS, uci_data->cfg.o_ack);
|
|
|
|
|
for (uint32_t i = 0; i < nof_bits; i++) {
|
|
|
|
|
b[i] = uci_data->value.ack[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set SR bits
|
|
|
|
|
// For a positive SR transmission using PUCCH format 1, the UE transmits the PUCCH as described in [4, TS
|
|
|
|
|
// 38.211] by setting b ( 0 ) = 0 .
|
|
|
|
|
if (nof_bits == 0 && uci_data->cfg.o_sr > 0 && uci_data->value.sr[0] != 0) {
|
|
|
|
|
b[0] = 0;
|
|
|
|
|
nof_bits = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (srslte_dmrs_pucch_format1_put(&q->pucch, &q->carrier, cfg, slot, resource, q->sf_symbols[0])) {
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
@ -238,3 +250,40 @@ int srslte_ue_ul_nr_pucch_info(const srslte_pucch_nr_resource_t* resource,
|
|
|
|
|
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int srslte_ue_ul_nr_sr_send_slot(const srslte_pucch_nr_sr_resource_t sr_resources[SRSLTE_PUCCH_MAX_NOF_SR_RESOURCES],
|
|
|
|
|
uint32_t slot_idx,
|
|
|
|
|
uint32_t sr_id,
|
|
|
|
|
uint32_t* sr_resource_id)
|
|
|
|
|
{
|
|
|
|
|
// Check inputs
|
|
|
|
|
if (sr_resources == NULL) {
|
|
|
|
|
return SRSLTE_ERROR_INVALID_INPUTS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Iterate over all SR resources
|
|
|
|
|
for (uint32_t i = 0; i < SRSLTE_PUCCH_MAX_NOF_SR_RESOURCES; i++) {
|
|
|
|
|
const srslte_pucch_nr_sr_resource_t* res = &sr_resources[i];
|
|
|
|
|
|
|
|
|
|
// Skip if resource is not provided
|
|
|
|
|
if (!res->configured) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Skip if SR identifier does not match
|
|
|
|
|
if (sr_id != res->sr_id) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check periodicity and offset condition
|
|
|
|
|
if ((slot_idx + res->period - res->offset) % res->period == 0) {
|
|
|
|
|
if (sr_resource_id != NULL) {
|
|
|
|
|
*sr_resource_id = i;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the program reached this point is because there is no SR transmission opportunity
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|