/* Initializes the Pseudo-Random sequence to the provided cell id. Can be called multiple times without allocating new * memory */ int srslte_ra_ul_pusch_hopping_init(srslte_ra_ul_pusch_hopping_t* q, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q) { if (cell.id != q->cell.id || !q->initialized) { q->cell = cell; q->initialized = true; /* Precompute sequence for type2 frequency hopping */ if (srslte_sequence_LTE_pr(&q->seq_type2_fo, 210, q->cell.id)) { ERROR("Error initiating type2 frequency hopping sequence\n"); return SRSLTE_ERROR; } ret = SRSLTE_SUCCESS; } } return ret; }
/** Computes sequence-group pattern f_gh according to 5.5.1.3 of 36.211 */ int srslte_group_hopping_f_gh(uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME], uint32_t cell_id) { srslte_sequence_t seq; bzero(&seq, sizeof(srslte_sequence_t)); if (srslte_sequence_LTE_pr(&seq, 160, cell_id / 30)) { return SRSLTE_ERROR; } for (uint32_t ns=0;ns<SRSLTE_NSLOTS_X_FRAME;ns++) { f_gh[ns] = 0; for (int i = 0; i < 8; i++) { f_gh[ns] += (((uint32_t) seq.c[8 * ns + i]) << i); } } srslte_sequence_free(&seq); return SRSLTE_SUCCESS; }
/* Generates n_cs_cell according to Sec 5.4 of 36.211 */ int srslte_pucch_n_cs_cell(srslte_cell_t cell, uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB]) { srslte_sequence_t seq; bzero(&seq, sizeof(srslte_sequence_t)); srslte_sequence_LTE_pr(&seq, 8*SRSLTE_CP_NSYMB(cell.cp)*SRSLTE_NSLOTS_X_FRAME, cell.id); for (uint32_t ns=0;ns<SRSLTE_NSLOTS_X_FRAME;ns++) { for (uint32_t l=0;l<SRSLTE_CP_NSYMB(cell.cp);l++) { n_cs_cell[ns][l] = 0; for (uint32_t i=0;i<8;i++) { n_cs_cell[ns][l] += seq.c[8*SRSLTE_CP_NSYMB(cell.cp)*ns+8*l+i]<<i; } } } srslte_sequence_free(&seq); return SRSLTE_SUCCESS; }
/** * 36.211 5.4.2 */ int srslte_sequence_pucch(srslte_sequence_t *seq, uint16_t rnti, uint32_t nslot, uint32_t cell_id) { bzero(seq, sizeof(srslte_sequence_t)); return srslte_sequence_LTE_pr(seq, 20, ((((nslot/2)+1)*(2*cell_id+1))<<16)+rnti); }
/** * 36.211 5.3.1 */ int srslte_sequence_pusch(srslte_sequence_t *seq, uint16_t rnti, uint32_t nslot, uint32_t cell_id, uint32_t len) { bzero(seq, sizeof(srslte_sequence_t)); return srslte_sequence_LTE_pr(seq, len, (rnti<<14) + ((nslot/2)<<9) + cell_id); }
/** * 36.211 6.8.2 */ int srslte_sequence_pdcch(srslte_sequence_t *seq, uint32_t nslot, uint32_t cell_id, uint32_t len) { bzero(seq, sizeof(srslte_sequence_t)); return srslte_sequence_LTE_pr(seq, len, (nslot/2) * 512 + cell_id); }
/** * 36.211 6.9.1 */ int srslte_sequence_phich(srslte_sequence_t *seq, uint32_t nslot, uint32_t cell_id) { bzero(seq, sizeof(srslte_sequence_t)); return srslte_sequence_LTE_pr(seq, 12, (nslot/2+1) * (2*cell_id + 1) * 512 + cell_id); }
/** * 36.211 6.6.1 */ int srslte_sequence_pbch(srslte_sequence_t *seq, srslte_cp_t cp, uint32_t cell_id) { bzero(seq, sizeof(srslte_sequence_t)); return srslte_sequence_LTE_pr(seq, SRSLTE_CP_ISNORM(cp)?1920:1728, cell_id); }
int srslte_sequence_pmch(srslte_sequence_t *seq, uint32_t nslot, uint32_t mbsfn_id , uint32_t len){ bzero(seq,sizeof(srslte_sequence_t)); return srslte_sequence_LTE_pr(seq, len, (((nslot/2)<<9) + mbsfn_id)); }
/** * 36.211 6.3.1 */ int srslte_sequence_pdsch(srslte_sequence_t *seq, uint16_t rnti, int q, uint32_t nslot, uint32_t cell_id, uint32_t len) { return srslte_sequence_LTE_pr(seq, len, (rnti<<14) + (q<<13) + ((nslot/2)<<9) + cell_id); }
/** * 36.211 6.7.1 */ int srslte_sequence_pcfich(srslte_sequence_t *seq, uint32_t nslot, uint32_t cell_id) { return srslte_sequence_LTE_pr(seq, 32, (nslot/2+1) * (2*cell_id + 1) * 512 + cell_id); }