parent
1c1b0e843d
commit
3eaaa18e2a
|
@ -57,31 +57,31 @@ struct calib_file_desc {
|
||||||
|
|
||||||
static const struct calib_file_desc calib_files[] = {
|
static const struct calib_file_desc calib_files[] = {
|
||||||
{
|
{
|
||||||
.fname = "calib_rx0a.conf",
|
|
||||||
.rx = 1,
|
|
||||||
.trx = 0,
|
|
||||||
.rxpath = 0,
|
|
||||||
}, {
|
|
||||||
.fname = "calib_rx0b.conf",
|
|
||||||
.rx = 1,
|
|
||||||
.trx = 0,
|
|
||||||
.rxpath = 1,
|
|
||||||
}, {
|
|
||||||
.fname = "calib_rx1a.conf",
|
.fname = "calib_rx1a.conf",
|
||||||
.rx = 1,
|
.rx = 1,
|
||||||
.trx = 1,
|
.trx = 0,
|
||||||
.rxpath = 0,
|
.rxpath = 0,
|
||||||
}, {
|
}, {
|
||||||
.fname = "calib_rx1b.conf",
|
.fname = "calib_rx1b.conf",
|
||||||
.rx = 1,
|
.rx = 1,
|
||||||
|
.trx = 0,
|
||||||
|
.rxpath = 1,
|
||||||
|
}, {
|
||||||
|
.fname = "calib_rx2a.conf",
|
||||||
|
.rx = 1,
|
||||||
|
.trx = 1,
|
||||||
|
.rxpath = 0,
|
||||||
|
}, {
|
||||||
|
.fname = "calib_rx2b.conf",
|
||||||
|
.rx = 1,
|
||||||
.trx = 1,
|
.trx = 1,
|
||||||
.rxpath = 1,
|
.rxpath = 1,
|
||||||
}, {
|
}, {
|
||||||
.fname = "calib_tx0.conf",
|
.fname = "calib_tx1.conf",
|
||||||
.rx = 0,
|
.rx = 0,
|
||||||
.trx = 0,
|
.trx = 0,
|
||||||
}, {
|
}, {
|
||||||
.fname = "calib_tx1.conf",
|
.fname = "calib_tx2.conf",
|
||||||
.rx = 0,
|
.rx = 0,
|
||||||
.trx = 1,
|
.trx = 1,
|
||||||
},
|
},
|
||||||
|
|
|
@ -63,7 +63,7 @@ int lc15bts_led_set(enum lc15bts_led_color c)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open("/var/lc15/leds/led0/brightness", O_WRONLY);
|
fd = open("/sys/class/leds/usr0/brightness", O_WRONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ int lc15bts_led_set(enum lc15bts_led_color c)
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
fd = open("/var/lc15/leds/led1/brightness", O_WRONLY);
|
fd = open("/sys/class/leds/usr1/brightness", O_WRONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ int l1if_transport_open(int q, struct lc15l1_hdl *hdl)
|
||||||
struct osmo_wqueue *wq = &hdl->write_q[q];
|
struct osmo_wqueue *wq = &hdl->write_q[q];
|
||||||
struct osmo_fd *write_ofd = &hdl->write_q[q].bfd;
|
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';
|
buf[sizeof(buf)-1] = '\0';
|
||||||
|
|
||||||
rc = open(buf, O_RDONLY);
|
rc = open(buf, O_RDONLY);
|
||||||
|
@ -270,7 +270,7 @@ int l1if_transport_open(int q, struct lc15l1_hdl *hdl)
|
||||||
return rc;
|
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';
|
buf[sizeof(buf)-1] = '\0';
|
||||||
|
|
||||||
rc = open(buf, O_WRONLY);
|
rc = open(buf, O_WRONLY);
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#include "lc15bts_bid.h"
|
#include "lc15bts_bid.h"
|
||||||
|
|
||||||
#define BOARD_REV_SYSFS "/var/lc15/platform/revision"
|
#define BOARD_REV_SYSFS "/sys/devices/0.lc15/revision"
|
||||||
#define BOARD_OPT_SYSFS "/var/lc15/platform/option"
|
#define BOARD_OPT_SYSFS "/sys/devices/0.lc15/option"
|
||||||
|
|
||||||
static const int option_type_mask[_NUM_OPTION_TYPES] = {
|
static const int option_type_mask[_NUM_OPTION_TYPES] = {
|
||||||
[LC15BTS_OPTION_OCXO] = 0x07,
|
[LC15BTS_OPTION_OCXO] = 0x07,
|
||||||
|
|
|
@ -27,15 +27,15 @@
|
||||||
|
|
||||||
#include "lc15bts_clock.h"
|
#include "lc15bts_clock.h"
|
||||||
|
|
||||||
#define CLKERR_ERR_SYSFS "/var/lc15/clkerr/clkerr1_average"
|
#define CLKERR_ERR_SYSFS "/sys/devices/5002000.clkerr/clkerr1_average"
|
||||||
#define CLKERR_ACC_SYSFS "/var/lc15/clkerr/clkerr1_average_accuracy"
|
#define CLKERR_ACC_SYSFS "/sys/devices/5002000.clkerr/clkerr1_average_accuracy"
|
||||||
#define CLKERR_INT_SYSFS "/var/lc15/clkerr/clkerr1_average_interval"
|
#define CLKERR_INT_SYSFS "/sys/devices/5002000.clkerr/clkerr1_average_interval"
|
||||||
#define CLKERR_FLT_SYSFS "/var/lc15/clkerr/clkerr1_fault"
|
#define CLKERR_FLT_SYSFS "/sys/devices/5002000.clkerr/clkerr1_fault"
|
||||||
#define CLKERR_RFS_SYSFS "/var/lc15/clkerr/refresh"
|
#define CLKERR_RFS_SYSFS "/sys/devices/5002000.clkerr/refresh"
|
||||||
#define CLKERR_RST_SYSFS "/var/lc15/clkerr/reset"
|
#define CLKERR_RST_SYSFS "/sys/devices/5002000.clkerr/reset"
|
||||||
|
|
||||||
#define OCXODAC_VAL_SYSFS "/var/lc15/ocxo/voltage"
|
#define OCXODAC_VAL_SYSFS "/sys/bus/iio/devices/iio:device0/out_voltage0_raw"
|
||||||
#define OCXODAC_ROM_SYSFS "/var/lc15/ocxo/eeprom"
|
#define OCXODAC_ROM_SYSFS "/sys/bus/iio/devices/iio:device0/store_eeprom"
|
||||||
|
|
||||||
/* clock error */
|
/* clock error */
|
||||||
static int clkerr_fd_err = -1;
|
static int clkerr_fd_err = -1;
|
||||||
|
|
|
@ -74,15 +74,7 @@ static struct lc15bts_mgr_instance manager = {
|
||||||
.thresh_warn = 60,
|
.thresh_warn = 60,
|
||||||
.thresh_crit = 78,
|
.thresh_crit = 78,
|
||||||
},
|
},
|
||||||
.logrf_limit = {
|
.memory_limit = {
|
||||||
.thresh_warn = 60,
|
|
||||||
.thresh_crit = 78,
|
|
||||||
},
|
|
||||||
.ocxo_limit = {
|
|
||||||
.thresh_warn = 60,
|
|
||||||
.thresh_crit = 78,
|
|
||||||
},
|
|
||||||
.tx0_limit = {
|
|
||||||
.thresh_warn = 60,
|
.thresh_warn = 60,
|
||||||
.thresh_crit = 78,
|
.thresh_crit = 78,
|
||||||
},
|
},
|
||||||
|
@ -90,7 +82,7 @@ static struct lc15bts_mgr_instance manager = {
|
||||||
.thresh_warn = 60,
|
.thresh_warn = 60,
|
||||||
.thresh_crit = 78,
|
.thresh_crit = 78,
|
||||||
},
|
},
|
||||||
.pa0_limit = {
|
.tx2_limit = {
|
||||||
.thresh_warn = 60,
|
.thresh_warn = 60,
|
||||||
.thresh_crit = 78,
|
.thresh_crit = 78,
|
||||||
},
|
},
|
||||||
|
@ -98,8 +90,12 @@ static struct lc15bts_mgr_instance manager = {
|
||||||
.thresh_warn = 60,
|
.thresh_warn = 60,
|
||||||
.thresh_crit = 78,
|
.thresh_crit = 78,
|
||||||
},
|
},
|
||||||
|
.pa2_limit = {
|
||||||
|
.thresh_warn = 60,
|
||||||
|
.thresh_crit = 78,
|
||||||
|
},
|
||||||
.action_warn = 0,
|
.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,
|
.state = STATE_NORMAL,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -264,12 +260,12 @@ int main(int argc, char **argv)
|
||||||
hours_timer_cb(NULL);
|
hours_timer_cb(NULL);
|
||||||
|
|
||||||
/* Enable the PAs */
|
/* Enable the PAs */
|
||||||
rc = lc15bts_power_set(LC15BTS_POWER_PA0, 1);
|
rc = lc15bts_power_set(LC15BTS_POWER_PA1, 1);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
exit(3);
|
exit(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = lc15bts_power_set(LC15BTS_POWER_PA1, 1);
|
rc = lc15bts_power_set(LC15BTS_POWER_PA2, 1);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
exit(3);
|
exit(3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ enum {
|
||||||
#if 0
|
#if 0
|
||||||
TEMP_ACT_PWR_CONTRL = 0x1,
|
TEMP_ACT_PWR_CONTRL = 0x1,
|
||||||
#endif
|
#endif
|
||||||
TEMP_ACT_PA0_OFF = 0x2,
|
TEMP_ACT_PA1_OFF = 0x2,
|
||||||
TEMP_ACT_PA1_OFF = 0x4,
|
TEMP_ACT_PA2_OFF = 0x4,
|
||||||
TEMP_ACT_BTS_SRV_OFF = 0x10,
|
TEMP_ACT_BTS_SRV_OFF = 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ enum {
|
||||||
#if 0
|
#if 0
|
||||||
TEMP_ACT_NORM_PW_CONTRL = 0x1,
|
TEMP_ACT_NORM_PW_CONTRL = 0x1,
|
||||||
#endif
|
#endif
|
||||||
TEMP_ACT_NORM_PA0_ON = 0x2,
|
TEMP_ACT_NORM_PA1_ON = 0x2,
|
||||||
TEMP_ACT_NORM_PA1_ON = 0x4,
|
TEMP_ACT_NORM_PA2_ON = 0x4,
|
||||||
TEMP_ACT_NORM_BTS_SRV_ON= 0x10,
|
TEMP_ACT_NORM_BTS_SRV_ON= 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,12 +62,11 @@ enum mgr_vty_node {
|
||||||
LIMIT_SUPPLY_NODE,
|
LIMIT_SUPPLY_NODE,
|
||||||
LIMIT_SOC_NODE,
|
LIMIT_SOC_NODE,
|
||||||
LIMIT_FPGA_NODE,
|
LIMIT_FPGA_NODE,
|
||||||
LIMIT_LOGRF_NODE,
|
LIMIT_MEMORY_NODE,
|
||||||
LIMIT_OCXO_NODE,
|
|
||||||
LIMIT_TX0_NODE,
|
|
||||||
LIMIT_TX1_NODE,
|
LIMIT_TX1_NODE,
|
||||||
LIMIT_PA0_NODE,
|
LIMIT_TX2_NODE,
|
||||||
LIMIT_PA1_NODE,
|
LIMIT_PA1_NODE,
|
||||||
|
LIMIT_PA2_NODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lc15bts_mgr_instance {
|
struct lc15bts_mgr_instance {
|
||||||
|
@ -83,12 +82,11 @@ struct lc15bts_mgr_instance {
|
||||||
struct lc15bts_temp_limit supply_limit;
|
struct lc15bts_temp_limit supply_limit;
|
||||||
struct lc15bts_temp_limit soc_limit;
|
struct lc15bts_temp_limit soc_limit;
|
||||||
struct lc15bts_temp_limit fpga_limit;
|
struct lc15bts_temp_limit fpga_limit;
|
||||||
struct lc15bts_temp_limit logrf_limit;
|
struct lc15bts_temp_limit memory_limit;
|
||||||
struct lc15bts_temp_limit ocxo_limit;
|
|
||||||
struct lc15bts_temp_limit tx0_limit;
|
|
||||||
struct lc15bts_temp_limit tx1_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 pa1_limit;
|
||||||
|
struct lc15bts_temp_limit pa2_limit;
|
||||||
} temp;
|
} temp;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define ETH0_ADDR_SYSFS "/var/lc15/net/eth0/address"
|
#define ETH0_ADDR_SYSFS "/sys/class/net/eth0/address"
|
||||||
|
|
||||||
static struct osmo_fd nl_fd;
|
static struct osmo_fd nl_fd;
|
||||||
|
|
||||||
|
|
|
@ -85,16 +85,6 @@ static int next_state(enum lc15bts_temp_state current_state, int critical, int w
|
||||||
static void handle_normal_actions(int actions)
|
static void handle_normal_actions(int actions)
|
||||||
{
|
{
|
||||||
/* switch on the PA */
|
/* switch on the PA */
|
||||||
if (actions & TEMP_ACT_NORM_PA0_ON) {
|
|
||||||
if (lc15bts_power_set(LC15BTS_POWER_PA0, 1) != 0) {
|
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
|
||||||
"Failed to switch on the PA #0\n");
|
|
||||||
} else {
|
|
||||||
LOGP(DTEMP, LOGL_NOTICE,
|
|
||||||
"Switched on the PA #0 as normal action.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actions & TEMP_ACT_NORM_PA1_ON) {
|
if (actions & TEMP_ACT_NORM_PA1_ON) {
|
||||||
if (lc15bts_power_set(LC15BTS_POWER_PA1, 1) != 0) {
|
if (lc15bts_power_set(LC15BTS_POWER_PA1, 1) != 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
|
@ -105,6 +95,16 @@ static void handle_normal_actions(int actions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 #2\n");
|
||||||
|
} else {
|
||||||
|
LOGP(DTEMP, LOGL_NOTICE,
|
||||||
|
"Switched on the PA #2 as normal action.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (actions & TEMP_ACT_NORM_BTS_SRV_ON) {
|
if (actions & TEMP_ACT_NORM_BTS_SRV_ON) {
|
||||||
LOGP(DTEMP, LOGL_NOTICE,
|
LOGP(DTEMP, LOGL_NOTICE,
|
||||||
"Going to switch on the BTS service\n");
|
"Going to switch on the BTS service\n");
|
||||||
|
@ -120,6 +120,16 @@ static void handle_normal_actions(int actions)
|
||||||
static void handle_actions(int actions)
|
static void handle_actions(int actions)
|
||||||
{
|
{
|
||||||
/* switch off the PA */
|
/* switch off the PA */
|
||||||
|
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 #2. Stop BTS?\n");
|
||||||
|
} else {
|
||||||
|
LOGP(DTEMP, LOGL_NOTICE,
|
||||||
|
"Switched off the PA #2 due temperature.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (actions & TEMP_ACT_PA1_OFF) {
|
if (actions & TEMP_ACT_PA1_OFF) {
|
||||||
if (lc15bts_power_set(LC15BTS_POWER_PA1, 0) != 0) {
|
if (lc15bts_power_set(LC15BTS_POWER_PA1, 0) != 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
|
@ -130,16 +140,6 @@ static void handle_actions(int actions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actions & TEMP_ACT_PA0_OFF) {
|
|
||||||
if (lc15bts_power_set(LC15BTS_POWER_PA0, 0) != 0) {
|
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
|
||||||
"Failed to switch off the PA #0. Stop BTS?\n");
|
|
||||||
} else {
|
|
||||||
LOGP(DTEMP, LOGL_NOTICE,
|
|
||||||
"Switched off the PA #0 due temperature.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actions & TEMP_ACT_BTS_SRV_OFF) {
|
if (actions & TEMP_ACT_BTS_SRV_OFF) {
|
||||||
LOGP(DTEMP, LOGL_NOTICE,
|
LOGP(DTEMP, LOGL_NOTICE,
|
||||||
"Going to switch off the BTS service\n");
|
"Going to switch off the BTS service\n");
|
||||||
|
@ -215,7 +215,7 @@ static void temp_ctrl_check()
|
||||||
LOGP(DTEMP, LOGL_DEBUG, "Going to check the temperature.\n");
|
LOGP(DTEMP, LOGL_DEBUG, "Going to check the temperature.\n");
|
||||||
|
|
||||||
/* Read the current supply temperature */
|
/* 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) {
|
if (rc < 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
"Failed to read the supply temperature. rc=%d\n", rc);
|
"Failed to read the supply temperature. rc=%d\n", rc);
|
||||||
|
@ -230,7 +230,7 @@ static void temp_ctrl_check()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the current SoC temperature */
|
/* 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) {
|
if (rc < 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
"Failed to read the SoC temperature. rc=%d\n", rc);
|
"Failed to read the SoC temperature. rc=%d\n", rc);
|
||||||
|
@ -245,7 +245,7 @@ static void temp_ctrl_check()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the current fpga temperature */
|
/* 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) {
|
if (rc < 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
"Failed to read the fpga temperature. rc=%d\n", rc);
|
"Failed to read the fpga temperature. rc=%d\n", rc);
|
||||||
|
@ -259,53 +259,23 @@ static void temp_ctrl_check()
|
||||||
LOGP(DTEMP, LOGL_DEBUG, "FPGA temperature is: %d\n", temp);
|
LOGP(DTEMP, LOGL_DEBUG, "FPGA temperature is: %d\n", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the current RF log detector temperature */
|
/* Read the current memory temperature */
|
||||||
rc = lc15bts_temp_get(LC15BTS_TEMP_LOGRF);
|
rc = lc15bts_temp_get(LC15BTS_TEMP_MEMORY, LC15BTS_TEMP_INPUT);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
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;
|
warn_thresh_passed = crit_thresh_passed = 1;
|
||||||
} else {
|
} else {
|
||||||
int temp = rc / 1000;
|
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;
|
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;
|
crit_thresh_passed = 1;
|
||||||
LOGP(DTEMP, LOGL_DEBUG, "RF log detector temperature is: %d\n", temp);
|
LOGP(DTEMP, LOGL_DEBUG, "Memory 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the current TX #1 temperature */
|
/* 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);
|
|
||||||
warn_thresh_passed = crit_thresh_passed = 1;
|
|
||||||
} else {
|
|
||||||
int temp = rc / 1000;
|
|
||||||
if (temp > s_mgr->temp.tx0_limit.thresh_warn)
|
|
||||||
warn_thresh_passed = 1;
|
|
||||||
if (temp > s_mgr->temp.tx0_limit.thresh_crit)
|
|
||||||
crit_thresh_passed = 1;
|
|
||||||
LOGP(DTEMP, LOGL_DEBUG, "TX #0 temperature is: %d\n", temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read the current TX #2 temperature */
|
|
||||||
rc = lc15bts_temp_get(LC15BTS_TEMP_TX1);
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
"Failed to read the TX #1 temperature. rc=%d\n", rc);
|
"Failed to read the TX #1 temperature. rc=%d\n", rc);
|
||||||
|
@ -319,23 +289,23 @@ static void temp_ctrl_check()
|
||||||
LOGP(DTEMP, LOGL_DEBUG, "TX #1 temperature is: %d\n", temp);
|
LOGP(DTEMP, LOGL_DEBUG, "TX #1 temperature is: %d\n", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the current PA #1 temperature */
|
/* Read the current TX #2 temperature */
|
||||||
rc = lc15bts_temp_get(LC15BTS_TEMP_PA0);
|
rc = lc15bts_temp_get(LC15BTS_TEMP_TX2, LC15BTS_TEMP_INPUT);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
"Failed to read the PA #0 temperature. rc=%d\n", rc);
|
"Failed to read the TX #2 temperature. rc=%d\n", rc);
|
||||||
warn_thresh_passed = crit_thresh_passed = 1;
|
warn_thresh_passed = crit_thresh_passed = 1;
|
||||||
} else {
|
} else {
|
||||||
int temp = rc / 1000;
|
int temp = rc / 1000;
|
||||||
if (temp > s_mgr->temp.pa0_limit.thresh_warn)
|
if (temp > s_mgr->temp.tx2_limit.thresh_warn)
|
||||||
warn_thresh_passed = 1;
|
warn_thresh_passed = 1;
|
||||||
if (temp > s_mgr->temp.pa0_limit.thresh_crit)
|
if (temp > s_mgr->temp.tx2_limit.thresh_crit)
|
||||||
crit_thresh_passed = 1;
|
crit_thresh_passed = 1;
|
||||||
LOGP(DTEMP, LOGL_DEBUG, "PA #0 temperature is: %d\n", temp);
|
LOGP(DTEMP, LOGL_DEBUG, "TX #2 temperature is: %d\n", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the current PA #2 temperature */
|
/* Read the current PA #1 temperature */
|
||||||
rc = lc15bts_temp_get(LC15BTS_TEMP_PA1);
|
rc = lc15bts_temp_get(LC15BTS_TEMP_PA1, LC15BTS_TEMP_INPUT);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
LOGP(DTEMP, LOGL_ERROR,
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
"Failed to read the PA #1 temperature. rc=%d\n", rc);
|
"Failed to read the PA #1 temperature. rc=%d\n", rc);
|
||||||
|
@ -349,6 +319,21 @@ static void temp_ctrl_check()
|
||||||
LOGP(DTEMP, LOGL_DEBUG, "PA #1 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_PA2, LC15BTS_TEMP_INPUT);
|
||||||
|
if (rc < 0) {
|
||||||
|
LOGP(DTEMP, LOGL_ERROR,
|
||||||
|
"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.pa2_limit.thresh_warn)
|
||||||
|
warn_thresh_passed = 1;
|
||||||
|
if (temp > s_mgr->temp.pa2_limit.thresh_crit)
|
||||||
|
crit_thresh_passed = 1;
|
||||||
|
LOGP(DTEMP, LOGL_DEBUG, "PA #2 temperature is: %d\n", temp);
|
||||||
|
}
|
||||||
|
|
||||||
lc15bts_mgr_temp_handle(s_mgr, crit_thresh_passed, warn_thresh_passed);
|
lc15bts_mgr_temp_handle(s_mgr, crit_thresh_passed, warn_thresh_passed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,11 @@ static int go_to_parent(struct vty *vty)
|
||||||
case LIMIT_SUPPLY_NODE:
|
case LIMIT_SUPPLY_NODE:
|
||||||
case LIMIT_SOC_NODE:
|
case LIMIT_SOC_NODE:
|
||||||
case LIMIT_FPGA_NODE:
|
case LIMIT_FPGA_NODE:
|
||||||
case LIMIT_LOGRF_NODE:
|
case LIMIT_MEMORY_NODE:
|
||||||
case LIMIT_OCXO_NODE:
|
|
||||||
case LIMIT_TX0_NODE:
|
|
||||||
case LIMIT_TX1_NODE:
|
case LIMIT_TX1_NODE:
|
||||||
case LIMIT_PA0_NODE:
|
case LIMIT_TX2_NODE:
|
||||||
case LIMIT_PA1_NODE:
|
case LIMIT_PA1_NODE:
|
||||||
|
case LIMIT_PA2_NODE:
|
||||||
vty->node = MGR_NODE;
|
vty->node = MGR_NODE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -91,12 +90,11 @@ static int is_config_node(struct vty *vty, int node)
|
||||||
case LIMIT_SUPPLY_NODE:
|
case LIMIT_SUPPLY_NODE:
|
||||||
case LIMIT_SOC_NODE:
|
case LIMIT_SOC_NODE:
|
||||||
case LIMIT_FPGA_NODE:
|
case LIMIT_FPGA_NODE:
|
||||||
case LIMIT_LOGRF_NODE:
|
case LIMIT_MEMORY_NODE:
|
||||||
case LIMIT_OCXO_NODE:
|
|
||||||
case LIMIT_TX0_NODE:
|
|
||||||
case LIMIT_TX1_NODE:
|
case LIMIT_TX1_NODE:
|
||||||
case LIMIT_PA0_NODE:
|
case LIMIT_TX2_NODE:
|
||||||
case LIMIT_PA1_NODE:
|
case LIMIT_PA1_NODE:
|
||||||
|
case LIMIT_PA2_NODE:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -156,31 +154,20 @@ static struct cmd_node limit_fpga_node = {
|
||||||
1,
|
1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cmd_node limit_logrf_node = {
|
static struct cmd_node limit_memory_node = {
|
||||||
LIMIT_LOGRF_NODE,
|
LIMIT_MEMORY_NODE,
|
||||||
"%s(limit-logrf)# ",
|
"%s(limit-memory)# ",
|
||||||
1,
|
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 = {
|
static struct cmd_node limit_tx1_node = {
|
||||||
LIMIT_TX1_NODE,
|
LIMIT_TX1_NODE,
|
||||||
"%s(limit-tx1)# ",
|
"%s(limit-tx1)# ",
|
||||||
1,
|
1,
|
||||||
};
|
};
|
||||||
static struct cmd_node limit_pa0_node = {
|
static struct cmd_node limit_tx2_node = {
|
||||||
LIMIT_PA0_NODE,
|
LIMIT_TX2_NODE,
|
||||||
"%s(limit-pa0)# ",
|
"%s(limit-tx2)# ",
|
||||||
1,
|
1,
|
||||||
};
|
};
|
||||||
static struct cmd_node limit_pa1_node = {
|
static struct cmd_node limit_pa1_node = {
|
||||||
|
@ -188,6 +175,11 @@ static struct cmd_node limit_pa1_node = {
|
||||||
"%s(limit-pa1)# ",
|
"%s(limit-pa1)# ",
|
||||||
1,
|
1,
|
||||||
};
|
};
|
||||||
|
static struct cmd_node limit_pa2_node = {
|
||||||
|
LIMIT_PA2_NODE,
|
||||||
|
"%s(limit-pa2)# ",
|
||||||
|
1,
|
||||||
|
};
|
||||||
|
|
||||||
DEFUN(cfg_mgr, cfg_mgr_cmd,
|
DEFUN(cfg_mgr, cfg_mgr_cmd,
|
||||||
"lc15bts-mgr",
|
"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)
|
static void write_norm_action(struct vty *vty, const char *name, int actions)
|
||||||
{
|
{
|
||||||
vty_out(vty, " %s%s", name, VTY_NEWLINE);
|
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",
|
vty_out(vty, " %spa1-on%s",
|
||||||
(actions & TEMP_ACT_NORM_PA1_ON) ? "" : "no ", VTY_NEWLINE);
|
(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",
|
vty_out(vty, " %sbts-service-on%s",
|
||||||
(actions & TEMP_ACT_NORM_BTS_SRV_ON) ? "" : "no ", VTY_NEWLINE);
|
(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)
|
static void write_action(struct vty *vty, const char *name, int actions)
|
||||||
{
|
{
|
||||||
vty_out(vty, " %s%s", name, VTY_NEWLINE);
|
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",
|
vty_out(vty, " %spa1-off%s",
|
||||||
(actions & TEMP_ACT_PA1_OFF) ? "" : "no ", VTY_NEWLINE);
|
(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",
|
vty_out(vty, " %sbts-service-off%s",
|
||||||
(actions & TEMP_ACT_BTS_SRV_OFF) ? "" : "no ", VTY_NEWLINE);
|
(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 supply", &s_mgr->temp.supply_limit);
|
||||||
write_temp_limit(vty, "limits soc", &s_mgr->temp.soc_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 fpga", &s_mgr->temp.fpga_limit);
|
||||||
write_temp_limit(vty, "limits logrf", &s_mgr->temp.logrf_limit);
|
write_temp_limit(vty, "limits memory", &s_mgr->temp.memory_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 tx1", &s_mgr->temp.tx1_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 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_norm_action(vty, "actions normal", s_mgr->temp.action_norm);
|
||||||
write_action(vty, "actions warn", s_mgr->temp.action_warn);
|
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(supply, "SUPPLY\n", LIMIT_SUPPLY_NODE, supply_limit)
|
||||||
CFG_LIMIT(soc, "SOC\n", LIMIT_SOC_NODE, soc_limit)
|
CFG_LIMIT(soc, "SOC\n", LIMIT_SOC_NODE, soc_limit)
|
||||||
CFG_LIMIT(fpga, "FPGA\n", LIMIT_FPGA_NODE, fpga_limit)
|
CFG_LIMIT(fpga, "FPGA\n", LIMIT_FPGA_NODE, fpga_limit)
|
||||||
CFG_LIMIT(logrf, "LOGRF\n", LIMIT_LOGRF_NODE, logrf_limit)
|
CFG_LIMIT(memory, "MEMORY\n", LIMIT_MEMORY_NODE, memory_limit)
|
||||||
CFG_LIMIT(ocxo, "OCXO\n", LIMIT_OCXO_NODE, ocxo_limit)
|
|
||||||
CFG_LIMIT(tx0, "TX0\n", LIMIT_TX0_NODE, tx0_limit)
|
|
||||||
CFG_LIMIT(tx1, "TX1\n", LIMIT_TX1_NODE, tx1_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(pa1, "PA1\n", LIMIT_PA1_NODE, pa1_limit)
|
||||||
|
CFG_LIMIT(pa2, "PA2\n", LIMIT_PA2_NODE, pa2_limit)
|
||||||
#undef CFG_LIMIT
|
#undef CFG_LIMIT
|
||||||
|
|
||||||
DEFUN(cfg_limit_warning, cfg_thresh_warning_cmd,
|
DEFUN(cfg_limit_warning, cfg_thresh_warning_cmd,
|
||||||
|
@ -308,24 +298,6 @@ CFG_ACTION(warn, "Warning Actions\n", ACT_WARN_NODE, action_warn)
|
||||||
CFG_ACTION(critical, "Critical Actions\n", ACT_CRIT_NODE, action_crit)
|
CFG_ACTION(critical, "Critical Actions\n", ACT_CRIT_NODE, action_crit)
|
||||||
#undef CFG_ACTION
|
#undef CFG_ACTION
|
||||||
|
|
||||||
DEFUN(cfg_action_pa0_on, cfg_action_pa0_on_cmd,
|
|
||||||
"pa0-on",
|
|
||||||
"Switch the Power Amplifier #0 on\n")
|
|
||||||
{
|
|
||||||
int *action = vty->index;
|
|
||||||
*action |= TEMP_ACT_NORM_PA0_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")
|
|
||||||
{
|
|
||||||
int *action = vty->index;
|
|
||||||
*action &= ~TEMP_ACT_NORM_PA0_ON;
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN(cfg_action_pa1_on, cfg_action_pa1_on_cmd,
|
DEFUN(cfg_action_pa1_on, cfg_action_pa1_on_cmd,
|
||||||
"pa1-on",
|
"pa1-on",
|
||||||
"Switch the Power Amplifier #1 on\n")
|
"Switch the Power Amplifier #1 on\n")
|
||||||
|
@ -344,6 +316,24 @@ DEFUN(cfg_no_action_pa1_on, cfg_no_action_pa1_on_cmd,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_PA2_ON;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
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_PA2_ON;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN(cfg_action_bts_srv_on, cfg_action_bts_srv_on_cmd,
|
DEFUN(cfg_action_bts_srv_on, cfg_action_bts_srv_on_cmd,
|
||||||
"bts-service-on",
|
"bts-service-on",
|
||||||
"Start the systemd lc15bts.service\n")
|
"Start the systemd lc15bts.service\n")
|
||||||
|
@ -362,24 +352,6 @@ DEFUN(cfg_no_action_bts_srv_on, cfg_no_action_bts_srv_on_cmd,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN(cfg_action_pa0_off, cfg_action_pa0_off_cmd,
|
|
||||||
"pa0-off",
|
|
||||||
"Switch the Power Amplifier #0 off\n")
|
|
||||||
{
|
|
||||||
int *action = vty->index;
|
|
||||||
*action |= TEMP_ACT_PA0_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")
|
|
||||||
{
|
|
||||||
int *action = vty->index;
|
|
||||||
*action &= ~TEMP_ACT_PA0_OFF;
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN(cfg_action_pa1_off, cfg_action_pa1_off_cmd,
|
DEFUN(cfg_action_pa1_off, cfg_action_pa1_off_cmd,
|
||||||
"pa1-off",
|
"pa1-off",
|
||||||
"Switch the Power Amplifier #1 off\n")
|
"Switch the Power Amplifier #1 off\n")
|
||||||
|
@ -398,6 +370,24 @@ DEFUN(cfg_no_action_pa1_off, cfg_no_action_pa1_off_cmd,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_PA2_OFF;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
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_PA2_OFF;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN(cfg_action_bts_srv_off, cfg_action_bts_srv_off_cmd,
|
DEFUN(cfg_action_bts_srv_off, cfg_action_bts_srv_off_cmd,
|
||||||
"bts-service-off",
|
"bts-service-off",
|
||||||
"Stop the systemd lc15bts.service\n")
|
"Stop the systemd lc15bts.service\n")
|
||||||
|
@ -423,35 +413,40 @@ DEFUN(show_mgr, show_mgr_cmd, "show manager",
|
||||||
lc15bts_mgr_temp_get_state(s_mgr->temp.state), VTY_NEWLINE);
|
lc15bts_mgr_temp_get_state(s_mgr->temp.state), VTY_NEWLINE);
|
||||||
vty_out(vty, "Current Temperatures%s", VTY_NEWLINE);
|
vty_out(vty, "Current Temperatures%s", VTY_NEWLINE);
|
||||||
vty_out(vty, " Main Supply : %f Celcius%s",
|
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_NEWLINE);
|
||||||
vty_out(vty, " SoC : %f Celcius%s",
|
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_NEWLINE);
|
||||||
vty_out(vty, " FPGA : %f Celcius%s",
|
vty_out(vty, " FPGA : %f Celcius%s",
|
||||||
lc15bts_temp_get(LC15BTS_TEMP_FPGA) / 1000.0f,
|
lc15bts_temp_get(LC15BTS_TEMP_FPGA,
|
||||||
|
LC15BTS_TEMP_INPUT) / 1000.0f,
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
vty_out(vty, " LogRF : %f Celcius%s",
|
vty_out(vty, " Memory (DDR): %f Celcius%s",
|
||||||
lc15bts_temp_get(LC15BTS_TEMP_LOGRF) / 1000.0f,
|
lc15bts_temp_get(LC15BTS_TEMP_MEMORY,
|
||||||
VTY_NEWLINE);
|
LC15BTS_TEMP_INPUT) / 1000.0f,
|
||||||
vty_out(vty, " OCXO : %f Celcius%s",
|
|
||||||
lc15bts_temp_get(LC15BTS_TEMP_OCXO) / 1000.0f,
|
|
||||||
VTY_NEWLINE);
|
|
||||||
vty_out(vty, " TX 0 : %f Celcius%s",
|
|
||||||
lc15bts_temp_get(LC15BTS_TEMP_TX0) / 1000.0f,
|
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
vty_out(vty, " TX 1 : %f Celcius%s",
|
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_NEWLINE);
|
||||||
vty_out(vty, " Power Amp #0: %f Celcius%s",
|
vty_out(vty, " TX 2 : %f Celcius%s",
|
||||||
lc15bts_temp_get(LC15BTS_TEMP_PA0) / 1000.0f,
|
lc15bts_temp_get(LC15BTS_TEMP_TX2,
|
||||||
|
LC15BTS_TEMP_INPUT) / 1000.0f,
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
vty_out(vty, " Power Amp #1: %f Celcius%s",
|
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_NEWLINE);
|
||||||
|
|
||||||
vty_out(vty, "Power Status%s", 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_sensor_get(LC15BTS_POWER_SUPPLY,
|
||||||
LC15BTS_POWER_VOLTAGE)/1000.0f,
|
LC15BTS_POWER_VOLTAGE)/1000.0f,
|
||||||
lc15bts_power_sensor_get(LC15BTS_POWER_SUPPLY,
|
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_sensor_get(LC15BTS_POWER_SUPPLY,
|
||||||
LC15BTS_POWER_POWER)/1000000.0f,
|
LC15BTS_POWER_POWER)/1000000.0f,
|
||||||
VTY_NEWLINE);
|
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",
|
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_get(LC15BTS_POWER_PA1) ? "ON " : "OFF",
|
||||||
lc15bts_power_sensor_get(LC15BTS_POWER_PA1,
|
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_sensor_get(LC15BTS_POWER_PA1,
|
||||||
LC15BTS_POWER_POWER)/1000000.0f,
|
LC15BTS_POWER_POWER)/1000000.0f,
|
||||||
VTY_NEWLINE);
|
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;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -501,20 +496,20 @@ static void register_limit(int limit)
|
||||||
|
|
||||||
static void register_normal_action(int act)
|
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_action_pa1_on_cmd);
|
||||||
install_element(act, &cfg_no_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_action_bts_srv_on_cmd);
|
||||||
install_element(act, &cfg_no_action_bts_srv_on_cmd);
|
install_element(act, &cfg_no_action_bts_srv_on_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void register_action(int act)
|
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_action_pa1_off_cmd);
|
||||||
install_element(act, &cfg_no_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_action_bts_srv_off_cmd);
|
||||||
install_element(act, &cfg_no_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);
|
register_limit(LIMIT_FPGA_NODE);
|
||||||
vty_install_default(LIMIT_FPGA_NODE);
|
vty_install_default(LIMIT_FPGA_NODE);
|
||||||
|
|
||||||
install_node(&limit_logrf_node, config_write_dummy);
|
install_node(&limit_memory_node, config_write_dummy);
|
||||||
install_element(MGR_NODE, &cfg_limit_logrf_cmd);
|
install_element(MGR_NODE, &cfg_limit_memory_cmd);
|
||||||
register_limit(LIMIT_LOGRF_NODE);
|
register_limit(LIMIT_MEMORY_NODE);
|
||||||
vty_install_default(LIMIT_LOGRF_NODE);
|
vty_install_default(LIMIT_MEMORY_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_tx1_node, config_write_dummy);
|
install_node(&limit_tx1_node, config_write_dummy);
|
||||||
install_element(MGR_NODE, &cfg_limit_tx1_cmd);
|
install_element(MGR_NODE, &cfg_limit_tx1_cmd);
|
||||||
register_limit(LIMIT_TX1_NODE);
|
register_limit(LIMIT_TX1_NODE);
|
||||||
vty_install_default(LIMIT_TX1_NODE);
|
vty_install_default(LIMIT_TX1_NODE);
|
||||||
|
|
||||||
install_node(&limit_pa0_node, config_write_dummy);
|
install_node(&limit_tx2_node, config_write_dummy);
|
||||||
install_element(MGR_NODE, &cfg_limit_pa0_cmd);
|
install_element(MGR_NODE, &cfg_limit_tx2_cmd);
|
||||||
register_limit(LIMIT_PA0_NODE);
|
register_limit(LIMIT_TX2_NODE);
|
||||||
vty_install_default(LIMIT_PA0_NODE);
|
vty_install_default(LIMIT_TX2_NODE);
|
||||||
|
|
||||||
install_node(&limit_pa1_node, config_write_dummy);
|
install_node(&limit_pa1_node, config_write_dummy);
|
||||||
install_element(MGR_NODE, &cfg_limit_pa1_cmd);
|
install_element(MGR_NODE, &cfg_limit_pa1_cmd);
|
||||||
register_limit(LIMIT_PA1_NODE);
|
register_limit(LIMIT_PA1_NODE);
|
||||||
vty_install_default(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 the normal node */
|
||||||
install_node(&act_norm_node, config_write_dummy);
|
install_node(&act_norm_node, config_write_dummy);
|
||||||
install_element(MGR_NODE, &cfg_action_normal_cmd);
|
install_element(MGR_NODE, &cfg_action_normal_cmd);
|
||||||
|
|
|
@ -74,41 +74,37 @@ static const struct {
|
||||||
.ee_par = LC15BTS_PAR_TEMP_FPGA_MAX,
|
.ee_par = LC15BTS_PAR_TEMP_FPGA_MAX,
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
.name = "logrf",
|
.name = "memory",
|
||||||
.has_max = 1,
|
.has_max = 1,
|
||||||
.sensor = LC15BTS_TEMP_LOGRF,
|
.sensor = LC15BTS_TEMP_MEMORY,
|
||||||
.ee_par = LC15BTS_PAR_TEMP_LOGRF_MAX,
|
.ee_par = LC15BTS_PAR_TEMP_MEMORY_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,
|
|
||||||
}, {
|
}, {
|
||||||
.name = "tx1",
|
.name = "tx1",
|
||||||
.has_max = 0,
|
.has_max = 0,
|
||||||
.sensor = LC15BTS_TEMP_TX1,
|
.sensor = LC15BTS_TEMP_TX1,
|
||||||
.ee_par = LC15BTS_PAR_TEMP_TX1_MAX,
|
.ee_par = LC15BTS_PAR_TEMP_TX1_MAX,
|
||||||
}, {
|
}, {
|
||||||
.name = "pa0",
|
.name = "tx2",
|
||||||
.has_max = 1,
|
.has_max = 0,
|
||||||
.sensor = LC15BTS_TEMP_PA0,
|
.sensor = LC15BTS_TEMP_TX2,
|
||||||
.ee_par = LC15BTS_PAR_TEMP_PA0_MAX,
|
.ee_par = LC15BTS_PAR_TEMP_TX2_MAX,
|
||||||
}, {
|
}, {
|
||||||
.name = "pa1",
|
.name = "pa1",
|
||||||
.has_max = 1,
|
.has_max = 1,
|
||||||
.sensor = LC15BTS_TEMP_PA1,
|
.sensor = LC15BTS_TEMP_PA1,
|
||||||
.ee_par = LC15BTS_PAR_TEMP_PA1_MAX,
|
.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)
|
void lc15bts_check_temp(int no_rom_write)
|
||||||
{
|
{
|
||||||
int temp_old[ARRAY_SIZE(temp_data)];
|
int temp_old[ARRAY_SIZE(temp_data)];
|
||||||
|
int temp_hi[ARRAY_SIZE(temp_data)];
|
||||||
int temp_cur[ARRAY_SIZE(temp_data)];
|
int temp_cur[ARRAY_SIZE(temp_data)];
|
||||||
int i, rc;
|
int i, rc;
|
||||||
|
|
||||||
|
@ -116,24 +112,40 @@ void lc15bts_check_temp(int no_rom_write)
|
||||||
int ret;
|
int ret;
|
||||||
rc = lc15bts_par_get_int(temp_data[i].ee_par, &ret);
|
rc = lc15bts_par_get_int(temp_data[i].ee_par, &ret);
|
||||||
temp_old[i] = ret * 1000;
|
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);
|
||||||
|
|
||||||
temp_cur[i] = lc15bts_temp_get(temp_data[i].sensor);
|
if ((temp_cur[i] < 0 && temp_cur[i] > -1000) ||
|
||||||
if (temp_cur[i] < 0 && temp_cur[i] > -1000) {
|
(temp_hi[i] < 0 && temp_hi[i] > -1000)) {
|
||||||
LOGP(DTEMP, LOGL_ERROR, "Error reading temperature (%d)\n", temp_data[i].sensor);
|
LOGP(DTEMP, LOGL_ERROR, "Error reading temperature\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
temp_cur[i] = lc15bts_temp_get(temp_data[i].sensor,
|
||||||
|
LC15BTS_TEMP_INPUT);
|
||||||
|
|
||||||
|
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",
|
LOGP(DTEMP, LOGL_DEBUG, "Current %s temperature: %d.%d C\n",
|
||||||
temp_data[i].name, temp_cur[i]/1000, temp_cur[i]%1000);
|
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 "
|
LOGP(DTEMP, LOGL_NOTICE, "New maximum %s "
|
||||||
"temperature: %d.%d C\n", temp_data[i].name,
|
"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) {
|
if (!no_rom_write) {
|
||||||
rc = lc15bts_par_set_int(temp_data[i].ee_par,
|
rc = lc15bts_par_set_int(temp_data[i].ee_par,
|
||||||
temp_cur[i]/1000);
|
temp_hi[i]/1000);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
LOGP(DTEMP, LOGL_ERROR, "error writing new %s "
|
LOGP(DTEMP, LOGL_ERROR, "error writing new %s "
|
||||||
"max temp %d (%s)\n", temp_data[i].name,
|
"max temp %d (%s)\n", temp_data[i].name,
|
||||||
|
|
|
@ -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_SUPPLY_MAX, "temp-supply-max" },
|
||||||
{ LC15BTS_PAR_TEMP_SOC_MAX, "temp-soc-max" },
|
{ LC15BTS_PAR_TEMP_SOC_MAX, "temp-soc-max" },
|
||||||
{ LC15BTS_PAR_TEMP_FPGA_MAX, "temp-fpga-max" },
|
{ LC15BTS_PAR_TEMP_FPGA_MAX, "temp-fpga-max" },
|
||||||
{ LC15BTS_PAR_TEMP_LOGRF_MAX, "temp-logrf-max" },
|
{ LC15BTS_PAR_TEMP_MEMORY_MAX, "temp-memory-max" },
|
||||||
{ LC15BTS_PAR_TEMP_OCXO_MAX, "temp-ocxo-max" },
|
|
||||||
{ LC15BTS_PAR_TEMP_TX0_MAX, "temp-tx0-max" },
|
|
||||||
{ LC15BTS_PAR_TEMP_TX1_MAX, "temp-tx1-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_PA1_MAX, "temp-pa1-max" },
|
||||||
|
{ LC15BTS_PAR_TEMP_PA2_MAX, "temp-pa2-max" },
|
||||||
{ LC15BTS_PAR_SERNR, "serial-nr" },
|
{ LC15BTS_PAR_SERNR, "serial-nr" },
|
||||||
{ LC15BTS_PAR_HOURS, "hours-running" },
|
{ LC15BTS_PAR_HOURS, "hours-running" },
|
||||||
{ LC15BTS_PAR_BOOTS, "boot-count" },
|
{ 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_SUPPLY_MAX:
|
||||||
case LC15BTS_PAR_TEMP_SOC_MAX:
|
case LC15BTS_PAR_TEMP_SOC_MAX:
|
||||||
case LC15BTS_PAR_TEMP_FPGA_MAX:
|
case LC15BTS_PAR_TEMP_FPGA_MAX:
|
||||||
case LC15BTS_PAR_TEMP_LOGRF_MAX:
|
case LC15BTS_PAR_TEMP_MEMORY_MAX:
|
||||||
case LC15BTS_PAR_TEMP_OCXO_MAX:
|
|
||||||
case LC15BTS_PAR_TEMP_TX0_MAX:
|
|
||||||
case LC15BTS_PAR_TEMP_TX1_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_PA1_MAX:
|
||||||
|
case LC15BTS_PAR_TEMP_PA2_MAX:
|
||||||
case LC15BTS_PAR_SERNR:
|
case LC15BTS_PAR_SERNR:
|
||||||
case LC15BTS_PAR_HOURS:
|
case LC15BTS_PAR_HOURS:
|
||||||
case LC15BTS_PAR_BOOTS:
|
case LC15BTS_PAR_BOOTS:
|
||||||
|
|
|
@ -7,12 +7,11 @@ enum lc15bts_par {
|
||||||
LC15BTS_PAR_TEMP_SUPPLY_MAX,
|
LC15BTS_PAR_TEMP_SUPPLY_MAX,
|
||||||
LC15BTS_PAR_TEMP_SOC_MAX,
|
LC15BTS_PAR_TEMP_SOC_MAX,
|
||||||
LC15BTS_PAR_TEMP_FPGA_MAX,
|
LC15BTS_PAR_TEMP_FPGA_MAX,
|
||||||
LC15BTS_PAR_TEMP_LOGRF_MAX,
|
LC15BTS_PAR_TEMP_MEMORY_MAX,
|
||||||
LC15BTS_PAR_TEMP_OCXO_MAX,
|
|
||||||
LC15BTS_PAR_TEMP_TX0_MAX,
|
|
||||||
LC15BTS_PAR_TEMP_TX1_MAX,
|
LC15BTS_PAR_TEMP_TX1_MAX,
|
||||||
LC15BTS_PAR_TEMP_PA0_MAX,
|
LC15BTS_PAR_TEMP_TX2_MAX,
|
||||||
LC15BTS_PAR_TEMP_PA1_MAX,
|
LC15BTS_PAR_TEMP_PA1_MAX,
|
||||||
|
LC15BTS_PAR_TEMP_PA2_MAX,
|
||||||
LC15BTS_PAR_SERNR,
|
LC15BTS_PAR_SERNR,
|
||||||
LC15BTS_PAR_HOURS,
|
LC15BTS_PAR_HOURS,
|
||||||
LC15BTS_PAR_BOOTS,
|
LC15BTS_PAR_BOOTS,
|
||||||
|
|
|
@ -30,24 +30,24 @@
|
||||||
|
|
||||||
#define LC15BTS_PA_VOLTAGE 24000000
|
#define LC15BTS_PA_VOLTAGE 24000000
|
||||||
|
|
||||||
#define PA_SUPPLY_MIN_SYSFS "/var/lc15/pa-supply/min_microvolts"
|
#define PA_SUPPLY_MIN_SYSFS "/sys/devices/0.pa-supply/min_microvolts"
|
||||||
#define PA_SUPPLY_MAX_SYSFS "/var/lc15/pa-supply/max_microvolts"
|
#define PA_SUPPLY_MAX_SYSFS "/sys/devices/0.pa-supply/max_microvolts"
|
||||||
|
|
||||||
static const char *power_enable_devs[_NUM_POWER_SOURCES] = {
|
static const char *power_enable_devs[_NUM_POWER_SOURCES] = {
|
||||||
[LC15BTS_POWER_PA0] = "/var/lc15/pa-state/pa0/state",
|
[LC15BTS_POWER_PA1] = "/sys/devices/0.pa1/state",
|
||||||
[LC15BTS_POWER_PA1] = "/var/lc15/pa-state/pa1/state",
|
[LC15BTS_POWER_PA2] = "/sys/devices/0.pa2/state",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *power_sensor_devs[_NUM_POWER_SOURCES] = {
|
static const char *power_sensor_devs[_NUM_POWER_SOURCES] = {
|
||||||
[LC15BTS_POWER_SUPPLY] = "/var/lc15/pwr-sense/pa-supply/",
|
[LC15BTS_POWER_SUPPLY] = "/sys/bus/i2c/devices/2-0040/hwmon/hwmon6/",
|
||||||
[LC15BTS_POWER_PA0] = "/var/lc15/pwr-sense/pa0/",
|
[LC15BTS_POWER_PA1] = "/sys/bus/i2c/devices/2-0044/hwmon/hwmon7/",
|
||||||
[LC15BTS_POWER_PA1] = "/var/lc15/pwr-sense/pa1/",
|
[LC15BTS_POWER_PA2] = "/sys/bus/i2c/devices/2-0045/hwmon/hwmon8/",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *power_sensor_type_str[_NUM_POWER_TYPES] = {
|
static const char *power_sensor_type_str[_NUM_POWER_TYPES] = {
|
||||||
[LC15BTS_POWER_POWER] = "power",
|
[LC15BTS_POWER_POWER] = "power1_input",
|
||||||
[LC15BTS_POWER_VOLTAGE] = "voltage",
|
[LC15BTS_POWER_VOLTAGE] = "in1_input",
|
||||||
[LC15BTS_POWER_CURRENT] = "current",
|
[LC15BTS_POWER_CURRENT] = "curr1_input",
|
||||||
};
|
};
|
||||||
|
|
||||||
int lc15bts_power_sensor_get(
|
int lc15bts_power_sensor_get(
|
||||||
|
@ -94,8 +94,8 @@ int lc15bts_power_set(
|
||||||
int fd;
|
int fd;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((source != LC15BTS_POWER_PA0)
|
if ((source != LC15BTS_POWER_PA1)
|
||||||
&& (source != LC15BTS_POWER_PA1) ) {
|
&& (source != LC15BTS_POWER_PA2) ) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,6 @@ int lc15bts_power_get(
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int rc;
|
int rc;
|
||||||
int retVal = 0;
|
|
||||||
char enstr[10];
|
char enstr[10];
|
||||||
|
|
||||||
fd = open(power_enable_devs[source], O_RDONLY);
|
fd = open(power_enable_devs[source], O_RDONLY);
|
||||||
|
@ -153,7 +152,7 @@ int lc15bts_power_get(
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = read(fd, enstr, sizeof(enstr));
|
rc = read(fd, enstr, sizeof(enstr));
|
||||||
enstr[rc-1] = '\0';
|
enstr[sizeof(enstr)-1] = '\0';
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
@ -164,10 +163,5 @@ int lc15bts_power_get(
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = strcmp(enstr, "enabled");
|
return atoi(enstr);
|
||||||
if(rc == 0) {
|
|
||||||
retVal = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
enum lc15bts_power_source {
|
enum lc15bts_power_source {
|
||||||
LC15BTS_POWER_SUPPLY,
|
LC15BTS_POWER_SUPPLY,
|
||||||
LC15BTS_POWER_PA0,
|
|
||||||
LC15BTS_POWER_PA1,
|
LC15BTS_POWER_PA1,
|
||||||
|
LC15BTS_POWER_PA2,
|
||||||
_NUM_POWER_SOURCES
|
_NUM_POWER_SOURCES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,27 +31,43 @@
|
||||||
|
|
||||||
|
|
||||||
static const char *temp_devs[_NUM_TEMP_SENSORS] = {
|
static const char *temp_devs[_NUM_TEMP_SENSORS] = {
|
||||||
[LC15BTS_TEMP_SUPPLY] = "/var/lc15/temp/pa-supply/temp",
|
[LC15BTS_TEMP_SUPPLY] = "/sys/bus/i2c/devices/2-004d/hwmon/hwmon5/temp1_",
|
||||||
[LC15BTS_TEMP_SOC] = "/var/lc15/temp/cpu/temp",
|
[LC15BTS_TEMP_SOC] = "/sys/class/hwmon/hwmon1/temp1_",
|
||||||
[LC15BTS_TEMP_FPGA] = "/var/lc15/temp/fpga/temp",
|
[LC15BTS_TEMP_FPGA] = "/sys/devices/0.iio_hwmon/temp1_",
|
||||||
[LC15BTS_TEMP_LOGRF] = "/var/lc15/temp/logrf/temp",
|
[LC15BTS_TEMP_MEMORY] = "/sys/bus/i2c/devices/2-004c/hwmon/hwmon4/temp1_",
|
||||||
[LC15BTS_TEMP_OCXO] = "/var/lc15/temp/ocxo/temp",
|
[LC15BTS_TEMP_TX1] = "/sys/devices/0.ncp15xh103_tx1/temp1_",
|
||||||
[LC15BTS_TEMP_TX0] = "/var/lc15/temp/tx0/temp",
|
[LC15BTS_TEMP_TX2] = "/sys/devices/0.ncp15xh103_tx2/temp1_",
|
||||||
[LC15BTS_TEMP_TX1] = "/var/lc15/temp/tx1/temp",
|
[LC15BTS_TEMP_PA1] = "/sys/bus/i2c/devices/2-004d/hwmon/hwmon5/temp2_",
|
||||||
[LC15BTS_TEMP_PA0] = "/var/lc15/temp/pa0/temp",
|
[LC15BTS_TEMP_PA2] = "/sys/bus/i2c/devices/2-004c/hwmon/hwmon4/temp2_",
|
||||||
[LC15BTS_TEMP_PA1] = "/var/lc15/temp/pa1/temp",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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 buf[PATH_MAX];
|
||||||
char tempstr[8];
|
char tempstr[8];
|
||||||
|
char faultstr[8];
|
||||||
int fd, rc;
|
int fd, rc;
|
||||||
|
|
||||||
if (sensor < 0 || sensor >= _NUM_TEMP_SENSORS)
|
if (sensor < 0 || sensor >= _NUM_TEMP_SENSORS)
|
||||||
return -EINVAL;
|
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';
|
buf[sizeof(buf)-1] = '\0';
|
||||||
|
|
||||||
fd = open(buf, O_RDONLY);
|
fd = open(buf, O_RDONLY);
|
||||||
|
@ -70,6 +86,32 @@ int lc15bts_temp_get(enum lc15bts_temp_sensor sensor)
|
||||||
}
|
}
|
||||||
close(fd);
|
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);
|
return atoi(tempstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,11 @@ enum lc15bts_temp_sensor {
|
||||||
LC15BTS_TEMP_SUPPLY,
|
LC15BTS_TEMP_SUPPLY,
|
||||||
LC15BTS_TEMP_SOC,
|
LC15BTS_TEMP_SOC,
|
||||||
LC15BTS_TEMP_FPGA,
|
LC15BTS_TEMP_FPGA,
|
||||||
LC15BTS_TEMP_LOGRF,
|
LC15BTS_TEMP_MEMORY,
|
||||||
LC15BTS_TEMP_OCXO,
|
|
||||||
LC15BTS_TEMP_TX0,
|
|
||||||
LC15BTS_TEMP_TX1,
|
LC15BTS_TEMP_TX1,
|
||||||
LC15BTS_TEMP_PA0,
|
LC15BTS_TEMP_TX2,
|
||||||
LC15BTS_TEMP_PA1,
|
LC15BTS_TEMP_PA1,
|
||||||
|
LC15BTS_TEMP_PA2,
|
||||||
_NUM_TEMP_SENSORS
|
_NUM_TEMP_SENSORS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,6 +21,7 @@ enum lc15bts_temp_type {
|
||||||
_NUM_TEMP_TYPES
|
_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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue