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.
171 lines
5.6 KiB
C
171 lines
5.6 KiB
C
4 years ago
|
/**
|
||
11 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
11 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
11 years ago
|
*
|
||
4 years ago
|
* 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.
|
||
11 years ago
|
*
|
||
|
*/
|
||
6 years ago
|
|
||
4 years ago
|
#ifndef SRSRAN_RF_H
|
||
|
#define SRSRAN_RF_H
|
||
11 years ago
|
|
||
5 years ago
|
#include <pthread.h>
|
||
11 years ago
|
#include <stdbool.h>
|
||
11 years ago
|
#include <stdint.h>
|
||
5 years ago
|
#include <sys/time.h>
|
||
9 years ago
|
|
||
4 years ago
|
#include "srsran/config.h"
|
||
11 years ago
|
|
||
5 years ago
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
5 years ago
|
#define RF_PARAM_LEN (256)
|
||
|
|
||
9 years ago
|
typedef struct {
|
||
5 years ago
|
void* handler;
|
||
|
void* dev;
|
||
|
|
||
|
// The following variables are for threaded RX gain control
|
||
|
bool thread_gain_run;
|
||
|
pthread_t thread_gain;
|
||
|
pthread_cond_t cond;
|
||
|
pthread_mutex_t mutex;
|
||
|
double cur_rx_gain;
|
||
|
double new_rx_gain;
|
||
|
bool tx_gain_same_rx;
|
||
|
float tx_rx_gain_offset;
|
||
4 years ago
|
} srsran_rf_t;
|
||
11 years ago
|
|
||
7 years ago
|
typedef struct {
|
||
|
double min_tx_gain;
|
||
|
double max_tx_gain;
|
||
|
double min_rx_gain;
|
||
|
double max_rx_gain;
|
||
4 years ago
|
} srsran_rf_info_t;
|
||
7 years ago
|
|
||
9 years ago
|
typedef struct {
|
||
5 years ago
|
enum {
|
||
4 years ago
|
SRSRAN_RF_ERROR_LATE,
|
||
|
SRSRAN_RF_ERROR_UNDERFLOW,
|
||
|
SRSRAN_RF_ERROR_OVERFLOW,
|
||
|
SRSRAN_RF_ERROR_RX,
|
||
|
SRSRAN_RF_ERROR_OTHER
|
||
9 years ago
|
} type;
|
||
5 years ago
|
int opt;
|
||
|
const char* msg;
|
||
4 years ago
|
} srsran_rf_error_t;
|
||
9 years ago
|
|
||
4 years ago
|
typedef void (*srsran_rf_error_handler_t)(void* arg, srsran_rf_error_t error);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_open(srsran_rf_t* h, char* args);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_open_multi(srsran_rf_t* h, char* args, uint32_t nof_channels);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_open_devname(srsran_rf_t* h, const char* devname, char* args, uint32_t nof_channels);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API const char* srsran_rf_name(srsran_rf_t* h);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_start_gain_thread(srsran_rf_t* rf, bool tx_gain_same_rx);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_close(srsran_rf_t* h);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_start_rx_stream(srsran_rf_t* h, bool now);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_stop_rx_stream(srsran_rf_t* h);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_rf_flush_buffer(srsran_rf_t* h);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API bool srsran_rf_has_rssi(srsran_rf_t* h);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API float srsran_rf_get_rssi(srsran_rf_t* h);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API double srsran_rf_set_rx_srate(srsran_rf_t* h, double freq);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_set_rx_gain(srsran_rf_t* h, double gain);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_set_rx_gain_ch(srsran_rf_t* h, uint32_t ch, double gain);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_rf_set_tx_rx_gain_offset(srsran_rf_t* h, double offset);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_set_rx_gain_th(srsran_rf_t* h, double gain);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API double srsran_rf_get_rx_gain(srsran_rf_t* h);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API double srsran_rf_get_tx_gain(srsran_rf_t* h);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API srsran_rf_info_t* srsran_rf_get_info(srsran_rf_t* h);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_rf_suppress_stdout(srsran_rf_t* h);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_rf_register_error_handler(srsran_rf_t* h, srsran_rf_error_handler_t error_handler, void* arg);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API double srsran_rf_set_rx_freq(srsran_rf_t* h, uint32_t ch, double freq);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_recv(srsran_rf_t* h, void* data, uint32_t nsamples, bool blocking);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API int
|
||
|
srsran_rf_recv_with_time(srsran_rf_t* h, void* data, uint32_t nsamples, bool blocking, time_t* secs, double* frac_secs);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_recv_with_time_multi(srsran_rf_t* h,
|
||
5 years ago
|
void** data,
|
||
|
uint32_t nsamples,
|
||
|
bool blocking,
|
||
|
time_t* secs,
|
||
|
double* frac_secs);
|
||
8 years ago
|
|
||
4 years ago
|
SRSRAN_API double srsran_rf_set_tx_srate(srsran_rf_t* h, double freq);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_set_tx_gain(srsran_rf_t* h, double gain);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_set_tx_gain_ch(srsran_rf_t* h, uint32_t ch, double gain);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API double srsran_rf_set_tx_freq(srsran_rf_t* h, uint32_t ch, double freq);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_rf_get_time(srsran_rf_t* h, time_t* secs, double* frac_secs);
|
||
6 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_sync(srsran_rf_t* rf);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_send(srsran_rf_t* h, void* data, uint32_t nsamples, bool blocking);
|
||
8 years ago
|
|
||
4 years ago
|
SRSRAN_API int
|
||
|
srsran_rf_send2(srsran_rf_t* h, void* data, uint32_t nsamples, bool blocking, bool start_of_burst, bool end_of_burst);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_send(srsran_rf_t* h, void* data, uint32_t nsamples, bool blocking);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_send_timed(srsran_rf_t* h, void* data, int nsamples, time_t secs, double frac_secs);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_send_timed2(srsran_rf_t* h,
|
||
5 years ago
|
void* data,
|
||
|
int nsamples,
|
||
|
time_t secs,
|
||
|
double frac_secs,
|
||
|
bool is_start_of_burst,
|
||
|
bool is_end_of_burst);
|
||
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_send_timed_multi(srsran_rf_t* rf,
|
||
5 years ago
|
void** data,
|
||
5 years ago
|
int nsamples,
|
||
|
time_t secs,
|
||
|
double frac_secs,
|
||
|
bool blocking,
|
||
|
bool is_start_of_burst,
|
||
|
bool is_end_of_burst);
|
||
|
|
||
4 years ago
|
SRSRAN_API int srsran_rf_send_multi(srsran_rf_t* rf,
|
||
5 years ago
|
void** data,
|
||
5 years ago
|
int nsamples,
|
||
|
bool blocking,
|
||
|
bool is_start_of_burst,
|
||
|
bool is_end_of_burst);
|
||
|
|
||
5 years ago
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
4 years ago
|
#endif // SRSRAN_RF_H
|