From f50fe6abb4a2972441a159fc210d2cacf72406f8 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 21 Jun 2016 18:55:01 +0200 Subject: Revert "LC15: Hardware changes:" This reverts commit cbbce0be0965c3160c4916384c3d3d5303c57ae2. Needed for the litecell15 instance in our lab that still runs with older firmware. Change-Id: Ibcfe651e3793b433e6479bfb610765a468e699e6 --- src/osmo-bts-litecell15/calib_file.c | 12 +- src/osmo-bts-litecell15/hw_misc.c | 4 +- src/osmo-bts-litecell15/l1_transp_hw.c | 4 +- src/osmo-bts-litecell15/misc/lc15bts_bid.c | 4 +- src/osmo-bts-litecell15/misc/lc15bts_clock.c | 18 +- src/osmo-bts-litecell15/misc/lc15bts_mgr.c | 20 +-- src/osmo-bts-litecell15/misc/lc15bts_mgr.h | 22 ++- src/osmo-bts-litecell15/misc/lc15bts_mgr_nl.c | 2 +- src/osmo-bts-litecell15/misc/lc15bts_mgr_temp.c | 105 +++++------ src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c | 222 +++++++++++------------- src/osmo-bts-litecell15/misc/lc15bts_misc.c | 62 ++++--- src/osmo-bts-litecell15/misc/lc15bts_par.c | 14 +- src/osmo-bts-litecell15/misc/lc15bts_par.h | 7 +- src/osmo-bts-litecell15/misc/lc15bts_power.c | 34 ++-- src/osmo-bts-litecell15/misc/lc15bts_power.h | 2 +- src/osmo-bts-litecell15/misc/lc15bts_temp.c | 64 +++++-- src/osmo-bts-litecell15/misc/lc15bts_temp.h | 10 +- 17 files changed, 310 insertions(+), 296 deletions(-) diff --git a/src/osmo-bts-litecell15/calib_file.c b/src/osmo-bts-litecell15/calib_file.c index ac39e464..12c4ba2e 100644 --- a/src/osmo-bts-litecell15/calib_file.c +++ b/src/osmo-bts-litecell15/calib_file.c @@ -57,31 +57,31 @@ struct calib_file_desc { static const struct calib_file_desc calib_files[] = { { - .fname = "calib_rx0a.conf", + .fname = "calib_rx1a.conf", .rx = 1, .trx = 0, .rxpath = 0, }, { - .fname = "calib_rx0b.conf", + .fname = "calib_rx1b.conf", .rx = 1, .trx = 0, .rxpath = 1, }, { - .fname = "calib_rx1a.conf", + .fname = "calib_rx2a.conf", .rx = 1, .trx = 1, .rxpath = 0, }, { - .fname = "calib_rx1b.conf", + .fname = "calib_rx2b.conf", .rx = 1, .trx = 1, .rxpath = 1, }, { - .fname = "calib_tx0.conf", + .fname = "calib_tx1.conf", .rx = 0, .trx = 0, }, { - .fname = "calib_tx1.conf", + .fname = "calib_tx2.conf", .rx = 0, .trx = 1, }, diff --git a/src/osmo-bts-litecell15/hw_misc.c b/src/osmo-bts-litecell15/hw_misc.c index 49232b2d..cd53e26b 100644 --- a/src/osmo-bts-litecell15/hw_misc.c +++ b/src/osmo-bts-litecell15/hw_misc.c @@ -63,7 +63,7 @@ int lc15bts_led_set(enum lc15bts_led_color c) return -EINVAL; } - fd = open("/var/lc15/leds/led0/brightness", O_WRONLY); + fd = open("/sys/class/leds/usr0/brightness", O_WRONLY); if (fd < 0) return -ENODEV; @@ -73,7 +73,7 @@ int lc15bts_led_set(enum lc15bts_led_color c) } close(fd); - fd = open("/var/lc15/leds/led1/brightness", O_WRONLY); + fd = open("/sys/class/leds/usr1/brightness", O_WRONLY); if (fd < 0) return -ENODEV; diff --git a/src/osmo-bts-litecell15/l1_transp_hw.c b/src/osmo-bts-litecell15/l1_transp_hw.c index 63818643..7e6cd687 100644 --- a/src/osmo-bts-litecell15/l1_transp_hw.c +++ b/src/osmo-bts-litecell15/l1_transp_hw.c @@ -249,7 +249,7 @@ int l1if_transport_open(int q, struct lc15l1_hdl *hdl) struct osmo_wqueue *wq = &hdl->write_q[q]; struct osmo_fd *write_ofd = &hdl->write_q[q].bfd; - snprintf(buf, sizeof(buf)-1, "%s%d", rd_devnames[q], plink->num); + snprintf(buf, sizeof(buf)-1, "%s%d", rd_devnames[q], plink->num+1); buf[sizeof(buf)-1] = '\0'; rc = open(buf, O_RDONLY); @@ -270,7 +270,7 @@ int l1if_transport_open(int q, struct lc15l1_hdl *hdl) return rc; } - snprintf(buf, sizeof(buf)-1, "%s%d", wr_devnames[q], plink->num); + snprintf(buf, sizeof(buf)-1, "%s%d", wr_devnames[q], plink->num+1); buf[sizeof(buf)-1] = '\0'; rc = open(buf, O_WRONLY); diff --git a/src/osmo-bts-litecell15/misc/lc15bts_bid.c b/src/osmo-bts-litecell15/misc/lc15bts_bid.c index 06a126ae..1fb58514 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_bid.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_bid.c @@ -27,8 +27,8 @@ #include "lc15bts_bid.h" -#define BOARD_REV_SYSFS "/var/lc15/platform/revision" -#define BOARD_OPT_SYSFS "/var/lc15/platform/option" +#define BOARD_REV_SYSFS "/sys/devices/0.lc15/revision" +#define BOARD_OPT_SYSFS "/sys/devices/0.lc15/option" static const int option_type_mask[_NUM_OPTION_TYPES] = { [LC15BTS_OPTION_OCXO] = 0x07, diff --git a/src/osmo-bts-litecell15/misc/lc15bts_clock.c b/src/osmo-bts-litecell15/misc/lc15bts_clock.c index f4df5d34..90ecb7a8 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_clock.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_clock.c @@ -27,15 +27,15 @@ #include "lc15bts_clock.h" -#define CLKERR_ERR_SYSFS "/var/lc15/clkerr/clkerr1_average" -#define CLKERR_ACC_SYSFS "/var/lc15/clkerr/clkerr1_average_accuracy" -#define CLKERR_INT_SYSFS "/var/lc15/clkerr/clkerr1_average_interval" -#define CLKERR_FLT_SYSFS "/var/lc15/clkerr/clkerr1_fault" -#define CLKERR_RFS_SYSFS "/var/lc15/clkerr/refresh" -#define CLKERR_RST_SYSFS "/var/lc15/clkerr/reset" - -#define OCXODAC_VAL_SYSFS "/var/lc15/ocxo/voltage" -#define OCXODAC_ROM_SYSFS "/var/lc15/ocxo/eeprom" +#define CLKERR_ERR_SYSFS "/sys/devices/5002000.clkerr/clkerr1_average" +#define CLKERR_ACC_SYSFS "/sys/devices/5002000.clkerr/clkerr1_average_accuracy" +#define CLKERR_INT_SYSFS "/sys/devices/5002000.clkerr/clkerr1_average_interval" +#define CLKERR_FLT_SYSFS "/sys/devices/5002000.clkerr/clkerr1_fault" +#define CLKERR_RFS_SYSFS "/sys/devices/5002000.clkerr/refresh" +#define CLKERR_RST_SYSFS "/sys/devices/5002000.clkerr/reset" + +#define OCXODAC_VAL_SYSFS "/sys/bus/iio/devices/iio:device0/out_voltage0_raw" +#define OCXODAC_ROM_SYSFS "/sys/bus/iio/devices/iio:device0/store_eeprom" /* clock error */ static int clkerr_fd_err = -1; diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr.c b/src/osmo-bts-litecell15/misc/lc15bts_mgr.c index 506e5250..a4c5650b 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr.c @@ -74,32 +74,28 @@ static struct lc15bts_mgr_instance manager = { .thresh_warn = 60, .thresh_crit = 78, }, - .logrf_limit = { + .memory_limit = { .thresh_warn = 60, .thresh_crit = 78, }, - .ocxo_limit = { - .thresh_warn = 60, - .thresh_crit = 78, - }, - .tx0_limit = { + .tx1_limit = { .thresh_warn = 60, .thresh_crit = 78, }, - .tx1_limit = { + .tx2_limit = { .thresh_warn = 60, .thresh_crit = 78, }, - .pa0_limit = { + .pa1_limit = { .thresh_warn = 60, .thresh_crit = 78, }, - .pa1_limit = { + .pa2_limit = { .thresh_warn = 60, .thresh_crit = 78, }, .action_warn = 0, - .action_crit = TEMP_ACT_PA0_OFF | TEMP_ACT_PA1_OFF, + .action_crit = TEMP_ACT_PA1_OFF | TEMP_ACT_PA2_OFF, .state = STATE_NORMAL, } }; @@ -264,12 +260,12 @@ int main(int argc, char **argv) hours_timer_cb(NULL); /* Enable the PAs */ - rc = lc15bts_power_set(LC15BTS_POWER_PA0, 1); + rc = lc15bts_power_set(LC15BTS_POWER_PA1, 1); if (rc < 0) { exit(3); } - rc = lc15bts_power_set(LC15BTS_POWER_PA1, 1); + rc = lc15bts_power_set(LC15BTS_POWER_PA2, 1); if (rc < 0) { exit(3); } diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr.h b/src/osmo-bts-litecell15/misc/lc15bts_mgr.h index 98bd7010..466d0b26 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr.h +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr.h @@ -21,8 +21,8 @@ enum { #if 0 TEMP_ACT_PWR_CONTRL = 0x1, #endif - TEMP_ACT_PA0_OFF = 0x2, - TEMP_ACT_PA1_OFF = 0x4, + TEMP_ACT_PA1_OFF = 0x2, + TEMP_ACT_PA2_OFF = 0x4, TEMP_ACT_BTS_SRV_OFF = 0x10, }; @@ -31,8 +31,8 @@ enum { #if 0 TEMP_ACT_NORM_PW_CONTRL = 0x1, #endif - TEMP_ACT_NORM_PA0_ON = 0x2, - TEMP_ACT_NORM_PA1_ON = 0x4, + TEMP_ACT_NORM_PA1_ON = 0x2, + TEMP_ACT_NORM_PA2_ON = 0x4, TEMP_ACT_NORM_BTS_SRV_ON= 0x10, }; @@ -62,12 +62,11 @@ enum mgr_vty_node { LIMIT_SUPPLY_NODE, LIMIT_SOC_NODE, LIMIT_FPGA_NODE, - LIMIT_LOGRF_NODE, - LIMIT_OCXO_NODE, - LIMIT_TX0_NODE, + LIMIT_MEMORY_NODE, LIMIT_TX1_NODE, - LIMIT_PA0_NODE, + LIMIT_TX2_NODE, LIMIT_PA1_NODE, + LIMIT_PA2_NODE, }; struct lc15bts_mgr_instance { @@ -83,12 +82,11 @@ struct lc15bts_mgr_instance { struct lc15bts_temp_limit supply_limit; struct lc15bts_temp_limit soc_limit; struct lc15bts_temp_limit fpga_limit; - struct lc15bts_temp_limit logrf_limit; - struct lc15bts_temp_limit ocxo_limit; - struct lc15bts_temp_limit tx0_limit; + struct lc15bts_temp_limit memory_limit; struct lc15bts_temp_limit tx1_limit; - struct lc15bts_temp_limit pa0_limit; + struct lc15bts_temp_limit tx2_limit; struct lc15bts_temp_limit pa1_limit; + struct lc15bts_temp_limit pa2_limit; } temp; struct { diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr_nl.c b/src/osmo-bts-litecell15/misc/lc15bts_mgr_nl.c index 903c5fe5..d2100eb1 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr_nl.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr_nl.c @@ -47,7 +47,7 @@ #include #include -#define ETH0_ADDR_SYSFS "/var/lc15/net/eth0/address" +#define ETH0_ADDR_SYSFS "/sys/class/net/eth0/address" static struct osmo_fd nl_fd; diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr_temp.c b/src/osmo-bts-litecell15/misc/lc15bts_mgr_temp.c index 042fc875..00b8657c 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr_temp.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr_temp.c @@ -85,23 +85,23 @@ static int next_state(enum lc15bts_temp_state current_state, int critical, int w static void handle_normal_actions(int actions) { /* switch on the PA */ - if (actions & TEMP_ACT_NORM_PA0_ON) { - if (lc15bts_power_set(LC15BTS_POWER_PA0, 1) != 0) { + if (actions & TEMP_ACT_NORM_PA1_ON) { + if (lc15bts_power_set(LC15BTS_POWER_PA1, 1) != 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to switch on the PA #0\n"); + "Failed to switch on the PA #1\n"); } else { LOGP(DTEMP, LOGL_NOTICE, - "Switched on the PA #0 as normal action.\n"); + "Switched on the PA #1 as normal action.\n"); } } - if (actions & TEMP_ACT_NORM_PA1_ON) { - if (lc15bts_power_set(LC15BTS_POWER_PA1, 1) != 0) { + if (actions & TEMP_ACT_NORM_PA2_ON) { + if (lc15bts_power_set(LC15BTS_POWER_PA2, 1) != 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to switch on the PA #1\n"); + "Failed to switch on the PA #2\n"); } else { LOGP(DTEMP, LOGL_NOTICE, - "Switched on the PA #1 as normal action.\n"); + "Switched on the PA #2 as normal action.\n"); } } @@ -120,23 +120,23 @@ static void handle_normal_actions(int actions) static void handle_actions(int actions) { /* switch off the PA */ - if (actions & TEMP_ACT_PA1_OFF) { - if (lc15bts_power_set(LC15BTS_POWER_PA1, 0) != 0) { + if (actions & TEMP_ACT_PA2_OFF) { + if (lc15bts_power_set(LC15BTS_POWER_PA2, 0) != 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to switch off the PA #1. Stop BTS?\n"); + "Failed to switch off the PA #2. Stop BTS?\n"); } else { LOGP(DTEMP, LOGL_NOTICE, - "Switched off the PA #1 due temperature.\n"); + "Switched off the PA #2 due temperature.\n"); } } - if (actions & TEMP_ACT_PA0_OFF) { - if (lc15bts_power_set(LC15BTS_POWER_PA0, 0) != 0) { + if (actions & TEMP_ACT_PA1_OFF) { + if (lc15bts_power_set(LC15BTS_POWER_PA1, 0) != 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to switch off the PA #0. Stop BTS?\n"); + "Failed to switch off the PA #1. Stop BTS?\n"); } else { LOGP(DTEMP, LOGL_NOTICE, - "Switched off the PA #0 due temperature.\n"); + "Switched off the PA #1 due temperature.\n"); } } @@ -215,7 +215,7 @@ static void temp_ctrl_check() LOGP(DTEMP, LOGL_DEBUG, "Going to check the temperature.\n"); /* Read the current supply temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_SUPPLY); + rc = lc15bts_temp_get(LC15BTS_TEMP_SUPPLY, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, "Failed to read the supply temperature. rc=%d\n", rc); @@ -230,7 +230,7 @@ static void temp_ctrl_check() } /* Read the current SoC temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_SOC); + rc = lc15bts_temp_get(LC15BTS_TEMP_SOC, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, "Failed to read the SoC temperature. rc=%d\n", rc); @@ -245,7 +245,7 @@ static void temp_ctrl_check() } /* Read the current fpga temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_FPGA); + rc = lc15bts_temp_get(LC15BTS_TEMP_FPGA, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, "Failed to read the fpga temperature. rc=%d\n", rc); @@ -259,94 +259,79 @@ static void temp_ctrl_check() LOGP(DTEMP, LOGL_DEBUG, "FPGA temperature is: %d\n", temp); } - /* Read the current RF log detector temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_LOGRF); + /* Read the current memory temperature */ + rc = lc15bts_temp_get(LC15BTS_TEMP_MEMORY, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to read the RF log detector temperature. rc=%d\n", rc); + "Failed to read the memory temperature. rc=%d\n", rc); warn_thresh_passed = crit_thresh_passed = 1; } else { int temp = rc / 1000; - if (temp > s_mgr->temp.logrf_limit.thresh_warn) + if (temp > s_mgr->temp.memory_limit.thresh_warn) warn_thresh_passed = 1; - if (temp > s_mgr->temp.logrf_limit.thresh_crit) + if (temp > s_mgr->temp.memory_limit.thresh_crit) crit_thresh_passed = 1; - LOGP(DTEMP, LOGL_DEBUG, "RF log detector temperature is: %d\n", temp); - } - - /* Read the current OCXO temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_OCXO); - if (rc < 0) { - LOGP(DTEMP, LOGL_ERROR, - "Failed to read the OCXO temperature. rc=%d\n", rc); - warn_thresh_passed = crit_thresh_passed = 1; - } else { - int temp = rc / 1000; - if (temp > s_mgr->temp.ocxo_limit.thresh_warn) - warn_thresh_passed = 1; - if (temp > s_mgr->temp.ocxo_limit.thresh_crit) - crit_thresh_passed = 1; - LOGP(DTEMP, LOGL_DEBUG, "OCXO temperature is: %d\n", temp); + LOGP(DTEMP, LOGL_DEBUG, "Memory temperature is: %d\n", temp); } /* Read the current TX #1 temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_TX0); + rc = lc15bts_temp_get(LC15BTS_TEMP_TX1, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to read the TX #0 temperature. rc=%d\n", rc); + "Failed to read the TX #1 temperature. rc=%d\n", rc); warn_thresh_passed = crit_thresh_passed = 1; } else { int temp = rc / 1000; - if (temp > s_mgr->temp.tx0_limit.thresh_warn) + if (temp > s_mgr->temp.tx1_limit.thresh_warn) warn_thresh_passed = 1; - if (temp > s_mgr->temp.tx0_limit.thresh_crit) + if (temp > s_mgr->temp.tx1_limit.thresh_crit) crit_thresh_passed = 1; - LOGP(DTEMP, LOGL_DEBUG, "TX #0 temperature is: %d\n", temp); + LOGP(DTEMP, LOGL_DEBUG, "TX #1 temperature is: %d\n", temp); } /* Read the current TX #2 temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_TX1); + rc = lc15bts_temp_get(LC15BTS_TEMP_TX2, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to read the TX #1 temperature. rc=%d\n", rc); + "Failed to read the TX #2 temperature. rc=%d\n", rc); warn_thresh_passed = crit_thresh_passed = 1; } else { int temp = rc / 1000; - if (temp > s_mgr->temp.tx1_limit.thresh_warn) + if (temp > s_mgr->temp.tx2_limit.thresh_warn) warn_thresh_passed = 1; - if (temp > s_mgr->temp.tx1_limit.thresh_crit) + if (temp > s_mgr->temp.tx2_limit.thresh_crit) crit_thresh_passed = 1; - LOGP(DTEMP, LOGL_DEBUG, "TX #1 temperature is: %d\n", temp); + LOGP(DTEMP, LOGL_DEBUG, "TX #2 temperature is: %d\n", temp); } /* Read the current PA #1 temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_PA0); + rc = lc15bts_temp_get(LC15BTS_TEMP_PA1, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to read the PA #0 temperature. rc=%d\n", rc); + "Failed to read the PA #1 temperature. rc=%d\n", rc); warn_thresh_passed = crit_thresh_passed = 1; } else { int temp = rc / 1000; - if (temp > s_mgr->temp.pa0_limit.thresh_warn) + if (temp > s_mgr->temp.pa1_limit.thresh_warn) warn_thresh_passed = 1; - if (temp > s_mgr->temp.pa0_limit.thresh_crit) + if (temp > s_mgr->temp.pa1_limit.thresh_crit) crit_thresh_passed = 1; - LOGP(DTEMP, LOGL_DEBUG, "PA #0 temperature is: %d\n", temp); + LOGP(DTEMP, LOGL_DEBUG, "PA #1 temperature is: %d\n", temp); } /* Read the current PA #2 temperature */ - rc = lc15bts_temp_get(LC15BTS_TEMP_PA1); + rc = lc15bts_temp_get(LC15BTS_TEMP_PA2, LC15BTS_TEMP_INPUT); if (rc < 0) { LOGP(DTEMP, LOGL_ERROR, - "Failed to read the PA #1 temperature. rc=%d\n", rc); + "Failed to read the PA #2 temperature. rc=%d\n", rc); warn_thresh_passed = crit_thresh_passed = 1; } else { int temp = rc / 1000; - if (temp > s_mgr->temp.pa1_limit.thresh_warn) + if (temp > s_mgr->temp.pa2_limit.thresh_warn) warn_thresh_passed = 1; - if (temp > s_mgr->temp.pa1_limit.thresh_crit) + if (temp > s_mgr->temp.pa2_limit.thresh_crit) crit_thresh_passed = 1; - LOGP(DTEMP, LOGL_DEBUG, "PA #1 temperature is: %d\n", temp); + LOGP(DTEMP, LOGL_DEBUG, "PA #2 temperature is: %d\n", temp); } lc15bts_mgr_temp_handle(s_mgr, crit_thresh_passed, warn_thresh_passed); diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c b/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c index 280c9c75..e5ef55f8 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c @@ -67,12 +67,11 @@ static int go_to_parent(struct vty *vty) case LIMIT_SUPPLY_NODE: case LIMIT_SOC_NODE: case LIMIT_FPGA_NODE: - case LIMIT_LOGRF_NODE: - case LIMIT_OCXO_NODE: - case LIMIT_TX0_NODE: + case LIMIT_MEMORY_NODE: case LIMIT_TX1_NODE: - case LIMIT_PA0_NODE: + case LIMIT_TX2_NODE: case LIMIT_PA1_NODE: + case LIMIT_PA2_NODE: vty->node = MGR_NODE; break; default: @@ -91,12 +90,11 @@ static int is_config_node(struct vty *vty, int node) case LIMIT_SUPPLY_NODE: case LIMIT_SOC_NODE: case LIMIT_FPGA_NODE: - case LIMIT_LOGRF_NODE: - case LIMIT_OCXO_NODE: - case LIMIT_TX0_NODE: + case LIMIT_MEMORY_NODE: case LIMIT_TX1_NODE: - case LIMIT_PA0_NODE: + case LIMIT_TX2_NODE: case LIMIT_PA1_NODE: + case LIMIT_PA2_NODE: return 1; default: return 0; @@ -156,31 +154,20 @@ static struct cmd_node limit_fpga_node = { 1, }; -static struct cmd_node limit_logrf_node = { - LIMIT_LOGRF_NODE, - "%s(limit-logrf)# ", +static struct cmd_node limit_memory_node = { + LIMIT_MEMORY_NODE, + "%s(limit-memory)# ", 1, }; -static struct cmd_node limit_ocxo_node = { - LIMIT_OCXO_NODE, - "%s(limit-ocxo)# ", - 1, -}; - -static struct cmd_node limit_tx0_node = { - LIMIT_TX0_NODE, - "%s(limit-tx0)# ", - 1, -}; static struct cmd_node limit_tx1_node = { LIMIT_TX1_NODE, "%s(limit-tx1)# ", 1, }; -static struct cmd_node limit_pa0_node = { - LIMIT_PA0_NODE, - "%s(limit-pa0)# ", +static struct cmd_node limit_tx2_node = { + LIMIT_TX2_NODE, + "%s(limit-tx2)# ", 1, }; static struct cmd_node limit_pa1_node = { @@ -188,6 +175,11 @@ static struct cmd_node limit_pa1_node = { "%s(limit-pa1)# ", 1, }; +static struct cmd_node limit_pa2_node = { + LIMIT_PA2_NODE, + "%s(limit-pa2)# ", + 1, +}; DEFUN(cfg_mgr, cfg_mgr_cmd, "lc15bts-mgr", @@ -210,10 +202,10 @@ static void write_temp_limit(struct vty *vty, const char *name, static void write_norm_action(struct vty *vty, const char *name, int actions) { vty_out(vty, " %s%s", name, VTY_NEWLINE); - vty_out(vty, " %spa0-on%s", - (actions & TEMP_ACT_NORM_PA0_ON) ? "" : "no ", VTY_NEWLINE); vty_out(vty, " %spa1-on%s", (actions & TEMP_ACT_NORM_PA1_ON) ? "" : "no ", VTY_NEWLINE); + vty_out(vty, " %spa2-on%s", + (actions & TEMP_ACT_NORM_PA2_ON) ? "" : "no ", VTY_NEWLINE); vty_out(vty, " %sbts-service-on%s", (actions & TEMP_ACT_NORM_BTS_SRV_ON) ? "" : "no ", VTY_NEWLINE); } @@ -221,10 +213,10 @@ static void write_norm_action(struct vty *vty, const char *name, int actions) static void write_action(struct vty *vty, const char *name, int actions) { vty_out(vty, " %s%s", name, VTY_NEWLINE); - vty_out(vty, " %spa0-off%s", - (actions & TEMP_ACT_PA0_OFF) ? "" : "no ", VTY_NEWLINE); vty_out(vty, " %spa1-off%s", (actions & TEMP_ACT_PA1_OFF) ? "" : "no ", VTY_NEWLINE); + vty_out(vty, " %spa2-off%s", + (actions & TEMP_ACT_PA2_OFF) ? "" : "no ", VTY_NEWLINE); vty_out(vty, " %sbts-service-off%s", (actions & TEMP_ACT_BTS_SRV_OFF) ? "" : "no ", VTY_NEWLINE); } @@ -236,12 +228,11 @@ static int config_write_mgr(struct vty *vty) write_temp_limit(vty, "limits supply", &s_mgr->temp.supply_limit); write_temp_limit(vty, "limits soc", &s_mgr->temp.soc_limit); write_temp_limit(vty, "limits fpga", &s_mgr->temp.fpga_limit); - write_temp_limit(vty, "limits logrf", &s_mgr->temp.logrf_limit); - write_temp_limit(vty, "limits ocxo", &s_mgr->temp.ocxo_limit); - write_temp_limit(vty, "limits tx0", &s_mgr->temp.tx0_limit); + write_temp_limit(vty, "limits memory", &s_mgr->temp.memory_limit); write_temp_limit(vty, "limits tx1", &s_mgr->temp.tx1_limit); - write_temp_limit(vty, "limits pa0", &s_mgr->temp.pa0_limit); + write_temp_limit(vty, "limits tx2", &s_mgr->temp.tx2_limit); write_temp_limit(vty, "limits pa1", &s_mgr->temp.pa1_limit); + write_temp_limit(vty, "limits pa2", &s_mgr->temp.pa2_limit); write_norm_action(vty, "actions normal", s_mgr->temp.action_norm); write_action(vty, "actions warn", s_mgr->temp.action_warn); @@ -268,12 +259,11 @@ DEFUN(cfg_limit_##name, cfg_limit_##name##_cmd, \ CFG_LIMIT(supply, "SUPPLY\n", LIMIT_SUPPLY_NODE, supply_limit) CFG_LIMIT(soc, "SOC\n", LIMIT_SOC_NODE, soc_limit) CFG_LIMIT(fpga, "FPGA\n", LIMIT_FPGA_NODE, fpga_limit) -CFG_LIMIT(logrf, "LOGRF\n", LIMIT_LOGRF_NODE, logrf_limit) -CFG_LIMIT(ocxo, "OCXO\n", LIMIT_OCXO_NODE, ocxo_limit) -CFG_LIMIT(tx0, "TX0\n", LIMIT_TX0_NODE, tx0_limit) +CFG_LIMIT(memory, "MEMORY\n", LIMIT_MEMORY_NODE, memory_limit) CFG_LIMIT(tx1, "TX1\n", LIMIT_TX1_NODE, tx1_limit) -CFG_LIMIT(pa0, "PA0\n", LIMIT_PA0_NODE, pa0_limit) +CFG_LIMIT(tx2, "TX2\n", LIMIT_TX2_NODE, tx2_limit) CFG_LIMIT(pa1, "PA1\n", LIMIT_PA1_NODE, pa1_limit) +CFG_LIMIT(pa2, "PA2\n", LIMIT_PA2_NODE, pa2_limit) #undef CFG_LIMIT DEFUN(cfg_limit_warning, cfg_thresh_warning_cmd, @@ -308,39 +298,39 @@ CFG_ACTION(warn, "Warning Actions\n", ACT_WARN_NODE, action_warn) CFG_ACTION(critical, "Critical Actions\n", ACT_CRIT_NODE, action_crit) #undef CFG_ACTION -DEFUN(cfg_action_pa0_on, cfg_action_pa0_on_cmd, - "pa0-on", - "Switch the Power Amplifier #0 on\n") +DEFUN(cfg_action_pa1_on, cfg_action_pa1_on_cmd, + "pa1-on", + "Switch the Power Amplifier #1 on\n") { int *action = vty->index; - *action |= TEMP_ACT_NORM_PA0_ON; + *action |= TEMP_ACT_NORM_PA1_ON; return CMD_SUCCESS; } -DEFUN(cfg_no_action_pa0_on, cfg_no_action_pa0_on_cmd, - "no pa0-on", - NO_STR "Switch the Power Amplifieri #0 on\n") +DEFUN(cfg_no_action_pa1_on, cfg_no_action_pa1_on_cmd, + "no pa1-on", + NO_STR "Switch the Power Amplifieri #1 on\n") { int *action = vty->index; - *action &= ~TEMP_ACT_NORM_PA0_ON; + *action &= ~TEMP_ACT_NORM_PA1_ON; return CMD_SUCCESS; } -DEFUN(cfg_action_pa1_on, cfg_action_pa1_on_cmd, - "pa1-on", - "Switch the Power Amplifier #1 on\n") +DEFUN(cfg_action_pa2_on, cfg_action_pa2_on_cmd, + "pa2-on", + "Switch the Power Amplifier #2 on\n") { int *action = vty->index; - *action |= TEMP_ACT_NORM_PA1_ON; + *action |= TEMP_ACT_NORM_PA2_ON; return CMD_SUCCESS; } -DEFUN(cfg_no_action_pa1_on, cfg_no_action_pa1_on_cmd, - "no pa1-on", - NO_STR "Switch the Power Amplifieri #1 on\n") +DEFUN(cfg_no_action_pa2_on, cfg_no_action_pa2_on_cmd, + "no pa2-on", + NO_STR "Switch the Power Amplifieri #2 on\n") { int *action = vty->index; - *action &= ~TEMP_ACT_NORM_PA1_ON; + *action &= ~TEMP_ACT_NORM_PA2_ON; return CMD_SUCCESS; } @@ -362,39 +352,39 @@ DEFUN(cfg_no_action_bts_srv_on, cfg_no_action_bts_srv_on_cmd, return CMD_SUCCESS; } -DEFUN(cfg_action_pa0_off, cfg_action_pa0_off_cmd, - "pa0-off", - "Switch the Power Amplifier #0 off\n") +DEFUN(cfg_action_pa1_off, cfg_action_pa1_off_cmd, + "pa1-off", + "Switch the Power Amplifier #1 off\n") { int *action = vty->index; - *action |= TEMP_ACT_PA0_OFF; + *action |= TEMP_ACT_PA1_OFF; return CMD_SUCCESS; } -DEFUN(cfg_no_action_pa0_off, cfg_no_action_pa0_off_cmd, - "no pa0-off", - NO_STR "Do not switch off the Power Amplifier #0\n") +DEFUN(cfg_no_action_pa1_off, cfg_no_action_pa1_off_cmd, + "no pa1-off", + NO_STR "Do not switch off the Power Amplifier #1\n") { int *action = vty->index; - *action &= ~TEMP_ACT_PA0_OFF; + *action &= ~TEMP_ACT_PA1_OFF; return CMD_SUCCESS; } -DEFUN(cfg_action_pa1_off, cfg_action_pa1_off_cmd, - "pa1-off", - "Switch the Power Amplifier #1 off\n") +DEFUN(cfg_action_pa2_off, cfg_action_pa2_off_cmd, + "pa2-off", + "Switch the Power Amplifier #2 off\n") { int *action = vty->index; - *action |= TEMP_ACT_PA1_OFF; + *action |= TEMP_ACT_PA2_OFF; return CMD_SUCCESS; } -DEFUN(cfg_no_action_pa1_off, cfg_no_action_pa1_off_cmd, - "no pa1-off", - NO_STR "Do not switch off the Power Amplifier #1\n") +DEFUN(cfg_no_action_pa2_off, cfg_no_action_pa2_off_cmd, + "no pa2-off", + NO_STR "Do not switch off the Power Amplifier #2\n") { int *action = vty->index; - *action &= ~TEMP_ACT_PA1_OFF; + *action &= ~TEMP_ACT_PA2_OFF; return CMD_SUCCESS; } @@ -423,35 +413,40 @@ DEFUN(show_mgr, show_mgr_cmd, "show manager", lc15bts_mgr_temp_get_state(s_mgr->temp.state), VTY_NEWLINE); vty_out(vty, "Current Temperatures%s", VTY_NEWLINE); vty_out(vty, " Main Supply : %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_SUPPLY) / 1000.0f, + lc15bts_temp_get(LC15BTS_TEMP_SUPPLY, + LC15BTS_TEMP_INPUT) / 1000.0f, VTY_NEWLINE); vty_out(vty, " SoC : %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_SOC) / 1000.0f, + lc15bts_temp_get(LC15BTS_TEMP_SOC, + LC15BTS_TEMP_INPUT) / 1000.0f, VTY_NEWLINE); vty_out(vty, " FPGA : %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_FPGA) / 1000.0f, - VTY_NEWLINE); - vty_out(vty, " LogRF : %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_LOGRF) / 1000.0f, - VTY_NEWLINE); - vty_out(vty, " OCXO : %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_OCXO) / 1000.0f, + lc15bts_temp_get(LC15BTS_TEMP_FPGA, + LC15BTS_TEMP_INPUT) / 1000.0f, VTY_NEWLINE); - vty_out(vty, " TX 0 : %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_TX0) / 1000.0f, + vty_out(vty, " Memory (DDR): %f Celcius%s", + lc15bts_temp_get(LC15BTS_TEMP_MEMORY, + LC15BTS_TEMP_INPUT) / 1000.0f, VTY_NEWLINE); vty_out(vty, " TX 1 : %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_TX1) / 1000.0f, + lc15bts_temp_get(LC15BTS_TEMP_TX1, + LC15BTS_TEMP_INPUT) / 1000.0f, VTY_NEWLINE); - vty_out(vty, " Power Amp #0: %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_PA0) / 1000.0f, + vty_out(vty, " TX 2 : %f Celcius%s", + lc15bts_temp_get(LC15BTS_TEMP_TX2, + LC15BTS_TEMP_INPUT) / 1000.0f, VTY_NEWLINE); vty_out(vty, " Power Amp #1: %f Celcius%s", - lc15bts_temp_get(LC15BTS_TEMP_PA1) / 1000.0f, + lc15bts_temp_get(LC15BTS_TEMP_PA1, + LC15BTS_TEMP_INPUT) / 1000.0f, + VTY_NEWLINE); + vty_out(vty, " Power Amp #2: %f Celcius%s", + lc15bts_temp_get(LC15BTS_TEMP_PA2, + LC15BTS_TEMP_INPUT) / 1000.0f, VTY_NEWLINE); vty_out(vty, "Power Status%s", VTY_NEWLINE); - vty_out(vty, " Main Supply : ON [%6.2f Vdc, %4.2f A, %6.2f W]%s", + vty_out(vty, " Main Supply : (ON) [%6.2f Vdc, %4.2f A, %6.2f W]%s", lc15bts_power_sensor_get(LC15BTS_POWER_SUPPLY, LC15BTS_POWER_VOLTAGE)/1000.0f, lc15bts_power_sensor_get(LC15BTS_POWER_SUPPLY, @@ -459,15 +454,6 @@ DEFUN(show_mgr, show_mgr_cmd, "show manager", lc15bts_power_sensor_get(LC15BTS_POWER_SUPPLY, LC15BTS_POWER_POWER)/1000000.0f, VTY_NEWLINE); - vty_out(vty, " Power Amp #0: %s [%6.2f Vdc, %4.2f A, %6.2f W]%s", - lc15bts_power_get(LC15BTS_POWER_PA0) ? "ON " : "OFF", - lc15bts_power_sensor_get(LC15BTS_POWER_PA0, - LC15BTS_POWER_VOLTAGE)/1000.0f, - lc15bts_power_sensor_get(LC15BTS_POWER_PA0, - LC15BTS_POWER_CURRENT)/1000.0f, - lc15bts_power_sensor_get(LC15BTS_POWER_PA0, - LC15BTS_POWER_POWER)/1000000.0f, - VTY_NEWLINE); vty_out(vty, " Power Amp #1: %s [%6.2f Vdc, %4.2f A, %6.2f W]%s", lc15bts_power_get(LC15BTS_POWER_PA1) ? "ON " : "OFF", lc15bts_power_sensor_get(LC15BTS_POWER_PA1, @@ -477,6 +463,15 @@ DEFUN(show_mgr, show_mgr_cmd, "show manager", lc15bts_power_sensor_get(LC15BTS_POWER_PA1, LC15BTS_POWER_POWER)/1000000.0f, VTY_NEWLINE); + vty_out(vty, " Power Amp #2: %s [%6.2f Vdc, %4.2f A, %6.2f W]%s", + lc15bts_power_get(LC15BTS_POWER_PA2) ? "ON " : "OFF", + lc15bts_power_sensor_get(LC15BTS_POWER_PA2, + LC15BTS_POWER_VOLTAGE)/1000.0f, + lc15bts_power_sensor_get(LC15BTS_POWER_PA2, + LC15BTS_POWER_CURRENT)/1000.0f, + lc15bts_power_sensor_get(LC15BTS_POWER_PA2, + LC15BTS_POWER_POWER)/1000000.0f, + VTY_NEWLINE); return CMD_SUCCESS; } @@ -501,20 +496,20 @@ static void register_limit(int limit) static void register_normal_action(int act) { - install_element(act, &cfg_action_pa0_on_cmd); - install_element(act, &cfg_no_action_pa0_on_cmd); install_element(act, &cfg_action_pa1_on_cmd); install_element(act, &cfg_no_action_pa1_on_cmd); + install_element(act, &cfg_action_pa2_on_cmd); + install_element(act, &cfg_no_action_pa2_on_cmd); install_element(act, &cfg_action_bts_srv_on_cmd); install_element(act, &cfg_no_action_bts_srv_on_cmd); } static void register_action(int act) { - install_element(act, &cfg_action_pa0_off_cmd); - install_element(act, &cfg_no_action_pa0_off_cmd); install_element(act, &cfg_action_pa1_off_cmd); install_element(act, &cfg_no_action_pa1_off_cmd); + install_element(act, &cfg_action_pa2_off_cmd); + install_element(act, &cfg_no_action_pa2_off_cmd); install_element(act, &cfg_action_bts_srv_off_cmd); install_element(act, &cfg_no_action_bts_srv_off_cmd); } @@ -547,36 +542,31 @@ int lc15bts_mgr_vty_init(void) register_limit(LIMIT_FPGA_NODE); vty_install_default(LIMIT_FPGA_NODE); - install_node(&limit_logrf_node, config_write_dummy); - install_element(MGR_NODE, &cfg_limit_logrf_cmd); - register_limit(LIMIT_LOGRF_NODE); - vty_install_default(LIMIT_LOGRF_NODE); - - install_node(&limit_ocxo_node, config_write_dummy); - install_element(MGR_NODE, &cfg_limit_ocxo_cmd); - register_limit(LIMIT_OCXO_NODE); - vty_install_default(LIMIT_OCXO_NODE); - - install_node(&limit_tx0_node, config_write_dummy); - install_element(MGR_NODE, &cfg_limit_tx0_cmd); - register_limit(LIMIT_TX0_NODE); - vty_install_default(LIMIT_TX0_NODE); + install_node(&limit_memory_node, config_write_dummy); + install_element(MGR_NODE, &cfg_limit_memory_cmd); + register_limit(LIMIT_MEMORY_NODE); + vty_install_default(LIMIT_MEMORY_NODE); install_node(&limit_tx1_node, config_write_dummy); install_element(MGR_NODE, &cfg_limit_tx1_cmd); register_limit(LIMIT_TX1_NODE); vty_install_default(LIMIT_TX1_NODE); - install_node(&limit_pa0_node, config_write_dummy); - install_element(MGR_NODE, &cfg_limit_pa0_cmd); - register_limit(LIMIT_PA0_NODE); - vty_install_default(LIMIT_PA0_NODE); + install_node(&limit_tx2_node, config_write_dummy); + install_element(MGR_NODE, &cfg_limit_tx2_cmd); + register_limit(LIMIT_TX2_NODE); + vty_install_default(LIMIT_TX2_NODE); install_node(&limit_pa1_node, config_write_dummy); install_element(MGR_NODE, &cfg_limit_pa1_cmd); register_limit(LIMIT_PA1_NODE); vty_install_default(LIMIT_PA1_NODE); + install_node(&limit_pa2_node, config_write_dummy); + install_element(MGR_NODE, &cfg_limit_pa2_cmd); + register_limit(LIMIT_PA2_NODE); + vty_install_default(LIMIT_PA2_NODE); + /* install the normal node */ install_node(&act_norm_node, config_write_dummy); install_element(MGR_NODE, &cfg_action_normal_cmd); diff --git a/src/osmo-bts-litecell15/misc/lc15bts_misc.c b/src/osmo-bts-litecell15/misc/lc15bts_misc.c index 5ff8e312..e0602c82 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_misc.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_misc.c @@ -74,41 +74,37 @@ static const struct { .ee_par = LC15BTS_PAR_TEMP_FPGA_MAX, }, { - .name = "logrf", + .name = "memory", .has_max = 1, - .sensor = LC15BTS_TEMP_LOGRF, - .ee_par = LC15BTS_PAR_TEMP_LOGRF_MAX, - }, { - .name = "ocxo", - .has_max = 1, - .sensor = LC15BTS_TEMP_OCXO, - .ee_par = LC15BTS_PAR_TEMP_OCXO_MAX, - }, { - .name = "tx0", - .has_max = 0, - .sensor = LC15BTS_TEMP_TX0, - .ee_par = LC15BTS_PAR_TEMP_TX0_MAX, + .sensor = LC15BTS_TEMP_MEMORY, + .ee_par = LC15BTS_PAR_TEMP_MEMORY_MAX, }, { .name = "tx1", .has_max = 0, .sensor = LC15BTS_TEMP_TX1, .ee_par = LC15BTS_PAR_TEMP_TX1_MAX, }, { - .name = "pa0", - .has_max = 1, - .sensor = LC15BTS_TEMP_PA0, - .ee_par = LC15BTS_PAR_TEMP_PA0_MAX, + .name = "tx2", + .has_max = 0, + .sensor = LC15BTS_TEMP_TX2, + .ee_par = LC15BTS_PAR_TEMP_TX2_MAX, }, { .name = "pa1", .has_max = 1, .sensor = LC15BTS_TEMP_PA1, .ee_par = LC15BTS_PAR_TEMP_PA1_MAX, + }, { + .name = "pa2", + .has_max = 1, + .sensor = LC15BTS_TEMP_PA2, + .ee_par = LC15BTS_PAR_TEMP_PA2_MAX, } }; void lc15bts_check_temp(int no_rom_write) { int temp_old[ARRAY_SIZE(temp_data)]; + int temp_hi[ARRAY_SIZE(temp_data)]; int temp_cur[ARRAY_SIZE(temp_data)]; int i, rc; @@ -116,24 +112,40 @@ void lc15bts_check_temp(int no_rom_write) int ret; rc = lc15bts_par_get_int(temp_data[i].ee_par, &ret); temp_old[i] = ret * 1000; + if (temp_data[i].has_max) { + temp_hi[i] = lc15bts_temp_get(temp_data[i].sensor, + LC15BTS_TEMP_HIGHEST); + temp_cur[i] = lc15bts_temp_get(temp_data[i].sensor, + LC15BTS_TEMP_INPUT); + + if ((temp_cur[i] < 0 && temp_cur[i] > -1000) || + (temp_hi[i] < 0 && temp_hi[i] > -1000)) { + LOGP(DTEMP, LOGL_ERROR, "Error reading temperature\n"); + continue; + } + } + else { + temp_cur[i] = lc15bts_temp_get(temp_data[i].sensor, + LC15BTS_TEMP_INPUT); - temp_cur[i] = lc15bts_temp_get(temp_data[i].sensor); - if (temp_cur[i] < 0 && temp_cur[i] > -1000) { - LOGP(DTEMP, LOGL_ERROR, "Error reading temperature (%d)\n", temp_data[i].sensor); - continue; + if (temp_cur[i] < 0 && temp_cur[i] > -1000) { + LOGP(DTEMP, LOGL_ERROR, "Error reading temperature\n"); + continue; + } + temp_hi[i] = temp_cur[i]; } - + LOGP(DTEMP, LOGL_DEBUG, "Current %s temperature: %d.%d C\n", temp_data[i].name, temp_cur[i]/1000, temp_cur[i]%1000); - if (temp_cur[i] > temp_old[i]) { + if (temp_hi[i] > temp_old[i]) { LOGP(DTEMP, LOGL_NOTICE, "New maximum %s " "temperature: %d.%d C\n", temp_data[i].name, - temp_cur[i]/1000, temp_old[i]%1000); + temp_hi[i]/1000, temp_hi[i]%1000); if (!no_rom_write) { rc = lc15bts_par_set_int(temp_data[i].ee_par, - temp_cur[i]/1000); + temp_hi[i]/1000); if (rc < 0) LOGP(DTEMP, LOGL_ERROR, "error writing new %s " "max temp %d (%s)\n", temp_data[i].name, diff --git a/src/osmo-bts-litecell15/misc/lc15bts_par.c b/src/osmo-bts-litecell15/misc/lc15bts_par.c index 3d80e67d..71544261 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_par.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_par.c @@ -46,12 +46,11 @@ const struct value_string lc15bts_par_names[_NUM_LC15BTS_PAR+1] = { { LC15BTS_PAR_TEMP_SUPPLY_MAX, "temp-supply-max" }, { LC15BTS_PAR_TEMP_SOC_MAX, "temp-soc-max" }, { LC15BTS_PAR_TEMP_FPGA_MAX, "temp-fpga-max" }, - { LC15BTS_PAR_TEMP_LOGRF_MAX, "temp-logrf-max" }, - { LC15BTS_PAR_TEMP_OCXO_MAX, "temp-ocxo-max" }, - { LC15BTS_PAR_TEMP_TX0_MAX, "temp-tx0-max" }, + { LC15BTS_PAR_TEMP_MEMORY_MAX, "temp-memory-max" }, { LC15BTS_PAR_TEMP_TX1_MAX, "temp-tx1-max" }, - { LC15BTS_PAR_TEMP_PA0_MAX, "temp-pa0-max" }, + { LC15BTS_PAR_TEMP_TX2_MAX, "temp-tx2-max" }, { LC15BTS_PAR_TEMP_PA1_MAX, "temp-pa1-max" }, + { LC15BTS_PAR_TEMP_PA2_MAX, "temp-pa2-max" }, { LC15BTS_PAR_SERNR, "serial-nr" }, { LC15BTS_PAR_HOURS, "hours-running" }, { LC15BTS_PAR_BOOTS, "boot-count" }, @@ -65,12 +64,11 @@ int lc15bts_par_is_int(enum lc15bts_par par) case LC15BTS_PAR_TEMP_SUPPLY_MAX: case LC15BTS_PAR_TEMP_SOC_MAX: case LC15BTS_PAR_TEMP_FPGA_MAX: - case LC15BTS_PAR_TEMP_LOGRF_MAX: - case LC15BTS_PAR_TEMP_OCXO_MAX: - case LC15BTS_PAR_TEMP_TX0_MAX: + case LC15BTS_PAR_TEMP_MEMORY_MAX: case LC15BTS_PAR_TEMP_TX1_MAX: - case LC15BTS_PAR_TEMP_PA0_MAX: + case LC15BTS_PAR_TEMP_TX2_MAX: case LC15BTS_PAR_TEMP_PA1_MAX: + case LC15BTS_PAR_TEMP_PA2_MAX: case LC15BTS_PAR_SERNR: case LC15BTS_PAR_HOURS: case LC15BTS_PAR_BOOTS: diff --git a/src/osmo-bts-litecell15/misc/lc15bts_par.h b/src/osmo-bts-litecell15/misc/lc15bts_par.h index c50a69fc..7c182715 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_par.h +++ b/src/osmo-bts-litecell15/misc/lc15bts_par.h @@ -7,12 +7,11 @@ enum lc15bts_par { LC15BTS_PAR_TEMP_SUPPLY_MAX, LC15BTS_PAR_TEMP_SOC_MAX, LC15BTS_PAR_TEMP_FPGA_MAX, - LC15BTS_PAR_TEMP_LOGRF_MAX, - LC15BTS_PAR_TEMP_OCXO_MAX, - LC15BTS_PAR_TEMP_TX0_MAX, + LC15BTS_PAR_TEMP_MEMORY_MAX, LC15BTS_PAR_TEMP_TX1_MAX, - LC15BTS_PAR_TEMP_PA0_MAX, + LC15BTS_PAR_TEMP_TX2_MAX, LC15BTS_PAR_TEMP_PA1_MAX, + LC15BTS_PAR_TEMP_PA2_MAX, LC15BTS_PAR_SERNR, LC15BTS_PAR_HOURS, LC15BTS_PAR_BOOTS, diff --git a/src/osmo-bts-litecell15/misc/lc15bts_power.c b/src/osmo-bts-litecell15/misc/lc15bts_power.c index 5b01d36b..a2997ee2 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_power.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_power.c @@ -30,24 +30,24 @@ #define LC15BTS_PA_VOLTAGE 24000000 -#define PA_SUPPLY_MIN_SYSFS "/var/lc15/pa-supply/min_microvolts" -#define PA_SUPPLY_MAX_SYSFS "/var/lc15/pa-supply/max_microvolts" +#define PA_SUPPLY_MIN_SYSFS "/sys/devices/0.pa-supply/min_microvolts" +#define PA_SUPPLY_MAX_SYSFS "/sys/devices/0.pa-supply/max_microvolts" static const char *power_enable_devs[_NUM_POWER_SOURCES] = { - [LC15BTS_POWER_PA0] = "/var/lc15/pa-state/pa0/state", - [LC15BTS_POWER_PA1] = "/var/lc15/pa-state/pa1/state", + [LC15BTS_POWER_PA1] = "/sys/devices/0.pa1/state", + [LC15BTS_POWER_PA2] = "/sys/devices/0.pa2/state", }; static const char *power_sensor_devs[_NUM_POWER_SOURCES] = { - [LC15BTS_POWER_SUPPLY] = "/var/lc15/pwr-sense/pa-supply/", - [LC15BTS_POWER_PA0] = "/var/lc15/pwr-sense/pa0/", - [LC15BTS_POWER_PA1] = "/var/lc15/pwr-sense/pa1/", + [LC15BTS_POWER_SUPPLY] = "/sys/bus/i2c/devices/2-0040/hwmon/hwmon6/", + [LC15BTS_POWER_PA1] = "/sys/bus/i2c/devices/2-0044/hwmon/hwmon7/", + [LC15BTS_POWER_PA2] = "/sys/bus/i2c/devices/2-0045/hwmon/hwmon8/", }; static const char *power_sensor_type_str[_NUM_POWER_TYPES] = { - [LC15BTS_POWER_POWER] = "power", - [LC15BTS_POWER_VOLTAGE] = "voltage", - [LC15BTS_POWER_CURRENT] = "current", + [LC15BTS_POWER_POWER] = "power1_input", + [LC15BTS_POWER_VOLTAGE] = "in1_input", + [LC15BTS_POWER_CURRENT] = "curr1_input", }; int lc15bts_power_sensor_get( @@ -94,8 +94,8 @@ int lc15bts_power_set( int fd; int rc; - if ((source != LC15BTS_POWER_PA0) - && (source != LC15BTS_POWER_PA1) ) { + if ((source != LC15BTS_POWER_PA1) + && (source != LC15BTS_POWER_PA2) ) { return -EINVAL; } @@ -144,7 +144,6 @@ int lc15bts_power_get( { int fd; int rc; - int retVal = 0; char enstr[10]; fd = open(power_enable_devs[source], O_RDONLY); @@ -153,7 +152,7 @@ int lc15bts_power_get( } rc = read(fd, enstr, sizeof(enstr)); - enstr[rc-1] = '\0'; + enstr[sizeof(enstr)-1] = '\0'; close(fd); @@ -164,10 +163,5 @@ int lc15bts_power_get( return -EIO; } - rc = strcmp(enstr, "enabled"); - if(rc == 0) { - retVal = 1; - } - - return retVal; + return atoi(enstr); } diff --git a/src/osmo-bts-litecell15/misc/lc15bts_power.h b/src/osmo-bts-litecell15/misc/lc15bts_power.h index 8963b761..4bb27486 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_power.h +++ b/src/osmo-bts-litecell15/misc/lc15bts_power.h @@ -3,8 +3,8 @@ enum lc15bts_power_source { LC15BTS_POWER_SUPPLY, - LC15BTS_POWER_PA0, LC15BTS_POWER_PA1, + LC15BTS_POWER_PA2, _NUM_POWER_SOURCES }; diff --git a/src/osmo-bts-litecell15/misc/lc15bts_temp.c b/src/osmo-bts-litecell15/misc/lc15bts_temp.c index aa358547..fa6300e7 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_temp.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_temp.c @@ -31,27 +31,43 @@ static const char *temp_devs[_NUM_TEMP_SENSORS] = { - [LC15BTS_TEMP_SUPPLY] = "/var/lc15/temp/pa-supply/temp", - [LC15BTS_TEMP_SOC] = "/var/lc15/temp/cpu/temp", - [LC15BTS_TEMP_FPGA] = "/var/lc15/temp/fpga/temp", - [LC15BTS_TEMP_LOGRF] = "/var/lc15/temp/logrf/temp", - [LC15BTS_TEMP_OCXO] = "/var/lc15/temp/ocxo/temp", - [LC15BTS_TEMP_TX0] = "/var/lc15/temp/tx0/temp", - [LC15BTS_TEMP_TX1] = "/var/lc15/temp/tx1/temp", - [LC15BTS_TEMP_PA0] = "/var/lc15/temp/pa0/temp", - [LC15BTS_TEMP_PA1] = "/var/lc15/temp/pa1/temp", + [LC15BTS_TEMP_SUPPLY] = "/sys/bus/i2c/devices/2-004d/hwmon/hwmon5/temp1_", + [LC15BTS_TEMP_SOC] = "/sys/class/hwmon/hwmon1/temp1_", + [LC15BTS_TEMP_FPGA] = "/sys/devices/0.iio_hwmon/temp1_", + [LC15BTS_TEMP_MEMORY] = "/sys/bus/i2c/devices/2-004c/hwmon/hwmon4/temp1_", + [LC15BTS_TEMP_TX1] = "/sys/devices/0.ncp15xh103_tx1/temp1_", + [LC15BTS_TEMP_TX2] = "/sys/devices/0.ncp15xh103_tx2/temp1_", + [LC15BTS_TEMP_PA1] = "/sys/bus/i2c/devices/2-004d/hwmon/hwmon5/temp2_", + [LC15BTS_TEMP_PA2] = "/sys/bus/i2c/devices/2-004c/hwmon/hwmon4/temp2_", }; -int lc15bts_temp_get(enum lc15bts_temp_sensor sensor) +static const int temp_has_fault[_NUM_TEMP_SENSORS] = { + [LC15BTS_TEMP_PA1] = 1, + [LC15BTS_TEMP_PA2] = 1, +}; + +static const char *temp_type_str[_NUM_TEMP_TYPES] = { + [LC15BTS_TEMP_INPUT] = "input", + [LC15BTS_TEMP_LOWEST] = "lowest", + [LC15BTS_TEMP_HIGHEST] = "highest", + [LC15BTS_TEMP_FAULT] = "fault", +}; + +int lc15bts_temp_get(enum lc15bts_temp_sensor sensor, + enum lc15bts_temp_type type) { char buf[PATH_MAX]; char tempstr[8]; + char faultstr[8]; int fd, rc; if (sensor < 0 || sensor >= _NUM_TEMP_SENSORS) return -EINVAL; - snprintf(buf, sizeof(buf)-1, "%s", temp_devs[sensor]); + if (type >= ARRAY_SIZE(temp_type_str)) + return -EINVAL; + + snprintf(buf, sizeof(buf)-1, "%s%s", temp_devs[sensor], temp_type_str[type]); buf[sizeof(buf)-1] = '\0'; fd = open(buf, O_RDONLY); @@ -70,6 +86,32 @@ int lc15bts_temp_get(enum lc15bts_temp_sensor sensor) } close(fd); + // Check fault + if (type == LC15BTS_TEMP_FAULT || !temp_has_fault[sensor]) + return atoi(tempstr); + + snprintf(buf, sizeof(buf)-1, "%s%s", temp_devs[sensor], temp_type_str[LC15BTS_TEMP_FAULT]); + buf[sizeof(buf)-1] = '\0'; + + fd = open(buf, O_RDONLY); + if (fd < 0) + return fd; + + rc = read(fd, faultstr, sizeof(faultstr)); + tempstr[sizeof(faultstr)-1] = '\0'; + if (rc < 0) { + close(fd); + return rc; + } + if (rc == 0) { + close(fd); + return -EIO; + } + close(fd); + + if (atoi(faultstr)) + return -EIO; + return atoi(tempstr); } diff --git a/src/osmo-bts-litecell15/misc/lc15bts_temp.h b/src/osmo-bts-litecell15/misc/lc15bts_temp.h index aca8fe26..4b70cb8b 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_temp.h +++ b/src/osmo-bts-litecell15/misc/lc15bts_temp.h @@ -5,12 +5,11 @@ enum lc15bts_temp_sensor { LC15BTS_TEMP_SUPPLY, LC15BTS_TEMP_SOC, LC15BTS_TEMP_FPGA, - LC15BTS_TEMP_LOGRF, - LC15BTS_TEMP_OCXO, - LC15BTS_TEMP_TX0, + LC15BTS_TEMP_MEMORY, LC15BTS_TEMP_TX1, - LC15BTS_TEMP_PA0, + LC15BTS_TEMP_TX2, LC15BTS_TEMP_PA1, + LC15BTS_TEMP_PA2, _NUM_TEMP_SENSORS }; @@ -22,6 +21,7 @@ enum lc15bts_temp_type { _NUM_TEMP_TYPES }; -int lc15bts_temp_get(enum lc15bts_temp_sensor sensor); +int lc15bts_temp_get(enum lc15bts_temp_sensor sensor, + enum lc15bts_temp_type type); #endif -- cgit v1.2.3