]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/commitdiff
Add SPI devices available on hydctr board
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 29 Aug 2015 07:41:48 +0000 (09:41 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 3 Sep 2015 08:22:11 +0000 (10:22 +0200)
build/tms570_hydctr/Makefile.config
rpp/include/drv/.gitattributes
rpp/include/drv/_tms570_hydctr/.gitattributes
rpp/include/drv/_tms570_hydctr/spi_def.h [new file with mode: 0644]
rpp/include/drv/spi_tms570.h
rpp/include/ul/.gitattributes [new file with mode: 0644]
rpp/src/drv/.gitattributes
rpp/src/drv/_tms570_hydctr/.gitattributes
rpp/src/drv/_tms570_hydctr/spi_def.c [new file with mode: 0644]
rpp/src/drv/spi_tms570.c

index 0de1a1385895cc3c205e26043ab37225bb322176..a55eb4dcec648288b324db9cf206cfd48266fb93 100644 (file)
@@ -6,5 +6,5 @@ TARGET_CCXML = TMS570LS1227.ccxml
 TARGET_LDFLAGS = --be32
 
 TARGET_HAS_DMM = n
-TARGET_HAS_SPI = n
+TARGET_HAS_SPI = y
 
index 632d8fa143453ddcb040acd3d711649b9275f039..38f649a2cb2e9e62659ade90c994f0a273238205 100644 (file)
@@ -9,3 +9,6 @@
 /port.h        eaton
 /port_def.h    eaton
 /sci.h eaton
+/spi.h eaton
+/spi_def.h     eaton
+/spi_tms570.h  eaton
index aad7dfa02ff5f1486c50ab91215ec7aa8c208c74..6764242e803918f6d071670d55cd0cb900b11793 100644 (file)
@@ -1,2 +1,3 @@
 /gio_def.h     eaton
 /port_def.h    eaton
+/spi_def.h     eaton
diff --git a/rpp/include/drv/_tms570_hydctr/spi_def.h b/rpp/include/drv/_tms570_hydctr/spi_def.h
new file mode 100644 (file)
index 0000000..0da0c6a
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 Czech Technical University in Prague
+ *
+ * Authors:
+ *     - 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.
+ *
+ */
+
+#ifndef _TMS570_HYDCTR_SPI_DEF_H
+#define _TMS570_HYDCTR_SPI_DEF_H
+
+/* Identifiers of SPI devices (=chips) */
+
+enum spi_device {
+       SPIDEV_MCP6S93_TH1,
+       SPIDEV_MCP6S93_TH2,
+       SPIDEV_MCP6S93_6ADC,
+       SPIDEV_TPS65381_PWR,
+       SPIDEV_MCP6S93_SENSUP,
+       SPIDEV_MCP6S93_DAC,
+
+       _SPIDEV_COUNT
+};
+
+
+#endif
index d2a6f9986d45c478430479a4617549ffd1a61ca3..16f6e85cde66a2c73f3d13d637078e0b155dea5e 100644 (file)
@@ -45,9 +45,11 @@ enum spiChipSelect {
        SPI_CS_5 =    0x00DF,
        SPI_CS_6 =    0x00BF,
        SPI_CS_7 =    0x007F,
+#if defined(TARGET_TMS570_RPP)
        SPI_CS_DMM0 = 0x0100,
        SPI_CS_DMM1 = 0x0200,
        SPI_CS_DMM2 = 0x0400
+#endif
 };
 
 enum spi_iface {
diff --git a/rpp/include/ul/.gitattributes b/rpp/include/ul/.gitattributes
new file mode 100644 (file)
index 0000000..291dabd
--- /dev/null
@@ -0,0 +1,4 @@
+/ul_itbase.h   eaton
+/ul_list.h     eaton
+/ul_listbase.h eaton
+/ul_utdefs.h   eaton
index b67ba5b3bf11a3f002de0ce251183f4fbd6a6f1d..265029f19606c02ef3763efa5e80cf0fd80893d7 100644 (file)
@@ -2,3 +2,5 @@
 /gio.c eaton
 /gio_tab.c     eaton
 /sci.c eaton
+/spi.c eaton
+/spi_tms570.c  eaton
index 7a08363fc957da065417e15b8c020fe4f7cbd9c3..e7c85041fa09d138fbc41f221785b7ef3968236f 100644 (file)
@@ -1 +1,2 @@
 /port_def.c    eaton
+/spi_def.c     eaton
diff --git a/rpp/src/drv/_tms570_hydctr/spi_def.c b/rpp/src/drv/_tms570_hydctr/spi_def.c
new file mode 100644 (file)
index 0000000..a2d84ab
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2015 Czech Technical University in Prague
+ *
+ * Authors:
+ *     - 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/spi_def.h"
+#include "drv/spi_tms570.h"
+
+const spi_dev_t spi_devs[_SPIDEV_COUNT] = {
+       [SPIDEV_MCP6S93_TH1] = {
+               .iface = SPI_IFACE3,
+               .cs = SPI_CS_4,
+               .dfsel = 0,
+               .wdel = 0,
+               .cshold = 1,
+               .dlen = 0
+       },
+       [SPIDEV_MCP6S93_TH2] = {
+               .iface = SPI_IFACE3,
+               .cs = SPI_CS_5,
+               .dfsel = 0,
+               .wdel = 0,
+               .cshold = 1,
+               .dlen = 0
+       },
+       [SPIDEV_MCP6S93_6ADC] = {
+               .iface = SPI_IFACE3,
+               .cs = SPI_CS_0,
+               .dfsel = 0,
+               .wdel = 0,
+               .cshold = 1,
+               .dlen = 0
+       },
+       [SPIDEV_TPS65381_PWR] = {
+               .iface = SPI_IFACE2,
+               .cs = SPI_CS_1,
+               .dfsel = 0,
+               .wdel = 0,
+               .cshold = 1,
+               .dlen = 0
+       },
+       [SPIDEV_MCP6S93_SENSUP] = {
+               .iface = SPI_IFACE5,
+               .cs = SPI_CS_3,
+               .dfsel = 0,
+               .wdel = 0,
+               .cshold = 1,
+               .dlen = 0
+       },
+       [SPIDEV_MCP6S93_DAC] = {
+               .iface = SPI_IFACE5,
+               .cs = SPI_CS_2,
+               .dfsel = 0,
+               .wdel = 0,
+               .cshold = 1,
+               .dlen = 0
+       },
+};
index f25e25a2e5c81940578fa6043c8a783753c45eb6..cc5d1fa0d45df87475512fb3110424f7ab7023d9 100644 (file)
@@ -421,6 +421,7 @@ void spi_tms570_isr(int spi_ifc, uint32_t flags)
                                        | (dev->cshold & 0x1) << 28
                                        | (dev->dfsel & 0x3) << 24;
 
+#if defined(TARGET_TMS570_RPP)
                                /* GPIO CS -- setting the multiplexer */
                                if (cs > 0xff) {
                                        switch (cs & 0xFF00) {
@@ -438,6 +439,7 @@ void spi_tms570_isr(int spi_ifc, uint32_t flags)
                                                break;
                                        }
                                }
+#endif
                        }
 
                        rq_len = msg->rq_len;