From: Michal Sojka Date: Sat, 29 Aug 2015 07:41:48 +0000 (+0200) Subject: Add SPI devices available on hydctr board X-Git-Tag: eaton-0.6~18 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/pes-rpp/rpp-lib.git/commitdiff_plain/8cfb68ebffe0f80e4f9fb1e343d494bdf0481fba Add SPI devices available on hydctr board --- diff --git a/build/tms570_hydctr/Makefile.config b/build/tms570_hydctr/Makefile.config index 0de1a13..a55eb4d 100644 --- a/build/tms570_hydctr/Makefile.config +++ b/build/tms570_hydctr/Makefile.config @@ -6,5 +6,5 @@ TARGET_CCXML = TMS570LS1227.ccxml TARGET_LDFLAGS = --be32 TARGET_HAS_DMM = n -TARGET_HAS_SPI = n +TARGET_HAS_SPI = y diff --git a/rpp/include/drv/.gitattributes b/rpp/include/drv/.gitattributes index 632d8fa..38f649a 100644 --- a/rpp/include/drv/.gitattributes +++ b/rpp/include/drv/.gitattributes @@ -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 diff --git a/rpp/include/drv/_tms570_hydctr/.gitattributes b/rpp/include/drv/_tms570_hydctr/.gitattributes index aad7dfa..6764242 100644 --- a/rpp/include/drv/_tms570_hydctr/.gitattributes +++ b/rpp/include/drv/_tms570_hydctr/.gitattributes @@ -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 index 0000000..0da0c6a --- /dev/null +++ b/rpp/include/drv/_tms570_hydctr/spi_def.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015 Czech Technical University in Prague + * + * Authors: + * - Michal Sojka + * + * 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 diff --git a/rpp/include/drv/spi_tms570.h b/rpp/include/drv/spi_tms570.h index d2a6f99..16f6e85 100644 --- a/rpp/include/drv/spi_tms570.h +++ b/rpp/include/drv/spi_tms570.h @@ -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 index 0000000..291dabd --- /dev/null +++ b/rpp/include/ul/.gitattributes @@ -0,0 +1,4 @@ +/ul_itbase.h eaton +/ul_list.h eaton +/ul_listbase.h eaton +/ul_utdefs.h eaton diff --git a/rpp/src/drv/.gitattributes b/rpp/src/drv/.gitattributes index b67ba5b..265029f 100644 --- a/rpp/src/drv/.gitattributes +++ b/rpp/src/drv/.gitattributes @@ -2,3 +2,5 @@ /gio.c eaton /gio_tab.c eaton /sci.c eaton +/spi.c eaton +/spi_tms570.c eaton diff --git a/rpp/src/drv/_tms570_hydctr/.gitattributes b/rpp/src/drv/_tms570_hydctr/.gitattributes index 7a08363..e7c8504 100644 --- a/rpp/src/drv/_tms570_hydctr/.gitattributes +++ b/rpp/src/drv/_tms570_hydctr/.gitattributes @@ -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 index 0000000..a2d84ab --- /dev/null +++ b/rpp/src/drv/_tms570_hydctr/spi_def.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2015 Czech Technical University in Prague + * + * Authors: + * - Michal Sojka + * + * 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 + }, +}; diff --git a/rpp/src/drv/spi_tms570.c b/rpp/src/drv/spi_tms570.c index f25e25a..cc5d1fa 100644 --- a/rpp/src/drv/spi_tms570.c +++ b/rpp/src/drv/spi_tms570.c @@ -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;