This section lists the constants and types that are defined for drivers the kernel loads. Everything listed here was explained in the previous sections on "Developing a Kernel-Loadable Driver" and "Functions for Drivers."
Declared in: <device/Drivers.h>
Enumerated constant |
---|
B_GET_SIZE |
B_SET_SIZE |
B_SET_NONBLOCKING_IO |
B_SET_BLOCKING_IO |
B_GET_READ_STATUS |
B_GET_WRITE_STATUS |
B_GET_GEOMETRY |
B_FORMAT |
B_DEVICE_OP_CODES_END = 9999 |
These constants name the control operations that the kernel defines. You should expect the control hook function for any driver you develop to be called with these constants as the operation code (op).
All system-defined control constants are guaranteed to have values less than B_DEVICE_OP_CODES_END. Since additional constants might be defined for future releases, any that you define should be greater than B_DEVICE_OP_CODES_END.
See also: Control Operations
Declared in: <device/KernelExport.h>
Defined constant | Value |
---|---|
B_MAX_ISA_DMA_COUNT | 0x10000 |
This constant indicates the maximum number of transfers for a single DMA request.
See also: start_isa_dma() on page 66
Declared in: <device/KernelExport.h>
Enumerated constant |
---|
B_8_BIT_TRANSFER |
B_16_BIT_TRANSFER |
These constants are passed to make_isa_dma_table() to indicate the size of a single DMA transfer.
See also: start_isa_dma() on page 66
Declared in: <device/KernelExport.h>
typedef ulong cpu_status
This defined type is returned by disable_interrupts() to record whether interrupts were already disabled or not. It can be passed to restore_interrupts() to restore the previous state.
See also: disable_interrupts() on page 56
Declared in: <device/Drivers.h>
typedef long (*device_close_hook)(device_info *info)
The hook function that the kernel calls to close a device must conform to this type.
See also: Opening and Closing a Device
Declared in: <device/Drivers.h>
typedef long (*device_control_hook)(device_info *info, ulong op, void *data)
The hook function for controlling a device must conform to this type.
See also: Controlling the Device
Declared in: <device/Drivers.h>
typedef struct { const char *name; device_open_hook open; device_close_hook close; device_control_hook control; device_io_hook read; device_io_hook write; } device_entry
This structure declares the name of a device and the hook functions that the kernel can call to operate that device. The driver must provide one device_entry declaration for each of its devices.
See also: Device Declarations
Declared in: <device/Drivers.h>
typedef struct { ulong bytes_per_sector; ulong sectors_per_track; ulong cylinder_count; ulong head_count; bool removable; bool read_only; bool write_once; } device_geometry
Drivers use this structure to report the physical configuration of a mass-storage device.
See also: B_GET_GEOMETRY
Declared in: <device/Drivers.h>
typedef struct { device_entry *entry; void *private_data; } device_info
This structure contains publicly declared and private information about a device. It's passed as the first argument to each of the device-specific hook functions.
See also: Hook Functions
Declared in: <device/Drivers.h>
typedef long (*device_io_hook)(device_info *info, void *data, ulong numBytes, ulong position)
The hook functions that the kernel calls to read data from or write it to a device must conform to this type.
See also: Reading and Writing Data
Declared in: <device/Drivers.h>
typedef long (*device_open_hook)(device_info *info, ulong flags)
The hook function that opens a device must conform to this type.
See also: Opening and Closing a Device
Declared in: <device/KernelExport.h>
typedef bool (*interrupt_handler)(void *data)
The functions that are installed to handle interrupts must conform to this type.
See also: set_io_interrupt_handler() on page 64, set_isa_interrupt_handler() on page 65
Declared in: <device/KernelExport.h>
typedef struct { ulong address; ushort transfer_count; uchar reserved; struct { int end_of_list:1; int reserved:7; } flags; } isa_dma_entry
This structure is filled in by make_isa_dma_table() and is passed unchanged to start_scattered_isa_dma().
See also: start_isa_dma() on page 66
Declared in: <device/PCI.h>
typedef struct { ushort vendor_id; ushort device_id; uchar bus; uchar device; uchar function; uchar revision; uchar class_api; uchar class_sub; uchar class_base; uchar line_size; uchar latency; uchar header_type; uchar bist; uchar reserved; union { struct { ulong cardbus_cis; ushort subsystem_id; ushort subsystem_vendor_id; ulong rom_base; ulong rom_base_pci; ulong rom_size; ulong base_registers[6]; ulong base_registers_pci[6]; ulong base_register_sizes[6]; uchar base_register_flags[6]; uchar interrupt_line; uchar interrupt_pin; uchar min_grant; uchar max_latency; } h0; } u; } pci_info
This structure reports values from the PCI configuration register space and describes how the device has been mapped into the system.
See also: get_nth_pci_info() on page 59
Declared in: <device/KernelExport.h>
typedef struct { void *address; ulong size; } physical_entry
This structure is used to describe a chunk of physical memory corresponding to some part of a contiguous virtual buffer.
See also: get_memory_map() on page 58
Declared in: <device/KernelExport.h>
typedef vlong spinlock
This data type serves the acquire_spinlock()/release_spinlock() protocol.
See also: acquire_spinlock() on page 55
The Be Book, HTML Edition, for Developer Release 8 of the Be Operating System.
Copyright © 1996 Be, Inc. All rights reserved.
Be, the Be logo, BeBox, BeOS, BeWare, and GeekPort are trademarks of Be, Inc.
Last modified September 6, 1996.