When the BeOS is booted, it automatically configures any Plug and Play peripherals that it finds. Drivers for these peripherals then query the BeOS for configuration information, including IRQs, DMA channels, and IO port ranges. From that point on, the driver need not worry about Plug and Play issues.
A driver queries the BeOS for configuration information through an ioctl() call on the special Plug and Play configuration that you access by open()'ing the special /pnp/config_mgr file. The ioctl() call lets the driver fetch the configuration of a particular device indexed by an integer ranging from 0 to N-1, where N is the number of plug and play devices installed in the system. The driver typically scans through the list of configurations until it finds the one matching its device as identified by the EISA product id. Typical usage of the Plug and Play ioctl() call is illustrated below:
isa_device_config config; status_t ret; int i, fd; // open plug and play configuration manager fd = open("/pnp/config_mgr", O_RDWR); for (i=0;;i++) { // fetch the configuration of the ith device *(uint *)&config = i; ret = ioctl(fd, CONFIG_MGR_GET_NTH_ISA_DEVICE_CONFIG, &config, sizeof(isa_device_config) if (ret == B_OK) { printf("Card: %s, Device: %s\\n", config.card_name, config.logical_device_name); } else break; }
The ioct() call shown here returns an isa_device_config structure; the definition of the structure and the flags that you can use to examine its fields are given in /boot/develop/headers/be/device/isapnp.h.
Declared in: posix/unistd.h
status_t ioctl(int fd, int op, isa_device_config *config, int size_config)
The function returns B_NO_ERROR on success and B_ERROR on failure. Failure indicates that the index was out of range.
Declared in: be/device/isapnp.h
EQUAL_EISA_PRODUCT_ID(EISA_PRODUCT_ID id1, EISA_PRODUCT_ID id2)
Compares two product id's, ignoring the revision value.
Declared in: be/device/isapnp.h
MAKE_EISA_PRODUCT_ID(EISA_PRODUCT_ID *ptr, char ch0, char ch1, char ch2, uint12 prod_num, uint4 rev)
Properly gloms its parameters into a product id in little-endian format.
The Be Book, in lovely HTML, for BeOS Release 3.
Copyright © 1998 Be, Inc. All rights reserved.
Last modified March 27, 1998.