From 8208ca5f0d45f657d8f049d456f30589303d7939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drahoslav=20Bedn=C3=A1=C5=99?= Date: Wed, 15 Nov 2017 17:48:18 +0100 Subject: [PATCH] fix memMap base attr How could it even work before? --- rpio.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rpio.go b/rpio.go index 30fab9c..56d83ef 100644 --- a/rpio.go +++ b/rpio.go @@ -81,13 +81,12 @@ const ( ) var ( - base int64 gpioBase int64 clkBase int64 ) func init() { - base = getBase() + base := getBase() gpioBase = base + gpioOffset clkBase = base + clkOffset } @@ -383,10 +382,10 @@ func Open() (err error) { return nil } -func memMap(fd uintptr, offset int64) (mem []uint32, mem8 []byte, err error) { +func memMap(fd uintptr, base int64) (mem []uint32, mem8 []byte, err error) { mem8, err = syscall.Mmap( int(fd), - base+clkOffset, + base, memLength, syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_SHARED,