Main index | Section 9 | 日本語 | Options |
#include <sys/param.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
The arguments are as follows:
dev | |
The device that requests ownership of the resource. Before allocation, the resource is owned by the parent bus. | |
type | |
The type of resource you want to allocate.
It is one of:
| |
PCI_RES_BUS | for PCI bus numbers |
SYS_RES_IRQ | for IRQs |
SYS_RES_DRQ | for ISA DMA lines |
SYS_RES_IOPORT | |
for I/O ports | |
SYS_RES_MEMORY | |
for I/O memory | |
rid | |
A pointer to a bus specific handle that identifies the resource being allocated. | |
r | |
A pointer to the struct resource returned by bus_alloc_resource(9). | |
This implicit mapping can be disabled by passing the RF_UNMAPPED flag to bus_alloc_resource(9). A driver may use this if it wishes to allocate its own mappings of a resource using bus_map_resource(9).
A wrapper API for bus_space(9) is also provided that accepts the associated resource as the first argument in place of the bus_space(9) tag and handle. The functions in this wrapper API are named similarly to the bus_space(9) API except that "_space" is removed from their name. For example, bus_read_4() can be used in place of bus_space_read_4(). The wrapper API is preferred in new drivers.
These two statements both read a 32-bit register at the start of a resource:
bus_space_read_4(rman_get_bustag(res), rman_get_bushandle(res), 0); bus_read_4(res, 0);
BUS_ACTIVATE_RESOURCE (9) | May 20, 2016 |
Main index | Section 9 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.