Categorygithub.com/DerLukas15/rpimemmap
repositorypackage
1.0.1
Repository: https://github.com/derlukas15/rpimemmap.git
Documentation: pkg.go.dev

# README

rpimemmap GoDoc

Package for allocating uncached memory and physical devices on Raspberry Pi's using plain GO.

About

This package provides access to uncached memory and physical devices on any Raspberry Pi. Uncached memory is done with the help of videocore. All access is directly written to memory.

Installation

go get github.com/DerLukas15/rpimemmap

Usage

Open

You need to supply the desired size during the creation of the actual map. However, the actual allocation is done during the map call.

The supplyed size is rounded up to the nearest pageSize.

Physical Devices

Map any physical device to virtual memory for access by supplying the physical address of the device:

deviceMap := rpimemmap.NewPeripheral(size)
err := deviceMap.Map(physicalAddress, memoryDevice, 0)

Uncached Memory

Map uncached memory to virtual memory for access:

uncachedMap := rpimemmap.NewUncached(size)
err := uncachedMap.Map(0, "", UncachedMemFlags)

Close

Close any MemMap with

err := curMap.Unmap()

License

MIT, see LICENSE