func castByteSliceToUint32Slice(raw []byte) []uint32 {
	rawlen := len(raw)
	header := *(*reflect.SliceHeader)(unsafe.Pointer(&raw))
	header.Len /= BYTES_IN_UINT32
	header.Cap /= BYTES_IN_UINT32
	if rawlen != len(raw) {
		panic("NO we did NOT want to change the []byte slice, just create a []uint32 slice pointing to the same data")
	}
	return *(*[]uint32)(unsafe.Pointer(&header))
}
warning: you must keep the []byte array/slice around
so that the []uint32 data will not be garbage collected
package bbhw
import (
	"fmt"
	"os"
	"reflect"
	"sync"
	"syscall"
	"unsafe"
)
type mappedRegisters struct {
	memfd            *os.File
	memgpiochipreg   [][]byte
	memgpiochipreg32 [][]uint32
	reglock          sync.Mutex
}
var mmapped_gpio_register_ *mappedRegisters
const (  
	omap4_gpio0_offset_          = 0x44E07000
	omap4_gpio1_offset_          = 0x4804C000
	gpio_pagesize_               = 0x1000  
	spinlock_offset_             = 0x480CA000
	spinlock_pagesize_           = 0x1000  
	omap4_gpio2_offset_          = 0x481AC000
	omap4_gpio3_offset_          = 0x481AE000
	pinmux_controlmodule_offset_ = 0x44E10000
	intgpio_setdataout_          = 0x194
	intgpio_setdataout_o32_      = 0x194 / 4
	intgpio_cleardataout_        = 0x190
	intgpio_cleardataout_o32_    = 0x190 / 4
	intgpio_datain_              = 0x138
	intgpio_datain_o32_          = 0x138 / 4
	intgpio_dataout_             = 0x13C
	intgpio_dataout_o32_         = 0x13C / 4
	intgpio_debounceenable_      = 0x150
	intgpio_debounceenable_o32_  = 0x150 / 4
	intgpio_debouncetime_        = 0x154
	intgpio_debouncetime_o32_    = 0x154 / 4
	intgpio_output_enabled_      = 0x134
	intgpio_output_enabled_o32_  = 0x134 / 4
	BYTES_IN_UINT32              = 4  
)
func verifyAddrIsTIOmap4(addr uint) bool {
	filename := fmt.Sprintf("/proc/device-tree/ocp/gpio@%x/compatible", addr)
	pf, err := os.OpenFile(filename, os.O_RDONLY, 0666)
	if err != nil {
		return false
	}
	defer pf.Close()
	buf := make([]byte, 32)
	pf.Seek(0, 0)
	n, err := pf.Read(buf)  
	if err != nil || n == 0 {
		return false
	}
	return string(buf)[0:13] == "ti,omap4-gpio"
}