Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.





Defined Types




IOAddressRange

DECLARED IN driverkit/IODeviceInspector.h

SYNOPSIS    typedef struct IOAddressRange {
unsigned start;
unsigned length;
} IOAddressRange

DESCRIPTION Used to describe address ranges.



IOCache

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef enum {
IO_CacheOff,

IO_WriteThrough,
IO_CopyBack
} IOCache




Used <<where?>> to specify caching. IO_CacheOff inhibits the cache. IOChannelCommand

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef unsigned int IOChannelCommand

DESCRIPTION





IOChannelDequeueOption

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef unsigned int IOChannelDequeueOption

DESCRIPTION





IOChannelEnqueueOption

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef unsigned int IOChannelEnqueueOption

DESCRIPTION





IOCharParameter

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef char IOCharParameter[IO_MAX_PARAMETER_ARRAY_LENGTH]

DESCRIPTION Standard type for a character parameter value, used by the get/set parameter functionality provided by IODevice and IODeviceMaster.



IODDMMsg

DECLARED IN driverkit/debuggingMsg.h

SYNOPSIS    typedef struct {
msg_header_t header;
msg_type_t argType;
unsigned index;
unsigned maskValue;
unsigned status;
unsigned timestampHighInt;
unsigned timestampLowInt;
int cpuNumber;
msg_type_t stringType;
char string[IO_DDM_STRING_LENGTH];
} IODDMMsg

DESCRIPTION The message format understood by the Driver Debugging Module. You don't usually have to use this message, as long as DDMViewer <<check>> is sufficient for your needs.



IODescriptorCommand

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef unsigned char IODescriptorCommand

DESCRIPTION





IODeviceNumber

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef unsigned int IODeviceNumber

DESCRIPTION





IODeviceStyle

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef enum {
IO_DirectDevice,
IO_IndirectDevice,
IO_PseudoDevice
} IODeviceStyle

DESCRIPTION Returned by the deviceStyle method to specify whether the driver is a direct device driver (one that directly controls hardware), an indirect device driver (one that controls hardware using a direct device driver), or a pseudodriver (one that controls no hardware). The driver style determines how it's configured into the system, as described <<somewhere>>.



IODisplayInfo

DECLARED IN bsd/dev/i386/displayDefs.h <<to be moved to driverkit/>>

SYNOPSIS    typedef struct{
int width;
int height;
int totalWidth;
int rowBytes;
int refreshRate;
void *frameBuffer;
IOBitsPerPixel bitsPerPixel;
IOColorSpace colorSpace;
unsigned int flags;
void *parameters;
} IODisplayInfo;

DESCRIPTION This structure describes a video display. Each linear mode supported by an IOFrameBufferDisplay has a corresponding IODisplayInfo. <<Tell when it's used.>> The structure's fields are

width Width, in pixels
height Height, in pixels
totalWidth Width including undisplayed pixels
rowBytes The number of bytes to get from one scanline to next. To determine this value, determine how many 8-bit bytes each pixel occupies (rounding up to an integer) and multiply this by the value of totalWidth. For example, a color display mode that uses 15 bits per pixel and has a totalWidth of 1024 has a rowBytes value of 2048.
refreshRate Monitor refresh setting, in Hz <<how do you decide this?>>
frameBuffer Pointer to origin of screen; untyped to force actual screen writes to be dependent on bitsPerPixel. The driver's initFromDeviceDescription: method should set this field to the value returned by mapFrameBufferAtPhysicalAddress:length:.
bitsPerPixel The memory space occupied by one pixel. 8-bit black and white display modes use the value IO_8BitsPerPixel, and "16-bit" color display modes that use 5 bits each for red, green, and blue use the value IO_15BitsPerPixel. See the documentation of the IOBitsPerPixel type for other values.
colorSpace Specifies the sample-encoding format.<<what does that mean?>> Typically, this value is either IO_DISPLAY_ONEISWHITECOLORSPACE (for monochrome modes) or IO_DISPLAY_RGBCOLORSPACE (for color modes). See the documentation of the IOColorSpace type for other values.
flags Flags used to indicate special requirements or conditions to DPS. Currently, this should always be zero. <<true? Or is it ignored?>>
parameters Driver-specific parameters.

Here's an array of IODisplayInfo structures for a driver that supports several monochrome and color modes:

static const IODisplayInfo MyModes[MY_NUM_MODES] = {
{ 1024, 768, 1024, 1024, 66, 0,
IO_8BitsPerPixel, IO_DISPLAY_ONEISWHITECOLORSPACE, 0, 0 },
{ 1280, 1024, 2048, 2048, 68, 0,
IO_8BitsPerPixel, IO_DISPLAY_ONEISWHITECOLORSPACE, 0, 0 },
{ 800, 600, 800, 1600, 72, 0,
IO_15BitsPerPixel, IO_DISPLAY_RGBCOLORSPACE, 0, 0 },
{ 1024, 768, 1024, 2048, 72, 0,
IO_15BitsPerPixel, IO_DISPLAY_RGBCOLORSPACE, 0, 0 }
};

These structures correspond to the display modes specified in the device configuration bundle's Localizable.strings file:

"DisplayModes" = "Height:768 Width:1024 Refresh:66Hz ColorSpace: BW:8;
Height:1024 Width:1280 Refresh: 68Hz ColorSpace: BW:8;
Height: 768 Width:1024 Refresh: 72Hz ColorSpace: RGB:555/16;
Height: 600 Width: 800 Refresh: 72Hz ColorSpace: RGB:555/16";



IODMAAlignment

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef struct {
unsigned readStart;
unsigned writeStart;
unsigned readLength;
unsigned writeLength;
} IODMAAlignment

DESCRIPTION Used <<by whom?>> to specify DMA alignment. A field value of 0 means that alignment isn't restricted for values corresponding to the field.



IODMABuffer

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef void *IODMABuffer

DESCRIPTION Used as a machine-independent type for a machine-dependent DMA buffer.

SEE ALSO IOEISADMABuffer



IODMADirection

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef enum {
IO_DMARead,
IO_DMAWrite
} IODMADirection

DESCRIPTION Used <<where?>> to specify the direction of DMA. IO_DMARead indicates a transfer from the device into system memory; IO_DMAWrite indicates a transfer from system memory to the device.



IODMAStatus

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef enum {
IO_None,
IO_Complete,
IO_Running,
IO_Underrun,
IO_BusError,
IO_BufferError,
} IODMAStatus

DESCRIPTION Used <<where?>> to specify machine-independent DMA channel status.

IO_None No appropriate status
IO_Complete DMA channel idle
IO_Running DMA channel running
IO_Underrun Underrun or overrun
IO_BusError Bus error
IO_BufferError DMA buffer error



IODMATransferMode

DECLARED IN driverkit/i386/directDevice.h

SYNOPSIS    typedef enum {
IO_Demand,
IO_Single,
IO_Block,
IO_Cascade,
} IODMATransferMode

DESCRIPTION Used only in the setTransferMode:forChannel: method of the EISA/ISA category of IODirectDevice.



IOEISADMABuffer

DECLARED IN driverkit/i386/driverTypes.h

SYNOPSIS    typedef void *IOEISADMABuffer

DESCRIPTION Used as a machine-dependent type for a DMA buffer.



IOEISADMATiming

DECLARED IN driverkit/i386/directDevice.h

SYNOPSIS    typedef enum {
IO_Compatible,
IO_TypeA,
IO_TypeB,
IO_Burst,
} IOEISADMATiming

DESCRIPTION Used only in the setDMATiming:forChannel: method of the EISA/ISA category of IODirectDevice.



IOEISADMATransferWidth

DECLARED IN driverkit/i386/directDevice.h

SYNOPSIS    typedef enum {
IO_8Bit,
IO_16BitWordCount,
IO_16BitByteCount,
IO_32Bit,
} IOEISADMATransferWidth

DESCRIPTION Used only in the setDMATransferWidth:forChannel: method of the EISA/ISA category of IODirectDevice.



IOEISAInterruptHandler

DECLARED IN driverkit/i386/driverTypes.h

SYNOPSIS    typedef void (*IOEISAInterruptHandler)
(void *identity,

void *state,
unsigned int arg)

DESCRIPTION





IOEISAPortAddress

DECLARED IN driverkit/i386/driverTypes.h

SYNOPSIS    typedef unsigned short IOEISAPortAddress

DESCRIPTION





IOEISAStopRegisterMode

DECLARED IN driverkit/i386/directDevice.h

SYNOPSIS    typedef enum {
IO_StopRegisterEnable,
IO_StopRegisterDisable,
} IOEISAStopRegisterMode

DESCRIPTION Used only in the setStopRegisterMode:forChannel: method of the EISA/ISA category of IODirectDevice.



IOIncrementMode

DECLARED IN driverkit/i386/directDevice.h

SYNOPSIS    typedef enum {
IO_Increment,
IO_Decrement,
} IOIncrementMode

DESCRIPTION Used only in the setIncrementMode:forChannel: method of the EISA/ISA category of IODirectDevice.



IOInterruptHandler

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef void (*IOInterruptHandler)
(void *identity,

void *state,
unsigned int arg)

DESCRIPTION





IOInterruptMsg

DECLARED IN driverkit/interruptMsg.h

SYNOPSIS    typedef struct {
msg_header_t header;
} IOInterruptMsg

DESCRIPTION The format of the message sent by the kernel to a driver's interrupt handler.



IOIntParameter

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef int IOIntParameter[IO_MAX_PARAMETER_ARRAY_LENGTH]

DESCRIPTION Standard type for an integer parameter value, used by the get/set parameter functionality provided by IODevice and IODeviceMaster.



IOIPCSpace

DECLARED IN driverkit/kernelDriver.h

SYNOPSIS    typedef enum {
IO_Kernel,
IO_KernelIOTask,
IO_CurrentTask
} IOIPCSpace

DESCRIPTION Used only by the IOConvertPort() function to specify which space to convert the port from and to.



IONamedValue

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef struct {
int value;
const char *name;
} IONamedValue

DESCRIPTION Map between constants or enumerations and text description.



IOObjectNumber

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef unsigned int IOObjectNumber

DESCRIPTION





IOParameterName

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef char IOParameterName[IO_MAX_PARAMETER_NAME_LENGTH]

DESCRIPTION Standard type for a parameter name, used by the get/set parameter functionality provided by IODevice and IODeviceMaster.



IORange

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef struct range {
unsigned int start;
unsigned int size;
} IORange

DESCRIPTION Indicates a range of values. Used for memory regions, port regions, and so on.



IOReturn

DECLARED IN driverkit/return.h

SYNOPSIS    typedef int IOReturn

DESCRIPTION IOReturn values are returned by many Driver Kit classes.



IOSCSIRequest

DECLARED IN driverkit/scsiTypes.h

SYNOPSIS    typedef struct {
unsigned char target;
unsigned char lun;
cdb_t cdb;
BOOL read;
int maxTransfer;
int timeoutLength;
unsigned disconnect:1;
unsigned pad:31;
sc_status_t driverStatus;
unsigned char scsiStatus;
int bytesTransferred;
ns_time_t totalTime;
ns_time_t latentTime;
esense_reply_t senseData;
} IOSCSIRequest

DESCRIPTION Used in the IOSCSIController protocol's executeRequest:buffer:client: method.



IOString

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    typedef char IOString[IO_STRING_LENGTH]

DESCRIPTION Standard type for an ASCII name, such as a device's name or type.



IOSwitchFunc

DECLARED IN driverkit/devsw.h

SYNOPSIS    typedef int (*IOSwitchFunc)()

DESCRIPTION Used by IOAddToBdevsw() and IOAddToCdevsw() to specify UNIX-style entry points into a driver.



IOThread

DECLARED IN driverkit/generalFuncs.h

SYNOPSIS    typedef void *IOThread

DESCRIPTION An opaque type used by the general-purpose functions to represent a thread.



IOThreadFunc

DECLARED IN driverkit/generalFuncs.h

SYNOPSIS    typedef void (*IOThreadFunc)
(void *arg)

DESCRIPTION Used by the general-purpose functions to specify the function that a thread should execute.




Symbolic Constants




Length Constants

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    IO_STRING_LENGTH
IO_MAX_PARAMETER_NAME_LENGTH
IO_MAX_PARAMETER_ARRAY_LENGTH

DESCRIPTION These constants are used to determine the maximum length of the following types:

IO_STRING_LENGTH IOString
IO_MAX_PARAMETER_NAME_LENGTH IOParameterName
IO_MAX_PARAMETER_ARRAY_LENGTH IOIntParameter
IOCharParameter



Debugging String Length

DECLARED IN driverkit/debuggingMsg.h

SYNOPSIS    IO_DDM_STRING_LENGTH

DESCRIPTION The length of the string field in an IODebuggingMsg.



Debugging Messages

DECLARED IN driverkit/debuggingMsg.h

SYNOPSIS    Constant Meaning
IO_DDM_MSG_BASE The lowest ID an IODebuggingMsg can have
IO_LOCK_DDM_MSG Lock the Driver Debugging Module (DDM)
IO_UNLOCK_DDM_MSG Unlock the DDM
IO_GET_DDM_ENTRY_MSG Get an entry from the DDM
IO_SET_DDM_MASK_MSG Set the debugging mask for the DDM
IO_CLEAR_DDM_MSG Clear all entries from the DDM

DESCRIPTION Values for the header.msg_id field of an IODebuggingMsg. See the discussion of the DDM in Chapter 2 for more information on these messages. <<check>>



Return Values from the DDM

DECLARED IN driverkit/debuggingMsg.h

SYNOPSIS    Constant Meaning
IO_DDM_SUCCESS The message was received and understood
IO_NO_DDM_BUFFER The DDM has no entry at the specified offset
IO_BAD_DDM_INDEX The specified index isn't valid

DESCRIPTION Values for the status field of an IODebuggingMsg.



DDM Masks

DECLARED IN driverkit/debugging.h

SYNOPSIS    IO_NUM_DDM_MASKS

DESCRIPTION This constant specifies the number of masks used by the Driver Debugging Module.



Interrupt Messages

DECLARED IN driverkit/interruptMsg.h

SYNOPSIS    Constant Meaning
IO_INTERRUPT_MSG_ID_BASE The lowest ID an IOInterruptMsg can have
IO_TIMEOUT_MSG
IO_COMMAND_MSG
IO_DEVICE_INTERRUPT_MSG Sent by the kernel when an interrupt occurs
IO_DMA_INTERRUPT_MSG
IO_FIRST_UNRESERVED_INTERRUPT_MSG

DESCRIPTION Values for the header.msg_id field of an IOInterruptMsg. See the discussion of interrupts in Chapter 2 for more information on interrupt messages. <<check. WHO USES everything except IO_DEVICE_INTERRUPT_MSG, and how?>>



IOReturn Constants

DECLARED IN driverkit/return.h

SYNOPSIS    Constant Meaning
IO_R_SUCCESS No error occurred
IO_R_NO_MEMORY Couldn't allocate memory
IO_R_RESOURCE Resource shortage
IO_R_VM_FAILURE Miscellaneous virtual memory failure
IO_R_INTERNAL Internal library error
IO_R_RLD Error in loading a relocatable file
IO_R_IPC_FAILURE Error during IPC
IO_R_NO_CHANNELS No DMA channels are available
IO_R_NO_SPACE No address space is available for mapping
IO_R_NO_DEVICE No such device
IO_R_PRIVILEGE Privilege/access violation
IO_R_INVALID_ARG Invalid argument
IO_R_BAD_MSG_ID ???
IO_R_UNSUPPORTED Unsupported function
IO_R_INVALID Should never be seen
IO_R_LOCKED_READ Device is read locked
IO_R_LOCKED_WRITE Device is write locked
IO_R_EXCLUSIVE_ACCESS Device is exclusive access and is already open
IO_R_CANT_LOCK Can't acquire requested lock
IO_R_NOT_OPEN Device not open
IO_R_OPEN Device is still open
IO_R_NOT_READABLE Reading not supported
IO_R_NOT_WRITABLE Writing not supported
IO_R_IO General I/O error
IO_R_BUSY Device is busy
IO_R_NOT_READY Device isn't ready
IO_R_OFFLINE Device is off line
IO_R_ALIGN DMA alignment error
IO_R_MEDIA Media error
IO_R_DMA DMA failure
IO_R_TIMEOUT I/O timeout
IO_R_NOT_ATTACHED The device or channel isn't attached
IO_R_PORT_EXISTS The device port already exists
IO_R_CANT_WIRE Can't wire down physical memory <<ever used? can you ever wire down physical
memory?>>
IO_R_NO_INTERRUPT No interrupt port is attached
IO_R_NO_FRAMES No DMA is enqueued

DESCRIPTION Values for IOReturns.



IODevice Parameter Names

DECLARED IN driverkit/IODevice.h

SYNOPSIS    Constant Meaning
IO_CLASS_NAME The value returned by + name
IO_DEVICE_NAME The value returned by name
IO_DEVICE_KIND The value returned by deviceKind
IO_UNIT The value returned by unit

DESCRIPTION





Null Constants

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    #define NULL 0
#define IO_NULL_VM_TASK ((vm_task_t)0)

DESCRIPTION Standard null values, used in various places.



Unused Constants

DECLARED IN driverkit/driverTypes.h

IO_CC_START_READ
IO_CC_START_WRITE
IO_CC_ABORT
IO_CC_ENABLE_DEVICE_INTERRUPTS
IO_CC_DISABLE_DEVICE_INTERRUPTS
IO_CC_ENABLE_INTERRUPTS
IO_CC_DISABLE_INTERRUPTS

IO_CC_CONNECT_FRAME_LOOP

IO_CC_DISCONNECT_FRAME_LOOP
IO_CDO_DONE
IO_CDO_ALL
IO_CDO_ENABLE_INTERRUPTS
IO_CDO_ENABLE_INTERRUPTS_IF_EMPTY
IO_CEO_END_OF_RECORD
IO_CEO_DESCRIPTOR_INTERRUPT
IO_CEO_ENABLE_INTERRUPTS
IO_CEO_DESCRIPTOR_COMMAND
IO_CEO_ENABLE_CHANNEL
IO_MAX_BOARD_SIZE
IO_MAX_NRW_SLOT_SIZE
IO_MAX_SLOT_SIZE
IO_NATIVE_SLOT_ID
IO_NO_CHANNEL
IO_NULL_SLOT_ID
IO_NULL_DEVICE_TYPE
IO_NULL_DEVICE_INDEX
IO_NULL_DMA_ID
IO_SLOT_DEVICE_TYPE

DESCRIPTION These constants aren't used by drivers for Intel-based computers.

Note:





Global Variables




IODDMMasks

DECLARED IN driverkit/debugging.h

SYNOPSIS    unsigned int IODDMMasks[IO_NUM_DDM_MASKS]

DESCRIPTION The bitmask used to filter storing of debugging events. See the discussion of the Driver Debugging Module in Chapter 2 for more information.



IODMAStatusStrings

DECLARED IN driverkit/driverTypes.h

SYNOPSIS    const IONamedValue IODMAStatusStrings[]

DECLARED IN Used as an argument to IOFindNameForValue() to convert an IODMAStatus value into an error string.