]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/src/drv/_tms570_rpp/port_def.c
Change target-specific pin and port definitions to match the new interface
[pes-rpp/rpp-lib.git] / rpp / src / drv / _tms570_rpp / port_def.c
diff --git a/rpp/src/drv/_tms570_rpp/port_def.c b/rpp/src/drv/_tms570_rpp/port_def.c
new file mode 100644 (file)
index 0000000..8a14ede
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2015 Czech Technical University in Prague
+ *
+ * Authors:
+ *     - Michal Horn <hornmich@fel.cvut.cz>
+ *     - Michal Sojka <sojkam1@fel.cvut.cz>
+ *
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
+ *
+ */
+
+#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 gio ports
+static enum pin_name pins_dinmcu[] = {
+               PIN_DIN8, PIN_DIN9, PIN_DIN10, PIN_DIN11,
+               PIN_DIN12, PIN_DIN13, PIN_DIN14, PIN_DIN15
+};
+static enum pin_name pins_houtin[] = {
+               PIN_HOUT1IN, PIN_HOUT2IN, PIN_HOUT3IN,
+               PIN_HOUT4IN, PIN_HOUT5IN, PIN_HOUT6IN
+};
+static enum pin_name pins_houtdiag[] = {
+               PIN_HOUT1DIAG, PIN_HOUT2DIAG, PIN_HOUT3DIAG,
+               PIN_HOUT4DIAG, PIN_HOUT5DIAG, PIN_HOUT6DIAG
+};
+static enum pin_name pins_mouten[] = {
+               PIN_MOUT1EN, PIN_MOUT2EN, PIN_MOUT3EN,
+               PIN_MOUT4EN, PIN_MOUT5EN, PIN_MOUT6EN
+};
+static enum pin_name pins_moutin[] = {
+               PIN_MOUT1IN, PIN_MOUT2IN, PIN_MOUT3IN,
+               PIN_MOUT4IN, PIN_MOUT5IN, PIN_MOUT6IN
+};
+
+const struct port_desc port_desc[] = {
+       [PORT_ID_DINMCU] = {
+               .name = "DINMCU",
+               .numchn = ARRAY_SIZE(pins_dinmcu),
+               .bpch = 1,
+               .get = port_gioset_get,
+               .set = NULL,
+               .cfg = { .gioset = { .pins = pins_dinmcu } },
+       },
+       [PORT_ID_DINSPI] = {
+               .name = "DINSPI",
+               .numchn = 1,
+               .bpch = 24,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 1, .cs = 0 } },
+       },
+       [PORT_ID_HOUTDIAG] = {
+               .name = "HOUTDIAG",
+               .numchn = ARRAY_SIZE(pins_houtdiag),
+               .bpch = 1,
+               .get = port_gioset_get,
+               .set = NULL,
+               .cfg = { .gioset = { .pins = pins_houtdiag } },
+       },
+       [PORT_ID_HOUTIN] = {
+               .name = "HOUTIN",
+               .numchn = ARRAY_SIZE(pins_houtin),
+               .bpch = 1,
+               .get = port_gioset_get,
+               .set = port_gioset_set,
+               .cfg = { .gioset = { .pins = pins_houtin } },
+       },
+       [PORT_ID_HOUTIFBK] = {
+               .name = "HOUTIFBK",
+               .numchn = 6,
+               .bpch = 16,
+               .get = port_adc_get,
+               .set = NULL,
+               .cfg = { .adc = { .reg = adcREG2, .group = adcGROUP1, .sem = 0 } },
+       },
+       [PORT_ID_ADC] = {
+               .name = "ADC",
+               .numchn = 12,
+               .bpch = 16,
+               .get = port_adc_get,
+               .set = NULL,
+               .cfg = { .adc = { .reg = adcREG1, .group = adcGROUP1, .sem = 1 } },
+       },
+       [PORT_ID_LOUT] = {
+               .name = "LOUT",
+               .numchn = 1,
+               .bpch = 32,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 1, .cs = 1 }, },
+       },
+       [PORT_ID_DAC1_2] = {
+               .name = "DAC12",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 3, .cs = 0 }, },
+       },
+       [PORT_ID_DAC3_4] = {
+               .name = "DAC34",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 3, .cs = 1 }, },
+       },
+       [PORT_ID_DACDREF] = {
+               .name = "DACDREF",              /* Reference voltage for DIN */
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 3, .cs = 2 }, },
+       },
+       [PORT_ID_HBR] = {
+               .name = "HBR",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 4, .cs = 0 }, },
+       },
+       [PORT_ID_FRAY1] = {
+               .name = "FRAY1",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 4, .cs = 1 }, },
+       },
+       [PORT_ID_FRAY2] = {
+               .name = "FRAY2",
+               .numchn = 1,
+               .bpch = 16,
+               .get = NULL,
+               .set = port_spi_set,
+               .cfg = { .spi = { .ifc = 4, .cs = 2 }, },
+       },
+       [PORT_ID_MOUTEN] = {
+               .name = "MOUTEN",
+               .numchn = ARRAY_SIZE(pins_mouten),
+               .bpch = 1,
+               .get = port_gioset_get,
+               .set = NULL,
+               .cfg = { .gioset = { .pins = pins_mouten } },
+       },
+       [PORT_ID_MOUTIN] = {
+               .name = "MOUTIN",
+               .numchn = ARRAY_SIZE(pins_moutin),
+               .bpch = 1,
+               .get = port_gioset_get,
+               .set = port_gioset_set,
+               .cfg = { .gioset = { .pins = pins_moutin } },
+       }
+};