1.\"- 2.\" Copyright (c) 2012 Robert N. M. Watson 3.\" All rights reserved. 4.\" 5.\" This software was developed by SRI International and the University of 6.\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7.\" ("CTSRD"), as part of the DARPA CRASH research programme. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.Dd August 18, 2012 31.Dt ALTERA_AVGEN 4 32.Os 33.Sh NAME 34.Nm altera_avgen 35.Nd driver for generic Altera Avalon-bus-attached, memory-mapped devices 36.Sh SYNOPSIS 37.Cd "device altera_avgen" 38.Pp 39In 40.Pa /boot/device.hints : 41.Cd hint.altera_avgen.0.at="nexus0" 42.Cd hint.altera_avgen.0.maddr=0x7f00a000 43.Cd hint.altera_avgen.0.msize=20 44.Cd hint.altera_avgen.0.width=4 45.Cd hint.altera_avgen.0.fileio="rw" 46.Cd hint.altera_avgen.0.devname="berirom" 47.Sh DESCRIPTION 48The 49.Nm 50device driver provides generic support for memory-mapped devices on the 51Altera Avalon bus. 52.Pa device.hints 53entries configure the address, size, I/O disposition, and 54.Pa /dev 55device node name that will be used. 56The 57.Xr open 2 , 58.Xr read 2 , 59.Xr write 2 , 60and 61.Xr mmap 2 62system calls (and variations) may be used on 63.Nm 64device nodes, subject to constraints imposed using 65.Pa device.hints 66entries. 67Although reading and writing mapped memory is supported, 68.Nm 69does not currently support directing device interrupts to userspace. 70.Pp 71A number of 72.Pa device.hints 73sub-fields are available to configure 74.Nm 75device instances: 76.Bl -tag -width devunit 77.It maddr 78base physical address of the memory region to export; must be aligned to 79.Li width 80.It msize 81length of the memory region export; must be aligned to 82.Li width 83.It width 84Granularity at which 85.Xr read 2 86and 87.Xr write 2 88operations will be performed. 89Larger requests will be broken down into 90.Li width -sized 91operations; smaller requests will be rejected. 92I/O operations must be aligned to 93.Li width . 94.It fileio 95allowed file descriptor operations; 96.Li r 97authorizes 98.Xr read 2 ; 99.Li w 100authorizes 101.Xr write 2 . 102.It mmapio 103allowed 104.Xr mmap 2 105permissions; 106.Li w 107authorizes 108.Dv PROT_WRITE ; 109.Li r 110authorizes 111.Dv PROT_READ ; 112.Li x 113authorizes 114.Dv PROT_EXEC . 115.It devname 116specifies a device name relative to 117.Pa /dev . 118.It devunit 119specifies a device unit number; no unit number is used if this is unspecified. 120.El 121.Sh SEE ALSO 122.Xr mmap 2 , 123.Xr open 2 , 124.Xr read 2 , 125.Xr write 2 126.Sh HISTORY 127The 128.Nm 129device driver first appeared in 130.Fx 10.0 . 131.Sh AUTHORS 132The 133.Nm 134device driver and this manual page were 135developed by SRI International and the University of Cambridge Computer 136Laboratory under DARPA/AFRL contract 137.Pq FA8750-10-C-0237 138.Pq Do CTSRD Dc , 139as part of the DARPA CRASH research programme. 140This device driver was written by 141.An Robert N. M. Watson . 142.Sh BUGS 143.Nm 144is intended to support the writing of userspace device drivers; however, it 145does not permit directing interrupts to userspace, only memory-mapped I/O. 146.Pp 147.Nm 148supports only a 149.Li nexus 150bus attachment, which is appropriate for system-on-chip busses such as 151Altera's Avalon bus. 152If the target device is off of another bus type, then additional bus 153attachments will be required. 154