Added attributes for rebooting the I/O group and saving current state to non-volatile...
authorTom Knot <tomasknot@gmail.com>
Thu, 27 Sep 2018 14:20:54 +0000 (16:20 +0200)
committerTom Knot <tomasknot@gmail.com>
Thu, 27 Sep 2018 14:20:54 +0000 (16:20 +0200)
misc/tmp/versions [new file with mode: 0644]
modules/unipi/src/unipi_common.h
modules/unipi/src/unipi_sysfs.c
version.txt

diff --git a/misc/tmp/versions b/misc/tmp/versions
new file mode 100644 (file)
index 0000000..e69de29
index 9970fe60b96f69469b836ce856d25f48c1046c52..de5c631415c8ccc8150cff1ba9f68d89fb8da0d7 100644 (file)
@@ -51,7 +51,7 @@
 #if NEURONSPI_SCHED_REQUIRED > 0
        #include <uapi/linux/sched/types.h>
 #endif
-#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.16:2018:09:21"
+#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.17:2018:09:27"
 
 #define NEURONSPI_MAX_DEVS                             3
 #define NEURONSPI_MAX_UART                             16
index 7b32fc37a6e7b5e31c7f5506ab8d9e492ca98e7d..1b5ccbb6fdede9c433560afeb5089adae8885515 100644 (file)
@@ -842,6 +842,48 @@ err_end:
        return count;
 }
 
+static ssize_t neuronspi_spi_store_reboot(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+       ssize_t err = 0;
+       unsigned int val = 0;
+       struct spi_device *spi;
+       struct platform_device *plat = to_platform_device(dev);
+    struct neuronspi_board_device_data *board_device_data = platform_get_drvdata(plat);
+       struct neuronspi_driver_data *n_spi = board_device_data->n_spi;
+#if NEURONSPI_DETAILED_DEBUG > 0
+       printk(KERN_INFO "UNIPISPI: Index %d\n", n_spi->neuron_index);
+#endif
+       err = kstrtouint(buf, 0, &val);
+       if (err >= 0) {
+               if (n_spi && n_spi->combination_id != 0xFF && n_spi->reg_map) {
+               spi = neuronspi_s_dev[n_spi->neuron_index];
+               unipispi_modbus_write_coil(spi, 1002, val);
+               }
+       }
+       return count;
+}
+
+static ssize_t neuronspi_spi_store_save_initial_state(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+       ssize_t err = 0;
+       unsigned int val = 0;
+       struct spi_device *spi;
+       struct platform_device *plat = to_platform_device(dev);
+    struct neuronspi_board_device_data *board_device_data = platform_get_drvdata(plat);
+       struct neuronspi_driver_data *n_spi = board_device_data->n_spi;
+#if NEURONSPI_DETAILED_DEBUG > 0
+       printk(KERN_INFO "UNIPISPI: Index %d\n", n_spi->neuron_index);
+#endif
+       err = kstrtouint(buf, 0, &val);
+       if (err >= 0) {
+               if (n_spi && n_spi->combination_id != 0xFF && n_spi->reg_map && n_spi->regstart_table->uart_conf_reg) {
+               spi = neuronspi_s_dev[n_spi->neuron_index];
+               unipispi_modbus_write_coil(spi, 1003, val);
+               }
+       }
+       return count;
+}
+
 static ssize_t neuronspi_spi_show_board(struct device *dev, struct device_attribute *attr, char *buf)
 {
        ssize_t ret = 0;
@@ -1141,6 +1183,8 @@ static DEVICE_ATTR(register_read, 0660, neuronspi_spi_show_register, neuronspi_s
 static DEVICE_ATTR(register_set, 0220, NULL, neuronspi_spi_store_register_value);
 static DEVICE_ATTR(regmap_read, 0660, neuronspi_show_regmap, neuronspi_store_regmap);
 static DEVICE_ATTR(regmap_set, 0220, NULL, neuronspi_store_regmap_value);
+static DEVICE_ATTR(reboot_group, 0220, NULL, neuronspi_spi_store_reboot);
+static DEVICE_ATTR(save_initial_state, 0220, NULL, neuronspi_spi_store_save_initial_state);
 static DEVICE_ATTR(sys_board_serial, 0440, neuronspi_spi_show_serial, NULL);
 static DEVICE_ATTR(sys_board_name, 0444, neuronspi_spi_show_board, NULL);
 static DEVICE_ATTR(sys_primary_major_id, 0444, neuronspi_spi_show_lboard_id, NULL);
@@ -1202,6 +1246,8 @@ static struct attribute *neuron_board_attrs[] = {
                &dev_attr_register_set.attr,
                &dev_attr_regmap_read.attr,
                &dev_attr_regmap_set.attr,
+               &dev_attr_reboot_group.attr,
+               &dev_attr_save_initial_state.attr,
                NULL,
 };
 
index 91dd5bba52ef7762a55d9b6a4a03eba20426ee12..c59e8b54c7eb2d576f8b258a2c74b65c64197e9e 100644 (file)
@@ -1 +1 @@
-Repository:unipi-kernel ActiveBranch:[master] PrecedingRelease:v.0.12 PrecedingRevision:103(35aafeb) LatestCommit:Tue Aug 14 19:22:23 CEST 2018
+Repository:unipi-kernel ActiveBranch:[master] PrecedingRelease:v.0.12 PrecedingRevision:121(321cdd4) LatestCommit:Thu Sep 27 16:20:55 CEST 2018