Important: The information in this document is obsolete and should not be used for new development.
Chapter 1 - Device Manager
This chapter describes how your application can use the Device Manager to transfer information into and out of a Macintosh computer. The Device Manager controls the exchange of information between applications and hardware devices.This chapter provides a brief introduction to devices and device drivers (the programs that control devices) and then explains how you can use the Device Manager functions to
You should read the sections "About the Device Manager" and "Using the Device Manager" if your application needs to use the Device Manager to communicate with a device driver. Applications often communicate with the Device Manager indirectly, by calling functions of other managers (for example, the File Manager) that use the Device Manager. However, sometimes applications must call Device Manager functions directly.
- open, close, and exchange information with device drivers
- write your own device driver that can communicate with the Device Manager
- provide a user interface for your device driver by making it a Chooser extension or desk accessory.
The sections "Writing a Device Driver," "Writing a Chooser-Compatible Device Driver," and "Writing a Desk Accessory," provide information you'll need if you are writing your own device driver.
If you writing a device driver, you should understand how memory is organized and allocated in Macintosh computers. See Inside Macintosh: Memory, for this information. You should also be familiar with resources and how the system searches resource files. You can find this information in the chapter "Resource Manager" in Inside Macintosh: More Macintosh Toolbox. If your device driver is to perform background tasks, you'll need to understand how processes are scheduled. Inside Macintosh: Processes covers these topics. If your driver will control a hardware device, you should read Designing Cards and Drivers for the Macintosh Family, third edition.
Chapter Contents
- Introduction to Devices and Drivers
- About the Device Manager
- The Device Control Entry
- The Unit Table
- The Driver I/O Queue
- Driver Routines
- Driver Resources
- Using the Device Manager
- Opening and Closing Device Drivers
- Communicating With Device Drivers
- Controlling and Monitoring Device Drivers
- Writing a Device Driver
- Creating a Driver Resource
- Responding to the Device Manager
- Entering and Exiting From Driver Routines
- Writing Open and Close Routines
- Writing a Prime Routine
- Writing Control and Status Routines
- Handling Asynchronous I/O
- Installing a Device Driver
- Writing a Chooser-Compatible Device Driver
- How the Chooser Works
- Creating a Chooser Extension File
- Creating a Device Package
- Responding to the Chooser
- Allocating Private Storage
- Writing a Desk Accessory
- How Desk Accessories Work
- Creating a Driver Resource for a Desk Accessory
- Opening and Closing a Desk Accessory
- Responding to Events
- Device Manager Reference
- Data Structures
- Device Manager Parameter Block
- Device Control Entry
- Device Manager Functions
- Opening and Closing Device Drivers
- Communicating With Device Drivers
- Controlling and Monitoring Device Drivers
- Writing and Installing Device Drivers
- Resources
- The Driver Resource
- Summary of the Device Manager
- C Summary
- Constants
- Data Types
- Functions
- Pascal Summary
- Constants
- Data Types
- Routines
- Assembly-Language Summary
- Data Structures
- Trap Macros
- Result Codes