aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/e300/battery/fpga.h
diff options
context:
space:
mode:
authorMoritz Fischer <moritz.fischer@ettus.com>2015-07-13 14:03:42 -0700
committerMoritz Fischer <moritz.fischer@ettus.com>2015-07-13 14:03:42 -0700
commitc65e0ea6e387b39e115b6af28e79ba1418f605b2 (patch)
tree85bc5673ca01f22b6b9362b0aba8c80d13ba1eab /firmware/e300/battery/fpga.h
parent69bcfba936e49c2825a6d9be677c3150a5c6b70c (diff)
downloaduhd-c65e0ea6e387b39e115b6af28e79ba1418f605b2.tar.gz
uhd-c65e0ea6e387b39e115b6af28e79ba1418f605b2.tar.bz2
uhd-c65e0ea6e387b39e115b6af28e79ba1418f605b2.zip
e3xx: Added firmware for battery based devices.
Note: This firmware does *not* support Rev B units. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Diffstat (limited to 'firmware/e300/battery/fpga.h')
-rw-r--r--firmware/e300/battery/fpga.h180
1 files changed, 180 insertions, 0 deletions
diff --git a/firmware/e300/battery/fpga.h b/firmware/e300/battery/fpga.h
new file mode 100644
index 000000000..869c130de
--- /dev/null
+++ b/firmware/e300/battery/fpga.h
@@ -0,0 +1,180 @@
+/* USRP E310 Firmware FPGA driver
+ * Copyright (C) 2014 Ettus Research
+ * This file is part of the USRP E310 Firmware
+ * The USRP E310 Firmware is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ * The USRP E310 Firmware is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with the USRP E310 Firmware. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file fpga.h
+ * \brief FPGA driver
+ */
+
+#ifndef FPGA_H
+#define FPGA_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/**
+ * \brief Initialize the fpga internal shadow registers
+ *
+ */
+void fpga_init(void);
+
+/* battery stuff */
+
+/**
+ * \brief Initialize the fpga internal shadow registers
+ *
+ * \param[in] voltage The voltage that will be sent to the FPGA
+ *
+ */
+void fpga_set_battery_voltage(uint16_t voltage);
+
+/**
+ * \brief Trigger a battery temp alert in FPGA
+ *
+ * \param[in] alert The alert flags
+ *
+ */
+void fpga_set_battery_temp_alert(uint8_t alert);
+
+void fpga_set_battery_online(bool online);
+
+bool fpga_get_battery_online(void);
+
+/**
+ * \brief Set the battery health that will be sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] health The battery health
+ *
+ */
+void fpga_set_battery_health(uint8_t health);
+
+/**
+ * \brief Set the battery status that will be sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] status The battery status
+ *
+ */
+void fpga_set_battery_status(uint8_t status);
+
+/* charger stuff */
+/**
+ * \brief Set the charger status that will be sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] status The charger status
+ *
+ */
+void fpga_set_charger_status(uint8_t status);
+
+void fpga_set_charger_online(bool online);
+
+void fpga_set_charger_charge_type(uint8_t type);
+
+/**
+ * \brief Set the charger health that will be sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] health The charger health
+ *
+ */
+void fpga_set_charger_health(uint8_t health);
+
+/**
+ * \brief Set the gauge charge value that is sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] charge The accumulated charge value
+ *
+ */
+void fpga_set_gauge_charge(uint16_t charge);
+
+/**
+ * \brief Get the gauge charge value that is stored in shadow register
+ *
+ * \return The accumulated charge value stored in shadow register
+ *
+ */
+uint16_t fpga_get_gauge_charge(void);
+
+/**
+ * \brief Set the gauge charge last full value that is sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] charge The accumulated charge when last charge cycle terminated
+ *
+ */
+void fpga_set_gauge_charge_last_full(uint16_t charge);
+
+/**
+ * \brief Set the gauge temperature value that is sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] temp The temperature as reported by fuel gauge
+ *
+ */
+void fpga_set_gauge_temp(uint16_t temp);
+
+/**
+ * \brief Set the gauge voltage value that is sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] volt The voltage as reported by fuel gauge
+ *
+ */
+void fpga_set_gauge_voltage(uint16_t volt);
+
+/**
+ * \brief Set the gauge status value that is sent to the FPGA with next fpga_sync()
+ *
+ * \param[in] status The status as reported by fuel gauge
+ *
+ */
+void fpga_set_gauge_status(uint8_t status);
+
+/* misc stuff */
+
+/**
+ * \brief Get the shutdown flag from the shadow registers
+ *
+ * \return true if shutdown was requested by FPGA
+ *
+ */
+bool fpga_get_shutdown(void);
+
+/**
+ * \brief Get the write charge flag from shadow register
+ *
+ * \return true if write to charge count was requested by FPGA
+ *
+ */
+bool fpga_get_write_charge(void);
+
+/**
+ * \brief Get the settings from shadow register
+ *
+ * \return value that was requested to be stored in settings reg
+ *
+ */
+uint8_t fpga_get_settings(void);
+
+/**
+ * \brief Get the settings write flag from shadow register
+ *
+ * \return true if write to settings reg was requested by FPGA
+ *
+ */
+bool fpga_get_write_settings(void);
+
+/**
+ * \brief Synchronize the shadow registers with the FPGA
+ *
+ */
+void fpga_sync(void);
+
+#endif /* FPGA_H */