ALTERA_AVGEN(4)
β¨ ALTERA_AVGEN(4) β¨
okay bestie, welcome to section 4 of the Kernel Interfaces Manual β yes this is the altera_avgen(4) page, and no it's not scary, i promise π it's literally just a driver that goes "here's some memory, go nuts."
πΈ NAME πΈ
altera_avgen β driver for generic Altera Avalon-bus-attached, memory-mapped devices
it's giving "i'm a bridge between you and some mmio," and honestly? iconic.
π SYNOPSIS π
device altera_avgen
and then in /boot/device.hints:
hint.altera_avgen.0.at="nexus0"
hint.altera_avgen.0.maddr=0x7f00a000
hint.altera_avgen.0.msize=20
hint.altera_avgen.0.width=4
hint.altera_avgen.0.fileio="rw"
hint.altera_avgen.0.devname="berirom"
no cap, that's the whole setup. look at her go π¦
π DESCRIPTION π
so. the altera_avgen device driver is your generic bestie for memory-mapped devices living on the Altera Avalon bus. the device.hints entries are what tell it the address, the size, the I/O disposition, and the /dev device node name to use. then you can hit those altera_avgen device nodes with open(2), read(2), write(2), and mmap(2) (and all their little variations), as long as you stay within the constraints you set up in device.hints.
and yes, reading and writing mapped memory is supported. but lowkey important: altera_avgen does not currently support directing device interrupts to userspace. that's just not on the menu, bestie π
so there's a whole little roster of device.hints sub-fields you can use to configure your altera_avgen device instances:
maddrβ base physical address of the memory region to export. it must be aligned towidth, no skipping that πmsizeβ length of the memory region export. also must be aligned towidth. matching set, slay.widthβ the granularity at whichread(2)andwrite(2)operations get performed. bigger requests get broken down intowidth-sized operations, and smaller requests get rejected outright. also, I/O operations must be aligned towidth. so basically: know your width or perish πfileioβ the allowed file descriptor operations.rauthorizesread(2);wauthorizeswrite(2).mmapioβ the allowedmmap(2)permissions.wauthorizesPROT_WRITE;rauthorizesPROT_READ;xauthorizesPROT_EXEC.devnameβ specifies a device name relative to/dev.devunitβ specifies a device unit number; no unit number is used if this is unspecified.
that's the whole vibe check, and she passed π
π SEE ALSO π
mmap(2), open(2), read(2), write(2)
go read those next, they're the supporting cast π«Ά
π HISTORY π
the altera_avgen device driver first appeared in FreeBSD 10.0. a legend was born β¨
π AUTHORS π
the altera_avgen device driver and this manual page were developed by SRI International and the University of Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) (βCTSRDβ), as part of the DARPA CRASH research programme. this device driver was written by Robert N. M. Watson. academic royalty fr fr ππ
π BUGS π
okay so, the tea:
altera_avgenis intended to support the writing of userspace device drivers. however, it does not permit directing interrupts to userspace β only memory-mapped I/O. so close, and yet π₯²altera_avgensupports only anexusbus attachment, which is appropriate for system-on-chip busses such as Altera's Avalon bus. if the target device is off of another bus type, then additional bus attachments will be required. not optional, bestie, you gotta build those.
not me listing bugs and still thinking this driver ate π
Debian Β· August 18, 2012 β that's the source, version and date, mwah, signing off, love u, go write a userspace driver πβπ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2012 Robert N. M. Watson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms