I've uploaded my very rough source code here: https://github.com/mattjlewis/diozero/t ... mmap-tests.

Rough outline of C code:

Code: Select all

```
fdMem = open("/dev/gpiomem", O_RDWR | O_SYNC | O_CLOEXEC);
gpioAddr = (uint32_t *)mmap(NULL, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fdMem, gpioBase);
return (*env)->NewDirectByteBuffer(env, gpioAddr, BLOCK_SIZE);
```

Code: Select all

```
&gpioAddr[0]=0x76f92000, gpioAddr[0]=0x21200900
&gpioAddr[1]=0x76f92004, gpioAddr[1]=0x24024
&gpioAddr[2]=0x76f92008, gpioAddr[2]=0x0
&gpioAddr[3]=0x76f9200c, gpioAddr[3]=0x1000048
&gpioAddr[4]=0x76f92010, gpioAddr[4]=0x2422400c
&gpioAddr[5]=0x76f92014, gpioAddr[5]=0x924
&gpioAddr[6]=0x76f92018, gpioAddr[6]=0x0
&gpioAddr[7]=0x76f9201c, gpioAddr[7]=0x6770696f
&gpioAddr[8]=0x76f92020, gpioAddr[8]=0x6770696f
&gpioAddr[9]=0x76f92024, gpioAddr[9]=0x6770696f
&gpioAddr[10]=0x76f92028, gpioAddr[10]=0x6770696f
&gpioAddr[11]=0x76f9202c, gpioAddr[11]=0x6770696f
&gpioAddr[12]=0x76f92030, gpioAddr[12]=0x6770696f
&gpioAddr[13]=0x76f92034, gpioAddr[13]=0xb000c1ff
&gpioAddr[14]=0x76f92038, gpioAddr[14]=0x3e5c5c
&gpioAddr[15]=0x76f9203c, gpioAddr[15]=0x0
&gpioAddr[16]=0x76f92040, gpioAddr[16]=0x0
&gpioAddr[17]=0x76f92044, gpioAddr[17]=0x0
&gpioAddr[18]=0x76f92048, gpioAddr[18]=0x0
&gpioAddr[19]=0x76f9204c, gpioAddr[19]=0x0
```

Code: Select all

```
gpioReg[0]=0x67706900
gpioReg[1]=0x67706924
gpioReg[2]=0x67706900
gpioReg[3]=0x67706948
gpioReg[4]=0x6770690c
gpioReg[5]=0x67706924
gpioReg[6]=0x67706900
gpioReg[7]=0x6770696f
gpioReg[8]=0x6770696f
gpioReg[9]=0x6770696f
gpioReg[10]=0x6770696f
gpioReg[11]=0x6770696f
gpioReg[12]=0x6770696f
gpioReg[13]=0x677069ff
gpioReg[14]=0x6770695c
gpioReg[15]=0x67706900
gpioReg[16]=0x67706900
gpioReg[17]=0x67706900
gpioReg[18]=0x67706900
gpioReg[19]=0x67706900
```

Any ideas would be greatly appreciated.

Regards,

Matt