srsLTE/lib/include/srsran/phy/phch/sci.h

102 lines
2.6 KiB
C
Raw Normal View History

/**
2020-01-28 12:24:37 -08:00
*
* \section COPYRIGHT
2020-01-28 12:24:37 -08:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2020-01-28 12:24:37 -08:00
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
2020-01-28 12:24:37 -08:00
*
*/
2021-03-19 03:45:56 -07:00
#ifndef SRSRAN_SCI_H
#define SRSRAN_SCI_H
2020-01-28 12:24:37 -08:00
#include <stdbool.h>
#include <stdint.h>
2021-03-19 03:45:56 -07:00
#include "srsran/config.h"
#include "srsran/phy/common/phy_common_sl.h"
2020-01-28 12:24:37 -08:00
2021-03-19 03:45:56 -07:00
#define SRSRAN_SCI_MSG_MAX_LEN 80
2020-01-28 12:24:37 -08:00
2021-03-19 03:45:56 -07:00
#define SRSRAN_SCI_CRC_LEN (16)
#define SRSRAN_SCI_MAX_LEN (45)
#define SRSRAN_SCI_TM34_LEN (32)
2020-02-23 01:43:33 -08:00
2021-03-19 03:45:56 -07:00
typedef enum { SRSRAN_SCI_FORMAT0 = 0, SRSRAN_SCI_FORMAT1 } srsran_sci_format_t;
2020-02-23 01:43:33 -08:00
2020-01-28 12:24:37 -08:00
/**
* Sidelink Control Information - Sidelink (SCI0 and SCI1).
*
* \brief SCI0/1 packing/unpacking functions to convert between bit streams
*
* Reference: 3GPP TS 36.212 version 15.6.0 Release 15 Section 5.4.3
*/
2021-03-19 03:45:56 -07:00
typedef struct SRSRAN_API {
srsran_sl_tm_t tm;
2020-01-28 12:24:37 -08:00
uint32_t sci_len;
uint32_t nof_prb;
2021-03-19 03:45:56 -07:00
srsran_sci_format_t format;
2020-01-28 12:24:37 -08:00
// sizeSubChannel
uint32_t size_sub_channel;
// numSubChannel
uint32_t num_sub_channel;
///< SCI Format 0: Resource block assignment and hopping resource allocation
///< SCI Format 1: Frequency resource location (0,3,6,7,8 bits)
uint32_t riv;
// Modulation and coding scheme (bits);
uint32_t mcs_idx;
///< SCI Format 0
// Frequency hopping flag (1 bit)
bool freq_hopping_flag;
uint32_t hopping_bits;
// TRP - Time resource pattern (7bits)
uint32_t trp_idx;
// Timing advance indication (11 bits)
uint32_t timing_advance;
// Group ID (8 bits)
uint32_t N_sa_id;
///< SCI Format 1
// Priority (3bits)
uint32_t priority;
// Resource reservation (4 bits)
uint32_t resource_reserv;
// Time gap (4 bits)
uint32_t time_gap;
// Retransmission index (1 bit)
bool retransmission;
// Transmission format (1 bit)
// 1 means transmission format including rate-matching and TBS scaling
// 0 means transmission format including puncturing and no TBS-scaling
uint32_t transmission_format;
2021-03-19 03:45:56 -07:00
} srsran_sci_t;
2020-01-28 12:24:37 -08:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int
srsran_sci_init(srsran_sci_t* q, srsran_cell_sl_t cell, srsran_sl_comm_resource_pool_t sl_comm_resource_pool);
SRSRAN_API int srsran_sci_format0_pack(srsran_sci_t* q, uint8_t* output);
SRSRAN_API int srsran_sci_format1_pack(srsran_sci_t* q, uint8_t* output);
SRSRAN_API int srsran_sci_format0_unpack(srsran_sci_t* q, uint8_t* input);
SRSRAN_API int srsran_sci_format1_unpack(srsran_sci_t* q, uint8_t* input);
SRSRAN_API void srsran_sci_info(const srsran_sci_t* sci, char* str, uint32_t len);
SRSRAN_API void srsran_sci_free(srsran_sci_t* q);
2020-01-28 12:24:37 -08:00
2021-03-19 03:45:56 -07:00
#endif // SRSRAN_SCI_H