[PATCH 3/3] [raspberrypi] Allow only read or write for SPI 3-wire mode

Jan Sommer soja-lists at aries.uberspace.de
Sun Jun 12 18:45:03 UTC 2016


---
 c/src/lib/libbsp/arm/raspberrypi/spi/spi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/c/src/lib/libbsp/arm/raspberrypi/spi/spi.c b/c/src/lib/libbsp/arm/raspberrypi/spi/spi.c
index de3c44b..0104624 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/spi/spi.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/spi/spi.c
@@ -550,6 +550,11 @@ static int rpi_libi2c_spi_ioctl(rtems_libi2c_bus_t * bushdl, int cmd, void *arg)
       
     case RTEMS_LIBI2C_IOCTL_READ_WRITE:
       rw = (const rtems_libi2c_read_write_t*) arg;
+      if ( bidirectional && rw.rd_buf && rw->wr_buf ) {
+        /* With bidirectional mode simultaneous read-write
+         * is not supported */
+        return -1;
+      }
       return rpi_spi_read_write(
                 bushdl, 
                 rw->rd_buf, 
-- 
2.7.4




More information about the devel mailing list