| 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.
| “ | "I liken starting one's computing career with Unix, say as an undergraduate, to being born in East Africa. It is intolerably hot, your body is covered with lice and flies, you are malnourished and you suffer from numerous curable diseases. But, as far as young East Africans can tell, this is simply the natural condition and they live within it. By the time they find out differently, it is too late. They already think that the writing of shell scripts is a natural act." | ” |
| — Ken Pier, Xerox PARC | ||