Hello,
this list of patches includes support to change the PLL set and work value with bs11_config. Many thanks go to Dieter Spaar who figured out how to change the work value.
Harald, if these patches are okay for you I'll go ahead and commit them.
Regards, Daniel Willmann (5): [abis_nm] Add generic abis_nm_bs11_logon function [abis_nm] Add abis_nm_bs11_infield_logon to logon as user field [abis_nm] Add abis_nm_bs11_set_pll function to change the set/work value [bs11_config] Whitespace changes so the help text looks nice [bs11_config] Add pll-setvalue and pll-workvalue commands
openbsc/include/openbsc/abis_nm.h | 3 ++ openbsc/src/abis_nm.c | 39 +++++++++++++++++++++++++--- openbsc/src/bs11_config.c | 50 +++++++++++++++++++++++++----------- 3 files changed, 72 insertions(+), 20 deletions(-)
Factoring out common logon functionality will allow us to logon as different user. abis_nm_bs11_factory_logon now uses this function. --- openbsc/include/openbsc/abis_nm.h | 1 + openbsc/src/abis_nm.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h index 6876435..8fe4b0c 100644 --- a/openbsc/include/openbsc/abis_nm.h +++ b/openbsc/include/openbsc/abis_nm.h @@ -787,6 +787,7 @@ int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts); int abis_nm_bs11_get_serno(struct gsm_bts *bts); int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level); int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx); +int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on); int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on); int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password); int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked); diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c index 7a67fdf..3d337e2 100644 --- a/openbsc/src/abis_nm.c +++ b/openbsc/src/abis_nm.c @@ -2416,11 +2416,14 @@ int abis_nm_bs11_get_cclk(struct gsm_bts *bts) }
//static const u_int8_t bs11_logon_c7[] = { 0x07, 0xd9, 0x01, 0x11, 0x0d, 0x10, 0x20 }; -static const u_int8_t bs11_logon_c8[] = { 0x02 }; -static const u_int8_t bs11_logon_c9[] = "FACTORY";
int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on) { + return abis_nm_bs11_logon(bts, 0x02, "FACTORY", on); +} + +int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on) +{ struct abis_om_hdr *oh; struct msgb *msg = nm_msgb_alloc(); struct bs11_date_time bdt; @@ -2430,15 +2433,15 @@ int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on) oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); if (on) { u_int8_t len = 3*2 + sizeof(bdt) - + sizeof(bs11_logon_c8) + sizeof(bs11_logon_c9); + + 1 + strlen(name); fill_om_fom_hdr(oh, len, NM_MT_BS11_LMT_LOGON, NM_OC_BS11_BTSE, 0xff, 0xff, 0xff); msgb_tlv_put(msg, NM_ATT_BS11_LMT_LOGIN_TIME, sizeof(bdt), (u_int8_t *) &bdt); msgb_tlv_put(msg, NM_ATT_BS11_LMT_USER_ACC_LEV, - sizeof(bs11_logon_c8), bs11_logon_c8); + 1, &level); msgb_tlv_put(msg, NM_ATT_BS11_LMT_USER_NAME, - sizeof(bs11_logon_c9), bs11_logon_c9); + strlen(name), (u_int8_t *)name); } else { fill_om_fom_hdr(oh, 0, NM_MT_BS11_LMT_LOGOFF, NM_OC_BS11_BTSE, 0xff, 0xff, 0xff);
As this user you are able to set the PLL work value which is especially useful if your BS11 got detuned by an inaccurate oscillator in your E1 card. --- openbsc/include/openbsc/abis_nm.h | 1 + openbsc/src/abis_nm.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h index 8fe4b0c..9d9b8c1 100644 --- a/openbsc/include/openbsc/abis_nm.h +++ b/openbsc/include/openbsc/abis_nm.h @@ -789,6 +789,7 @@ int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level); int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx); int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on); int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on); +int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on); int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password); int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked); int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts); diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c index 3d337e2..138a134 100644 --- a/openbsc/src/abis_nm.c +++ b/openbsc/src/abis_nm.c @@ -2422,6 +2422,11 @@ int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on) return abis_nm_bs11_logon(bts, 0x02, "FACTORY", on); }
+int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on) +{ + return abis_nm_bs11_logon(bts, 0x03, "FIELD ", on); +} + int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on) { struct abis_om_hdr *oh;
Whether this function changes the set or the work value depends on your type of login. In FACTORY login it changes the set value, in FIELD login it changes the work value (which is what is used by the BS11 to tune the frequency). --- openbsc/include/openbsc/abis_nm.h | 1 + openbsc/src/abis_nm.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h index 9d9b8c1..d5c7a13 100644 --- a/openbsc/include/openbsc/abis_nm.h +++ b/openbsc/include/openbsc/abis_nm.h @@ -793,6 +793,7 @@ int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on); int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password); int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked); int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts); +int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value); int abis_nm_bs11_get_cclk(struct gsm_bts *bts); int abis_nm_bs11_get_state(struct gsm_bts *bts); int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname, diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c index 138a134..311bb3e 100644 --- a/openbsc/src/abis_nm.c +++ b/openbsc/src/abis_nm.c @@ -2494,6 +2494,27 @@ int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked) return abis_nm_sendmsg(bts, msg); }
+/* Set the calibration value of the PLL (work value/set value) + * It depends on the login which one is changed */ +int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value) +{ + struct abis_om_hdr *oh; + struct msgb *msg; + u_int8_t tlv_value[2]; + + msg = nm_msgb_alloc(); + oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); + fill_om_fom_hdr(oh, 3, NM_MT_BS11_SET_ATTR, NM_OC_BS11, + BS11_OBJ_TRX1, 0x00, 0x00); + + tlv_value[0] = value>>8; + tlv_value[1] = value&0xff; + + msgb_tlv_put(msg, NM_ATT_BS11_PLL, 2, tlv_value); + + return abis_nm_sendmsg(bts, msg); +} + int abis_nm_bs11_get_state(struct gsm_bts *bts) { return __simple_cmd(bts, NM_MT_BS11_GET_STATE);
--- openbsc/src/bs11_config.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/openbsc/src/bs11_config.c b/openbsc/src/bs11_config.c index b2470a9..3d719bb 100644 --- a/openbsc/src/bs11_config.c +++ b/openbsc/src/bs11_config.c @@ -706,25 +706,25 @@ static void print_help(void) printf("\t-p --port </dev/ttyXXX>\t\tSpecify serial port\n"); printf("\t-s --software <file>\t\tSpecify Software file\n"); printf("\t-S --safety <file>\t\tSpecify Safety Load file\n"); - printf("\t-d --delay <ms>\t\tSpecify delay in milliseconds\n"); + printf("\t-d --delay <ms>\t\t\tSpecify delay in milliseconds\n"); printf("\t-D --disconnect\t\t\tDisconnect BTS from BSC\n"); printf("\t-w --win-size <num>\t\tSpecify Window Size\n"); printf("\t-f --forced\t\t\tForce Software Load\n"); printf("\nSupported commands:\n"); - printf("\tquery\t\tQuery the BS-11 about serial number and configuration\n"); - printf("\tdisconnect\tDisconnect A-bis link (go into administrative state)\n"); - printf("\tresconnect\tReconnect A-bis link (go into normal state)\n"); - printf("\trestart\t\tRestart the BTS\n"); - printf("\tsoftware\tDownload Software (only in administrative state)\n"); - printf("\tcreate-trx1\tCreate objects for TRX1 (Danger: Your BS-11 might overheat)\n"); - printf("\tdelete-trx1\tDelete objects for TRX1\n"); - printf("\tpll-e1-locked\tSet the PLL to be locked to E1 clock\n"); - printf("\tpll-standalone\tSet the PLL to be in standalone mode\n"); - printf("\toml-tei\tSet OML E1 TS and TEI\n"); - printf("\tbport0-star\tSet BPORT0 line config to star\n"); + printf("\tquery\t\t\tQuery the BS-11 about serial number and configuration\n"); + printf("\tdisconnect\t\tDisconnect A-bis link (go into administrative state)\n"); + printf("\tresconnect\t\tReconnect A-bis link (go into normal state)\n"); + printf("\trestart\t\t\tRestart the BTS\n"); + printf("\tsoftware\t\tDownload Software (only in administrative state)\n"); + printf("\tcreate-trx1\t\tCreate objects for TRX1 (Danger: Your BS-11 might overheat)\n"); + printf("\tdelete-trx1\t\tDelete objects for TRX1\n"); + printf("\tpll-e1-locked\t\tSet the PLL to be locked to E1 clock\n"); + printf("\tpll-standalone\t\tSet the PLL to be in standalone mode\n"); + printf("\toml-tei\t\t\tSet OML E1 TS and TEI\n"); + printf("\tbport0-star\t\tSet BPORT0 line config to star\n"); printf("\tbport0-multiport\tSet BPORT0 line config to multiport\n"); - printf("\tcreate-bport1\tCreate BPORT1 object\n"); - printf("\tdelete-bport1\tDelete BPORT1 object\n"); + printf("\tcreate-bport1\t\tCreate BPORT1 object\n"); + printf("\tdelete-bport1\t\tDelete BPORT1 object\n"); }
static void handle_options(int argc, char **argv)
These commands let you change the PLL set and work values. Many thanks to Dieter Spaar for figuring out how to do this! Now you can just reset your PLL work value if it drifts away due to your E1 card. Use it like this: bs11_config pll-workvalue 1000 --- openbsc/src/bs11_config.c | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/openbsc/src/bs11_config.c b/openbsc/src/bs11_config.c index 3d719bb..6a76b96 100644 --- a/openbsc/src/bs11_config.c +++ b/openbsc/src/bs11_config.c @@ -51,7 +51,7 @@ enum bs11cfg_state { STATE_QUERY, }; static enum bs11cfg_state bs11cfg_state = STATE_NONE; -static char *command; +static char *command, *value; struct timer_list status_timer;
static const u_int8_t obj_li_attr[] = { @@ -540,6 +540,21 @@ static int handle_state_resp(enum abis_bs11_phase state) sleep(1); abis_nm_bs11_factory_logon(g_bts, 0); command = NULL; + } else if (!strcmp(command, "pll-setvalue")) { + abis_nm_bs11_set_pll(g_bts, atoi(value)); + sleep(1); + abis_nm_bs11_factory_logon(g_bts, 0); + command = NULL; + } else if (!strcmp(command, "pll-workvalue")) { + /* To set the work value we need to login as FIELD */ + abis_nm_bs11_factory_logon(g_bts, 0); + sleep(1); + abis_nm_bs11_infield_logon(g_bts, 1); + sleep(1); + abis_nm_bs11_set_pll(g_bts, atoi(value)); + sleep(1); + abis_nm_bs11_infield_logon(g_bts, 0); + command = NULL; } else if (!strcmp(command, "oml-tei")) { abis_nm_bs11_conn_oml_tei(g_bts, 0, 1, 0xff, TEI_OML); command = NULL; @@ -720,6 +735,8 @@ static void print_help(void) printf("\tdelete-trx1\t\tDelete objects for TRX1\n"); printf("\tpll-e1-locked\t\tSet the PLL to be locked to E1 clock\n"); printf("\tpll-standalone\t\tSet the PLL to be in standalone mode\n"); + printf("\tpll-setvalue <value>\tSet the PLL set value\n"); + printf("\tpll-workvalue <value>\tSet the PLL work value\n"); printf("\toml-tei\t\t\tSet OML E1 TS and TEI\n"); printf("\tbport0-star\t\tSet BPORT0 line config to star\n"); printf("\tbport0-multiport\tSet BPORT0 line config to multiport\n"); @@ -791,6 +808,9 @@ static void handle_options(int argc, char **argv) } if (optind < argc) command = argv[optind]; + if (optind+1 < argc) + value = argv[optind+1]; + }
static int num_sigint;
Hi Daniel,
On Thu, Jan 07, 2010 at 03:20:50AM +0100, Daniel Willmann wrote:
this list of patches includes support to change the PLL set and work value with bs11_config. Many thanks go to Dieter Spaar who figured out how to change the work value.
Yes, indeed! Especially since it's such a subtle difference, i.e. the same command changes its meaning depending on the logon type!
Harald, if these patches are okay for you I'll go ahead and commit them.
yes, they're fine, go ahead. You could have also put them in a origin/alphaone/pllvalue branch and I could have merged from there.
Regards,