2016-01-09 12:13:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2016-06-16 10:36:20 +00:00
|
|
|
#include <stdbool.h>
|
2016-01-09 12:13:37 +00:00
|
|
|
#include <osmocom/core/linuxlist.h>
|
|
|
|
|
|
|
|
#include <osmo-bts/scheduler.h>
|
2020-07-03 15:27:01 +00:00
|
|
|
#include <osmo-bts/bts_trx.h>
|
2016-01-09 12:13:37 +00:00
|
|
|
|
|
|
|
#include <linux/if_packet.h>
|
2016-10-05 11:52:00 +00:00
|
|
|
#include "btsconfig.h"
|
2016-01-09 12:13:37 +00:00
|
|
|
|
2020-07-03 15:27:01 +00:00
|
|
|
|
2016-01-09 12:13:37 +00:00
|
|
|
struct virt_um_inst;
|
2016-01-09 12:13:37 +00:00
|
|
|
|
|
|
|
enum phy_link_type {
|
|
|
|
PHY_LINK_T_NONE,
|
|
|
|
PHY_LINK_T_SYSMOBTS,
|
|
|
|
PHY_LINK_T_OSMOTRX,
|
2016-01-09 12:13:37 +00:00
|
|
|
PHY_LINK_T_VIRTUAL,
|
2016-01-09 12:13:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum phy_link_state {
|
|
|
|
PHY_LINK_SHUTDOWN,
|
|
|
|
PHY_LINK_CONNECTING,
|
|
|
|
PHY_LINK_CONNECTED,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* A PHY link represents the connection to a given PHYsical layer
|
|
|
|
* implementation. That PHY link contains 1...N PHY instances, one for
|
|
|
|
* each TRX */
|
|
|
|
struct phy_link {
|
|
|
|
struct llist_head list;
|
|
|
|
int num;
|
|
|
|
enum phy_link_type type;
|
|
|
|
enum phy_link_state state;
|
|
|
|
struct llist_head instances;
|
|
|
|
char *description;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
} sysmobts;
|
|
|
|
struct {
|
2017-05-26 10:45:33 +00:00
|
|
|
char *local_ip;
|
|
|
|
char *remote_ip;
|
2016-01-09 12:13:37 +00:00
|
|
|
uint16_t base_port_local;
|
|
|
|
uint16_t base_port_remote;
|
|
|
|
struct osmo_fd trx_ofd_clk;
|
|
|
|
uint32_t clock_advance;
|
|
|
|
uint32_t rts_advance;
|
2017-06-24 16:42:00 +00:00
|
|
|
bool use_legacy_setbsic;
|
2021-04-14 18:45:49 +00:00
|
|
|
uint8_t trxd_pdu_ver_max; /* Maximum TRXD PDU version to negotiate */
|
2019-09-27 22:50:51 +00:00
|
|
|
bool powered; /* last POWERON (true) or POWEROFF (false) confirmed */
|
2021-10-04 10:44:03 +00:00
|
|
|
bool poweron_sent; /* is there a POWERON in transit? */
|
|
|
|
bool poweroff_sent; /* is there a POWEROFF in transit? */
|
2016-01-09 12:13:37 +00:00
|
|
|
} osmotrx;
|
2016-01-09 12:13:37 +00:00
|
|
|
struct {
|
|
|
|
char *mcast_dev; /* Network device for multicast */
|
2020-03-10 15:46:41 +00:00
|
|
|
int ttl; /* TTL of transmitted udp multicast */
|
2016-01-09 12:13:37 +00:00
|
|
|
char *bts_mcast_group; /* BTS are listening to this group */
|
|
|
|
uint16_t bts_mcast_port;
|
|
|
|
char *ms_mcast_group; /* MS are listening to this group */
|
|
|
|
uint16_t ms_mcast_port;
|
|
|
|
struct virt_um_inst *virt_um;
|
|
|
|
} virt;
|
2016-01-09 12:13:37 +00:00
|
|
|
struct {
|
|
|
|
/* MAC address of the PHY */
|
|
|
|
struct sockaddr_ll phy_addr;
|
|
|
|
/* Network device name */
|
|
|
|
char *netdev_name;
|
|
|
|
|
|
|
|
/* configuration */
|
|
|
|
uint32_t rf_port_index;
|
2017-03-06 12:52:56 +00:00
|
|
|
#if OCTPHY_USE_ANTENNA_ID == 1
|
|
|
|
uint32_t rx_ant_id;
|
|
|
|
uint32_t tx_ant_id;
|
|
|
|
#endif
|
2016-01-09 12:13:37 +00:00
|
|
|
uint32_t rx_gain_db;
|
2016-09-22 13:40:35 +00:00
|
|
|
bool tx_atten_flag;
|
2016-01-09 12:13:37 +00:00
|
|
|
uint32_t tx_atten_db;
|
2018-06-21 14:28:47 +00:00
|
|
|
bool over_sample_16x;
|
2016-10-05 11:52:00 +00:00
|
|
|
#if OCTPHY_MULTI_TRX == 1
|
|
|
|
/* arfcn used by TRX with id 0 */
|
|
|
|
uint16_t center_arfcn;
|
|
|
|
#endif
|
octphy: fix build: Revert "octphy: fix for multiple trx with more than 1 dsp"
This reverts commit 06968beab90806cba94c8b331276e4dc209c152b.
Theoretically, this patch makes a lot of sense, but in order to be able to
build osmo-bts-octphy until the headers version is clarified, revert use of
usCentreArfcn:
Above commit uses an usCentreArfcn member that is never defined in the history
of our octphy-2g-headers.git. This usCentreArfcn does exist in a code snapshot
OCTSDR-2G-02.05.00-B780-DEBUG, which is not (yet?) publicly available.
Also, the current headers version is apparently 02.07, though the octasic
version numbers have been known to cause confusion among osmocom folks.
This along with one other revert fixes this build problem:
make[3]: Entering directory '/n/s/octphy/git/osmo-bts/src/osmo-bts-octphy'
CC l1_oml.o
l1_oml.c: In function ‘l1if_trx_open’:
l1_oml.c:1350:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
oc->Config.usCentreArfcn = plink->u.octphy.center_arfcn;
^
l1_oml.c:1352:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
oc->Config.usCentreArfcn = trx->arfcn;
^
In file included from ../../include/osmo-bts/logging.h:5:0,
from l1_oml.c:33:
l1_oml.c:1365:13: error: ‘tOCTVC1_GSM_TRX_CONFIG’ has no member named ‘usCentreArfcn’
oc->Config.usCentreArfcn, oc->Config.usTsc, oc->RfConfig.ulRxGainDb,
^
Change-Id: I222766f6961f5f35aa3651e2907e3e908fe9a66e
2016-09-06 13:08:07 +00:00
|
|
|
|
2016-01-09 12:13:37 +00:00
|
|
|
struct octphy_hdl *hdl;
|
|
|
|
} octphy;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct phy_instance {
|
|
|
|
/* liked inside phy_link.linstances */
|
|
|
|
struct llist_head list;
|
|
|
|
int num;
|
|
|
|
char *description;
|
2017-05-29 14:23:02 +00:00
|
|
|
char version[MAX_VERSION_LENGTH];
|
2016-01-09 12:13:37 +00:00
|
|
|
/* pointer to the PHY link to which we belong */
|
|
|
|
struct phy_link *phy_link;
|
|
|
|
|
|
|
|
/* back-pointer to the TRX to which we're associated */
|
2021-05-19 13:52:07 +00:00
|
|
|
struct gsm_bts_trx *trx; /* NOTE: may be NULL! */
|
2016-01-09 12:13:37 +00:00
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
2016-01-20 21:50:06 +00:00
|
|
|
/* configuration */
|
|
|
|
uint8_t clk_use_eeprom;
|
2016-01-20 20:56:47 +00:00
|
|
|
uint32_t dsp_trace_f;
|
2016-01-20 21:50:06 +00:00
|
|
|
int clk_cal;
|
|
|
|
uint8_t clk_src;
|
|
|
|
char *calib_path;
|
|
|
|
|
2016-01-19 19:22:07 +00:00
|
|
|
struct femtol1_hdl *hdl;
|
2016-01-09 12:13:37 +00:00
|
|
|
} sysmobts;
|
|
|
|
struct {
|
|
|
|
struct trx_l1h *hdl;
|
2021-05-18 20:43:23 +00:00
|
|
|
struct trx_dl_burst_req br[TRX_NR_TS];
|
2016-01-09 12:13:37 +00:00
|
|
|
} osmotrx;
|
|
|
|
struct {
|
|
|
|
/* logical transceiver number within one PHY */
|
|
|
|
uint32_t trx_id;
|
2016-09-28 10:30:07 +00:00
|
|
|
/* trx lock state variable */
|
|
|
|
int trx_locked;
|
2016-01-09 12:13:37 +00:00
|
|
|
} octphy;
|
2016-01-20 16:48:42 +00:00
|
|
|
struct {
|
2016-01-20 21:50:06 +00:00
|
|
|
/* configuration */
|
2016-01-20 20:56:47 +00:00
|
|
|
uint32_t dsp_trace_f;
|
2016-01-20 21:50:06 +00:00
|
|
|
char *calib_path;
|
2016-06-09 20:24:36 +00:00
|
|
|
int minTxPower;
|
|
|
|
int maxTxPower;
|
2016-01-20 16:48:42 +00:00
|
|
|
struct lc15l1_hdl *hdl;
|
2017-07-18 16:34:29 +00:00
|
|
|
uint8_t max_cell_size; /* 0:166 qbits*/
|
|
|
|
uint8_t diversity_mode; /* 0: SISO A, 1: SISO B, 2: MRC */
|
|
|
|
uint8_t pedestal_mode; /* 0: unused TS is OFF, 1: unused TS is in minimum Tx power */
|
|
|
|
uint8_t dsp_alive_period; /* DSP alive timer period */
|
|
|
|
uint8_t tx_pwr_adj_mode; /* 0: no auto adjust power, 1: auto adjust power using RMS detector */
|
|
|
|
uint8_t tx_pwr_red_8psk; /* 8-PSK maximum Tx power reduction level in dB */
|
2020-04-18 14:04:18 +00:00
|
|
|
uint8_t tx_c0_idle_pwr_red; /* C0 idle slot Tx power reduction level in dB */
|
2016-01-20 16:48:42 +00:00
|
|
|
} lc15;
|
2018-10-23 22:42:46 +00:00
|
|
|
struct {
|
|
|
|
/* configuration */
|
|
|
|
uint32_t dsp_trace_f;
|
|
|
|
char *calib_path;
|
|
|
|
int minTxPower;
|
|
|
|
int maxTxPower;
|
|
|
|
struct oc2gl1_hdl *hdl;
|
|
|
|
uint8_t max_cell_size; /* 0:166 qbits*/
|
|
|
|
uint8_t pedestal_mode; /* 0: unused TS is OFF, 1: unused TS is in minimum Tx power */
|
|
|
|
uint8_t dsp_alive_period; /* DSP alive timer period */
|
|
|
|
uint8_t tx_pwr_adj_mode; /* 0: no auto adjust power, 1: auto adjust power using RMS detector */
|
|
|
|
uint8_t tx_pwr_red_8psk; /* 8-PSK maximum Tx power reduction level in dB */
|
|
|
|
uint8_t tx_c0_idle_pwr_red; /* C0 idle slot Tx power reduction level in dB */
|
|
|
|
} oc2g;
|
2016-01-09 12:13:37 +00:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct phy_link *phy_link_by_num(int num);
|
|
|
|
struct phy_link *phy_link_create(void *ctx, int num);
|
|
|
|
void phy_link_destroy(struct phy_link *plink);
|
2021-05-19 13:50:20 +00:00
|
|
|
const char *phy_link_name(const struct phy_link *plink);
|
2016-01-09 12:13:37 +00:00
|
|
|
void phy_link_state_set(struct phy_link *plink, enum phy_link_state state);
|
2019-09-30 14:03:19 +00:00
|
|
|
enum phy_link_state phy_link_state_get(struct phy_link *plink);
|
|
|
|
const char *phy_link_state_name(enum phy_link_state state);
|
2016-01-09 12:13:37 +00:00
|
|
|
int phy_links_open(void);
|
|
|
|
|
2020-09-25 02:53:59 +00:00
|
|
|
struct phy_instance *phy_instance_by_num(const struct phy_link *plink, int num);
|
2016-01-09 12:13:37 +00:00
|
|
|
struct phy_instance *phy_instance_create(struct phy_link *plink, int num);
|
|
|
|
void phy_instance_link_to_trx(struct phy_instance *pinst, struct gsm_bts_trx *trx);
|
|
|
|
void phy_instance_destroy(struct phy_instance *pinst);
|
2021-05-19 13:50:20 +00:00
|
|
|
const char *phy_instance_name(const struct phy_instance *pinst);
|
2016-01-09 12:13:37 +00:00
|
|
|
|
2019-04-18 19:03:47 +00:00
|
|
|
static inline struct phy_instance *trx_phy_instance(const struct gsm_bts_trx *trx)
|
2016-01-09 12:13:37 +00:00
|
|
|
{
|
2016-04-21 16:55:09 +00:00
|
|
|
OSMO_ASSERT(trx);
|
2021-05-07 01:28:04 +00:00
|
|
|
return trx->pinst;
|
2016-01-09 12:13:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int bts_model_phy_link_open(struct phy_link *plink);
|
2021-09-20 15:59:21 +00:00
|
|
|
int bts_model_phy_link_close(struct phy_link *plink);
|
2019-06-04 15:13:36 +00:00
|
|
|
|
2020-06-03 14:10:51 +00:00
|
|
|
#define LOGPPHL(plink, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_link_name(plink), ##args)
|
2019-06-04 15:13:36 +00:00
|
|
|
#define LOGPPHI(pinst, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_instance_name(pinst), ##args)
|