diff options
author | Sergiusz Bazanski <q3k@q3k.org> | 2020-02-23 15:13:16 +0100 |
---|---|---|
committer | Sergiusz Bazanski <q3k@q3k.org> | 2020-02-23 15:39:24 +0100 |
commit | 1735eb0cf6f0cf20580555a5989ef4efd786fd2b (patch) | |
tree | 12461d05eb447d1bae702041b7ddc3b3221cea48 | |
parent | 25b41d64960765a33cf2b409f3b3c9247df164fa (diff) | |
download | bitvend-1735eb0cf6f0cf20580555a5989ef4efd786fd2b.tar.gz bitvend-1735eb0cf6f0cf20580555a5989ef4efd786fd2b.tar.bz2 bitvend-1735eb0cf6f0cf20580555a5989ef4efd786fd2b.tar.xz bitvend-1735eb0cf6f0cf20580555a5989ef4efd786fd2b.zip |
*: fixes for 64-bit RPi3 via NixOS
We force pigpio to not use the old broadcom fork mailbox interface, and
we use a fork of pigpio that work with u-boot.
-rw-r--r-- | cygpio/cygpio.pyx | 12 | ||||
-rw-r--r-- | default.nix | 11 |
2 files changed, 19 insertions, 4 deletions
diff --git a/cygpio/cygpio.pyx b/cygpio/cygpio.pyx index 9049cda..dd0a931 100644 --- a/cygpio/cygpio.pyx +++ b/cygpio/cygpio.pyx @@ -20,6 +20,10 @@ cdef extern from "pigpio.h": int gpioWaveAddSerial(unsigned user_gpio, unsigned baud, unsigned data_bits, unsigned stop_bits, unsigned offset, unsigned numBytes, char *str) + int gpioCfgMemAlloc(unsigned memAllocMode) + unsigned int gpioCfgGetInternals() + int gpioCfgSetInternals(unsigned int cfgVal) + cdef int INPUT "PI_INPUT" cdef int OUTPUT "PI_OUTPUT" cdef int PI_DISABLE_FIFO_IF @@ -27,6 +31,8 @@ cdef extern from "pigpio.h": cdef int PI_WAVE_MODE_ONE_SHOT + cdef unsigned PI_MEM_ALLOC_PAGEMAP + cdef extern from "unistd.h" nogil: unsigned int sleep(unsigned int seconds) unsigned int usleep(unsigned int usecs) @@ -46,6 +52,12 @@ cdef class CythonRaspiBackend(object): self.tx_pin = tx_pin cpdef open(self): + # Enable full on debug + gpioCfgSetInternals(gpioCfgGetInternals() | 8); + + # Force usage of non-mailbox DMA + gpioCfgMemAlloc(PI_MEM_ALLOC_PAGEMAP); + gpioCfgInterfaces(PI_DISABLE_FIFO_IF | PI_DISABLE_SOCK_IF); gpioInitialise() gpioWaveClear() diff --git a/default.nix b/default.nix index 3afa202..b83484f 100644 --- a/default.nix +++ b/default.nix @@ -18,6 +18,7 @@ let inherit pyjwt; inherit pytest; inherit qrcode; + inherit raspberrypi-tools; inherit requests; inherit six; }; @@ -92,15 +93,17 @@ in with upstream; let pigpio = stdenv.mkDerivation rec { pname = "pigpio"; - version = "74"; + version = "74-q3k"; installFlags = [ "DESTDIR=$(out)" "prefix=" ]; src = pkgs.fetchFromGitHub { - owner = "joan2937"; + owner = "q3k"; repo = "pigpio"; - rev = "v${version}"; - sha256 = "1arq051dbki50rwhzdxjba3ispnl4vdw7mr244f5hmrk0p34frcy"; + rev = "5a0b27c997631b3ba1a7778a176b6f5462233be4"; + sha256 = "1b55bzfsyghd2lrfqmz6g935zsmwnhbcscb4g11hxm3g7a68g9vv"; }; + + propagatedBuildInputs = [ raspberrypi-tools ]; }; cygpio = buildPythonPackage { |