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>
|
|
|
|
|
|
|
|
#include <linux/if_packet.h>
|
2016-10-05 11:52:00 +00:00
|
|
|
#include "btsconfig.h"
|
2016-01-09 12:13:37 +00:00
|
|
|
|
|
|
|
struct gsm_bts_trx;
|
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;
|
|
|
|
} osmotrx;
|
2016-01-09 12:13:37 +00:00
|
|
|
struct {
|
|
|
|
char *mcast_dev; /* Network device for multicast */
|
|
|
|
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;
|
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 */
|
|
|
|
struct gsm_bts_trx *trx;
|
|
|
|
|
|
|
|
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;
|
2016-06-16 10:36:20 +00:00
|
|
|
bool sw_act_reported;
|
2016-01-09 12:13:37 +00:00
|
|
|
} osmotrx;
|
2016-01-09 12:13:37 +00:00
|
|
|
struct {
|
|
|
|
struct l1sched_trx sched;
|
|
|
|
} virt;
|
2016-01-09 12:13:37 +00:00
|
|
|
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;
|
|
|
|
} lc15;
|
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);
|
|
|
|
void phy_link_state_set(struct phy_link *plink, enum phy_link_state state);
|
|
|
|
int phy_links_open(void);
|
|
|
|
|
|
|
|
struct phy_instance *phy_instance_by_num(struct phy_link *plink, int num);
|
|
|
|
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);
|
|
|
|
const char *phy_instance_name(struct phy_instance *pinst);
|
|
|
|
|
|
|
|
void phy_user_statechg_notif(struct phy_instance *pinst, enum phy_link_state link_state);
|
|
|
|
|
|
|
|
static inline struct phy_instance *trx_phy_instance(struct gsm_bts_trx *trx)
|
|
|
|
{
|
2016-04-21 16:55:09 +00:00
|
|
|
OSMO_ASSERT(trx);
|
2016-01-09 12:13:37 +00:00
|
|
|
return trx->role_bts.l1h;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bts_model_phy_link_open(struct phy_link *plink);
|