V69+: #280 SPI/BSC SLAVE peripheral not available on BCM2711
authorjoan2937 <joan@abyz.me.uk>
Sun, 7 Jul 2019 11:52:44 +0000 (12:52 +0100)
committerjoan2937 <joan@abyz.me.uk>
Sun, 7 Jul 2019 11:52:44 +0000 (12:52 +0100)
12 files changed:
command.c
command.h
pigpio.3
pigpio.c
pigpio.h
pigpio.py
pigpiod_if2.3
pigpiod_if2.c
pigpiod_if2.h
pigs.1
pigs.c
setup.py

index 7b339ea8d0b28adba22cb31e97675e16df7b5fba..7a799ae910a81491f695363472869602d753dcf6 100644 (file)
--- a/command.c
+++ b/command.c
@@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
 */
 
 /*
-This version is for pigpio version 67+
+This version is for pigpio version 69+
 */
 
 #include <stdio.h>
@@ -564,6 +564,8 @@ static errInfo_t errInfo[]=
    {PI_NOT_SPI_GPIO     , "no bit bang SPI in progress on GPIO"},
    {PI_BAD_EVENT_ID     , "bad event id"},
    {PI_CMD_INTERRUPTED  , "command interrupted, Python"},
+   {PI_NOT_ON_BCM2711   , "not available on BCM2711"},
+   {PI_ONLY_ON_BCM2711  , "only available on BCM2711"},
 
 };
 
index d95eb49cf0103776ab6e5e81e29d4daafe2ed103..0a09d69ce2b2cb063fdc8a601c13be331bb362a3 100644 (file)
--- a/command.h
+++ b/command.h
@@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
 */
 
 /*
-This version is for pigpio version 57+
+This version is for pigpio version 69+
 */
 
 #ifndef COMMAND_H
index b37f1e533da78ebedfd0e304eeb86e89c5105322..54e23e146c622d0a67bb079815855aa76b6e4f7b 100644 (file)
--- a/pigpio.3
+++ b/pigpio.3
@@ -3634,6 +3634,12 @@ Pi to act as a slave device on an I2C or SPI bus.
 
 .br
 
+.br
+This function is not available on the BCM2711 (e.g. as
+used in the Pi4B).
+
+.br
+
 .br
 I can't get SPI to work properly.  I tried with a
 control word of 0x303 and swapped MISO and MOSI.
@@ -10355,6 +10361,10 @@ A 16-bit word value.
 .br
 #define PI_CMD_INTERRUPTED -144 // Used by Python
 .br
+#define PI_NOT_ON_BCM2711  -145 // not available on BCM2711
+.br
+#define PI_ONLY_ON_BCM2711 -146 // only available on BCM2711
+.br
 
 .br
 #define PI_PIGIF_ERR_0    -2000
index 282e80051352553fda40a0db8b36d6e7f6508db1..fc308d8bb67c5fe35943967f54439feed7770809 100644 (file)
--- a/pigpio.c
+++ b/pigpio.c
@@ -10731,6 +10731,9 @@ int bscXfer(bsc_xfer_t *xfer)
 
    CHECK_INITED;
 
+   if (pi_is_2711)
+      SOFT_ERROR(PI_NOT_ON_BCM2711, "SPI/BSC slave not available on BCM2711");
+
    eventAlert[PI_EVENT_BSC].ignore = 1;
 
    if (xfer->control)
index b61c5034fe210539e4900787a57b5d6c09daf661..178e3c8d0400629ba7e0469083faadaa7b49ec56 100644 (file)
--- a/pigpio.h
+++ b/pigpio.h
@@ -13,7 +13,6 @@ of the public at large and to the detriment of our heirs and
 successors. We intend this dedication to be an overt act of
 relinquishment in perpetuity of all present and future rights to this
 software under copyright law.
-
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -31,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
 #include <stdint.h>
 #include <pthread.h>
 
-#define PIGPIO_VERSION 6901
+#define PIGPIO_VERSION 6902
 
 /*TEXT
 
@@ -2880,6 +2879,9 @@ This function provides a low-level interface to the
 SPI/I2C Slave peripheral.  This peripheral allows the
 Pi to act as a slave device on an I2C or SPI bus.
 
+This function is not available on the BCM2711 (e.g. as
+used in the Pi4B).
+
 I can't get SPI to work properly.  I tried with a
 control word of 0x303 and swapped MISO and MOSI.
 
@@ -6426,6 +6428,8 @@ after this command is issued.
 #define PI_NOT_SPI_GPIO    -142 // no bit bang SPI in progress on GPIO
 #define PI_BAD_EVENT_ID    -143 // bad event id
 #define PI_CMD_INTERRUPTED -144 // Used by Python
+#define PI_NOT_ON_BCM2711  -145 // not available on BCM2711
+#define PI_ONLY_ON_BCM2711 -146 // only available on BCM2711
 
 #define PI_PIGIF_ERR_0    -2000
 #define PI_PIGIF_ERR_99   -2099
index ae7be89b80a79b849ccccdfc6c102f5a03f291b8..d66485dbf6883cde2241e48a1623e2e99bd3be6f 100644 (file)
--- a/pigpio.py
+++ b/pigpio.py
@@ -300,7 +300,7 @@ import threading
 import os
 import atexit
 
-VERSION = "1.42"
+VERSION = "1.43"
 
 exceptions = True
 
@@ -689,6 +689,8 @@ PI_BAD_SPI_BAUD     =-141
 PI_NOT_SPI_GPIO     =-142
 PI_BAD_EVENT_ID     =-143
 PI_CMD_INTERRUPTED  =-144
+PI_NOT_ON_BCM2711   =-145
+PI_ONLY_ON_BCM2711  =-146
 
 # pigpio error text
 
@@ -835,6 +837,8 @@ _errors=[
    [PI_NOT_SPI_GPIO      , "no bit bang SPI in progress on GPIO"],
    [PI_BAD_EVENT_ID      , "bad event id"],
    [PI_CMD_INTERRUPTED   , "pigpio command interrupted"],
+   [PI_NOT_ON_BCM2711    , "not available on BCM2711"],
+   [PI_ONLY_ON_BCM2711   , "only available on BCM2711"],
 ]
 
 _except_a = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n{}"
@@ -3513,6 +3517,9 @@ class pi():
       SPI/I2C Slave peripheral.  This peripheral allows the
       Pi to act as a slave device on an I2C or SPI bus.
 
+      This function is not available on the BCM2711 (e.g. as
+      used in the Pi4B).
+
       I can't get SPI to work properly.  I tried with a
       control word of 0x303 and swapped MISO and MOSI.
 
@@ -3619,6 +3626,9 @@ class pi():
       """
       This function allows the Pi to act as a slave I2C device.
 
+      This function is not available on the BCM2711 (e.g. as
+      used in the Pi4B).
+
       The data bytes (if any) are written to the BSC transmit
       FIFO and the bytes in the BSC receive FIFO are returned.
 
index d91c6867b67f63e88fb10015e0b68856978dd444..f39dfa496f070b2481d55b26d6a8092da249e4a1 100644 (file)
@@ -5604,6 +5604,12 @@ Pi to act as a slave device on an I2C or SPI bus.
 
 .br
 
+.br
+This function is not available on the BCM2711 (e.g. as
+used in the Pi4B).
+
+.br
+
 .br
 I can't get SPI to work properly.  I tried with a
 control word of 0x303 and swapped MISO and MOSI.
@@ -5847,6 +5853,12 @@ This function allows the Pi to act as a slave I2C device.
 
 .br
 
+.br
+This function is not available on the BCM2711 (e.g.as
+used in the Pi4B).
+
+.br
+
 .br
 The data bytes (if any) are written to the BSC transmit
 FIFO and the bytes in the BSC receive FIFO are returned.
index 85bc27cc5c31fb55740e5427d3bb627a88a69f5b..fa97d316b97ee19ed1cf2c2671c009931d441ed7 100644 (file)
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 For more information, please refer to <http://unlicense.org/>
 */
 
-/* PIGPIOD_IF2_VERSION 13 */
+/* PIGPIOD_IF2_VERSION 14 */
 
 #include <stdio.h>
 #include <stdlib.h>
index 062f71cf9a6e8185612b2d7a1dc05b141b8c8bc3..4cd7cf8afe1085521e713bb2af2dbd361b30c37e 100644 (file)
@@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
 
 #include "pigpio.h"
 
-#define PIGPIOD_IF2_VERSION 13
+#define PIGPIOD_IF2_VERSION 14
 
 /*TEXT
 
@@ -3402,6 +3402,9 @@ This function provides a low-level interface to the
 SPI/I2C Slave peripheral.  This peripheral allows the
 Pi to act as a slave device on an I2C or SPI bus.
 
+This function is not available on the BCM2711 (e.g. as
+used in the Pi4B).
+
 I can't get SPI to work properly.  I tried with a
 control word of 0x303 and swapped MISO and MOSI.
 
@@ -3522,6 +3525,9 @@ int bsc_i2c(int pi, int i2c_addr, bsc_xfer_t *bscxfer);
 /*D
 This function allows the Pi to act as a slave I2C device.
 
+This function is not available on the BCM2711 (e.g.as
+used in the Pi4B).
+
 The data bytes (if any) are written to the BSC transmit
 FIFO and the bytes in the BSC receive FIFO are returned.
 
diff --git a/pigs.1 b/pigs.1
index ebb07772a2b86b8d87f74edd5bdd79740c683dc9..cb55e3da3dc5fc4008eaeca83c880eccad3413cd 100644 (file)
--- a/pigs.1
+++ b/pigs.1
@@ -542,6 +542,10 @@ ERROR: no permission to update one or more GPIO
 This command performs a BSC I2C/SPI slave transfer as defined by
 \fBbctl\fP with data \fBbvs\fP.
 
+.br
+This function is not available on the BCM2711 (e.g. as
+used in the Pi4B).
+
 .br
 I can't get SPI to work properly.  I tried with a
 control word of 0x303 and swapped MISO and MOSI.
diff --git a/pigs.c b/pigs.c
index 0d0f44ecf87d234e68de1bbcfd3fd814a111f612..928afa3d8c698d82b69586bc955a8bab2cdee8e5 100644 (file)
--- a/pigs.c
+++ b/pigs.c
@@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
 */
 
 /*
-This version is for pigpio version 67+
+This version is for pigpio version 69+
 */
 
 #include <stdio.h>
@@ -233,8 +233,9 @@ void print_result(int sock, int rv, cmdCmd_t cmd)
               */
          if (r < 0)
          {
-            printf("%d", r);
+            printf("%d\n", r);
             report(PIGS_SCRIPT_ERR, "ERROR: %s", cmdErrStr(r));
+            break;
          }
 
          p = (uint32_t *)response_buf;
index 9de06d230be75c67c268db2a05e9af4f9309699c..a0cb2935f94d4bebaa7533c5e487be970ad3aa9e 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
 from distutils.core import setup
 
 setup(name='pigpio',
-      version='1.42',
+      version='1.43',
       author='joan',
       author_email='joan@abyz.me.uk',
       maintainer='joan',