aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-09-09 14:10:57 +0200
committerHarald Welte <laforge@gnumonks.org>2011-09-09 14:10:57 +0200
commit2c40d02f274199c465533c1fd1886d134f745683 (patch)
tree07d39d6bd90404896d042b3de27c5ebfa0db4b04
parent16c0ab92c1cf822c76a19ff44dc5b2470138d709 (diff)
Inquire DSP/FPGA version at BTS boot and check band compatibility
-rw-r--r--src/osmo-bts-sysmo/l1_if.c52
-rw-r--r--src/osmo-bts-sysmo/l1_if.h6
-rw-r--r--src/osmo-bts-sysmo/sysmobts_vty.c44
3 files changed, 100 insertions, 2 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index fcef1db..59db61f 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -728,6 +728,55 @@ int l1if_activate_rf(struct femtol1_hdl *hdl, int on)
return l1if_req_compl(hdl, msg, 1, activate_rf_compl_cb, hdl);
}
+/* call-back on arrival of DSP+FPGA version + band capability */
+static int info_compl_cb(struct msgb *resp, void *data)
+{
+ FemtoBts_Prim_t *sysp = msgb_sysprim(resp);
+ FemtoBts_SystemInfoCnf_t *sic = &sysp->u.systemInfoCnf;
+ struct femtol1_hdl *fl1h = data;
+ struct gsm_bts_trx *trx = fl1h->priv;
+
+ fl1h->hw_info.dsp_version[0] = sic->dspVersion.major;
+ fl1h->hw_info.dsp_version[1] = sic->dspVersion.minor;
+ fl1h->hw_info.dsp_version[2] = sic->dspVersion.build;
+
+ fl1h->hw_info.fpga_version[0] = sic->fpgaVersion.major;
+ fl1h->hw_info.fpga_version[1] = sic->fpgaVersion.minor;
+ fl1h->hw_info.fpga_version[2] = sic->fpgaVersion.build;
+
+ LOGP(DL1C, LOGL_INFO, "DSP v%u.%u.%u, FPGA v%u.%u.%u\n",
+ sic->dspVersion.major, sic->dspVersion.minor,
+ sic->dspVersion.build, sic->fpgaVersion.major,
+ sic->fpgaVersion.minor, sic->fpgaVersion.build);
+
+ if (sic->rfBand.gsm850)
+ fl1h->hw_info.band_support |= GSM_BAND_850;
+ if (sic->rfBand.gsm900)
+ fl1h->hw_info.band_support |= GSM_BAND_900;
+ if (sic->rfBand.dcs1800)
+ fl1h->hw_info.band_support |= GSM_BAND_1800;
+ if (sic->rfBand.pcs1900)
+ fl1h->hw_info.band_support |= GSM_BAND_1900;
+
+ if (!(fl1h->hw_info.band_support & trx->bts->band))
+ LOGP(DL1C, LOGL_FATAL, "BTS band %s not supported by hw\n",
+ gsm_band_name(trx->bts->band));
+
+ /* FIXME: clock related */
+ return 0;
+}
+
+/* request DSP+FPGA code versions + band capability */
+static int l1if_get_info(struct femtol1_hdl *hdl)
+{
+ struct msgb *msg = sysp_msgb_alloc();
+ FemtoBts_Prim_t *sysp = msgb_sysprim(msg);
+
+ sysp->id = FemtoBts_PrimId_SystemInfoReq;
+
+ return l1if_req_compl(hdl, msg, 1, info_compl_cb, hdl);
+}
+
static int reset_compl_cb(struct msgb *resp, void *data)
{
struct femtol1_hdl *fl1h = data;
@@ -751,6 +800,9 @@ static int reset_compl_cb(struct msgb *resp, void *data)
* set them to zero (or whatever dsp_trace_f has been initialized to */
l1if_set_trace_flags(fl1h, fl1h->dsp_trace_f);
+ /* obtain version information on DSP/FPGA and band capabilities */
+ l1if_get_info(fl1h);
+
/* otherwise, request activation of RF board */
l1if_activate_rf(fl1h, 1);
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
index a4b573b..705abc3 100644
--- a/src/osmo-bts-sysmo/l1_if.h
+++ b/src/osmo-bts-sysmo/l1_if.h
@@ -30,6 +30,12 @@ struct femtol1_hdl {
struct osmo_fd read_ofd[_NUM_MQ_READ]; /* osmo file descriptors */
struct osmo_wqueue write_q[_NUM_MQ_WRITE];
+
+ struct {
+ uint8_t dsp_version[3];
+ uint8_t fpga_version[3];
+ uint32_t band_support; /* bitmask of GSM_BAND_* */
+ } hw_info;
};
#define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h)
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c
index 712f793..86f54be 100644
--- a/src/osmo-bts-sysmo/sysmobts_vty.c
+++ b/src/osmo-bts-sysmo/sysmobts_vty.c
@@ -42,13 +42,18 @@
#include "femtobts.h"
#include "l1_if.h"
+#define SHOW_TRX_STR \
+ SHOW_STR \
+ "Show TRX specific information\n" \
+ "TRX number\n"
+
static struct gsm_bts *vty_bts;
/* This generates the logging command string for VTY. */
const char *vty_cmd_string_from_valstr(const struct value_string *vals,
const char *prefix)
{
- int len = 0, offset = 0, ret, i, rem;
+ int len = 0, offset = 0, ret, rem;
int size = strlen(prefix);
const struct value_string *vs;
char *str;
@@ -96,7 +101,7 @@ err:
DEFUN(show_dsp_trace_f, show_dsp_trace_f_cmd,
"show trx <0-0> dsp-trace-flags",
- SHOW_STR "Display the current setting of the DSP trace flags")
+ SHOW_TRX_STR "Display the current setting of the DSP trace flags")
{
int trx_nr = atoi(argv[0]);
struct gsm_bts_trx *trx = gsm_bts_trx_num(vty_bts, trx_nr);
@@ -170,6 +175,40 @@ DEFUN(no_dsp_trace_f, no_dsp_trace_f_cmd, "HIDDEN", "HIDDEN")
return CMD_SUCCESS;
}
+DEFUN(show_sys_info, show_sys_info_cmd,
+ "show trx <0-0> system-information",
+ SHOW_TRX_STR "Display information about system\n")
+{
+ int trx_nr = atoi(argv[0]);
+ struct gsm_bts_trx *trx = gsm_bts_trx_num(vty_bts, trx_nr);
+ struct femtol1_hdl *fl1h;
+ int i;
+
+ if (!trx) {
+ vty_out(vty, "Cannot find TRX number %u%s",
+ trx_nr, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ fl1h = trx_femtol1_hdl(trx);
+
+ vty_out(vty, "DSP Version: %u.%u.%u, FPGA Version: %u.%u.%u%s",
+ fl1h->hw_info.dsp_version[0],
+ fl1h->hw_info.dsp_version[1],
+ fl1h->hw_info.dsp_version[2],
+ fl1h->hw_info.fpga_version[0],
+ fl1h->hw_info.fpga_version[1],
+ fl1h->hw_info.fpga_version[2], VTY_NEWLINE);
+
+ vty_out(vty, "GSM Band Support: ");
+ for (i = 0; i < 32; i++) {
+ if (fl1h->hw_info.band_support & (1 << i))
+ vty_out(vty, "%s ", gsm_band_name(1 << i));
+ }
+ vty_out(vty, "%s", VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
int femtol1_vty_init(struct gsm_bts *bts)
{
@@ -182,6 +221,7 @@ int femtol1_vty_init(struct gsm_bts *bts)
"no trx <0-0> dsp-trace-flag (");
install_element_ve(&show_dsp_trace_f_cmd);
+ install_element_ve(&show_sys_info_cmd);
install_element_ve(&dsp_trace_f_cmd);
install_element_ve(&no_dsp_trace_f_cmd);