]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/src/drv/_tms570_hydctr/port_def.c
Add SPI chip name to port configuration
[pes-rpp/rpp-lib.git] / rpp / src / drv / _tms570_hydctr / port_def.c
index a5e801202dea94d5a46bb9c81f2b72b699db5da1..b268683a50a91b7b4909577e6e80e65d39dfde5d 100644 (file)
 #include "drv/port.h"
 #include "drv/gio_names.h"
 #include "drv/gio_tab.h"
+#include "drv/spi.h"
+#include "drv/spi_tms570.h"
 #include "drv/adc.h"
 
 // Lists of pins assigned to the ports
 static enum pin_name pins_gioa[] = {
-               PIN_GIOA0, PIN_GIOA1, PIN_GIOA2, PIN_GIOA3,
-               PIN_GIOA4, PIN_GIOA5, PIN_GIOA6, PIN_GIOA7
+       PIN_GIOA0, PIN_GIOA1, PIN_GIOA2, PIN_GIOA3,
+       PIN_GIOA4
 };
 static enum pin_name pins_giob[] = {
-               PIN_GIOB0, PIN_GIOB1, PIN_GIOB2, PIN_GIOB3,
-               PIN_GIOB4, PIN_GIOB5, PIN_GIOB6, PIN_GIOB7
+       PIN_GIOB0, PIN_GIOB1, PIN_GIOB2, PIN_GIOB3,
+       PIN_GIOB4, PIN_GIOB5, PIN_GIOB6
 };
 static enum pin_name pins_nhet1[] = {
-               PIN_NHET10, PIN_NHET11, PIN_NHET12,
-               PIN_NHET13, PIN_NHET14, PIN_NHET15,
-               PIN_NHET17, PIN_NHET18, PIN_NHET19,
-               PIN_NHET110, PIN_NHET111, PIN_NHET112,
-               PIN_NHET114, PIN_NHET115, PIN_NHET116,
-               PIN_NHET117, PIN_NHET118, PIN_NHET119,
-               PIN_NHET120, PIN_NHET121, PIN_NHET122,
-               PIN_NHET123, PIN_NHET124, PIN_NHET125,
-               PIN_NHET126, PIN_NHET127, PIN_NHET128,
-               PIN_NHET129, PIN_NHET130, PIN_NHET131
+       PIN_NHET11,
+       PIN_NHET13,
+       PIN_NHET18,
+       PIN_NHET112,
+       PIN_NHET114, PIN_NHET116,
+       PIN_NHET117, PIN_NHET119,
+       PIN_NHET122,
+       PIN_NHET123, PIN_NHET124, PIN_NHET125,
+       PIN_NHET126, PIN_NHET127, PIN_NHET128,
+       PIN_NHET129, PIN_NHET130, PIN_NHET131
 };
 
 // Port descriptors
@@ -66,10 +68,58 @@ const struct port_desc port_desc[] = {
        },
        [PORT_ID_ADC] = {
                .name = "ADC",
-               .cfg = { .adc = { .reg = adcREG1, .group = adcGROUP1, .sem = 1 } },
-               .numchn = 16,
+               .cfg = { .adc = { .reg = adcREG1, .group = adcGROUP1 } },
+               .numchn = PORT_ADC_CHANNELS,
                .bpch = 16,
                .get = port_adc_get,
                .set = NULL,
        },
+       [PORT_ID_THERMISTOR1] = {
+               .name = "THERM1",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .dev = SPIDEV_MCP6S93_TH1, .chip = "MCP6S93" }, },
+       },
+       [PORT_ID_THERMISTOR2] = {
+               .name = "THERM2",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .dev = SPIDEV_MCP6S93_TH2, .chip = "MCP6S93" }, },
+       },
+       [PORT_ID_ADC_COND] = {
+               .name = "ADCCND",
+               .numchn = 6,
+               .bpch = 16, /* 6 ICs in daisy chain */
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .dev = SPIDEV_MCP6S93_6ADC, .chip = "MCP6S93" }, },
+       },
+       [PORT_ID_POWER_SUPPLY] = {
+               .name = "PWR",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .dev = SPIDEV_TPS65381_PWR, .chip = "TPS65381" }, },
+       },
+       [PORT_ID_SENSOR_SUPPLY] = {
+               .name = "SENSUP",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .dev = SPIDEV_MCP6S93_SENSUP, .chip = "MCP6S93" }, },
+       },
+       [PORT_ID_DAC_ADC_LOOPBACK] = {
+               .name = "DACLBK",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .dev = SPIDEV_MCP6S93_DAC, .chip = "MCP6S93" }, },
+       },
 };