*: 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.
master
q3k 2020-02-23 15:13:16 +01:00
parent 25b41d6496
commit 1735eb0cf6
2 changed files with 19 additions and 4 deletions

View File

@ -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()

View File

@ -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 {