Add rpi_ws281x-git
This commit is contained in:
parent
bb1ac4ef8a
commit
b8e39c3f54
|
@ -0,0 +1,24 @@
|
|||
From 5291f6a3694f8622c5548a93b4e3ce65261fd9fc Mon Sep 17 00:00:00 2001
|
||||
From: Martchus <martchus@gmx.net>
|
||||
Date: Thu, 1 Nov 2018 04:58:01 +0000
|
||||
Subject: [PATCH 1/5] Allow to adjust build directory
|
||||
|
||||
---
|
||||
SConstruct | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/SConstruct b/SConstruct
|
||||
index 64c14c7..16ac279 100644
|
||||
--- a/SConstruct
|
||||
+++ b/SConstruct
|
||||
@@ -72,5 +72,6 @@ if env['TOOLCHAIN'] != '':
|
||||
env['AR'] = env['TOOLCHAIN'] + '-ar'
|
||||
|
||||
Export(['clean_envs'])
|
||||
-SConscript('SConscript');
|
||||
+AddOption('--build', default='')
|
||||
+SConscript('SConscript', variant_dir=GetOption('build'), duplicate=0);
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
From a4c6fc90385b6be5cab7d9b70d234ebeef87a8cf Mon Sep 17 00:00:00 2001
|
||||
From: Martchus <martchus@gmx.net>
|
||||
Date: Thu, 1 Nov 2018 04:59:59 +0000
|
||||
Subject: [PATCH 2/5] Cast pointer to uintptr_t instead of uint32_t
|
||||
|
||||
For compatibility with aarch64
|
||||
---
|
||||
mailbox.c | 4 ++--
|
||||
ws2811.c | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/mailbox.c b/mailbox.c
|
||||
index f42e04a..23f7d5a 100644
|
||||
--- a/mailbox.c
|
||||
+++ b/mailbox.c
|
||||
@@ -67,8 +67,8 @@ void *mapmem(uint32_t base, uint32_t size, const char *mem_dev) {
|
||||
}
|
||||
|
||||
void *unmapmem(void *addr, uint32_t size) {
|
||||
- uint32_t pagemask = ~0UL ^ (getpagesize() - 1);
|
||||
- uint32_t baseaddr = (uint32_t)addr & pagemask;
|
||||
+ uintptr_t pagemask = ~0UL ^ (getpagesize() - 1);
|
||||
+ uintptr_t baseaddr = (uintptr_t)addr & pagemask;
|
||||
int s;
|
||||
|
||||
s = munmap((void *)baseaddr, size);
|
||||
diff --git a/ws2811.c b/ws2811.c
|
||||
index 6ac82bf..63e50fe 100644
|
||||
--- a/ws2811.c
|
||||
+++ b/ws2811.c
|
||||
@@ -392,7 +392,7 @@ static int setup_pwm(ws2811_t *ws2811)
|
||||
|
||||
dma_cb->source_ad = addr_to_bus(device, device->pxl_raw);
|
||||
|
||||
- dma_cb->dest_ad = (uint32_t)&((pwm_t *)PWM_PERIPH_PHYS)->fif1;
|
||||
+ dma_cb->dest_ad = (uintptr_t)&((pwm_t *)PWM_PERIPH_PHYS)->fif1;
|
||||
dma_cb->txfr_len = byte_count;
|
||||
dma_cb->stride = 0;
|
||||
dma_cb->nextconbk = 0;
|
||||
@@ -457,7 +457,7 @@ static int setup_pcm(ws2811_t *ws2811)
|
||||
RPI_DMA_TI_SRC_INC; // Increment src addr
|
||||
|
||||
dma_cb->source_ad = addr_to_bus(device, device->pxl_raw);
|
||||
- dma_cb->dest_ad = (uint32_t)&((pcm_t *)PCM_PERIPH_PHYS)->fifo;
|
||||
+ dma_cb->dest_ad = (uintptr_t)&((pcm_t *)PCM_PERIPH_PHYS)->fifo;
|
||||
dma_cb->txfr_len = byte_count;
|
||||
dma_cb->stride = 0;
|
||||
dma_cb->nextconbk = 0;
|
||||
--
|
||||
2.19.1
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From aef253cb667e4cc7352a3a8be8caafb8d4afd25e Mon Sep 17 00:00:00 2001
|
||||
From: Martchus <martchus@gmx.net>
|
||||
Date: Thu, 1 Nov 2018 05:02:52 +0000
|
||||
Subject: [PATCH 3/5] Update help text for default DMA
|
||||
|
||||
---
|
||||
main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/main.c b/main.c
|
||||
index 85ecd67..f88414a 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -247,7 +247,7 @@ void parseargs(int argc, char **argv, ws2811_t *ws2811)
|
||||
"-s (--strip) - strip type - rgb, grb, gbr, rgbw\n"
|
||||
"-x (--width) - matrix width (default 8)\n"
|
||||
"-y (--height) - matrix height (default 8)\n"
|
||||
- "-d (--dma) - dma channel to use (default 5)\n"
|
||||
+ "-d (--dma) - dma channel to use (default 10)\n"
|
||||
"-g (--gpio) - GPIO to use\n"
|
||||
" If omitted, default is 18 (PWM0)\n"
|
||||
"-i (--invert) - invert pin output (pulse LOW)\n"
|
||||
--
|
||||
2.19.1
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
From 8863b65325b1669dcf46310d5d4e8a57fa9d0823 Mon Sep 17 00:00:00 2001
|
||||
From: James Lu <james@overdrivenetworks.com>
|
||||
Date: Sun, 26 Aug 2018 19:38:53 -0700
|
||||
Subject: [PATCH 4/5] Read CPU revision from /proc/device-tree on arm64 (closes
|
||||
#289)
|
||||
|
||||
---
|
||||
rpihw.c | 32 +++++++++++++++++++++++++++++---
|
||||
1 file changed, 29 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/rpihw.c b/rpihw.c
|
||||
index a0df569..d825970 100644
|
||||
--- a/rpihw.c
|
||||
+++ b/rpihw.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
+#include <byteswap.h>
|
||||
|
||||
#include "rpihw.h"
|
||||
|
||||
@@ -324,9 +325,34 @@ static const rpi_hw_t rpi_hw_info[] = {
|
||||
|
||||
const rpi_hw_t *rpi_hw_detect(void)
|
||||
{
|
||||
+ const rpi_hw_t *result = NULL;
|
||||
+#ifdef __aarch64__
|
||||
+ // On ARM64, read revision from /proc/device-tree as it is not shown in
|
||||
+ // /proc/cpuinfo
|
||||
+ FILE *f = fopen("/proc/device-tree/system/linux,revision", "r");
|
||||
+ if (!f)
|
||||
+ {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ uint32_t rev;
|
||||
+ fread(&rev, sizeof(uint32_t), 1, f);
|
||||
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
+ rev = bswap_32(rev); // linux,revision appears to be in big endian
|
||||
+ #endif
|
||||
+
|
||||
+ for (unsigned i = 0; i < (sizeof(rpi_hw_info) / sizeof(rpi_hw_info[0])); i++)
|
||||
+ {
|
||||
+ uint32_t hwver = rpi_hw_info[i].hwver;
|
||||
+ if (rev == hwver)
|
||||
+ {
|
||||
+ result = &rpi_hw_info[i];
|
||||
+
|
||||
+ goto done;
|
||||
+ }
|
||||
+ }
|
||||
+#else
|
||||
FILE *f = fopen("/proc/cpuinfo", "r");
|
||||
char line[LINE_WIDTH_MAX];
|
||||
- const rpi_hw_t *result = NULL;
|
||||
|
||||
if (!f)
|
||||
{
|
||||
@@ -361,7 +387,7 @@ const rpi_hw_t *rpi_hw_detect(void)
|
||||
// Take out warranty and manufacturer bits
|
||||
hwver &= ~(RPI_WARRANTY_MASK | RPI_MANUFACTURER_MASK);
|
||||
rev &= ~(RPI_WARRANTY_MASK | RPI_MANUFACTURER_MASK);
|
||||
-
|
||||
+
|
||||
if (rev == hwver)
|
||||
{
|
||||
result = &rpi_hw_info[i];
|
||||
@@ -371,7 +397,7 @@ const rpi_hw_t *rpi_hw_detect(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
done:
|
||||
fclose(f);
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
# Maintainer: Martchus <martchus@gmx.net>
|
||||
|
||||
# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
|
||||
# you also find the URL of a binary repository.
|
||||
|
||||
_reponame=rpi_ws281x
|
||||
pkgname=rpi_ws281x-git
|
||||
_name=${pkgname%-git}
|
||||
pkgver=173.e4a05d6
|
||||
pkgrel=1
|
||||
arch=('armv6h' 'armv7h' 'aarch64')
|
||||
pkgdesc='Userspace Raspberry Pi PWM library for WS281X LEDs'
|
||||
license=('BSD')
|
||||
depends=()
|
||||
makedepends=('scons' 'git')
|
||||
provides=("${_name}")
|
||||
conflicts=("${_name}")
|
||||
url="https://github.com/jgarff/${_reponame}"
|
||||
source=("${_reponame}::git://github.com/jgarff/${_reponame}.git"
|
||||
0001-Allow-to-adjust-build-directory.patch
|
||||
0002-Cast-pointer-to-uintptr_t-instead-of-uint32_t.patch
|
||||
0003-Update-help-text-for-default-DMA.patch
|
||||
0004-Read-CPU-revision-from-proc-device-tree-on-arm64-clo.patch)
|
||||
sha256sums=('SKIP'
|
||||
'd98ae1d48bc78e78da9488e1519b3751c1a91311fa4f054714f199aa82084436'
|
||||
'3013ee02539e3d6120ae8c66db6dfff88ddf79ef38bc7badd11ff87ec2015ef7'
|
||||
'4b14dceb422e48036367db0bbcb5fe8152e2b58b2fc213c31775c160512ee45b'
|
||||
'f1fac8430be31860324cb14b047182f88d4ab59b7bc186d16c0a782a68b54966')
|
||||
|
||||
prepare() {
|
||||
cd "$srcdir/$_reponame"
|
||||
|
||||
# apply patches; further descriptions can be found in patch files itself
|
||||
for patch in "$srcdir/"*.patch; do
|
||||
msg2 "Applying patch $patch"
|
||||
patch -p1 -i "$patch"
|
||||
done
|
||||
}
|
||||
|
||||
pkgver() {
|
||||
cd "$srcdir/$_reponame"
|
||||
echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$srcdir/$_reponame"
|
||||
scons
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir/$_reponame"
|
||||
|
||||
install -Dm0755 "test" "$pkgdir/usr/bin/$_name"
|
||||
install -Dm0644 "libws2811.a" "$pkgdir/usr/lib/libws2811.a"
|
||||
install -Dm0644 "LICENSE" "$pkgdir/usr/share/licenses/$_name/LICENSE"
|
||||
for header_file in *.h; do
|
||||
install -Dm0644 "$header_file" "$pkgdir/usr/include/$_name/$header_file"
|
||||
done
|
||||
}
|
Loading…
Reference in New Issue